Golang Invoke示例

说明

golang invoke示例是从最受好评的开源项目中提取的实现代码,你可以参考下面示例的使用方式。

编程语言: Golang

命名空间/包名称: google/golang.org/grpc

示例#1
文件: client.go 项目: jmank88/kit

// Endpoint returns a usable endpoint that will invoke the gRPC specified by the
// client.
func (c Client) Endpoint() endpoint.Endpoint {
	return func(ctx context.Context, request interface{}) (interface{}, error) {
		ctx, cancel := context.WithCancel(ctx)
		defer cancel()

		req, err := c.enc(ctx, request)
		if err != nil {
			return nil, fmt.Errorf("Encode: %v", err)
		}

		md := &metadata.MD{}
		for _, f := range c.before {
			ctx = f(ctx, md)
		}
		ctx = metadata.NewContext(ctx, *md)

		if err = grpc.Invoke(ctx, c.method, req, c.grpcReply, c.client); err != nil {
			return nil, fmt.Errorf("Invoke: %v", err)
		}

		response, err := c.dec(ctx, c.grpcReply)
		if err != nil {
			return nil, fmt.Errorf("Decode: %v", err)
		}
		return response, nil
	}
}

示例#2
文件: peer-rpc.pb.go 项目: kshlm/glusterd2

func (c *peerServiceClient) ValidateDelete(ctx context.Context, in *PeerDeleteReq, opts ...grpc.CallOption) (*PeerGenericResp, error) {
	out := new(PeerGenericResp)
	err := grpc.Invoke(ctx, "/peercommands.PeerService/ValidateDelete", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#3
文件: service.pb.go 项目: philips/hacks

func (c *yourServiceClient) Echo(ctx context.Context, in *StringMessage, opts ...grpc.CallOption) (*StringMessage, error) {
	out := new(StringMessage)
	err := grpc.Invoke(ctx, "/play.YourService/Echo", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#4
文件: logging.pb.go 项目: jmhodges/howsmyssl

func (c *loggingServiceV2Client) ListLogs(ctx context.Context, in *ListLogsRequest, opts ...grpc.CallOption) (*ListLogsResponse, error) {
	out := new(ListLogsResponse)
	err := grpc.Invoke(ctx, "/google.logging.v2.LoggingServiceV2/ListLogs", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#5
文件: mysqlctl.pb.go 项目: aaijazi/vitess

func (c *mysqlCtlClient) RunMysqlUpgrade(ctx context.Context, in *RunMysqlUpgradeRequest, opts ...grpc.CallOption) (*RunMysqlUpgradeResponse, error) {
	out := new(RunMysqlUpgradeResponse)
	err := grpc.Invoke(ctx, "/mysqlctl.MysqlCtl/RunMysqlUpgrade", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#6
文件: flow_combination.pb.go 项目: JohanSJA/grpc-gateway

func (c *flowCombinationClient) RpcPathNestedRpc(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (*EmptyProto, error) {
	out := new(EmptyProto)
	err := grpc.Invoke(ctx, "/gengo.grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#7
文件: route_guide.pb.go 项目: CocoaWang/grpc-go

func (c *routeGuideClient) GetFeature(ctx context.Context, in *Point, opts ...grpc.CallOption) (*Feature, error) {
	out := new(Feature)
	err := grpc.Invoke(ctx, "/routeguide.RouteGuide/GetFeature", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#8
文件: device.pb.go 项目: TheThingsNetwork/ttn

func (c *deviceManagerClient) GetDevice(ctx context.Context, in *DeviceIdentifier, opts ...grpc.CallOption) (*Device, error) {
	out := new(Device)
	err := grpc.Invoke(ctx, "/lorawan.DeviceManager/GetDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#9
文件: geo.pb.go 项目: eandbsoftware/go-micro-services

func (c *geoClient) BoundedBox(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Result, error) {
	out := new(Result)
	err := grpc.Invoke(ctx, "/geo.Geo/BoundedBox", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#10
文件: datastore.pb.go 项目: takbok/shared-contacts-admin

func (c *datastoreClient) Commit(ctx context.Context, in *CommitRequest, opts ...grpc.CallOption) (*CommitResponse, error) {
	out := new(CommitResponse)
	err := grpc.Invoke(ctx, "/google.datastore.v1beta3.Datastore/Commit", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#11
文件: datastore.pb.go 项目: takbok/shared-contacts-admin

func (c *datastoreClient) BeginTransaction(ctx context.Context, in *BeginTransactionRequest, opts ...grpc.CallOption) (*BeginTransactionResponse, error) {
	out := new(BeginTransactionResponse)
	err := grpc.Invoke(ctx, "/google.datastore.v1beta3.Datastore/BeginTransaction", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#12
文件: verifier.pb.go 项目: postfix/coname

func (c *e2EKSVerificationClient) PushRatification(ctx context.Context, in *SignedEpochHead, opts ...grpc.CallOption) (*Nothing, error) {
	out := new(Nothing)
	err := grpc.Invoke(ctx, "/proto.E2EKSVerification/PushRatification", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#13
文件: user.pb.go 项目: golanghr/platform-users

func (c *usersClient) Profile(ctx context.Context, in *platform.Request, opts ...grpc.CallOption) (*platform.Response, error) {
	out := new(platform.Response)
	err := grpc.Invoke(ctx, "/users.Users/Profile", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#14
文件: bytestream.pb.go 项目: jfrazelle/s3server

func (c *byteStreamClient) QueryWriteStatus(ctx context.Context, in *QueryWriteStatusRequest, opts ...grpc.CallOption) (*QueryWriteStatusResponse, error) {
	out := new(QueryWriteStatusResponse)
	err := grpc.Invoke(ctx, "/google.bytestream.ByteStream/QueryWriteStatus", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#15
文件: peer-rpc.pb.go 项目: kshlm/glusterd2

func (c *peerServiceClient) ExportAndStoreETCDConfig(ctx context.Context, in *EtcdConfigReq, opts ...grpc.CallOption) (*PeerGenericResp, error) {
	out := new(PeerGenericResp)
	err := grpc.Invoke(ctx, "/peercommands.PeerService/ExportAndStoreETCDConfig", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#16
文件: propagator.pb.go 项目: clawio/service-localfsxattr-meta

func (c *propClient) Rm(ctx context.Context, in *RmReq, opts ...grpc.CallOption) (*Void, error) {
	out := new(Void)
	err := grpc.Invoke(ctx, "/propagator.Prop/Rm", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#17
文件: throttlerservice.pb.go 项目: CowLeo/vitess

func (c *throttlerClient) SetMaxRate(ctx context.Context, in *throttlerdata.SetMaxRateRequest, opts ...grpc.CallOption) (*throttlerdata.SetMaxRateResponse, error) {
	out := new(throttlerdata.SetMaxRateResponse)
	err := grpc.Invoke(ctx, "/throttlerservice.Throttler/SetMaxRate", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#18
文件: bigtable_table_service.pb.go 项目: Celluliodio/flannel

func (c *bigtableTableServiceClient) UpdateColumnFamily(ctx context.Context, in *google_bigtable_admin_table_v11.ColumnFamily, opts ...grpc.CallOption) (*google_bigtable_admin_table_v11.ColumnFamily, error) {
	out := new(google_bigtable_admin_table_v11.ColumnFamily)
	err := grpc.Invoke(ctx, "/google.bigtable.admin.table.v1.BigtableTableService/UpdateColumnFamily", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#19
文件: device.pb.go 项目: TheThingsNetwork/ttn

func (c *deviceManagerClient) DeleteDevice(ctx context.Context, in *DeviceIdentifier, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
	out := new(google_protobuf.Empty)
	err := grpc.Invoke(ctx, "/lorawan.DeviceManager/DeleteDevice", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#20
文件: bigtable_table_service.pb.go 项目: Celluliodio/flannel

func (c *bigtableTableServiceClient) ListTables(ctx context.Context, in *ListTablesRequest, opts ...grpc.CallOption) (*ListTablesResponse, error) {
	out := new(ListTablesResponse)
	err := grpc.Invoke(ctx, "/google.bigtable.admin.table.v1.BigtableTableService/ListTables", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#21
文件: health.pb.go 项目: sr/pachyderm

func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
	out := new(HealthCheckResponse)
	err := grpc.Invoke(ctx, "/grpc.health.v1alpha.Health/Check", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#22
文件: bigtable_table_service.pb.go 项目: Celluliodio/flannel

func (c *bigtableTableServiceClient) GetTable(ctx context.Context, in *GetTableRequest, opts ...grpc.CallOption) (*google_bigtable_admin_table_v11.Table, error) {
	out := new(google_bigtable_admin_table_v11.Table)
	err := grpc.Invoke(ctx, "/google.bigtable.admin.table.v1.BigtableTableService/GetTable", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#23
文件: mysqlctl.pb.go 项目: aaijazi/vitess

func (c *mysqlCtlClient) Shutdown(ctx context.Context, in *ShutdownRequest, opts ...grpc.CallOption) (*ShutdownResponse, error) {
	out := new(ShutdownResponse)
	err := grpc.Invoke(ctx, "/mysqlctl.MysqlCtl/Shutdown", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#24
文件: bigtable_table_service.pb.go 项目: Celluliodio/flannel

func (c *bigtableTableServiceClient) RenameTable(ctx context.Context, in *RenameTableRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) {
	out := new(google_protobuf1.Empty)
	err := grpc.Invoke(ctx, "/google.bigtable.admin.table.v1.BigtableTableService/RenameTable", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#25
文件: logging.pb.go 项目: jmhodges/howsmyssl

func (c *loggingServiceV2Client) DeleteLog(ctx context.Context, in *DeleteLogRequest, opts ...grpc.CallOption) (*google_protobuf5.Empty, error) {
	out := new(google_protobuf5.Empty)
	err := grpc.Invoke(ctx, "/google.logging.v2.LoggingServiceV2/DeleteLog", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#26
文件: wordfilter.pb.go 项目: tenywen/login-srv

func (c *wordFilterServiceClient) Filter(ctx context.Context, in *WordFilter_Text, opts ...grpc.CallOption) (*WordFilter_Text, error) {
	out := new(WordFilter_Text)
	err := grpc.Invoke(ctx, "/proto.WordFilterService/Filter", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#27
文件: transaction-rpc.pb.go 项目: kshlm/glusterd2

func (c *txnSvcClient) RunStep(ctx context.Context, in *TxnStepReq, opts ...grpc.CallOption) (*TxnStepResp, error) {
	out := new(TxnStepResp)
	err := grpc.Invoke(ctx, "/transaction.TxnSvc/RunStep", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#28
文件: automationservice.pb.go 项目: littleyang/vitess

func (c *automationClient) GetClusterOperationDetails(ctx context.Context, in *automation.GetClusterOperationDetailsRequest, opts ...grpc.CallOption) (*automation.GetClusterOperationDetailsResponse, error) {
	out := new(automation.GetClusterOperationDetailsResponse)
	err := grpc.Invoke(ctx, "/automationservice.Automation/GetClusterOperationDetails", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#29
文件: propagator.pb.go 项目: clawio/service-localfsxattr-meta

func (c *propClient) Get(ctx context.Context, in *GetReq, opts ...grpc.CallOption) (*Record, error) {
	out := new(Record)
	err := grpc.Invoke(ctx, "/propagator.Prop/Get", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

示例#30
文件: rpc.pb.go 项目: kardianos/garage

func (c *garageClient) Toggle(ctx context.Context, in *Noop, opts ...grpc.CallOption) (*Noop, error) {
	out := new(Noop)
	err := grpc.Invoke(ctx, "/comm.Garage/Toggle", in, out, c.cc, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

展开阅读全文