khenaidoo | ab1f7bd | 2019-11-14 14:00:27 -0500 | [diff] [blame] | 1 | // Copyright 2017 The etcd Authors |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | // Package v3client provides clientv3 interfaces from an etcdserver. |
| 16 | // |
| 17 | // Use v3client by creating an EtcdServer instance, then wrapping it with v3client.New: |
| 18 | // |
| 19 | // import ( |
| 20 | // "context" |
| 21 | // |
| 22 | // "go.etcd.io/etcd/embed" |
| 23 | // "go.etcd.io/etcd/etcdserver/api/v3client" |
| 24 | // ) |
| 25 | // |
| 26 | // ... |
| 27 | // |
| 28 | // // create an embedded EtcdServer from the default configuration |
| 29 | // cfg := embed.NewConfig() |
| 30 | // cfg.Dir = "default.etcd" |
| 31 | // e, err := embed.StartEtcd(cfg) |
| 32 | // if err != nil { |
| 33 | // // handle error! |
| 34 | // } |
| 35 | // |
| 36 | // // wrap the EtcdServer with v3client |
| 37 | // cli := v3client.New(e.Server) |
| 38 | // |
| 39 | // // use like an ordinary clientv3 |
| 40 | // resp, err := cli.Put(context.TODO(), "some-key", "it works!") |
| 41 | // if err != nil { |
| 42 | // // handle error! |
| 43 | // } |
| 44 | // |
| 45 | package v3client |