go-vitess.v1: gopkg.in/src-d/go-vitess.v1/vt/vtgate/engine Index | Files

package engine

import "gopkg.in/src-d/go-vitess.v1/vt/vtgate/engine"

Index

Package Files

delete.go insert.go join.go limit.go merge_sort.go ordered_aggregate.go primitive.go pullout_subquery.go route.go subquery.go update.go vindex_func.go

Constants

const (
    // DeleteUnsharded is for routing a delete statement
    // to an unsharded keyspace.
    DeleteUnsharded = DeleteOpcode(iota)
    // DeleteEqual is for routing a delete statement
    // to a single shard. Requires: A Vindex, a single
    // Value, and an OwnedVindexQuery, which will be used to
    // determine if lookup rows need to be deleted.
    DeleteEqual
    // DeleteScatter is for routing a scattered
    // delete statement.
    DeleteScatter
    // DeleteByDestination is to route explicitly to a given
    // target destination. Is used when the query explicitly sets a target destination:
    // in the from clause:
    // e.g: DELETE FROM `keyspace[-]`.x1 LIMIT 100
    DeleteByDestination
)

This is the list of DeleteOpcode values.

const (
    // InsertUnsharded is for routing an insert statement
    // to an unsharded keyspace.
    InsertUnsharded = InsertOpcode(iota)
    // InsertSharded is for routing an insert statement
    // to individual shards. Requires: A list of Values, one
    // for each ColVindex. If the table has an Autoinc column,
    // A Generate subplan must be created.
    InsertSharded
    // InsertShardedIgnore is for INSERT IGNORE and
    // INSERT...ON DUPLICATE KEY constructs.
    InsertShardedIgnore
)
const (
    NormalJoin = JoinOpcode(iota)
    LeftJoin
)

This is the list of JoinOpcode values.

const (
    AggregateCount = AggregateOpcode(iota)
    AggregateSum
    AggregateMin
    AggregateMax
)

These constants list the possible aggregate opcodes.

const (
    // SeqVarName is a reserved bind var name for sequence values.
    SeqVarName = "__seq"
    // ListVarName is a reserved bind var name for list vars.
    // This is used for sending different IN clause values
    // to different shards.
    ListVarName = "__vals"
)
const (
    PulloutValue = PulloutOpcode(iota)
    PulloutIn
    PulloutNotIn
    PulloutExists
)

This is the list of PulloutOpcode values.

const (
    // SelectUnsharded is the opcode for routing a
    // select statement to an unsharded database.
    SelectUnsharded = RouteOpcode(iota)
    // SelectEqualUnique is for routing a query to
    // a single shard. Requires: A Unique Vindex, and
    // a single Value.
    SelectEqualUnique
    // SelectEqual is for routing a query using a
    // non-unique vindex. Requires: A Vindex, and
    // a single Value.
    SelectEqual
    // SelectIN is for routing a query that has an IN
    // clause using a Vindex. Requires: A Vindex,
    // and a Values list.
    SelectIN
    // SelectScatter is for routing a scatter query
    // to all shards of a keyspace.
    SelectScatter
    // SelectNext is for fetching from a sequence.
    SelectNext
    // SelectDBA is for executing a DBA statement.
    SelectDBA
    // SelectReference is for fetching from a reference table.
    SelectReference
)

This is the list of RouteOpcode values.

const (
    // UpdateUnsharded is for routing an update statement
    // to an unsharded keyspace.
    UpdateUnsharded = UpdateOpcode(iota)
    // UpdateEqual is for routing an update statement
    // to a single shard: Requires: A Vindex, and
    // a single Value.
    UpdateEqual
    // UpdateScatter is for routing a scattered
    // update statement.
    UpdateScatter
    // UpdateByDestination is to route explicitly to a given
    // target destination. Is used when the query explicitly sets a target destination:
    // in the clause:
    // e.g: UPDATE `keyspace[-]`.x1 SET foo=1
    UpdateByDestination
)

This is the list of UpdateOpcode values.

const (
    VindexNone = VindexOpcode(iota)
    VindexMap
    NumVindexCodes
)

These are opcode values for VindexFunc.

Variables

var SupportedAggregates = map[string]AggregateOpcode{
    "count": AggregateCount,
    "sum":   AggregateSum,
    "min":   AggregateMin,
    "max":   AggregateMax,
}

SupportedAggregates maps the list of supported aggregate functions to their opcodes.

type AggregateOpcode Uses

type AggregateOpcode int

AggregateOpcode is the aggregation Opcode.

func (AggregateOpcode) MarshalJSON Uses

func (code AggregateOpcode) MarshalJSON() ([]byte, error)

MarshalJSON serializes the AggregateOpcode as a JSON string. It's used for testing and diagnostics.

func (AggregateOpcode) String Uses

func (code AggregateOpcode) String() string

type AggregateParams Uses

type AggregateParams struct {
    Opcode AggregateOpcode
    Col    int
}

AggregateParams specify the parameters for each aggregation. It contains the opcode and input column number.

type Delete Uses

type Delete struct {
    // Opcode is the execution opcode.
    Opcode DeleteOpcode

    // Keyspace specifies the keyspace to send the query to.
    Keyspace *vindexes.Keyspace

    // TargetDestination specifies the destination to send the query to.
    TargetDestination key.Destination

    // Query specifies the query to be executed.
    Query string

    // Vindex specifies the vindex to be used.
    Vindex vindexes.Vindex
    // Values specifies the vindex values to use for routing.
    // For now, only one value is specified.
    Values []sqltypes.PlanValue

    // Table specifies the table for the delete.
    Table *vindexes.Table

    // OwnedVindexQuery is used for deleting lookup vindex entries.
    OwnedVindexQuery string

    // Option to override the standard behavior and allow a multi-shard delete
    // to use single round trip autocommit.
    MultiShardAutocommit bool

    // QueryTimeout contains the optional timeout (in milliseconds) to apply to this query
    QueryTimeout int
}

Delete represents the instructions to perform a delete.

func (*Delete) Execute Uses

func (del *Delete) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error)

Execute performs a non-streaming exec.

func (*Delete) GetFields Uses

func (del *Delete) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error)

GetFields fetches the field info.

func (*Delete) MarshalJSON Uses

func (del *Delete) MarshalJSON() ([]byte, error)

MarshalJSON serializes the Delete into a JSON representation. It's used for testing and diagnostics.

func (*Delete) RouteType Uses

func (del *Delete) RouteType() string

RouteType returns a description of the query routing type used by the primitive

func (*Delete) StreamExecute Uses

func (del *Delete) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error

StreamExecute performs a streaming exec.

type DeleteOpcode Uses

type DeleteOpcode int

DeleteOpcode is a number representing the opcode for the Delete primitve.

func (DeleteOpcode) MarshalJSON Uses

func (code DeleteOpcode) MarshalJSON() ([]byte, error)

MarshalJSON serializes the DeleteOpcode as a JSON string. It's used for testing and diagnostics.

type Generate Uses

type Generate struct {
    Keyspace *vindexes.Keyspace
    Query    string
    // Values are the supplied values for the column, which
    // will be stored as a list within the PlanValue. New
    // values will be generated based on how many were not
    // supplied (NULL).
    Values sqltypes.PlanValue
}

Generate represents the instruction to generate a value from a sequence.

type Insert Uses

type Insert struct {
    // Opcode is the execution opcode.
    Opcode InsertOpcode

    // Keyspace specifies the keyspace to send the query to.
    Keyspace *vindexes.Keyspace

    // Query specifies the query to be executed.
    // For InsertSharded plans, this value is unused,
    // and Prefix, Mid and Suffix are used instead.
    Query string

    // VindexValues specifies values for all the vindex columns.
    // This is a three-dimensonal data structure:
    // Insert.Values[i] represents the values to be inserted for the i'th colvindex (i < len(Insert.Table.ColumnVindexes))
    // Insert.Values[i].Values[j] represents values for the j'th column of the given colVindex (j < len(colVindex[i].Columns)
    // Insert.Values[i].Values[j].Values[k] represents the value pulled from row k for that column: (k < len(ins.rows))
    VindexValues []sqltypes.PlanValue

    // Table sepcifies the table for the insert.
    Table *vindexes.Table

    // Generate is only set for inserts where a sequence must be generated.
    Generate *Generate

    // Prefix, Mid and Suffix are for sharded insert plans.
    Prefix string
    Mid    []string
    Suffix string

    // Option to override the standard behavior and allow a multi-shard insert
    // to use single round trip autocommit.
    //
    // This is a clear violation of the SQL semantics since it means the statement
    // is not atomic in the presence of PK conflicts on one shard and not another.
    // However some application use cases would prefer that the statement partially
    // succeed in order to get the performance benefits of autocommit.
    MultiShardAutocommit bool

    // QueryTimeout contains the optional timeout (in milliseconds) to apply to this query
    QueryTimeout int
}

Insert represents the instructions to perform an insert operation.

func NewInsert Uses

func NewInsert(opcode InsertOpcode, keyspace *vindexes.Keyspace, vindexValues []sqltypes.PlanValue, table *vindexes.Table, prefix string, mid []string, suffix string) *Insert

NewInsert creates a new Insert.

func NewQueryInsert Uses

func NewQueryInsert(opcode InsertOpcode, keyspace *vindexes.Keyspace, query string) *Insert

NewQueryInsert creates an Insert with a query string.

func NewSimpleInsert Uses

func NewSimpleInsert(opcode InsertOpcode, table *vindexes.Table, keyspace *vindexes.Keyspace) *Insert

NewSimpleInsert creates an Insert for a Table.

func (*Insert) Execute Uses

func (ins *Insert) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error)

Execute performs a non-streaming exec.

func (*Insert) GetFields Uses

func (ins *Insert) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error)

GetFields fetches the field info.

func (*Insert) MarshalJSON Uses

func (ins *Insert) MarshalJSON() ([]byte, error)

MarshalJSON serializes the Insert into a JSON representation. It's used for testing and diagnostics.

func (*Insert) RouteType Uses

func (ins *Insert) RouteType() string

RouteType returns a description of the query routing type used by the primitive

func (*Insert) StreamExecute Uses

func (ins *Insert) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error

StreamExecute performs a streaming exec.

type InsertOpcode Uses

type InsertOpcode int

InsertOpcode is a number representing the opcode for the Insert primitve.

func (InsertOpcode) MarshalJSON Uses

func (code InsertOpcode) MarshalJSON() ([]byte, error)

MarshalJSON serializes the InsertOpcode as a JSON string. It's used for testing and diagnostics.

type Join Uses

type Join struct {
    Opcode JoinOpcode
    // Left and Right are the LHS and RHS primitives
    // of the Join. They can be any primitive.
    Left, Right Primitive `json:",omitempty"`

    // Cols defines which columns from the left
    // or right results should be used to build the
    // return result. For results coming from the
    // left query, the index values go as -1, -2, etc.
    // For the right query, they're 1, 2, etc.
    // If Cols is {-1, -2, 1, 2}, it means that
    // the returned result will be {Left0, Left1, Right0, Right1}.
    Cols []int `json:",omitempty"`

    // Vars defines the list of joinVars that need to
    // be built from the LHS result before invoking
    // the RHS subqquery.
    Vars map[string]int `json:",omitempty"`
}

Join specifies the parameters for a join primitive.

func (*Join) Execute Uses

func (jn *Join) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error)

Execute performs a non-streaming exec.

func (*Join) GetFields Uses

func (jn *Join) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error)

GetFields fetches the field info.

func (*Join) RouteType Uses

func (jn *Join) RouteType() string

RouteType returns a description of the query routing type used by the primitive

func (*Join) StreamExecute Uses

func (jn *Join) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error

StreamExecute performs a streaming exec.

type JoinOpcode Uses

type JoinOpcode int

JoinOpcode is a number representing the opcode for the Join primitive.

func (JoinOpcode) MarshalJSON Uses

func (code JoinOpcode) MarshalJSON() ([]byte, error)

MarshalJSON serializes the JoinOpcode as a JSON string. It's used for testing and diagnostics.

func (JoinOpcode) String Uses

func (code JoinOpcode) String() string

type Limit Uses

type Limit struct {
    Count  sqltypes.PlanValue
    Offset sqltypes.PlanValue
    Input  Primitive
}

Limit is a primitive that performs the LIMIT operation.

func (*Limit) Execute Uses

func (l *Limit) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error)

Execute satisfies the Primtive interface.

func (*Limit) GetFields Uses

func (l *Limit) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error)

GetFields satisfies the Primtive interface.

func (*Limit) MarshalJSON Uses

func (l *Limit) MarshalJSON() ([]byte, error)

MarshalJSON serializes the Limit into a JSON representation. It's used for testing and diagnostics.

func (*Limit) RouteType Uses

func (l *Limit) RouteType() string

RouteType returns a description of the query routing type used by the primitive

func (*Limit) StreamExecute Uses

func (l *Limit) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error

StreamExecute satisfies the Primtive interface.

type OrderbyParams Uses

type OrderbyParams struct {
    Col  int
    Desc bool
}

OrderbyParams specifies the parameters for ordering. This is used for merge-sorting scatter queries.

type OrderedAggregate Uses

type OrderedAggregate struct {
    // Aggregates specifies the aggregation parameters for each
    // aggregation function: function opcode and input column number.
    Aggregates []AggregateParams

    // Keys specifies the input values that must be used for
    // the aggregation key.
    Keys []int

    // TruncateColumnCount specifies the number of columns to return
    // in the final result. Rest of the columns are truncated
    // from the result received. If 0, no truncation happens.
    TruncateColumnCount int `json:",omitempty"`

    // Input is the primitive that will feed into this Primitive.
    Input Primitive
}

OrderedAggregate is a primitive that expects the underlying primitive to feed results in an order sorted by the Keys. Rows with duplicate keys are aggregated using the Aggregate functions. The assumption is that the underlying primitive is a scatter select with pre-sorted rows.

func (*OrderedAggregate) Execute Uses

func (oa *OrderedAggregate) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error)

Execute is a Primitive function.

func (*OrderedAggregate) GetFields Uses

func (oa *OrderedAggregate) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error)

GetFields is a Primitive function.

func (*OrderedAggregate) RouteType Uses

func (oa *OrderedAggregate) RouteType() string

RouteType returns a description of the query routing type used by the primitive

func (*OrderedAggregate) StreamExecute Uses

func (oa *OrderedAggregate) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error

StreamExecute is a Primitive function.

type Plan Uses

type Plan struct {
    // Original is the original query.
    Original string `json:",omitempty"`
    // Instructions contains the instructions needed to
    // fulfil the query.
    Instructions Primitive `json:",omitempty"`

    // Count of times this plan was executed
    ExecCount uint64
    // Total execution time
    ExecTime time.Duration
    // Total number of shard queries
    ShardQueries uint64
    // Total number of rows
    Rows uint64
    // Total number of errors
    Errors uint64
    // contains filtered or unexported fields
}

Plan represents the execution strategy for a given query. For now it's a simple wrapper around the real instructions. An instruction (aka Primitive) is typically a tree where each node does its part by combining the results of the sub-nodes.

func (*Plan) AddStats Uses

func (p *Plan) AddStats(execCount uint64, execTime time.Duration, shardQueries, rows, errors uint64)

AddStats updates the plan execution statistics

func (*Plan) Size Uses

func (p *Plan) Size() int

Size is defined so that Plan can be given to a cache.LRUCache. VTGate needs to maintain a cache of plans. It uses LRUCache, which in turn requires its objects to define a Size function.

func (*Plan) Stats Uses

func (p *Plan) Stats() (execCount uint64, execTime time.Duration, shardQueries, rows, errors uint64)

Stats returns a copy of the plan execution statistics

type Primitive Uses

type Primitive interface {
    RouteType() string
    Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error)
    StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantields bool, callback func(*sqltypes.Result) error) error
    GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error)
}

Primitive is the interface that needs to be satisfied by all primitives of a plan.

type PulloutOpcode Uses

type PulloutOpcode int

PulloutOpcode is a number representing the opcode for the PulloutSubquery primitive.

func (PulloutOpcode) MarshalJSON Uses

func (code PulloutOpcode) MarshalJSON() ([]byte, error)

MarshalJSON serializes the PulloutOpcode as a JSON string. It's used for testing and diagnostics.

func (PulloutOpcode) String Uses

func (code PulloutOpcode) String() string

type PulloutSubquery Uses

type PulloutSubquery struct {
    Opcode         PulloutOpcode
    SubqueryResult string
    HasValues      string
    Subquery       Primitive
    Underlying     Primitive
}

PulloutSubquery executes a "pulled out" subquery and stores the results in a bind variable.

func (*PulloutSubquery) Execute Uses

func (ps *PulloutSubquery) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error)

Execute satisfies the Primitive interface.

func (*PulloutSubquery) GetFields Uses

func (ps *PulloutSubquery) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error)

GetFields fetches the field info.

func (*PulloutSubquery) RouteType Uses

func (ps *PulloutSubquery) RouteType() string

RouteType returns a description of the query routing type used by the primitive

func (*PulloutSubquery) StreamExecute Uses

func (ps *PulloutSubquery) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error

StreamExecute performs a streaming exec.

type Route Uses

type Route struct {
    // the fields are described in the RouteOpcode values comments.
    // Opcode is the execution opcode.
    Opcode RouteOpcode

    // Keyspace specifies the keyspace to send the query to.
    Keyspace *vindexes.Keyspace

    // TargetDestination specifies an explicit target destination to send the query to.
    // This bypases the core of the v3 engine.
    TargetDestination key.Destination

    // TargetTabletType specifies an explicit target destination tablet type
    // this is only used in conjunction with TargetDestination
    TargetTabletType topodatapb.TabletType

    // Query specifies the query to be executed.
    Query string

    // FieldQuery specifies the query to be executed for a GetFieldInfo request.
    FieldQuery string

    // Vindex specifies the vindex to be used.
    Vindex vindexes.Vindex
    // Values specifies the vindex values to use for routing.
    Values []sqltypes.PlanValue

    // OrderBy specifies the key order for merge sorting. This will be
    // set only for scatter queries that need the results to be
    // merge-sorted.
    OrderBy []OrderbyParams

    // TruncateColumnCount specifies the number of columns to return
    // in the final result. Rest of the columns are truncated
    // from the result received. If 0, no truncation happens.
    TruncateColumnCount int

    // QueryTimeout contains the optional timeout (in milliseconds) to apply to this query
    QueryTimeout int

    // ScatterErrorsAsWarnings is true if results should be returned even if some shards have an error
    ScatterErrorsAsWarnings bool
}

Route represents the instructions to route a read query to one or many vttablets.

func NewRoute Uses

func NewRoute(opcode RouteOpcode, keyspace *vindexes.Keyspace, query, fieldQuery string) *Route

NewRoute creates a Route.

func NewSimpleRoute Uses

func NewSimpleRoute(opcode RouteOpcode, keyspace *vindexes.Keyspace) *Route

NewSimpleRoute creates a Route with the bare minimum of parameters.

func (*Route) Execute Uses

func (route *Route) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error)

Execute performs a non-streaming exec.

func (*Route) GetFields Uses

func (route *Route) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error)

GetFields fetches the field info.

func (*Route) MarshalJSON Uses

func (route *Route) MarshalJSON() ([]byte, error)

MarshalJSON serializes the Route into a JSON representation. It's used for testing and diagnostics.

func (*Route) RouteType Uses

func (route *Route) RouteType() string

RouteType returns a description of the query routing type used by the primitive

func (*Route) StreamExecute Uses

func (route *Route) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error

StreamExecute performs a streaming exec.

type RouteOpcode Uses

type RouteOpcode int

RouteOpcode is a number representing the opcode for the Route primitve. Adding new opcodes here will require review of the join code and the finalizeOptions code in planbuilder.

func (RouteOpcode) MarshalJSON Uses

func (code RouteOpcode) MarshalJSON() ([]byte, error)

MarshalJSON serializes the RouteOpcode as a JSON string. It's used for testing and diagnostics.

type Subquery Uses

type Subquery struct {
    // Cols defines the column numbers from the underlying primitive
    // to be returned.
    Cols     []int
    Subquery Primitive
}

Subquery specifies the parameters for a subquery primitive.

func (*Subquery) Execute Uses

func (sq *Subquery) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error)

Execute performs a non-streaming exec.

func (*Subquery) GetFields Uses

func (sq *Subquery) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error)

GetFields fetches the field info.

func (*Subquery) RouteType Uses

func (sq *Subquery) RouteType() string

RouteType returns a description of the query routing type used by the primitive

func (*Subquery) StreamExecute Uses

func (sq *Subquery) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error

StreamExecute performs a streaming exec.

type Update Uses

type Update struct {
    // Opcode is the execution opcode.
    Opcode UpdateOpcode

    // Keyspace specifies the keyspace to send the query to.
    Keyspace *vindexes.Keyspace

    // TargetDestination specifies the destination to send the query to.
    TargetDestination key.Destination

    // Query specifies the query to be executed.
    Query string

    // Vindex specifies the vindex to be used.
    Vindex vindexes.Vindex
    // Values specifies the vindex values to use for routing.
    // For now, only one value is specified.
    Values []sqltypes.PlanValue

    // ChangedVindexValues contains values for updated Vindexes during an update statement.
    ChangedVindexValues map[string][]sqltypes.PlanValue

    // Table sepcifies the table for the update.
    Table *vindexes.Table

    // OwnedVindexQuery is used for updating changes in lookup vindexes.
    OwnedVindexQuery string

    // Option to override the standard behavior and allow a multi-shard update
    // to use single round trip autocommit.
    MultiShardAutocommit bool

    // QueryTimeout contains the optional timeout (in milliseconds) to apply to this query
    QueryTimeout int
}

Update represents the instructions to perform an update.

func (*Update) Execute Uses

func (upd *Update) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error)

Execute performs a non-streaming exec.

func (*Update) GetFields Uses

func (upd *Update) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error)

GetFields fetches the field info.

func (*Update) MarshalJSON Uses

func (upd *Update) MarshalJSON() ([]byte, error)

MarshalJSON serializes the Update into a JSON representation. It's used for testing and diagnostics.

func (*Update) RouteType Uses

func (upd *Update) RouteType() string

RouteType returns a description of the query routing type used by the primitive

func (*Update) StreamExecute Uses

func (upd *Update) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error

StreamExecute performs a streaming exec.

type UpdateOpcode Uses

type UpdateOpcode int

UpdateOpcode is a number representing the opcode for the Update primitve.

func (UpdateOpcode) MarshalJSON Uses

func (code UpdateOpcode) MarshalJSON() ([]byte, error)

MarshalJSON serializes the UpdateOpcode as a JSON string. It's used for testing and diagnostics.

type VCursor Uses

type VCursor interface {
    // Context returns the context of the current request.
    Context() context.Context

    // SetContextTimeout updates the context and sets a timeout.
    SetContextTimeout(timeout time.Duration) context.CancelFunc

    // RecordWarning stores the given warning in the current session
    RecordWarning(warning *querypb.QueryWarning)

    // V3 functions.
    Execute(method string, query string, bindvars map[string]*querypb.BindVariable, isDML bool, co vtgatepb.CommitOrder) (*sqltypes.Result, error)
    AutocommitApproval() bool

    // Shard-level functions.
    ExecuteMultiShard(rss []*srvtopo.ResolvedShard, queries []*querypb.BoundQuery, isDML, canAutocommit bool) (*sqltypes.Result, []error)
    ExecuteStandalone(query string, bindvars map[string]*querypb.BindVariable, rs *srvtopo.ResolvedShard) (*sqltypes.Result, error)
    StreamExecuteMulti(query string, rss []*srvtopo.ResolvedShard, bindVars []map[string]*querypb.BindVariable, callback func(reply *sqltypes.Result) error) error

    // Keyspace ID level functions.
    ExecuteKeyspaceID(keyspace string, ksid []byte, query string, bindVars map[string]*querypb.BindVariable, isDML, autocommit bool) (*sqltypes.Result, error)

    // Resolver methods, from key.Destination to srvtopo.ResolvedShard.
    // Will replace all of the Topo functions.
    ResolveDestinations(keyspace string, ids []*querypb.Value, destinations []key.Destination) ([]*srvtopo.ResolvedShard, [][]*querypb.Value, error)
}

VCursor defines the interface the engine will use to execute routes.

type VindexFunc Uses

type VindexFunc struct {
    Opcode VindexOpcode
    // Fields is the field info for the result.
    Fields []*querypb.Field
    // Cols contains source column numbers: 0 for id, 1 for keyspace_id.
    Cols   []int
    Vindex vindexes.Vindex
    Value  sqltypes.PlanValue
}

VindexFunc is a primitive that performs vindex functions.

func (*VindexFunc) Execute Uses

func (vf *VindexFunc) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error)

Execute performs a non-streaming exec.

func (*VindexFunc) GetFields Uses

func (vf *VindexFunc) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error)

GetFields fetches the field info.

func (*VindexFunc) MarshalJSON Uses

func (vf *VindexFunc) MarshalJSON() ([]byte, error)

MarshalJSON serializes the VindexFunc into a JSON representation. It's used for testing and diagnostics.

func (*VindexFunc) RouteType Uses

func (vf *VindexFunc) RouteType() string

RouteType returns a description of the query routing type used by the primitive

func (*VindexFunc) StreamExecute Uses

func (vf *VindexFunc) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error

StreamExecute performs a streaming exec.

type VindexOpcode Uses

type VindexOpcode int

VindexOpcode is the opcode for a VindexFunc.

func (VindexOpcode) MarshalJSON Uses

func (code VindexOpcode) MarshalJSON() ([]byte, error)

MarshalJSON serializes the VindexOpcode into a JSON representation. It's used for testing and diagnostics.

Package engine imports 24 packages (graph) and is imported by 6 packages. Updated 2019-06-13. Refresh now. Tools for package owners.