C# Class EtcdNet.EtcdClient

The EtcdClient class is used to talk with etcd service
Show file Open project: wangjia184/etcdnet Class Usage Examples

Public Methods

Method Description
CompareAndDeleteNodeAsync ( string key, long prevIndex ) : Task

Compare and delete specific node

CompareAndDeleteNodeAsync ( string key, string prevValue ) : Task

Compare and delete specific node

CompareAndSwapNodeAsync ( string key, long prevIndex, string value, int ttl = null, bool dir = null ) : Task

CAS(Compare and Swap) a node

CompareAndSwapNodeAsync ( string key, string prevValue, string value, int ttl = null, bool dir = null ) : Task

CAS(Compare and Swap) a node

CreateInOrderNodeAsync ( string key, string value, int ttl = null, bool dir = null ) : Task

Create in-order node

CreateNodeAsync ( string key, string value, int ttl = null, bool dir = null ) : Task

Create a new node. If node exists, EtcdCommonException.NodeExist occurs

DeleteNodeAsync ( string key, bool ignoreKeyNotFoundException = false, bool dir = null ) : Task

delete specific node

EtcdClient ( EtcdClientOpitions options ) : System

Constructor

GetNodeAsync ( string key, bool ignoreKeyNotFoundException = false, bool recursive = false, bool sorted = false ) : Task

Get etcd node specified by `key`

GetNodeValueAsync ( string key, bool ignoreKeyNotFoundException = false ) : Task

Simplified version of `GetNodeAsync`. Get the value of the specific node

SetNodeAsync ( string key, string value, int ttl = null, bool dir = null ) : Task

Get etcd node specified by `key`

WatchNodeAsync ( string key, bool recursive = false, long waitIndex = null ) : Task

Watch changes

Private Methods

Method Description
GetLongHeader ( HttpResponseMessage responseMessage, string name ) : long
GetStringHeader ( HttpResponseMessage responseMessage, string name ) : string
SendRequest ( HttpMethod method, string requestUri, string>.IEnumerable formFields = null ) : Task

Method Details

CompareAndDeleteNodeAsync() public method

Compare and delete specific node
public CompareAndDeleteNodeAsync ( string key, long prevIndex ) : Task
key string path of the node
prevIndex long previous index
return Task

CompareAndDeleteNodeAsync() public method

Compare and delete specific node
public CompareAndDeleteNodeAsync ( string key, string prevValue ) : Task
key string Path of the node
prevValue string previous value
return Task

CompareAndSwapNodeAsync() public method

CAS(Compare and Swap) a node
public CompareAndSwapNodeAsync ( string key, long prevIndex, string value, int ttl = null, bool dir = null ) : Task
key string path of the node
prevIndex long previous index
value string value
ttl int time to live (in seconds)
dir bool is directory
return Task

CompareAndSwapNodeAsync() public method

CAS(Compare and Swap) a node
public CompareAndSwapNodeAsync ( string key, string prevValue, string value, int ttl = null, bool dir = null ) : Task
key string
prevValue string
value string
ttl int
dir bool
return Task

CreateInOrderNodeAsync() public method

Create in-order node
public CreateInOrderNodeAsync ( string key, string value, int ttl = null, bool dir = null ) : Task
key string
value string
ttl int
dir bool
return Task

CreateNodeAsync() public method

Create a new node. If node exists, EtcdCommonException.NodeExist occurs
public CreateNodeAsync ( string key, string value, int ttl = null, bool dir = null ) : Task
key string
value string
ttl int
dir bool
return Task

DeleteNodeAsync() public method

delete specific node
public DeleteNodeAsync ( string key, bool ignoreKeyNotFoundException = false, bool dir = null ) : Task
key string The path of the node, must start with `/`
ignoreKeyNotFoundException bool If `true`, `EtcdCommonException.KeyNotFound` exception is ignored and `null` is returned instead.
dir bool true to delete an empty directory
return Task

EtcdClient() public method

Constructor
public EtcdClient ( EtcdClientOpitions options ) : System
options EtcdClientOpitions options to initialize
return System

GetNodeAsync() public method

Get etcd node specified by `key`
public GetNodeAsync ( string key, bool ignoreKeyNotFoundException = false, bool recursive = false, bool sorted = false ) : Task
key string The path of the node, must start with `/`
ignoreKeyNotFoundException bool If `true`, `EtcdCommonException.KeyNotFound` exception is ignored and `null` is returned instead.
recursive bool Represents whether list the children nodes
sorted bool To enumerate the in-order keys as a sorted list, use the "sorted" parameter.
return Task

GetNodeValueAsync() public method

Simplified version of `GetNodeAsync`. Get the value of the specific node
public GetNodeValueAsync ( string key, bool ignoreKeyNotFoundException = false ) : Task
key string The path of the node, must start with `/`
ignoreKeyNotFoundException bool If `true`, `EtcdCommonException.KeyNotFound` exception is ignored and `null` is returned instead.
return Task

SetNodeAsync() public method

Get etcd node specified by `key`
public SetNodeAsync ( string key, string value, int ttl = null, bool dir = null ) : Task
key string path of the node
value string value to be set
ttl int time to live, in seconds
dir bool indicates if this is a directory
return Task

WatchNodeAsync() public method

Watch changes
public WatchNodeAsync ( string key, bool recursive = false, long waitIndex = null ) : Task
key string Path of the node
recursive bool true to monitor descendants
waitIndex long Etcd Index is continue monitor from
return Task