コード例 #1
0
ファイル: streamer.go プロジェクト: zhzhy917/vitess
// StreamTables is part of the pbs.UpdateStreamServer interface
func (server *UpdateStream) StreamTables(req *pb.StreamTablesRequest, stream pbs.UpdateStream_StreamTablesServer) (err error) {
	defer server.updateStream.HandlePanic(&err)
	return server.updateStream.StreamTables(&proto.TablesRequest{
		Position: myproto.ProtoToReplicationPosition(req.Position),
		Tables:   req.Tables,
		Charset:  mproto.ProtoToCharset(req.Charset),
	}, func(reply *proto.BinlogTransaction) error {
		return stream.Send(&pb.StreamTablesResponse{
			BinlogTransaction: proto.BinlogTransactionToProto(reply),
		})
	})
}
コード例 #2
0
ファイル: streamer.go プロジェクト: zhzhy917/vitess
// StreamKeyRange is part of the pbs.UpdateStreamServer interface
func (server *UpdateStream) StreamKeyRange(req *pb.StreamKeyRangeRequest, stream pbs.UpdateStream_StreamKeyRangeServer) (err error) {
	defer server.updateStream.HandlePanic(&err)
	return server.updateStream.StreamKeyRange(&proto.KeyRangeRequest{
		Position:       myproto.ProtoToReplicationPosition(req.Position),
		KeyspaceIdType: key.ProtoToKeyspaceIdType(req.KeyspaceIdType),
		KeyRange:       key.ProtoToKeyRange(req.KeyRange),
		Charset:        mproto.ProtoToCharset(req.Charset),
	}, func(reply *proto.BinlogTransaction) error {
		return stream.Send(&pb.StreamKeyRangeResponse{
			BinlogTransaction: proto.BinlogTransactionToProto(reply),
		})
	})
}