From 3ce17780b779e5e4900dcd5b498d668a13e1526a Mon Sep 17 00:00:00 2001 From: Andres Taylor Date: Tue, 14 Apr 2020 08:02:50 +0200 Subject: [PATCH] Remove unused code Signed-off-by: Andres Taylor --- go/vt/vtgate/engine/route.go | 36 ---------------------------- go/vt/vtgate/engine/send.go | 22 ----------------- go/vt/vtgate/engine/update_target.go | 15 ------------ go/vt/vtgate/engine/vindex_func.go | 19 --------------- 4 files changed, 92 deletions(-) diff --git a/go/vt/vtgate/engine/route.go b/go/vt/vtgate/engine/route.go index a3a862264df..9fff1e5afeb 100644 --- a/go/vt/vtgate/engine/route.go +++ b/go/vt/vtgate/engine/route.go @@ -23,7 +23,6 @@ import ( "strconv" "time" - "vitess.io/vitess/go/jsonutil" "vitess.io/vitess/go/mysql" "vitess.io/vitess/go/sqltypes" "vitess.io/vitess/go/stats" @@ -128,41 +127,6 @@ func (obp OrderbyParams) String() string { return val } -// MarshalJSON serializes the Route into a JSON representation. -// It's used for testing and diagnostics. -func (route *Route) MarshalJSON() ([]byte, error) { - var vindexName string - if route.Vindex != nil { - vindexName = route.Vindex.String() - } - marshalRoute := struct { - Opcode RouteOpcode - Keyspace *vindexes.Keyspace `json:",omitempty"` - Query string `json:",omitempty"` - FieldQuery string `json:",omitempty"` - Vindex string `json:",omitempty"` - Values []sqltypes.PlanValue `json:",omitempty"` - OrderBy []OrderbyParams `json:",omitempty"` - TruncateColumnCount int `json:",omitempty"` - QueryTimeout int `json:",omitempty"` - ScatterErrorsAsWarnings bool `json:",omitempty"` - Table string `json:",omitempty"` - }{ - Opcode: route.Opcode, - Keyspace: route.Keyspace, - Query: route.Query, - FieldQuery: route.FieldQuery, - Vindex: vindexName, - Values: route.Values, - OrderBy: route.OrderBy, - TruncateColumnCount: route.TruncateColumnCount, - QueryTimeout: route.QueryTimeout, - ScatterErrorsAsWarnings: route.ScatterErrorsAsWarnings, - Table: route.TableName, - } - return jsonutil.MarshalNoEscape(marshalRoute) -} - // RouteOpcode is a number representing the opcode // for the Route primitve. Adding new opcodes here // will require review of the join code and diff --git a/go/vt/vtgate/engine/send.go b/go/vt/vtgate/engine/send.go index 1f3db920045..50ca90fe829 100644 --- a/go/vt/vtgate/engine/send.go +++ b/go/vt/vtgate/engine/send.go @@ -17,8 +17,6 @@ limitations under the License. package engine import ( - "encoding/json" - "vitess.io/vitess/go/sqltypes" "vitess.io/vitess/go/vt/key" "vitess.io/vitess/go/vt/proto/query" @@ -53,26 +51,6 @@ func (s *Send) NeedsTransaction() bool { return s.IsDML } -// MarshalJSON serializes the Send into a JSON representation. -// It's used for testing and diagnostics. -func (s *Send) MarshalJSON() ([]byte, error) { - marshalSend := struct { - Opcode string - Keyspace *vindexes.Keyspace - TargetDestination key.Destination - Query string - IsDML bool - }{ - Opcode: "Send", - Keyspace: s.Keyspace, - TargetDestination: s.TargetDestination, - IsDML: s.IsDML, - Query: s.Query, - } - - return json.Marshal(marshalSend) -} - // RouteType implements Primitive interface func (s *Send) RouteType() string { if s.IsDML { diff --git a/go/vt/vtgate/engine/update_target.go b/go/vt/vtgate/engine/update_target.go index bb782627d9f..f297c43e941 100644 --- a/go/vt/vtgate/engine/update_target.go +++ b/go/vt/vtgate/engine/update_target.go @@ -17,8 +17,6 @@ limitations under the License. package engine import ( - "encoding/json" - vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc" "vitess.io/vitess/go/vt/vterrors" @@ -45,19 +43,6 @@ func (updTarget *UpdateTarget) description() PrimitiveDescription { } } -// MarshalJSON serializes the UpdateTarget into a JSON representation. -// It's used for testing and diagnostics. -func (updTarget *UpdateTarget) MarshalJSON() ([]byte, error) { - marshalUpdateTarget := struct { - Opcode string - Target string - }{ - Opcode: "UpdateTarget", - Target: updTarget.Target, - } - return json.Marshal(marshalUpdateTarget) -} - // RouteType implements the Primitive interface func (updTarget UpdateTarget) RouteType() string { return "UpdateTarget" diff --git a/go/vt/vtgate/engine/vindex_func.go b/go/vt/vtgate/engine/vindex_func.go index 5579f72a864..0e4e516c3b8 100644 --- a/go/vt/vtgate/engine/vindex_func.go +++ b/go/vt/vtgate/engine/vindex_func.go @@ -47,25 +47,6 @@ type VindexFunc struct { noTxNeeded } -// MarshalJSON serializes the VindexFunc into a JSON representation. -// It's used for testing and diagnostics. -func (vf *VindexFunc) MarshalJSON() ([]byte, error) { - v := struct { - Opcode VindexOpcode - Fields []*querypb.Field - Cols []int - Vindex string - Value sqltypes.PlanValue - }{ - Opcode: vf.Opcode, - Fields: vf.Fields, - Cols: vf.Cols, - Vindex: vf.Vindex.String(), - Value: vf.Value, - } - return json.Marshal(v) -} - // VindexOpcode is the opcode for a VindexFunc. type VindexOpcode int