本文整理汇总了Golang中github.com/coreos/etcd/etcdserver/etcdserverpb.NewMaintenanceClient函数的典型用法代码示例。如果您正苦于以下问题:Golang NewMaintenanceClient函数的具体用法?Golang NewMaintenanceClient怎么用?Golang NewMaintenanceClient使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewMaintenanceClient函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: NewMaintenance
func NewMaintenance(c *Client) Maintenance {
conn := c.ActiveConnection()
return &maintenance{
c: c,
conn: conn,
remote: pb.NewMaintenanceClient(conn),
}
}
开发者ID:achanda,项目名称:etcd,代码行数:8,代码来源:maintenance.go
示例2: toGRPC
func toGRPC(c *clientv3.Client) grpcAPI {
return grpcAPI{
pb.NewClusterClient(c.ActiveConnection()),
pb.NewKVClient(c.ActiveConnection()),
pb.NewLeaseClient(c.ActiveConnection()),
pb.NewWatchClient(c.ActiveConnection()),
pb.NewMaintenanceClient(c.ActiveConnection()),
}
}
开发者ID:XiangrongFan,项目名称:etcd,代码行数:9,代码来源:cluster.go
示例3: switchRemote
func (m *maintenance) switchRemote(prevErr error) error {
m.mu.Lock()
defer m.mu.Unlock()
newConn, err := m.c.retryConnection(m.conn, prevErr)
if err != nil {
return err
}
m.conn = newConn
m.remote = pb.NewMaintenanceClient(m.conn)
return nil
}
开发者ID:achanda,项目名称:etcd,代码行数:11,代码来源:maintenance.go
示例4: toGRPC
func toGRPC(c *clientv3.Client) grpcAPI {
if v, ok := proxies[c]; ok {
return v
}
return grpcAPI{
pb.NewClusterClient(c.ActiveConnection()),
grpcproxy.KvServerToKvClient(grpcproxy.NewKvProxy(c)),
pb.NewLeaseClient(c.ActiveConnection()),
grpcproxy.WatchServerToWatchClient(grpcproxy.NewWatchProxy(c)),
pb.NewMaintenanceClient(c.ActiveConnection()),
}
}
开发者ID:mgurevin,项目名称:etcd,代码行数:12,代码来源:cluster_proxy.go
示例5: Status
func (m *maintenance) Status(ctx context.Context, endpoint string) (*StatusResponse, error) {
conn, err := m.c.Dial(endpoint)
if err != nil {
return nil, err
}
remote := pb.NewMaintenanceClient(conn)
resp, err := remote.Status(ctx, &pb.StatusRequest{})
if err != nil {
return nil, err
}
return (*StatusResponse)(resp), nil
}
开发者ID:achanda,项目名称:etcd,代码行数:12,代码来源:maintenance.go
示例6: Defragment
func (m *maintenance) Defragment(ctx context.Context, endpoint string) (*DefragmentResponse, error) {
conn, err := m.c.Dial(endpoint)
if err != nil {
return nil, rpctypes.Error(err)
}
remote := pb.NewMaintenanceClient(conn)
resp, err := remote.Defragment(ctx, &pb.DefragmentRequest{})
if err != nil {
return nil, rpctypes.Error(err)
}
return (*DefragmentResponse)(resp), nil
}
开发者ID:XiangrongFan,项目名称:etcd,代码行数:12,代码来源:maintenance.go
示例7: Status
func (m *maintenance) Status(ctx context.Context, endpoint string) (*StatusResponse, error) {
conn, err := m.c.Dial(endpoint)
if err != nil {
return nil, toErr(ctx, err)
}
defer conn.Close()
remote := pb.NewMaintenanceClient(conn)
resp, err := remote.Status(ctx, &pb.StatusRequest{}, grpc.FailFast(false))
if err != nil {
return nil, toErr(ctx, err)
}
return (*StatusResponse)(resp), nil
}
开发者ID:CodeJuan,项目名称:kubernetes,代码行数:13,代码来源:maintenance.go
示例8: defrag
func (c *cluster) defrag() error {
for _, u := range c.GRPCURLs {
plog.Printf("defragmenting %s\n", u)
conn, err := grpc.Dial(u, grpc.WithInsecure(), grpc.WithTimeout(5*time.Second))
if err != nil {
return err
}
mt := pb.NewMaintenanceClient(conn)
if _, err = mt.Defragment(context.Background(), &pb.DefragmentRequest{}); err != nil {
return err
}
conn.Close()
plog.Printf("defragmented %s\n", u)
}
return nil
}
开发者ID:XiangrongFan,项目名称:etcd,代码行数:16,代码来源:cluster.go
示例9: RevHash
func (m *member) RevHash() (int64, int64, error) {
conn, err := m.dialGRPC()
if err != nil {
return 0, 0, err
}
mt := pb.NewMaintenanceClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
resp, err := mt.Hash(ctx, &pb.HashRequest{}, grpc.FailFast(false))
cancel()
conn.Close()
if err != nil {
return 0, 0, err
}
return resp.Header.Revision, int64(resp.Hash), nil
}
开发者ID:pulcy,项目名称:vault-monkey,代码行数:17,代码来源:member.go
示例10: toGRPC
func toGRPC(c *clientv3.Client) grpcAPI {
pmu.Lock()
defer pmu.Unlock()
if v, ok := proxies[c]; ok {
return v
}
api := grpcAPI{
pb.NewClusterClient(c.ActiveConnection()),
grpcproxy.KvServerToKvClient(grpcproxy.NewKvProxy(c)),
pb.NewLeaseClient(c.ActiveConnection()),
grpcproxy.WatchServerToWatchClient(grpcproxy.NewWatchProxy(c)),
pb.NewMaintenanceClient(c.ActiveConnection()),
}
proxies[c] = api
return api
}
开发者ID:nhr,项目名称:origin,代码行数:17,代码来源:cluster_proxy.go
示例11: getRevisionHash
func (c *cluster) getRevisionHash() (map[string]int64, map[string]int64, error) {
revs := make(map[string]int64)
hashes := make(map[string]int64)
for _, u := range c.GRPCURLs {
conn, err := grpc.Dial(u, grpc.WithInsecure(), grpc.WithTimeout(5*time.Second))
if err != nil {
return nil, nil, err
}
m := pb.NewMaintenanceClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
resp, err := m.Hash(ctx, &pb.HashRequest{})
cancel()
conn.Close()
if err != nil {
return nil, nil, err
}
revs[u] = resp.Header.Revision
hashes[u] = int64(resp.Hash)
}
return revs, hashes, nil
}
开发者ID:XiangrongFan,项目名称:etcd,代码行数:21,代码来源:cluster.go
示例12: Snapshot
func (mp *maintenanceProxy) Snapshot(sr *pb.SnapshotRequest, stream pb.Maintenance_SnapshotServer) error {
conn := mp.client.ActiveConnection()
ctx, cancel := context.WithCancel(stream.Context())
defer cancel()
sc, err := pb.NewMaintenanceClient(conn).Snapshot(ctx, sr)
if err != nil {
return err
}
for {
rr, err := sc.Recv()
if err != nil {
return err
}
err = stream.Send(rr)
if err != nil {
return err
}
}
}
开发者ID:nhr,项目名称:origin,代码行数:21,代码来源:maintenance.go
示例13: NewMaintenance
func NewMaintenance(c *Client) Maintenance {
return &maintenance{c: c, remote: pb.NewMaintenanceClient(c.conn)}
}
开发者ID:CodeJuan,项目名称:kubernetes,代码行数:3,代码来源:maintenance.go
示例14: NewMaintenance
func NewMaintenance(c *Client) Maintenance {
ret := &maintenance{c: c}
f := func(conn *grpc.ClientConn) { ret.remote = pb.NewMaintenanceClient(conn) }
ret.rc = newRemoteClient(c, f)
return ret
}
开发者ID:XiangrongFan,项目名称:etcd,代码行数:6,代码来源:maintenance.go
示例15: Status
func (mp *maintenanceProxy) Status(ctx context.Context, r *pb.StatusRequest) (*pb.StatusResponse, error) {
conn := mp.client.ActiveConnection()
return pb.NewMaintenanceClient(conn).Status(ctx, r)
}
开发者ID:nhr,项目名称:origin,代码行数:4,代码来源:maintenance.go
示例16: Defragment
func (mp *maintenanceProxy) Defragment(ctx context.Context, dr *pb.DefragmentRequest) (*pb.DefragmentResponse, error) {
conn := mp.client.ActiveConnection()
return pb.NewMaintenanceClient(conn).Defragment(ctx, dr)
}
开发者ID:nhr,项目名称:origin,代码行数:4,代码来源:maintenance.go
注:本文中的github.com/coreos/etcd/etcdserver/etcdserverpb.NewMaintenanceClient函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论