vitess.io/vitess@v0.16.2/go/vt/vtgate/vtgateservice/interface.go (about) 1 /* 2 Copyright 2019 The Vitess Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 // Package vtgateservice provides to interface definition for the 18 // vtgate service 19 package vtgateservice 20 21 import ( 22 "context" 23 24 "vitess.io/vitess/go/sqltypes" 25 26 binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata" 27 querypb "vitess.io/vitess/go/vt/proto/query" 28 topodatapb "vitess.io/vitess/go/vt/proto/topodata" 29 vtgatepb "vitess.io/vitess/go/vt/proto/vtgate" 30 ) 31 32 // VTGateService is the interface implemented by the VTGate service, 33 // that RPC server implementations will call. 34 type VTGateService interface { 35 // V3 API 36 Execute(ctx context.Context, session *vtgatepb.Session, sql string, bindVariables map[string]*querypb.BindVariable) (*vtgatepb.Session, *sqltypes.Result, error) 37 ExecuteBatch(ctx context.Context, session *vtgatepb.Session, sqlList []string, bindVariablesList []map[string]*querypb.BindVariable) (*vtgatepb.Session, []sqltypes.QueryResponse, error) 38 StreamExecute(ctx context.Context, session *vtgatepb.Session, sql string, bindVariables map[string]*querypb.BindVariable, callback func(*sqltypes.Result) error) error 39 // Prepare statement support 40 Prepare(ctx context.Context, session *vtgatepb.Session, sql string, bindVariables map[string]*querypb.BindVariable) (*vtgatepb.Session, []*querypb.Field, error) 41 42 // CloseSession closes the session, rolling back any implicit transactions. 43 // This has the same effect as if a "rollback" statement was executed, 44 // but does not affect the query statistics. 45 CloseSession(ctx context.Context, session *vtgatepb.Session) error 46 47 // 2PC support 48 ResolveTransaction(ctx context.Context, dtid string) error 49 50 // Update Stream methods 51 VStream(ctx context.Context, tabletType topodatapb.TabletType, vgtid *binlogdatapb.VGtid, filter *binlogdatapb.Filter, flags *vtgatepb.VStreamFlags, send func([]*binlogdatapb.VEvent) error) error 52 53 // HandlePanic should be called with defer at the beginning of each 54 // RPC implementation method, before calling any of the previous methods 55 HandlePanic(err *error) 56 }