本文整理汇总了Golang中github.com/youtube/vitess/go/vt/tabletserver.TabletErrorToRPCError函数的典型用法代码示例。如果您正苦于以下问题:Golang TabletErrorToRPCError函数的具体用法?Golang TabletErrorToRPCError怎么用?Golang TabletErrorToRPCError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TabletErrorToRPCError函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: StreamExecute
// StreamExecute is part of the queryservice.QueryServer interface
func (q *query) StreamExecute(request *pb.StreamExecuteRequest, stream pbs.Query_StreamExecuteServer) (err error) {
defer q.server.HandlePanic(&err)
ctx := callerid.NewContext(callinfo.GRPCCallInfo(stream.Context()),
request.GetEffectiveCallerId(),
request.GetImmediateCallerId(),
)
seErr := q.server.StreamExecute(ctx, &proto.Query{
Sql: string(request.Query.Sql),
BindVariables: proto.Proto3ToBindVariables(request.Query.BindVariables),
SessionId: request.SessionId,
}, func(reply *mproto.QueryResult) error {
return stream.Send(&pb.StreamExecuteResponse{
Result: mproto.QueryResultToProto3(reply),
})
})
if seErr != nil {
response := &pb.StreamExecuteResponse{
Error: tabletserver.TabletErrorToRPCError(seErr),
}
if err := stream.Send(response); err != nil {
return err
}
}
return nil
}
开发者ID:afrolovskiy,项目名称:vitess,代码行数:26,代码来源:server.go
示例2: Commit
// Commit is part of the queryservice.QueryServer interface
func (q *query) Commit(ctx context.Context, request *pb.CommitRequest) (response *pb.CommitResponse, err error) {
defer q.server.HandlePanic(&err)
ctx = callinfo.GRPCCallInfo(ctx)
commitErr := q.server.Commit(ctx, &proto.Session{
SessionId: request.SessionId,
TransactionId: request.TransactionId,
})
return &pb.CommitResponse{
Error: tabletserver.TabletErrorToRPCError(commitErr),
}, nil
}
开发者ID:UGuarder,项目名称:vitess,代码行数:13,代码来源:server.go
示例3: GetSessionId
// GetSessionId is part of the queryservice.QueryServer interface
func (q *query) GetSessionId(ctx context.Context, request *pb.GetSessionIdRequest) (response *pb.GetSessionIdResponse, err error) {
defer q.server.HandlePanic(&err)
sessionInfo := new(proto.SessionInfo)
gsiErr := q.server.GetSessionId(&proto.SessionParams{
Keyspace: request.Keyspace,
Shard: request.Shard,
}, sessionInfo)
return &pb.GetSessionIdResponse{
SessionId: sessionInfo.SessionId,
Error: tabletserver.TabletErrorToRPCError(gsiErr),
}, nil
}
开发者ID:UGuarder,项目名称:vitess,代码行数:15,代码来源:server.go
示例4: Rollback
// Rollback is part of the queryservice.QueryServer interface
func (q *query) Rollback(ctx context.Context, request *pb.RollbackRequest) (response *pb.RollbackResponse, err error) {
defer q.server.HandlePanic(&err)
ctx = callerid.NewContext(callinfo.GRPCCallInfo(ctx),
request.GetEffectiveCallerId(),
request.GetImmediateCallerId(),
)
rollbackErr := q.server.Rollback(ctx, &proto.Session{
SessionId: request.SessionId,
TransactionId: request.TransactionId,
})
return &pb.RollbackResponse{
Error: tabletserver.TabletErrorToRPCError(rollbackErr),
}, nil
}
开发者ID:afrolovskiy,项目名称:vitess,代码行数:16,代码来源:server.go
示例5: Begin
// Begin is part of the queryservice.QueryServer interface
func (q *query) Begin(ctx context.Context, request *pb.BeginRequest) (response *pb.BeginResponse, err error) {
defer q.server.HandlePanic(&err)
ctx = callinfo.GRPCCallInfo(ctx)
txInfo := new(proto.TransactionInfo)
if beginErr := q.server.Begin(ctx, &proto.Session{
SessionId: request.SessionId,
}, txInfo); beginErr != nil {
return &pb.BeginResponse{
Error: tabletserver.TabletErrorToRPCError(beginErr),
}, nil
}
return &pb.BeginResponse{
TransactionId: txInfo.TransactionId,
}, nil
}
开发者ID:UGuarder,项目名称:vitess,代码行数:18,代码来源:server.go
示例6: ExecuteBatch
// ExecuteBatch is part of the queryservice.QueryServer interface
func (q *query) ExecuteBatch(ctx context.Context, request *pb.ExecuteBatchRequest) (response *pb.ExecuteBatchResponse, err error) {
defer q.server.HandlePanic(&err)
ctx = callinfo.GRPCCallInfo(ctx)
reply := new(proto.QueryResultList)
execErr := q.server.ExecuteBatch(ctx, &proto.QueryList{
Queries: proto.Proto3ToBoundQueryList(request.Queries),
SessionId: request.SessionId,
TransactionId: request.TransactionId,
}, reply)
if execErr != nil {
return &pb.ExecuteBatchResponse{
Error: tabletserver.TabletErrorToRPCError(execErr),
}, nil
}
return &pb.ExecuteBatchResponse{
Results: proto.QueryResultListToProto3(reply.List),
}, nil
}
开发者ID:UGuarder,项目名称:vitess,代码行数:20,代码来源:server.go
示例7: SplitQuery
// SplitQuery is part of the queryservice.QueryServer interface
func (q *query) SplitQuery(ctx context.Context, request *pb.SplitQueryRequest) (response *pb.SplitQueryResponse, err error) {
defer q.server.HandlePanic(&err)
ctx = callinfo.GRPCCallInfo(ctx)
reply := &proto.SplitQueryResult{}
if sqErr := q.server.SplitQuery(ctx, &proto.SplitQueryRequest{
Query: *proto.Proto3ToBoundQuery(request.Query),
SplitColumn: request.SplitColumn,
SplitCount: int(request.SplitCount),
SessionID: request.SessionId,
}, reply); sqErr != nil {
return &pb.SplitQueryResponse{
Error: tabletserver.TabletErrorToRPCError(sqErr),
}, nil
}
return &pb.SplitQueryResponse{
Queries: proto.QuerySplitsToProto3(reply.Queries),
}, nil
}
开发者ID:UGuarder,项目名称:vitess,代码行数:20,代码来源:server.go
示例8: Execute
// Execute is part of the queryservice.QueryServer interface
func (q *query) Execute(ctx context.Context, request *pb.ExecuteRequest) (response *pb.ExecuteResponse, err error) {
defer q.server.HandlePanic(&err)
ctx = callinfo.GRPCCallInfo(ctx)
reply := new(mproto.QueryResult)
execErr := q.server.Execute(ctx, &proto.Query{
Sql: string(request.Query.Sql),
BindVariables: proto.Proto3ToBindVariables(request.Query.BindVariables),
SessionId: request.SessionId,
TransactionId: request.TransactionId,
}, reply)
if execErr != nil {
return &pb.ExecuteResponse{
Error: tabletserver.TabletErrorToRPCError(execErr),
}, nil
}
return &pb.ExecuteResponse{
Result: mproto.QueryResultToProto3(reply),
}, nil
}
开发者ID:UGuarder,项目名称:vitess,代码行数:21,代码来源:server.go
注:本文中的github.com/youtube/vitess/go/vt/tabletserver.TabletErrorToRPCError函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论