|
|
@ -64,7 +64,7 @@ func (kv KV) Keys(namespace string) (KVAPI, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Get returns an entry
|
|
|
|
// Get returns an entry
|
|
|
|
func (kv KV) Get(namespace string, key string) (KVAPI, error) { |
|
|
|
func (kv KV) Get(namespace string, key string, revision ...uint) (KVAPI, error) { |
|
|
|
m := KVAPI{ |
|
|
|
m := KVAPI{ |
|
|
|
Params: &kvParams{}, |
|
|
|
Params: &kvParams{}, |
|
|
|
} |
|
|
|
} |
|
|
@ -74,6 +74,10 @@ func (kv KV) Get(namespace string, key string) (KVAPI, error) { |
|
|
|
EntryKey: key, |
|
|
|
EntryKey: key, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(revision) > 0 { |
|
|
|
|
|
|
|
m.Params.Options.Revision = revision[0] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m.Method = "get" |
|
|
|
m.Method = "get" |
|
|
|
|
|
|
|
|
|
|
|
r, err := kvAPIOut(kv.keybase, m) |
|
|
|
r, err := kvAPIOut(kv.keybase, m) |
|
|
@ -84,7 +88,7 @@ func (kv KV) Get(namespace string, key string) (KVAPI, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Put adds an entry
|
|
|
|
// Put adds an entry
|
|
|
|
func (kv KV) Put(namespace string, key string, value string) (KVAPI, error) { |
|
|
|
func (kv KV) Put(namespace string, key string, value string, revision ...uint) (KVAPI, error) { |
|
|
|
m := KVAPI{ |
|
|
|
m := KVAPI{ |
|
|
|
Params: &kvParams{}, |
|
|
|
Params: &kvParams{}, |
|
|
|
} |
|
|
|
} |
|
|
@ -95,6 +99,10 @@ func (kv KV) Put(namespace string, key string, value string) (KVAPI, error) { |
|
|
|
EntryValue: value, |
|
|
|
EntryValue: value, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(revision) > 0 { |
|
|
|
|
|
|
|
m.Params.Options.Revision = revision[0] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m.Method = "put" |
|
|
|
m.Method = "put" |
|
|
|
|
|
|
|
|
|
|
|
r, err := kvAPIOut(kv.keybase, m) |
|
|
|
r, err := kvAPIOut(kv.keybase, m) |
|
|
@ -105,7 +113,7 @@ func (kv KV) Put(namespace string, key string, value string) (KVAPI, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Delete removes an entry
|
|
|
|
// Delete removes an entry
|
|
|
|
func (kv KV) Delete(namespace string, key string) (KVAPI, error) { |
|
|
|
func (kv KV) Delete(namespace string, key string, revision ...uint) (KVAPI, error) { |
|
|
|
m := KVAPI{ |
|
|
|
m := KVAPI{ |
|
|
|
Params: &kvParams{}, |
|
|
|
Params: &kvParams{}, |
|
|
|
} |
|
|
|
} |
|
|
@ -115,6 +123,10 @@ func (kv KV) Delete(namespace string, key string) (KVAPI, error) { |
|
|
|
EntryKey: key, |
|
|
|
EntryKey: key, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(revision) > 0 { |
|
|
|
|
|
|
|
m.Params.Options.Revision = revision[0] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m.Method = "del" |
|
|
|
m.Method = "del" |
|
|
|
|
|
|
|
|
|
|
|
r, err := kvAPIOut(kv.keybase, m) |
|
|
|
r, err := kvAPIOut(kv.keybase, m) |
|
|
|