Skip to content

Commit

Permalink
removed workaround regarding filtering bins on the client for BatchGet
Browse files Browse the repository at this point in the history
  • Loading branch information
khaf committed May 15, 2015
1 parent dd7ec5c commit 166bdd7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Change history

## May 15 2015 : v1.5.1

Maintenance release.

* **Improvements**

* Use type alias instead of struct for NullValue.

* Removed workaround regarding filtering bin names on the client for `BatchGet`.

* **Fixes**

* Fixed minor bugs regarding handling of nulls in structs for `GetObj()` and `PutObj()`.

* ** Other Changes **

* Removed deprecated `ReplaceRoles()` method.

* Removed deprecated `SetCapacity()` and `GetCapacity()` methods.

## April 13 2015 : v1.5.0

This release includes potential BREAKING CHANGES.
Expand Down
17 changes: 2 additions & 15 deletions batch_command_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,10 @@ func (cmd *batchCommandGet) parseRecordResults(ifc command, receiveSize int) (bo
return true, nil
}

func contains(a map[string]struct{}, elem string) bool {
_, exists := a[elem]
return exists
}

// Parses the given byte buffer and populate the result object.
// Returns the number of bytes that were parsed from the given buffer.
func (cmd *batchCommandGet) parseRecord(key *Key, opCount int, generation int, expiration int) (*Record, error) {
var bins map[string]interface{}
bins := make(map[string]interface{}, opCount)

for i := 0; i < opCount; i++ {
if err := cmd.readBytes(8); err != nil {
Expand All @@ -144,15 +139,7 @@ func (cmd *batchCommandGet) parseRecord(key *Key, opCount int, generation int, e
return nil, err
}

// Currently, the batch command returns all the bins even if a subset of
// the bins are requested. We have to filter it on the client side.
// TODO: Filter batch bins on server!
if len(cmd.binNames) == 0 || contains(cmd.binNames, name) {
if bins == nil {
bins = map[string]interface{}{}
}
bins[name] = value
}
bins[name] = value
}

return newRecord(cmd.node, key, bins, generation, expiration), nil
Expand Down

0 comments on commit 166bdd7

Please sign in to comment.