etcd (v3) store: implements KV methods of storage.Interface

This implements Get(), Create(), Delete(), GetToList(),
List(), GuaranteedUpdate().
This commit is contained in:
Hongchao Deng
2016-03-23 10:29:54 -07:00
parent e2ef27ee8a
commit 00ddf0671d
5 changed files with 979 additions and 10 deletions

View File

@@ -104,6 +104,7 @@ type Interface interface {
Set(ctx context.Context, key string, obj, out runtime.Object, ttl uint64) error
// Delete removes the specified key and returns the value that existed at that spot.
// If key didn't exist, it will return NotFound storage error.
Delete(ctx context.Context, key string, out runtime.Object, preconditions *Preconditions) error
// Watch begins watching the specified key. Events are decoded into API objects,
@@ -137,9 +138,13 @@ type Interface interface {
// GuaranteedUpdate keeps calling 'tryUpdate()' to update key 'key' (of type 'ptrToType')
// retrying the update until success if there is index conflict.
// Note that object passed to tryUpdate may change acress incovations of tryUpdate() if
// other writers are simultaneously updateing it, to tryUpdate() needs to take into account
// Note that object passed to tryUpdate may change across invocations of tryUpdate() if
// other writers are simultaneously updating it, to tryUpdate() needs to take into account
// the current contents of the object when deciding how the update object should look.
// If the key doesn't exist, it will return NotFound storage error if ignoreNotFound=false
// or zero value in 'ptrToType' parameter otherwise.
// If the object to update has the same value as previous, it won't do any update
// but will return the object in 'ptrToType' parameter.
//
// Example:
//