當前位置: 首頁>>代碼示例>>Golang>>正文


Golang etcdserverpb.NewMaintenanceClient函數代碼示例

本文整理匯總了Golang中github.com/coreos/etcd/etcdserver/etcdserverpb.NewMaintenanceClient函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewMaintenanceClient函數的具體用法?Golang NewMaintenanceClient怎麽用?Golang NewMaintenanceClient使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewMaintenanceClient函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的github.com/coreos/etcd/etcdserver/etcdserverpb.NewMaintenanceClient函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。