class Etcd::Kv

Included Modules

Defined in:

etcd/kv.cr

Constant Summary

Log = ::Log.for(self)

Constructors

Instance Method Summary

Instance methods inherited from module Etcd::Utils

prefix_range_end(prefix) prefix_range_end

Constructor Detail

def self.new(client : Etcd::Client = Etcd::Client.new) #

[View source]

Instance Method Detail

def compare_and_swap(key, value, previous_value, lease_id : Int64 = 0_i64) : Bool #

Sets a key if the given previous_value matches the existing value for key

Wrapper over the etcd transaction API.


[View source]
def delete(key, range_end : String | Nil = nil, base64_keys : Bool = true) #

Deletes key or range of keys


[View source]
def delete_prefix(prefix) #

Deletes an entire keyspace prefix


[View source]
def get(key) : String | Nil #

[View source]
def move(key : String, key_destination : String, value, lease : Int64 = 0_i64) : Bool #

Moves a value from key to key_destination, deleting the kv at key in the process.


[View source]
def put(key : String, value, lease : Int64 = 0_i64, prev_kv : Bool | Nil = nil, ignore_value : Bool | Nil = nil, ignore_lease : Bool | Nil = nil) #

Sets a key and value in etcd. key key is the string that will be base64 encoded and associated with value in the kv store String value value is the string that will be base64 encoded and associated with key in the kv store String opts lease lease is the lease ID to associate with the key in the key-value store. A lease value of 0 indicates no lease. Int64 prev_kv If prev_kv is set, etcd gets the previous key-value pair before changing it. The previous key-value pair will be returned in the put response. Bool ignore_value If ignore_value is set, etcd updates the key using its current value. Returns an error if the key does not exist Bool ignore_lease If ignore_lease is set, etcd updates the key using its current lease. Returns an error if the key does not exist Bool


[View source]
def put_not_exists(key : String, value, lease : Int64 = 0_i64) : Bool #

Sets a key if the key is not already present.

Wrapper over the etcd transaction API.


[View source]
def range(key, range_end : String | Nil = nil, base64_keys : Bool = true) #

Queries a range of keys


[View source]
def range_greater_than_or_equal(key) #

Query all keys >= key


[View source]
def range_prefix(prefix) #

Query keys beneath a prefix


[View source]