mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
04bd8f67ad
In that commit, AtomicPutCreate takes previous = nil to Atomically create keys that don't exist. We need a create operation that is atomic to prevent races between multiple libnetworks creating the same object. Previously, we just created new KVs with an index of 0 and wrote them to the datastore. Consul accepts this behaviour and interprets index of 0 as non-existing, but other data backends do no. - Add Exists() to the KV interface. SetIndex() should also modify a KV so that it exists. - Call SetIndex() from within the GetObject() method on DataStore interface. - This ensures objects have the updated values for exists and index. - Add SetValue() to the KV interface. This allows implementers to define their own method to marshall and unmarshall (as bitseq and allocator have). - Update existing users of the DataStore (endpoint, network, bitseq, allocator, ov_network) to new interfaces. - Fix UTs. |
||
---|---|---|
.. | ||
datastore.go | ||
datastore_test.go | ||
mock_store.go |