...
Package v3client
import "github.com/coreos/etcd/etcdserver/api/v3client"
- Overview
- Index
Package v3client provides clientv3 interfaces from an etcdserver.
Use v3client by creating an EtcdServer instance, then wrapping it with v3client.New:
import (
"context"
"github.com/coreos/etcd/embed"
"github.com/coreos/etcd/etcdserver/api/v3client"
)
...
// create an embedded EtcdServer from the default configuration
cfg := embed.NewConfig()
cfg.Dir = "default.etcd"
e, err := embed.StartEtcd(cfg)
if err != nil {
// handle error!
}
// wrap the EtcdServer with v3client
cli := v3client.New(e.Server)
// use like an ordinary clientv3
resp, err := cli.Put(context.TODO(), "some-key", "it works!")
if err != nil {
// handle error!
}
In the call graph viewer below, each node
is a function belonging to this package
and its children are the functions it
calls—perhaps dynamically.
The root nodes are the entry points of the
package: functions that may be called from
outside the package.
There may be non-exported or anonymous
functions among them if they are called
dynamically from another package.
Click a node to visit that function's source code.
From there you can visit its callers by
clicking its declaring func
token.
Functions may be omitted if they were
determined to be unreachable in the
particular programs or tests that were
analyzed.
func New(s *etcdserver.EtcdServer) *clientv3.Client
New creates a clientv3 client that wraps an in-process EtcdServer. Instead
of making gRPC calls through sockets, the client makes direct function calls
to the etcd server through its api/v3rpc function interfaces.