Fix in bitseq.NewHandle()

- When creating the handle, write it to store if
  not present. Currently it is written to store
  only on first bit allocation.

Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
Alessandro Boch 2015-10-03 20:23:26 -07:00
parent 8dde3b2380
commit 67b1e3c5f2
1 changed files with 7 additions and 0 deletions

View File

@ -65,6 +65,13 @@ func NewHandle(app string, ds datastore.DataStore, id string, numElements uint32
return nil, err
}
// If the handle is not in store, write it.
if !h.Exists() {
if err := h.writeToStore(); err != nil {
return nil, fmt.Errorf("failed to write bitsequence to store: %v", err)
}
}
return h, nil
}