Documentation ¶
Overview ¶
Package etcd contains an implementation of the `gokv.Store` interface for etcd.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = Options{ Endpoints: []string{"localhost:2379"}, Timeout: &defaultTimeout, Codec: encoding.JSON, }
DefaultOptions is an Options object with default values. Endpoints: []string{"localhost:2379"}, Timeout: 200 * time.Millisecond, Codec: encoding.JSON
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a gokv.Store implementation for etcd.
func NewClient ¶
NewClient creates a new etcd client.
You must call the Close() method on the client when you're done working with it.
func (Client) Close ¶ added in v0.4.0
Close closes the client. It must be called to shut down all connections to the etcd server.
func (Client) Delete ¶
Delete deletes the stored value for the given key. Deleting a non-existing key-value pair does NOT lead to an error. The key must not be "".
func (Client) Get ¶
Get retrieves the stored value for the given key. You need to pass a pointer to the value, so in case of a struct the automatic unmarshalling can populate the fields of the object that v points to with the values of the retrieved object's values. If no value is found it returns (false, nil). The key must not be "" and the pointer must not be nil.
type Options ¶
type Options struct { // Addresses of the etcd servers in the cluster, including port. // Optional ([]string{"localhost:2379"} by default). Endpoints []string // The timeout for operations. // Optional (200 * time.Millisecond by default). Timeout *time.Duration // Encoding format. // Optional (encoding.JSON by default). Codec encoding.Codec }
Options are the options for the etcd client.