id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
136,100 | vitessio/vitess | go/cmd/zk/zkcmd.go | cmdWatch | func cmdWatch(ctx context.Context, subFlags *flag.FlagSet, args []string) error {
subFlags.Parse(args)
eventChan := make(chan zk.Event, 16)
for _, arg := range subFlags.Args() {
zkPath := fixZkPath(arg)
_, _, watch, err := zconn.GetW(ctx, zkPath)
if err != nil {
return fmt.Errorf("watch error: %v", err)
... | go | func cmdWatch(ctx context.Context, subFlags *flag.FlagSet, args []string) error {
subFlags.Parse(args)
eventChan := make(chan zk.Event, 16)
for _, arg := range subFlags.Args() {
zkPath := fixZkPath(arg)
_, _, watch, err := zconn.GetW(ctx, zkPath)
if err != nil {
return fmt.Errorf("watch error: %v", err)
... | [
"func",
"cmdWatch",
"(",
"ctx",
"context",
".",
"Context",
",",
"subFlags",
"*",
"flag",
".",
"FlagSet",
",",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"subFlags",
".",
"Parse",
"(",
"args",
")",
"\n\n",
"eventChan",
":=",
"make",
"(",
"chan",
"... | // Watch for changes to the node. | [
"Watch",
"for",
"changes",
"to",
"the",
"node",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cmd/zk/zkcmd.go#L227-L274 |
136,101 | vitessio/vitess | go/cmd/zk/zkcmd.go | cmdZip | func cmdZip(ctx context.Context, subFlags *flag.FlagSet, args []string) error {
subFlags.Parse(args)
if subFlags.NArg() < 2 {
return fmt.Errorf("zip: need to specify source and destination paths")
}
dstPath := subFlags.Arg(subFlags.NArg() - 1)
paths := subFlags.Args()[:len(args)-1]
if !strings.HasSuffix(dstPat... | go | func cmdZip(ctx context.Context, subFlags *flag.FlagSet, args []string) error {
subFlags.Parse(args)
if subFlags.NArg() < 2 {
return fmt.Errorf("zip: need to specify source and destination paths")
}
dstPath := subFlags.Arg(subFlags.NArg() - 1)
paths := subFlags.Args()[:len(args)-1]
if !strings.HasSuffix(dstPat... | [
"func",
"cmdZip",
"(",
"ctx",
"context",
".",
"Context",
",",
"subFlags",
"*",
"flag",
".",
"FlagSet",
",",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"subFlags",
".",
"Parse",
"(",
"args",
")",
"\n",
"if",
"subFlags",
".",
"NArg",
"(",
")",
"<... | // Store a zk tree in a zip archive. This won't be immediately useful to
// zip tools since even "directories" can contain data. | [
"Store",
"a",
"zk",
"tree",
"in",
"a",
"zip",
"archive",
".",
"This",
"won",
"t",
"be",
"immediately",
"useful",
"to",
"zip",
"tools",
"since",
"even",
"directories",
"can",
"contain",
"data",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cmd/zk/zkcmd.go#L865-L931 |
136,102 | vitessio/vitess | go/sqltypes/event_token.go | EventTokenMinimum | func EventTokenMinimum(ev1, ev2 *querypb.EventToken) *querypb.EventToken {
if ev1 == nil || ev2 == nil {
// One or the other is not set, we can't do anything.
return nil
}
if ev1.Timestamp < ev2.Timestamp {
return &querypb.EventToken{
Timestamp: ev1.Timestamp,
}
}
return &querypb.EventToken{
Timestam... | go | func EventTokenMinimum(ev1, ev2 *querypb.EventToken) *querypb.EventToken {
if ev1 == nil || ev2 == nil {
// One or the other is not set, we can't do anything.
return nil
}
if ev1.Timestamp < ev2.Timestamp {
return &querypb.EventToken{
Timestamp: ev1.Timestamp,
}
}
return &querypb.EventToken{
Timestam... | [
"func",
"EventTokenMinimum",
"(",
"ev1",
",",
"ev2",
"*",
"querypb",
".",
"EventToken",
")",
"*",
"querypb",
".",
"EventToken",
"{",
"if",
"ev1",
"==",
"nil",
"||",
"ev2",
"==",
"nil",
"{",
"// One or the other is not set, we can't do anything.",
"return",
"nil"... | // EventTokenMinimum returns an event token that is guaranteed to
// happen before both provided EventToken objects. Note it doesn't
// parse the position, but rather only uses the timestamp. This is
// meant to be used for EventToken objects coming from different
// source shard. | [
"EventTokenMinimum",
"returns",
"an",
"event",
"token",
"that",
"is",
"guaranteed",
"to",
"happen",
"before",
"both",
"provided",
"EventToken",
"objects",
".",
"Note",
"it",
"doesn",
"t",
"parse",
"the",
"position",
"but",
"rather",
"only",
"uses",
"the",
"tim... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/event_token.go#L28-L42 |
136,103 | vitessio/vitess | go/vt/vtgate/planbuilder/from.go | processDMLTable | func (pb *primitiveBuilder) processDMLTable(tableExprs sqlparser.TableExprs) (*routeOption, error) {
if err := pb.processTableExprs(tableExprs); err != nil {
return nil, err
}
rb, ok := pb.bldr.(*route)
if !ok {
return nil, errors.New("unsupported: multi-shard or vindex write statement")
}
ro := rb.routeOptio... | go | func (pb *primitiveBuilder) processDMLTable(tableExprs sqlparser.TableExprs) (*routeOption, error) {
if err := pb.processTableExprs(tableExprs); err != nil {
return nil, err
}
rb, ok := pb.bldr.(*route)
if !ok {
return nil, errors.New("unsupported: multi-shard or vindex write statement")
}
ro := rb.routeOptio... | [
"func",
"(",
"pb",
"*",
"primitiveBuilder",
")",
"processDMLTable",
"(",
"tableExprs",
"sqlparser",
".",
"TableExprs",
")",
"(",
"*",
"routeOption",
",",
"error",
")",
"{",
"if",
"err",
":=",
"pb",
".",
"processTableExprs",
"(",
"tableExprs",
")",
";",
"er... | // This file has functions to analyze the FROM clause.
// processDMLTable analyzes the FROM clause for DMLs and returns a routeOption. | [
"This",
"file",
"has",
"functions",
"to",
"analyze",
"the",
"FROM",
"clause",
".",
"processDMLTable",
"analyzes",
"the",
"FROM",
"clause",
"for",
"DMLs",
"and",
"returns",
"a",
"routeOption",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/from.go#L32-L45 |
136,104 | vitessio/vitess | go/vt/vtgate/planbuilder/from.go | processTableExprs | func (pb *primitiveBuilder) processTableExprs(tableExprs sqlparser.TableExprs) error {
if len(tableExprs) == 1 {
return pb.processTableExpr(tableExprs[0])
}
if err := pb.processTableExpr(tableExprs[0]); err != nil {
return err
}
rpb := newPrimitiveBuilder(pb.vschema, pb.jt)
if err := rpb.processTableExprs(ta... | go | func (pb *primitiveBuilder) processTableExprs(tableExprs sqlparser.TableExprs) error {
if len(tableExprs) == 1 {
return pb.processTableExpr(tableExprs[0])
}
if err := pb.processTableExpr(tableExprs[0]); err != nil {
return err
}
rpb := newPrimitiveBuilder(pb.vschema, pb.jt)
if err := rpb.processTableExprs(ta... | [
"func",
"(",
"pb",
"*",
"primitiveBuilder",
")",
"processTableExprs",
"(",
"tableExprs",
"sqlparser",
".",
"TableExprs",
")",
"error",
"{",
"if",
"len",
"(",
"tableExprs",
")",
"==",
"1",
"{",
"return",
"pb",
".",
"processTableExpr",
"(",
"tableExprs",
"[",
... | // processTableExprs analyzes the FROM clause. It produces a builder
// with all the routes identified. | [
"processTableExprs",
"analyzes",
"the",
"FROM",
"clause",
".",
"It",
"produces",
"a",
"builder",
"with",
"all",
"the",
"routes",
"identified",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/from.go#L49-L62 |
136,105 | vitessio/vitess | go/vt/vtgate/planbuilder/from.go | processTableExpr | func (pb *primitiveBuilder) processTableExpr(tableExpr sqlparser.TableExpr) error {
switch tableExpr := tableExpr.(type) {
case *sqlparser.AliasedTableExpr:
return pb.processAliasedTable(tableExpr)
case *sqlparser.ParenTableExpr:
err := pb.processTableExprs(tableExpr.Exprs)
// If it's a route, preserve the par... | go | func (pb *primitiveBuilder) processTableExpr(tableExpr sqlparser.TableExpr) error {
switch tableExpr := tableExpr.(type) {
case *sqlparser.AliasedTableExpr:
return pb.processAliasedTable(tableExpr)
case *sqlparser.ParenTableExpr:
err := pb.processTableExprs(tableExpr.Exprs)
// If it's a route, preserve the par... | [
"func",
"(",
"pb",
"*",
"primitiveBuilder",
")",
"processTableExpr",
"(",
"tableExpr",
"sqlparser",
".",
"TableExpr",
")",
"error",
"{",
"switch",
"tableExpr",
":=",
"tableExpr",
".",
"(",
"type",
")",
"{",
"case",
"*",
"sqlparser",
".",
"AliasedTableExpr",
... | // processTableExpr produces a builder subtree for the given TableExpr. | [
"processTableExpr",
"produces",
"a",
"builder",
"subtree",
"for",
"the",
"given",
"TableExpr",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/from.go#L65-L83 |
136,106 | vitessio/vitess | go/vt/vtgate/planbuilder/from.go | processAliasedTable | func (pb *primitiveBuilder) processAliasedTable(tableExpr *sqlparser.AliasedTableExpr) error {
switch expr := tableExpr.Expr.(type) {
case sqlparser.TableName:
return pb.buildTablePrimitive(tableExpr, expr)
case *sqlparser.Subquery:
spb := newPrimitiveBuilder(pb.vschema, pb.jt)
switch stmt := expr.Select.(type... | go | func (pb *primitiveBuilder) processAliasedTable(tableExpr *sqlparser.AliasedTableExpr) error {
switch expr := tableExpr.Expr.(type) {
case sqlparser.TableName:
return pb.buildTablePrimitive(tableExpr, expr)
case *sqlparser.Subquery:
spb := newPrimitiveBuilder(pb.vschema, pb.jt)
switch stmt := expr.Select.(type... | [
"func",
"(",
"pb",
"*",
"primitiveBuilder",
")",
"processAliasedTable",
"(",
"tableExpr",
"*",
"sqlparser",
".",
"AliasedTableExpr",
")",
"error",
"{",
"switch",
"expr",
":=",
"tableExpr",
".",
"Expr",
".",
"(",
"type",
")",
"{",
"case",
"sqlparser",
".",
... | // processAliasedTable produces a builder subtree for the given AliasedTableExpr.
// If the expression is a subquery, then the primitive will create a table
// for it in the symtab. If the subquery is a route, then we build a route
// primitive with the subquery in the From clause, because a route is more
// versatile ... | [
"processAliasedTable",
"produces",
"a",
"builder",
"subtree",
"for",
"the",
"given",
"AliasedTableExpr",
".",
"If",
"the",
"expression",
"is",
"a",
"subquery",
"then",
"the",
"primitive",
"will",
"create",
"a",
"table",
"for",
"it",
"in",
"the",
"symtab",
".",... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/from.go#L92-L168 |
136,107 | vitessio/vitess | go/vt/vtgate/planbuilder/from.go | processJoin | func (pb *primitiveBuilder) processJoin(ajoin *sqlparser.JoinTableExpr) error {
switch ajoin.Join {
case sqlparser.JoinStr, sqlparser.StraightJoinStr, sqlparser.LeftJoinStr:
case sqlparser.RightJoinStr:
convertToLeftJoin(ajoin)
default:
return fmt.Errorf("unsupported: %s", ajoin.Join)
}
if err := pb.processTa... | go | func (pb *primitiveBuilder) processJoin(ajoin *sqlparser.JoinTableExpr) error {
switch ajoin.Join {
case sqlparser.JoinStr, sqlparser.StraightJoinStr, sqlparser.LeftJoinStr:
case sqlparser.RightJoinStr:
convertToLeftJoin(ajoin)
default:
return fmt.Errorf("unsupported: %s", ajoin.Join)
}
if err := pb.processTa... | [
"func",
"(",
"pb",
"*",
"primitiveBuilder",
")",
"processJoin",
"(",
"ajoin",
"*",
"sqlparser",
".",
"JoinTableExpr",
")",
"error",
"{",
"switch",
"ajoin",
".",
"Join",
"{",
"case",
"sqlparser",
".",
"JoinStr",
",",
"sqlparser",
".",
"StraightJoinStr",
",",
... | // processJoin produces a builder subtree for the given Join.
// If the left and right nodes can be part of the same route,
// then it's a route. Otherwise, it's a join. | [
"processJoin",
"produces",
"a",
"builder",
"subtree",
"for",
"the",
"given",
"Join",
".",
"If",
"the",
"left",
"and",
"right",
"nodes",
"can",
"be",
"part",
"of",
"the",
"same",
"route",
"then",
"it",
"s",
"a",
"route",
".",
"Otherwise",
"it",
"s",
"a"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/from.go#L254-L270 |
136,108 | vitessio/vitess | go/vt/vtgate/planbuilder/from.go | convertToLeftJoin | func convertToLeftJoin(ajoin *sqlparser.JoinTableExpr) {
newRHS := ajoin.LeftExpr
// If the LHS is a join, we have to parenthesize it.
// Otherwise, it can be used as is.
if _, ok := newRHS.(*sqlparser.JoinTableExpr); ok {
newRHS = &sqlparser.ParenTableExpr{
Exprs: sqlparser.TableExprs{newRHS},
}
}
ajoin.L... | go | func convertToLeftJoin(ajoin *sqlparser.JoinTableExpr) {
newRHS := ajoin.LeftExpr
// If the LHS is a join, we have to parenthesize it.
// Otherwise, it can be used as is.
if _, ok := newRHS.(*sqlparser.JoinTableExpr); ok {
newRHS = &sqlparser.ParenTableExpr{
Exprs: sqlparser.TableExprs{newRHS},
}
}
ajoin.L... | [
"func",
"convertToLeftJoin",
"(",
"ajoin",
"*",
"sqlparser",
".",
"JoinTableExpr",
")",
"{",
"newRHS",
":=",
"ajoin",
".",
"LeftExpr",
"\n",
"// If the LHS is a join, we have to parenthesize it.",
"// Otherwise, it can be used as is.",
"if",
"_",
",",
"ok",
":=",
"newRH... | // convertToLeftJoin converts a right join into a left join. | [
"convertToLeftJoin",
"converts",
"a",
"right",
"join",
"into",
"a",
"left",
"join",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/from.go#L273-L284 |
136,109 | vitessio/vitess | go/vt/vtgate/planbuilder/from.go | mergeRoutes | func (pb *primitiveBuilder) mergeRoutes(rpb *primitiveBuilder, routeOptions []*routeOption, ajoin *sqlparser.JoinTableExpr) error {
lRoute := pb.bldr.(*route)
rRoute := rpb.bldr.(*route)
sel := lRoute.Select.(*sqlparser.Select)
if ajoin == nil {
rhsSel := rRoute.Select.(*sqlparser.Select)
sel.From = append(sel... | go | func (pb *primitiveBuilder) mergeRoutes(rpb *primitiveBuilder, routeOptions []*routeOption, ajoin *sqlparser.JoinTableExpr) error {
lRoute := pb.bldr.(*route)
rRoute := rpb.bldr.(*route)
sel := lRoute.Select.(*sqlparser.Select)
if ajoin == nil {
rhsSel := rRoute.Select.(*sqlparser.Select)
sel.From = append(sel... | [
"func",
"(",
"pb",
"*",
"primitiveBuilder",
")",
"mergeRoutes",
"(",
"rpb",
"*",
"primitiveBuilder",
",",
"routeOptions",
"[",
"]",
"*",
"routeOption",
",",
"ajoin",
"*",
"sqlparser",
".",
"JoinTableExpr",
")",
"error",
"{",
"lRoute",
":=",
"pb",
".",
"bld... | // mergeRoutes merges the two routes. The ON clause is also analyzed to
// see if the primitive can be improved. The operation can fail if
// the expression contains a non-pushable subquery. ajoin can be nil
// if the join is on a ',' operator. | [
"mergeRoutes",
"merges",
"the",
"two",
"routes",
".",
"The",
"ON",
"clause",
"is",
"also",
"analyzed",
"to",
"see",
"if",
"the",
"primitive",
"can",
"be",
"improved",
".",
"The",
"operation",
"can",
"fail",
"if",
"the",
"expression",
"contains",
"a",
"non"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/from.go#L326-L355 |
136,110 | vitessio/vitess | go/vt/vttablet/sysloglogger/sysloglogger.go | run | func run() {
log.Info("Logging queries to syslog")
defer writer.Close()
// ch will only be non-nil in a unit test context, when a mock has been populated
if ch == nil {
ch = tabletenv.StatsLogger.Subscribe("gwslog")
defer tabletenv.StatsLogger.Unsubscribe(ch)
}
formatParams := map[string][]string{"full": {}... | go | func run() {
log.Info("Logging queries to syslog")
defer writer.Close()
// ch will only be non-nil in a unit test context, when a mock has been populated
if ch == nil {
ch = tabletenv.StatsLogger.Subscribe("gwslog")
defer tabletenv.StatsLogger.Unsubscribe(ch)
}
formatParams := map[string][]string{"full": {}... | [
"func",
"run",
"(",
")",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"defer",
"writer",
".",
"Close",
"(",
")",
"\n\n",
"// ch will only be non-nil in a unit test context, when a mock has been populated",
"if",
"ch",
"==",
"nil",
"{",
"ch",
"=",
"tabl... | // Run logs queries to syslog, if the "log_queries" flag is set to true when starting vttablet. | [
"Run",
"logs",
"queries",
"to",
"syslog",
"if",
"the",
"log_queries",
"flag",
"is",
"set",
"to",
"true",
"when",
"starting",
"vttablet",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/sysloglogger/sysloglogger.go#L60-L87 |
136,111 | vitessio/vitess | go/vt/vttablet/tabletserver/query_list.go | NewQueryDetail | func NewQueryDetail(ctx context.Context, conn killable) *QueryDetail {
return &QueryDetail{ctx: ctx, conn: conn, connID: conn.ID(), start: time.Now()}
} | go | func NewQueryDetail(ctx context.Context, conn killable) *QueryDetail {
return &QueryDetail{ctx: ctx, conn: conn, connID: conn.ID(), start: time.Now()}
} | [
"func",
"NewQueryDetail",
"(",
"ctx",
"context",
".",
"Context",
",",
"conn",
"killable",
")",
"*",
"QueryDetail",
"{",
"return",
"&",
"QueryDetail",
"{",
"ctx",
":",
"ctx",
",",
"conn",
":",
"conn",
",",
"connID",
":",
"conn",
".",
"ID",
"(",
")",
"... | // NewQueryDetail creates a new QueryDetail | [
"NewQueryDetail",
"creates",
"a",
"new",
"QueryDetail"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_list.go#L45-L47 |
136,112 | vitessio/vitess | go/vt/vttablet/tabletserver/query_list.go | Add | func (ql *QueryList) Add(qd *QueryDetail) {
ql.mu.Lock()
defer ql.mu.Unlock()
ql.queryDetails[qd.connID] = qd
} | go | func (ql *QueryList) Add(qd *QueryDetail) {
ql.mu.Lock()
defer ql.mu.Unlock()
ql.queryDetails[qd.connID] = qd
} | [
"func",
"(",
"ql",
"*",
"QueryList",
")",
"Add",
"(",
"qd",
"*",
"QueryDetail",
")",
"{",
"ql",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ql",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"ql",
".",
"queryDetails",
"[",
"qd",
".",
"connID"... | // Add adds a QueryDetail to QueryList | [
"Add",
"adds",
"a",
"QueryDetail",
"to",
"QueryList"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_list.go#L61-L65 |
136,113 | vitessio/vitess | go/vt/vttablet/tabletserver/query_list.go | Remove | func (ql *QueryList) Remove(qd *QueryDetail) {
ql.mu.Lock()
defer ql.mu.Unlock()
delete(ql.queryDetails, qd.connID)
} | go | func (ql *QueryList) Remove(qd *QueryDetail) {
ql.mu.Lock()
defer ql.mu.Unlock()
delete(ql.queryDetails, qd.connID)
} | [
"func",
"(",
"ql",
"*",
"QueryList",
")",
"Remove",
"(",
"qd",
"*",
"QueryDetail",
")",
"{",
"ql",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ql",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"delete",
"(",
"ql",
".",
"queryDetails",
",",
"... | // Remove removes a QueryDetail from QueryList | [
"Remove",
"removes",
"a",
"QueryDetail",
"from",
"QueryList"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_list.go#L68-L72 |
136,114 | vitessio/vitess | go/vt/vttablet/tabletserver/query_list.go | Terminate | func (ql *QueryList) Terminate(connID int64) error {
ql.mu.Lock()
defer ql.mu.Unlock()
qd := ql.queryDetails[connID]
if qd == nil {
return fmt.Errorf("query %v not found", connID)
}
qd.conn.Kill("QueryList.Terminate()", time.Since(qd.start))
return nil
} | go | func (ql *QueryList) Terminate(connID int64) error {
ql.mu.Lock()
defer ql.mu.Unlock()
qd := ql.queryDetails[connID]
if qd == nil {
return fmt.Errorf("query %v not found", connID)
}
qd.conn.Kill("QueryList.Terminate()", time.Since(qd.start))
return nil
} | [
"func",
"(",
"ql",
"*",
"QueryList",
")",
"Terminate",
"(",
"connID",
"int64",
")",
"error",
"{",
"ql",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ql",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"qd",
":=",
"ql",
".",
"queryDetails",
"[",
... | // Terminate updates the query status and kills the connection | [
"Terminate",
"updates",
"the",
"query",
"status",
"and",
"kills",
"the",
"connection"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_list.go#L75-L84 |
136,115 | vitessio/vitess | go/vt/vttablet/tabletserver/query_list.go | TerminateAll | func (ql *QueryList) TerminateAll() {
ql.mu.Lock()
defer ql.mu.Unlock()
for _, qd := range ql.queryDetails {
qd.conn.Kill("QueryList.TerminateAll()", time.Since(qd.start))
}
} | go | func (ql *QueryList) TerminateAll() {
ql.mu.Lock()
defer ql.mu.Unlock()
for _, qd := range ql.queryDetails {
qd.conn.Kill("QueryList.TerminateAll()", time.Since(qd.start))
}
} | [
"func",
"(",
"ql",
"*",
"QueryList",
")",
"TerminateAll",
"(",
")",
"{",
"ql",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ql",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"qd",
":=",
"range",
"ql",
".",
"queryDetails",
"{"... | // TerminateAll terminates all queries and kills the MySQL connections | [
"TerminateAll",
"terminates",
"all",
"queries",
"and",
"kills",
"the",
"MySQL",
"connections"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_list.go#L87-L93 |
136,116 | vitessio/vitess | go/vt/vttablet/tabletserver/query_list.go | GetQueryzRows | func (ql *QueryList) GetQueryzRows() []QueryDetailzRow {
ql.mu.Lock()
rows := []QueryDetailzRow{}
for _, qd := range ql.queryDetails {
row := QueryDetailzRow{
Query: qd.conn.Current(),
ContextHTML: callinfo.HTMLFromContext(qd.ctx),
Start: qd.start,
Duration: time.Since(qd.start),
Conn... | go | func (ql *QueryList) GetQueryzRows() []QueryDetailzRow {
ql.mu.Lock()
rows := []QueryDetailzRow{}
for _, qd := range ql.queryDetails {
row := QueryDetailzRow{
Query: qd.conn.Current(),
ContextHTML: callinfo.HTMLFromContext(qd.ctx),
Start: qd.start,
Duration: time.Since(qd.start),
Conn... | [
"func",
"(",
"ql",
"*",
"QueryList",
")",
"GetQueryzRows",
"(",
")",
"[",
"]",
"QueryDetailzRow",
"{",
"ql",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"rows",
":=",
"[",
"]",
"QueryDetailzRow",
"{",
"}",
"\n",
"for",
"_",
",",
"qd",
":=",
"range",
... | // GetQueryzRows returns a list of QueryDetailzRow sorted by start time | [
"GetQueryzRows",
"returns",
"a",
"list",
"of",
"QueryDetailzRow",
"sorted",
"by",
"start",
"time"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_list.go#L113-L129 |
136,117 | vitessio/vitess | go/mysql/conn.go | newConn | func newConn(conn net.Conn) *Conn {
return &Conn{
conn: conn,
closed: sync2.NewAtomicBool(false),
bufferedReader: bufio.NewReaderSize(conn, connBufferSize),
}
} | go | func newConn(conn net.Conn) *Conn {
return &Conn{
conn: conn,
closed: sync2.NewAtomicBool(false),
bufferedReader: bufio.NewReaderSize(conn, connBufferSize),
}
} | [
"func",
"newConn",
"(",
"conn",
"net",
".",
"Conn",
")",
"*",
"Conn",
"{",
"return",
"&",
"Conn",
"{",
"conn",
":",
"conn",
",",
"closed",
":",
"sync2",
".",
"NewAtomicBool",
"(",
"false",
")",
",",
"bufferedReader",
":",
"bufio",
".",
"NewReaderSize",... | // newConn is an internal method to create a Conn. Used by client and server
// side for common creation code. | [
"newConn",
"is",
"an",
"internal",
"method",
"to",
"create",
"a",
"Conn",
".",
"Used",
"by",
"client",
"and",
"server",
"side",
"for",
"common",
"creation",
"code",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L168-L174 |
136,118 | vitessio/vitess | go/mysql/conn.go | newServerConn | func newServerConn(conn net.Conn, listener *Listener) *Conn {
c := &Conn{
conn: conn,
listener: listener,
closed: sync2.NewAtomicBool(false),
}
if listener.connReadBufferSize > 0 {
c.bufferedReader = bufio.NewReaderSize(conn, listener.connReadBufferSize)
}
return c
} | go | func newServerConn(conn net.Conn, listener *Listener) *Conn {
c := &Conn{
conn: conn,
listener: listener,
closed: sync2.NewAtomicBool(false),
}
if listener.connReadBufferSize > 0 {
c.bufferedReader = bufio.NewReaderSize(conn, listener.connReadBufferSize)
}
return c
} | [
"func",
"newServerConn",
"(",
"conn",
"net",
".",
"Conn",
",",
"listener",
"*",
"Listener",
")",
"*",
"Conn",
"{",
"c",
":=",
"&",
"Conn",
"{",
"conn",
":",
"conn",
",",
"listener",
":",
"listener",
",",
"closed",
":",
"sync2",
".",
"NewAtomicBool",
... | // newServerConn should be used to create server connections.
//
// It stashes a reference to the listener to be able to determine if
// the server is shutting down, and has the ability to control buffer
// size for reads. | [
"newServerConn",
"should",
"be",
"used",
"to",
"create",
"server",
"connections",
".",
"It",
"stashes",
"a",
"reference",
"to",
"the",
"listener",
"to",
"be",
"able",
"to",
"determine",
"if",
"the",
"server",
"is",
"shutting",
"down",
"and",
"has",
"the",
... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L181-L191 |
136,119 | vitessio/vitess | go/mysql/conn.go | startWriterBuffering | func (c *Conn) startWriterBuffering() {
c.bufferedWriter = writersPool.Get().(*bufio.Writer)
c.bufferedWriter.Reset(c.conn)
} | go | func (c *Conn) startWriterBuffering() {
c.bufferedWriter = writersPool.Get().(*bufio.Writer)
c.bufferedWriter.Reset(c.conn)
} | [
"func",
"(",
"c",
"*",
"Conn",
")",
"startWriterBuffering",
"(",
")",
"{",
"c",
".",
"bufferedWriter",
"=",
"writersPool",
".",
"Get",
"(",
")",
".",
"(",
"*",
"bufio",
".",
"Writer",
")",
"\n",
"c",
".",
"bufferedWriter",
".",
"Reset",
"(",
"c",
"... | // startWriterBuffering starts using buffered writes. This should
// be terminated by a call to flush. | [
"startWriterBuffering",
"starts",
"using",
"buffered",
"writes",
".",
"This",
"should",
"be",
"terminated",
"by",
"a",
"call",
"to",
"flush",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L195-L198 |
136,120 | vitessio/vitess | go/mysql/conn.go | flush | func (c *Conn) flush() error {
if c.bufferedWriter == nil {
return nil
}
defer func() {
c.bufferedWriter.Reset(nil)
writersPool.Put(c.bufferedWriter)
c.bufferedWriter = nil
}()
return c.bufferedWriter.Flush()
} | go | func (c *Conn) flush() error {
if c.bufferedWriter == nil {
return nil
}
defer func() {
c.bufferedWriter.Reset(nil)
writersPool.Put(c.bufferedWriter)
c.bufferedWriter = nil
}()
return c.bufferedWriter.Flush()
} | [
"func",
"(",
"c",
"*",
"Conn",
")",
"flush",
"(",
")",
"error",
"{",
"if",
"c",
".",
"bufferedWriter",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"defer",
"func",
"(",
")",
"{",
"c",
".",
"bufferedWriter",
".",
"Reset",
"(",
"nil",
")"... | // flush flushes the written data to the socket.
// This must be called to terminate startBuffering. | [
"flush",
"flushes",
"the",
"written",
"data",
"to",
"the",
"socket",
".",
"This",
"must",
"be",
"called",
"to",
"terminate",
"startBuffering",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L202-L214 |
136,121 | vitessio/vitess | go/mysql/conn.go | getWriter | func (c *Conn) getWriter() io.Writer {
if c.bufferedWriter != nil {
return c.bufferedWriter
}
return c.conn
} | go | func (c *Conn) getWriter() io.Writer {
if c.bufferedWriter != nil {
return c.bufferedWriter
}
return c.conn
} | [
"func",
"(",
"c",
"*",
"Conn",
")",
"getWriter",
"(",
")",
"io",
".",
"Writer",
"{",
"if",
"c",
".",
"bufferedWriter",
"!=",
"nil",
"{",
"return",
"c",
".",
"bufferedWriter",
"\n",
"}",
"\n",
"return",
"c",
".",
"conn",
"\n",
"}"
] | // getWriter returns the current writer. It may be either
// the original connection or a wrapper. | [
"getWriter",
"returns",
"the",
"current",
"writer",
".",
"It",
"may",
"be",
"either",
"the",
"original",
"connection",
"or",
"a",
"wrapper",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L218-L223 |
136,122 | vitessio/vitess | go/mysql/conn.go | readEphemeralPacket | func (c *Conn) readEphemeralPacket() ([]byte, error) {
if c.currentEphemeralPolicy != ephemeralUnused {
panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "readEphemeralPacket: unexpected currentEphemeralPolicy: %v", c.currentEphemeralPolicy))
}
r := c.getReader()
length, err := c.readHeaderFrom(r)
if err != nil {
r... | go | func (c *Conn) readEphemeralPacket() ([]byte, error) {
if c.currentEphemeralPolicy != ephemeralUnused {
panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "readEphemeralPacket: unexpected currentEphemeralPolicy: %v", c.currentEphemeralPolicy))
}
r := c.getReader()
length, err := c.readHeaderFrom(r)
if err != nil {
r... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"readEphemeralPacket",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"c",
".",
"currentEphemeralPolicy",
"!=",
"ephemeralUnused",
"{",
"panic",
"(",
"vterrors",
".",
"Errorf",
"(",
"vtrpc",
".",
"Cod... | // readEphemeralPacket attempts to read a packet into buffer from sync.Pool. Do
// not use this method if the contents of the packet needs to be kept
// after the next readEphemeralPacket.
//
// Note if the connection is closed already, an error will be
// returned, and it may not be io.EOF. If the connection closes w... | [
"readEphemeralPacket",
"attempts",
"to",
"read",
"a",
"packet",
"into",
"buffer",
"from",
"sync",
".",
"Pool",
".",
"Do",
"not",
"use",
"this",
"method",
"if",
"the",
"contents",
"of",
"the",
"packet",
"needs",
"to",
"be",
"kept",
"after",
"the",
"next",
... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L273-L326 |
136,123 | vitessio/vitess | go/mysql/conn.go | readEphemeralPacketDirect | func (c *Conn) readEphemeralPacketDirect() ([]byte, error) {
if c.currentEphemeralPolicy != ephemeralUnused {
panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "readEphemeralPacketDirect: unexpected currentEphemeralPolicy: %v", c.currentEphemeralPolicy))
}
var r io.Reader = c.conn
length, err := c.readHeaderFrom(r)
i... | go | func (c *Conn) readEphemeralPacketDirect() ([]byte, error) {
if c.currentEphemeralPolicy != ephemeralUnused {
panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "readEphemeralPacketDirect: unexpected currentEphemeralPolicy: %v", c.currentEphemeralPolicy))
}
var r io.Reader = c.conn
length, err := c.readHeaderFrom(r)
i... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"readEphemeralPacketDirect",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"c",
".",
"currentEphemeralPolicy",
"!=",
"ephemeralUnused",
"{",
"panic",
"(",
"vterrors",
".",
"Errorf",
"(",
"vtrpc",
".",
... | // readEphemeralPacketDirect attempts to read a packet from the socket directly.
// It needs to be used for the first handshake packet the server receives,
// so we do't buffer the SSL negotiation packet. As a shortcut, only
// packets smaller than MaxPacketSize can be read here.
// This function usually shouldn't be u... | [
"readEphemeralPacketDirect",
"attempts",
"to",
"read",
"a",
"packet",
"from",
"the",
"socket",
"directly",
".",
"It",
"needs",
"to",
"be",
"used",
"for",
"the",
"first",
"handshake",
"packet",
"the",
"server",
"receives",
"so",
"we",
"do",
"t",
"buffer",
"th... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L333-L361 |
136,124 | vitessio/vitess | go/mysql/conn.go | recycleReadPacket | func (c *Conn) recycleReadPacket() {
if c.currentEphemeralPolicy != ephemeralRead {
// Programming error.
panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "trying to call recycleReadPacket while currentEphemeralPolicy is %d", c.currentEphemeralPolicy))
}
if c.currentEphemeralBuffer != nil {
// We are using the pool,... | go | func (c *Conn) recycleReadPacket() {
if c.currentEphemeralPolicy != ephemeralRead {
// Programming error.
panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "trying to call recycleReadPacket while currentEphemeralPolicy is %d", c.currentEphemeralPolicy))
}
if c.currentEphemeralBuffer != nil {
// We are using the pool,... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"recycleReadPacket",
"(",
")",
"{",
"if",
"c",
".",
"currentEphemeralPolicy",
"!=",
"ephemeralRead",
"{",
"// Programming error.",
"panic",
"(",
"vterrors",
".",
"Errorf",
"(",
"vtrpc",
".",
"Code_INTERNAL",
",",
"\"",
"\"... | // recycleReadPacket recycles the read packet. It needs to be called
// after readEphemeralPacket was called. | [
"recycleReadPacket",
"recycles",
"the",
"read",
"packet",
".",
"It",
"needs",
"to",
"be",
"called",
"after",
"readEphemeralPacket",
"was",
"called",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L365-L376 |
136,125 | vitessio/vitess | go/mysql/conn.go | readOnePacket | func (c *Conn) readOnePacket() ([]byte, error) {
r := c.getReader()
length, err := c.readHeaderFrom(r)
if err != nil {
return nil, err
}
if length == 0 {
// This can be caused by the packet after a packet of
// exactly size MaxPacketSize.
return nil, nil
}
data := make([]byte, length)
if _, err := io.R... | go | func (c *Conn) readOnePacket() ([]byte, error) {
r := c.getReader()
length, err := c.readHeaderFrom(r)
if err != nil {
return nil, err
}
if length == 0 {
// This can be caused by the packet after a packet of
// exactly size MaxPacketSize.
return nil, nil
}
data := make([]byte, length)
if _, err := io.R... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"readOnePacket",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"r",
":=",
"c",
".",
"getReader",
"(",
")",
"\n",
"length",
",",
"err",
":=",
"c",
".",
"readHeaderFrom",
"(",
"r",
")",
"\n",
"if",
... | // readOnePacket reads a single packet into a newly allocated buffer. | [
"readOnePacket",
"reads",
"a",
"single",
"packet",
"into",
"a",
"newly",
"allocated",
"buffer",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L379-L396 |
136,126 | vitessio/vitess | go/mysql/conn.go | readPacket | func (c *Conn) readPacket() ([]byte, error) {
// Optimize for a single packet case.
data, err := c.readOnePacket()
if err != nil {
return nil, err
}
// This is a single packet.
if len(data) < MaxPacketSize {
return data, nil
}
// There is more than one packet, read them all.
for {
next, err := c.readOn... | go | func (c *Conn) readPacket() ([]byte, error) {
// Optimize for a single packet case.
data, err := c.readOnePacket()
if err != nil {
return nil, err
}
// This is a single packet.
if len(data) < MaxPacketSize {
return data, nil
}
// There is more than one packet, read them all.
for {
next, err := c.readOn... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"readPacket",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// Optimize for a single packet case.",
"data",
",",
"err",
":=",
"c",
".",
"readOnePacket",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"r... | // readPacket reads a packet from the underlying connection.
// It re-assembles packets that span more than one message.
// This method returns a generic error, not a SQLError. | [
"readPacket",
"reads",
"a",
"packet",
"from",
"the",
"underlying",
"connection",
".",
"It",
"re",
"-",
"assembles",
"packets",
"that",
"span",
"more",
"than",
"one",
"message",
".",
"This",
"method",
"returns",
"a",
"generic",
"error",
"not",
"a",
"SQLError"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L401-L432 |
136,127 | vitessio/vitess | go/mysql/conn.go | ReadPacket | func (c *Conn) ReadPacket() ([]byte, error) {
result, err := c.readPacket()
if err != nil {
return nil, NewSQLError(CRServerLost, SSUnknownSQLState, "%v", err)
}
return result, err
} | go | func (c *Conn) ReadPacket() ([]byte, error) {
result, err := c.readPacket()
if err != nil {
return nil, NewSQLError(CRServerLost, SSUnknownSQLState, "%v", err)
}
return result, err
} | [
"func",
"(",
"c",
"*",
"Conn",
")",
"ReadPacket",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"result",
",",
"err",
":=",
"c",
".",
"readPacket",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"NewSQLError",
"... | // ReadPacket reads a packet from the underlying connection.
// it is the public API version, that returns a SQLError.
// The memory for the packet is always allocated, and it is owned by the caller
// after this function returns. | [
"ReadPacket",
"reads",
"a",
"packet",
"from",
"the",
"underlying",
"connection",
".",
"it",
"is",
"the",
"public",
"API",
"version",
"that",
"returns",
"a",
"SQLError",
".",
"The",
"memory",
"for",
"the",
"packet",
"is",
"always",
"allocated",
"and",
"it",
... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L438-L444 |
136,128 | vitessio/vitess | go/mysql/conn.go | writeEphemeralPacket | func (c *Conn) writeEphemeralPacket() error {
defer c.recycleWritePacket()
switch c.currentEphemeralPolicy {
case ephemeralWrite:
if err := c.writePacket(*c.currentEphemeralBuffer); err != nil {
return vterrors.Wrapf(err, "conn %v", c.ID())
}
case ephemeralUnused, ephemeralRead:
// Programming error.
pa... | go | func (c *Conn) writeEphemeralPacket() error {
defer c.recycleWritePacket()
switch c.currentEphemeralPolicy {
case ephemeralWrite:
if err := c.writePacket(*c.currentEphemeralBuffer); err != nil {
return vterrors.Wrapf(err, "conn %v", c.ID())
}
case ephemeralUnused, ephemeralRead:
// Programming error.
pa... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"writeEphemeralPacket",
"(",
")",
"error",
"{",
"defer",
"c",
".",
"recycleWritePacket",
"(",
")",
"\n\n",
"switch",
"c",
".",
"currentEphemeralPolicy",
"{",
"case",
"ephemeralWrite",
":",
"if",
"err",
":=",
"c",
".",
... | // writeEphemeralPacket writes the packet that was allocated by
// startEphemeralPacket. | [
"writeEphemeralPacket",
"writes",
"the",
"packet",
"that",
"was",
"allocated",
"by",
"startEphemeralPacket",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L522-L536 |
136,129 | vitessio/vitess | go/mysql/conn.go | recycleWritePacket | func (c *Conn) recycleWritePacket() {
if c.currentEphemeralPolicy != ephemeralWrite {
// Programming error.
panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "trying to call recycleWritePacket while currentEphemeralPolicy is %d", c.currentEphemeralPolicy))
}
// Release our reference so the buffer can be gced
bufPool.P... | go | func (c *Conn) recycleWritePacket() {
if c.currentEphemeralPolicy != ephemeralWrite {
// Programming error.
panic(vterrors.Errorf(vtrpc.Code_INTERNAL, "trying to call recycleWritePacket while currentEphemeralPolicy is %d", c.currentEphemeralPolicy))
}
// Release our reference so the buffer can be gced
bufPool.P... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"recycleWritePacket",
"(",
")",
"{",
"if",
"c",
".",
"currentEphemeralPolicy",
"!=",
"ephemeralWrite",
"{",
"// Programming error.",
"panic",
"(",
"vterrors",
".",
"Errorf",
"(",
"vtrpc",
".",
"Code_INTERNAL",
",",
"\"",
"... | // recycleWritePacket recycles the write packet. It needs to be called
// after writeEphemeralPacket was called. | [
"recycleWritePacket",
"recycles",
"the",
"write",
"packet",
".",
"It",
"needs",
"to",
"be",
"called",
"after",
"writeEphemeralPacket",
"was",
"called",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L540-L549 |
136,130 | vitessio/vitess | go/mysql/conn.go | String | func (c *Conn) String() string {
return fmt.Sprintf("client %v (%s)", c.ConnectionID, c.RemoteAddr().String())
} | go | func (c *Conn) String() string {
return fmt.Sprintf("client %v (%s)", c.ConnectionID, c.RemoteAddr().String())
} | [
"func",
"(",
"c",
"*",
"Conn",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"ConnectionID",
",",
"c",
".",
"RemoteAddr",
"(",
")",
".",
"String",
"(",
")",
")",
"\n",
"}"
] | // Ident returns a useful identification string for error logging | [
"Ident",
"returns",
"a",
"useful",
"identification",
"string",
"for",
"error",
"logging"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L578-L580 |
136,131 | vitessio/vitess | go/mysql/conn.go | Close | func (c *Conn) Close() {
if c.closed.CompareAndSwap(false, true) {
c.conn.Close()
}
} | go | func (c *Conn) Close() {
if c.closed.CompareAndSwap(false, true) {
c.conn.Close()
}
} | [
"func",
"(",
"c",
"*",
"Conn",
")",
"Close",
"(",
")",
"{",
"if",
"c",
".",
"closed",
".",
"CompareAndSwap",
"(",
"false",
",",
"true",
")",
"{",
"c",
".",
"conn",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"}"
] | // Close closes the connection. It can be called from a different go
// routine to interrupt the current connection. | [
"Close",
"closes",
"the",
"connection",
".",
"It",
"can",
"be",
"called",
"from",
"a",
"different",
"go",
"routine",
"to",
"interrupt",
"the",
"current",
"connection",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L584-L588 |
136,132 | vitessio/vitess | go/mysql/conn.go | writeOKPacket | func (c *Conn) writeOKPacket(affectedRows, lastInsertID uint64, flags uint16, warnings uint16) error {
length := 1 + // OKPacket
lenEncIntSize(affectedRows) +
lenEncIntSize(lastInsertID) +
2 + // flags
2 // warnings
data := c.startEphemeralPacket(length)
pos := 0
pos = writeByte(data, pos, OKPacket)
pos = ... | go | func (c *Conn) writeOKPacket(affectedRows, lastInsertID uint64, flags uint16, warnings uint16) error {
length := 1 + // OKPacket
lenEncIntSize(affectedRows) +
lenEncIntSize(lastInsertID) +
2 + // flags
2 // warnings
data := c.startEphemeralPacket(length)
pos := 0
pos = writeByte(data, pos, OKPacket)
pos = ... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"writeOKPacket",
"(",
"affectedRows",
",",
"lastInsertID",
"uint64",
",",
"flags",
"uint16",
",",
"warnings",
"uint16",
")",
"error",
"{",
"length",
":=",
"1",
"+",
"// OKPacket",
"lenEncIntSize",
"(",
"affectedRows",
")",... | //
// Packet writing methods, for generic packets.
//
// writeOKPacket writes an OK packet.
// Server -> Client.
// This method returns a generic error, not a SQLError. | [
"Packet",
"writing",
"methods",
"for",
"generic",
"packets",
".",
"writeOKPacket",
"writes",
"an",
"OK",
"packet",
".",
"Server",
"-",
">",
"Client",
".",
"This",
"method",
"returns",
"a",
"generic",
"error",
"not",
"a",
"SQLError",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L604-L619 |
136,133 | vitessio/vitess | go/mysql/conn.go | writeErrorPacket | func (c *Conn) writeErrorPacket(errorCode uint16, sqlState string, format string, args ...interface{}) error {
errorMessage := fmt.Sprintf(format, args...)
length := 1 + 2 + 1 + 5 + len(errorMessage)
data := c.startEphemeralPacket(length)
pos := 0
pos = writeByte(data, pos, ErrPacket)
pos = writeUint16(data, pos,... | go | func (c *Conn) writeErrorPacket(errorCode uint16, sqlState string, format string, args ...interface{}) error {
errorMessage := fmt.Sprintf(format, args...)
length := 1 + 2 + 1 + 5 + len(errorMessage)
data := c.startEphemeralPacket(length)
pos := 0
pos = writeByte(data, pos, ErrPacket)
pos = writeUint16(data, pos,... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"writeErrorPacket",
"(",
"errorCode",
"uint16",
",",
"sqlState",
"string",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"errorMessage",
":=",
"fmt",
".",
"Sprintf",
"(",
"forma... | // writeErrorPacket writes an error packet.
// Server -> Client.
// This method returns a generic error, not a SQLError. | [
"writeErrorPacket",
"writes",
"an",
"error",
"packet",
".",
"Server",
"-",
">",
"Client",
".",
"This",
"method",
"returns",
"a",
"generic",
"error",
"not",
"a",
"SQLError",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L646-L664 |
136,134 | vitessio/vitess | go/mysql/conn.go | writeErrorPacketFromError | func (c *Conn) writeErrorPacketFromError(err error) error {
if se, ok := err.(*SQLError); ok {
return c.writeErrorPacket(uint16(se.Num), se.State, "%v", se.Message)
}
return c.writeErrorPacket(ERUnknownError, SSUnknownSQLState, "unknown error: %v", err)
} | go | func (c *Conn) writeErrorPacketFromError(err error) error {
if se, ok := err.(*SQLError); ok {
return c.writeErrorPacket(uint16(se.Num), se.State, "%v", se.Message)
}
return c.writeErrorPacket(ERUnknownError, SSUnknownSQLState, "unknown error: %v", err)
} | [
"func",
"(",
"c",
"*",
"Conn",
")",
"writeErrorPacketFromError",
"(",
"err",
"error",
")",
"error",
"{",
"if",
"se",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"SQLError",
")",
";",
"ok",
"{",
"return",
"c",
".",
"writeErrorPacket",
"(",
"uint16",
"(",
... | // writeErrorPacketFromError writes an error packet, from a regular error.
// See writeErrorPacket for other info. | [
"writeErrorPacketFromError",
"writes",
"an",
"error",
"packet",
"from",
"a",
"regular",
"error",
".",
"See",
"writeErrorPacket",
"for",
"other",
"info",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L668-L674 |
136,135 | vitessio/vitess | go/mysql/conn.go | ParseErrorPacket | func ParseErrorPacket(data []byte) error {
// We already read the type.
pos := 1
// Error code is 2 bytes.
code, pos, ok := readUint16(data, pos)
if !ok {
return NewSQLError(CRUnknownError, SSUnknownSQLState, "invalid error packet code: %v", data)
}
// '#' marker of the SQL state is 1 byte. Ignored.
pos++
... | go | func ParseErrorPacket(data []byte) error {
// We already read the type.
pos := 1
// Error code is 2 bytes.
code, pos, ok := readUint16(data, pos)
if !ok {
return NewSQLError(CRUnknownError, SSUnknownSQLState, "invalid error packet code: %v", data)
}
// '#' marker of the SQL state is 1 byte. Ignored.
pos++
... | [
"func",
"ParseErrorPacket",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"// We already read the type.",
"pos",
":=",
"1",
"\n\n",
"// Error code is 2 bytes.",
"code",
",",
"pos",
",",
"ok",
":=",
"readUint16",
"(",
"data",
",",
"pos",
")",
"\n",
"if",
... | // ParseErrorPacket parses the error packet and returns a SQLError. | [
"ParseErrorPacket",
"parses",
"the",
"error",
"packet",
"and",
"returns",
"a",
"SQLError",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/conn.go#L963-L986 |
136,136 | vitessio/vitess | go/mysql/query.go | readColumnDefinitionType | func (c *Conn) readColumnDefinitionType(field *querypb.Field, index int) error {
colDef, err := c.readEphemeralPacket()
if err != nil {
return NewSQLError(CRServerLost, SSUnknownSQLState, "%v", err)
}
defer c.recycleReadPacket()
// catalog, schema, table, orgTable, name and orgName are
// strings, all skipped.... | go | func (c *Conn) readColumnDefinitionType(field *querypb.Field, index int) error {
colDef, err := c.readEphemeralPacket()
if err != nil {
return NewSQLError(CRServerLost, SSUnknownSQLState, "%v", err)
}
defer c.recycleReadPacket()
// catalog, schema, table, orgTable, name and orgName are
// strings, all skipped.... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"readColumnDefinitionType",
"(",
"field",
"*",
"querypb",
".",
"Field",
",",
"index",
"int",
")",
"error",
"{",
"colDef",
",",
"err",
":=",
"c",
".",
"readEphemeralPacket",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // readColumnDefinitionType is a faster version of
// readColumnDefinition that only fills in the Type.
// Returns a SQLError. | [
"readColumnDefinitionType",
"is",
"a",
"faster",
"version",
"of",
"readColumnDefinition",
"that",
"only",
"fills",
"in",
"the",
"Type",
".",
"Returns",
"a",
"SQLError",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/query.go#L175-L245 |
136,137 | vitessio/vitess | go/mysql/query.go | parseRow | func (c *Conn) parseRow(data []byte, fields []*querypb.Field) ([]sqltypes.Value, error) {
colNumber := len(fields)
result := make([]sqltypes.Value, colNumber)
pos := 0
for i := 0; i < colNumber; i++ {
if data[pos] == 0xfb {
pos++
continue
}
var s []byte
var ok bool
s, pos, ok = readLenEncStringAsByt... | go | func (c *Conn) parseRow(data []byte, fields []*querypb.Field) ([]sqltypes.Value, error) {
colNumber := len(fields)
result := make([]sqltypes.Value, colNumber)
pos := 0
for i := 0; i < colNumber; i++ {
if data[pos] == 0xfb {
pos++
continue
}
var s []byte
var ok bool
s, pos, ok = readLenEncStringAsByt... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"parseRow",
"(",
"data",
"[",
"]",
"byte",
",",
"fields",
"[",
"]",
"*",
"querypb",
".",
"Field",
")",
"(",
"[",
"]",
"sqltypes",
".",
"Value",
",",
"error",
")",
"{",
"colNumber",
":=",
"len",
"(",
"fields",
... | // parseRow parses an individual row.
// Returns a SQLError. | [
"parseRow",
"parses",
"an",
"individual",
"row",
".",
"Returns",
"a",
"SQLError",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/query.go#L249-L267 |
136,138 | vitessio/vitess | go/mysql/query.go | ExecuteFetchMulti | func (c *Conn) ExecuteFetchMulti(query string, maxrows int, wantfields bool) (result *sqltypes.Result, more bool, err error) {
defer func() {
if err != nil {
if sqlerr, ok := err.(*SQLError); ok {
sqlerr.Query = query
}
}
}()
// Send the query as a COM_QUERY packet.
if err = c.WriteComQuery(query); e... | go | func (c *Conn) ExecuteFetchMulti(query string, maxrows int, wantfields bool) (result *sqltypes.Result, more bool, err error) {
defer func() {
if err != nil {
if sqlerr, ok := err.(*SQLError); ok {
sqlerr.Query = query
}
}
}()
// Send the query as a COM_QUERY packet.
if err = c.WriteComQuery(query); e... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"ExecuteFetchMulti",
"(",
"query",
"string",
",",
"maxrows",
"int",
",",
"wantfields",
"bool",
")",
"(",
"result",
"*",
"sqltypes",
".",
"Result",
",",
"more",
"bool",
",",
"err",
"error",
")",
"{",
"defer",
"func",
... | // ExecuteFetchMulti is for fetching multiple results from a multi-statement result.
// It returns an additional 'more' flag. If it is set, you must fetch the additional
// results using ReadQueryResult. | [
"ExecuteFetchMulti",
"is",
"for",
"fetching",
"multiple",
"results",
"from",
"a",
"multi",
"-",
"statement",
"result",
".",
"It",
"returns",
"an",
"additional",
"more",
"flag",
".",
"If",
"it",
"is",
"set",
"you",
"must",
"fetch",
"the",
"additional",
"resul... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/query.go#L300-L316 |
136,139 | vitessio/vitess | go/mysql/query.go | drainResults | func (c *Conn) drainResults() error {
for {
data, err := c.readEphemeralPacket()
if err != nil {
return NewSQLError(CRServerLost, SSUnknownSQLState, "%v", err)
}
if isEOFPacket(data) {
c.recycleReadPacket()
return nil
} else if isErrorPacket(data) {
defer c.recycleReadPacket()
return ParseErro... | go | func (c *Conn) drainResults() error {
for {
data, err := c.readEphemeralPacket()
if err != nil {
return NewSQLError(CRServerLost, SSUnknownSQLState, "%v", err)
}
if isEOFPacket(data) {
c.recycleReadPacket()
return nil
} else if isErrorPacket(data) {
defer c.recycleReadPacket()
return ParseErro... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"drainResults",
"(",
")",
"error",
"{",
"for",
"{",
"data",
",",
"err",
":=",
"c",
".",
"readEphemeralPacket",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NewSQLError",
"(",
"CRServerLost",
",",
"SSUn... | // drainResults will read all packets for a result set and ignore them. | [
"drainResults",
"will",
"read",
"all",
"packets",
"for",
"a",
"result",
"set",
"and",
"ignore",
"them",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/query.go#L452-L467 |
136,140 | vitessio/vitess | go/mysql/query.go | writeFields | func (c *Conn) writeFields(result *sqltypes.Result) error {
// Send the number of fields first.
if err := c.sendColumnCount(uint64(len(result.Fields))); err != nil {
return err
}
// Now send each Field.
for _, field := range result.Fields {
if err := c.writeColumnDefinition(field); err != nil {
return err
... | go | func (c *Conn) writeFields(result *sqltypes.Result) error {
// Send the number of fields first.
if err := c.sendColumnCount(uint64(len(result.Fields))); err != nil {
return err
}
// Now send each Field.
for _, field := range result.Fields {
if err := c.writeColumnDefinition(field); err != nil {
return err
... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"writeFields",
"(",
"result",
"*",
"sqltypes",
".",
"Result",
")",
"error",
"{",
"// Send the number of fields first.",
"if",
"err",
":=",
"c",
".",
"sendColumnCount",
"(",
"uint64",
"(",
"len",
"(",
"result",
".",
"Fiel... | // writeFields writes the fields of a Result. It should be called only
// if there are valid columns in the result. | [
"writeFields",
"writes",
"the",
"fields",
"of",
"a",
"Result",
".",
"It",
"should",
"be",
"called",
"only",
"if",
"there",
"are",
"valid",
"columns",
"in",
"the",
"result",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/query.go#L603-L624 |
136,141 | vitessio/vitess | go/mysql/query.go | writeRows | func (c *Conn) writeRows(result *sqltypes.Result) error {
for _, row := range result.Rows {
if err := c.writeRow(row); err != nil {
return err
}
}
return nil
} | go | func (c *Conn) writeRows(result *sqltypes.Result) error {
for _, row := range result.Rows {
if err := c.writeRow(row); err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"c",
"*",
"Conn",
")",
"writeRows",
"(",
"result",
"*",
"sqltypes",
".",
"Result",
")",
"error",
"{",
"for",
"_",
",",
"row",
":=",
"range",
"result",
".",
"Rows",
"{",
"if",
"err",
":=",
"c",
".",
"writeRow",
"(",
"row",
")",
";",
... | // writeRows sends the rows of a Result. | [
"writeRows",
"sends",
"the",
"rows",
"of",
"a",
"Result",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/query.go#L627-L634 |
136,142 | vitessio/vitess | go/mysql/query.go | writeEndResult | func (c *Conn) writeEndResult(more bool, affectedRows, lastInsertID uint64, warnings uint16) error {
// Send either an EOF, or an OK packet.
// See doc.go.
flags := c.StatusFlags
if more {
flags |= ServerMoreResultsExists
}
if c.Capabilities&CapabilityClientDeprecateEOF == 0 {
if err := c.writeEOFPacket(flags... | go | func (c *Conn) writeEndResult(more bool, affectedRows, lastInsertID uint64, warnings uint16) error {
// Send either an EOF, or an OK packet.
// See doc.go.
flags := c.StatusFlags
if more {
flags |= ServerMoreResultsExists
}
if c.Capabilities&CapabilityClientDeprecateEOF == 0 {
if err := c.writeEOFPacket(flags... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"writeEndResult",
"(",
"more",
"bool",
",",
"affectedRows",
",",
"lastInsertID",
"uint64",
",",
"warnings",
"uint16",
")",
"error",
"{",
"// Send either an EOF, or an OK packet.",
"// See doc.go.",
"flags",
":=",
"c",
".",
"St... | // writeEndResult concludes the sending of a Result.
// if more is set to true, then it means there are more results afterwords | [
"writeEndResult",
"concludes",
"the",
"sending",
"of",
"a",
"Result",
".",
"if",
"more",
"is",
"set",
"to",
"true",
"then",
"it",
"means",
"there",
"are",
"more",
"results",
"afterwords"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/query.go#L638-L657 |
136,143 | vitessio/vitess | go/vt/sqlparser/parsed_query.go | NewParsedQuery | func NewParsedQuery(node SQLNode) *ParsedQuery {
buf := NewTrackedBuffer(nil)
buf.Myprintf("%v", node)
return buf.ParsedQuery()
} | go | func NewParsedQuery(node SQLNode) *ParsedQuery {
buf := NewTrackedBuffer(nil)
buf.Myprintf("%v", node)
return buf.ParsedQuery()
} | [
"func",
"NewParsedQuery",
"(",
"node",
"SQLNode",
")",
"*",
"ParsedQuery",
"{",
"buf",
":=",
"NewTrackedBuffer",
"(",
"nil",
")",
"\n",
"buf",
".",
"Myprintf",
"(",
"\"",
"\"",
",",
"node",
")",
"\n",
"return",
"buf",
".",
"ParsedQuery",
"(",
")",
"\n"... | // NewParsedQuery returns a ParsedQuery of the ast. | [
"NewParsedQuery",
"returns",
"a",
"ParsedQuery",
"of",
"the",
"ast",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/parsed_query.go#L41-L45 |
136,144 | vitessio/vitess | go/vt/sqlparser/parsed_query.go | GenerateQuery | func (pq *ParsedQuery) GenerateQuery(bindVariables map[string]*querypb.BindVariable, extras map[string]Encodable) (string, error) {
if len(pq.bindLocations) == 0 {
return pq.Query, nil
}
var buf strings.Builder
buf.Grow(len(pq.Query))
if err := pq.Append(&buf, bindVariables, extras); err != nil {
return "", er... | go | func (pq *ParsedQuery) GenerateQuery(bindVariables map[string]*querypb.BindVariable, extras map[string]Encodable) (string, error) {
if len(pq.bindLocations) == 0 {
return pq.Query, nil
}
var buf strings.Builder
buf.Grow(len(pq.Query))
if err := pq.Append(&buf, bindVariables, extras); err != nil {
return "", er... | [
"func",
"(",
"pq",
"*",
"ParsedQuery",
")",
"GenerateQuery",
"(",
"bindVariables",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
",",
"extras",
"map",
"[",
"string",
"]",
"Encodable",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
... | // GenerateQuery generates a query by substituting the specified
// bindVariables. The extras parameter specifies special parameters
// that can perform custom encoding. | [
"GenerateQuery",
"generates",
"a",
"query",
"by",
"substituting",
"the",
"specified",
"bindVariables",
".",
"The",
"extras",
"parameter",
"specifies",
"special",
"parameters",
"that",
"can",
"perform",
"custom",
"encoding",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/parsed_query.go#L50-L60 |
136,145 | vitessio/vitess | go/vt/sqlparser/parsed_query.go | Append | func (pq *ParsedQuery) Append(buf *strings.Builder, bindVariables map[string]*querypb.BindVariable, extras map[string]Encodable) error {
current := 0
for _, loc := range pq.bindLocations {
buf.WriteString(pq.Query[current:loc.offset])
name := pq.Query[loc.offset : loc.offset+loc.length]
if encodable, ok := extr... | go | func (pq *ParsedQuery) Append(buf *strings.Builder, bindVariables map[string]*querypb.BindVariable, extras map[string]Encodable) error {
current := 0
for _, loc := range pq.bindLocations {
buf.WriteString(pq.Query[current:loc.offset])
name := pq.Query[loc.offset : loc.offset+loc.length]
if encodable, ok := extr... | [
"func",
"(",
"pq",
"*",
"ParsedQuery",
")",
"Append",
"(",
"buf",
"*",
"strings",
".",
"Builder",
",",
"bindVariables",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
",",
"extras",
"map",
"[",
"string",
"]",
"Encodable",
")",
"error",
... | // Append appends the generated query to the provided buffer. | [
"Append",
"appends",
"the",
"generated",
"query",
"to",
"the",
"provided",
"buffer",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/parsed_query.go#L63-L81 |
136,146 | vitessio/vitess | go/vt/sqlparser/parsed_query.go | MarshalJSON | func (pq *ParsedQuery) MarshalJSON() ([]byte, error) {
return json.Marshal(TruncateForUI(pq.Query))
} | go | func (pq *ParsedQuery) MarshalJSON() ([]byte, error) {
return json.Marshal(TruncateForUI(pq.Query))
} | [
"func",
"(",
"pq",
"*",
"ParsedQuery",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"json",
".",
"Marshal",
"(",
"TruncateForUI",
"(",
"pq",
".",
"Query",
")",
")",
"\n",
"}"
] | // MarshalJSON is a custom JSON marshaler for ParsedQuery.
// Note that any queries longer that 512 bytes will be truncated. | [
"MarshalJSON",
"is",
"a",
"custom",
"JSON",
"marshaler",
"for",
"ParsedQuery",
".",
"Note",
"that",
"any",
"queries",
"longer",
"that",
"512",
"bytes",
"will",
"be",
"truncated",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/parsed_query.go#L85-L87 |
136,147 | vitessio/vitess | go/vt/sqlparser/parsed_query.go | FetchBindVar | func FetchBindVar(name string, bindVariables map[string]*querypb.BindVariable) (val *querypb.BindVariable, isList bool, err error) {
name = name[1:]
if name[0] == ':' {
name = name[1:]
isList = true
}
supplied, ok := bindVariables[name]
if !ok {
return nil, false, fmt.Errorf("missing bind var %s", name)
}
... | go | func FetchBindVar(name string, bindVariables map[string]*querypb.BindVariable) (val *querypb.BindVariable, isList bool, err error) {
name = name[1:]
if name[0] == ':' {
name = name[1:]
isList = true
}
supplied, ok := bindVariables[name]
if !ok {
return nil, false, fmt.Errorf("missing bind var %s", name)
}
... | [
"func",
"FetchBindVar",
"(",
"name",
"string",
",",
"bindVariables",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
")",
"(",
"val",
"*",
"querypb",
".",
"BindVariable",
",",
"isList",
"bool",
",",
"err",
"error",
")",
"{",
"name",
"=",
... | // FetchBindVar resolves the bind variable by fetching it from bindVariables. | [
"FetchBindVar",
"resolves",
"the",
"bind",
"variable",
"by",
"fetching",
"it",
"from",
"bindVariables",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/parsed_query.go#L110-L136 |
136,148 | vitessio/vitess | go/vt/concurrency/error_recorder.go | Error | func (fer *FirstErrorRecorder) Error() error {
fer.mu.Lock()
defer fer.mu.Unlock()
return fer.firstError
} | go | func (fer *FirstErrorRecorder) Error() error {
fer.mu.Lock()
defer fer.mu.Unlock()
return fer.firstError
} | [
"func",
"(",
"fer",
"*",
"FirstErrorRecorder",
")",
"Error",
"(",
")",
"error",
"{",
"fer",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"fer",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"fer",
".",
"firstError",
"\n",
"}"
] | // Error returns the first error we saw, or nil | [
"Error",
"returns",
"the",
"first",
"error",
"we",
"saw",
"or",
"nil"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/concurrency/error_recorder.go#L70-L74 |
136,149 | vitessio/vitess | go/vt/concurrency/error_recorder.go | AggrError | func (aer *AllErrorRecorder) AggrError(aggr AllErrorAggregator) error {
aer.mu.Lock()
defer aer.mu.Unlock()
if len(aer.Errors) == 0 {
return nil
}
return aggr(aer.Errors)
} | go | func (aer *AllErrorRecorder) AggrError(aggr AllErrorAggregator) error {
aer.mu.Lock()
defer aer.mu.Unlock()
if len(aer.Errors) == 0 {
return nil
}
return aggr(aer.Errors)
} | [
"func",
"(",
"aer",
"*",
"AllErrorRecorder",
")",
"AggrError",
"(",
"aggr",
"AllErrorAggregator",
")",
"error",
"{",
"aer",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"aer",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"len",
"(",
"aer",
"... | // AggrError runs the provided aggregator over all errors
// and returns the error from aggregator. | [
"AggrError",
"runs",
"the",
"provided",
"aggregator",
"over",
"all",
"errors",
"and",
"returns",
"the",
"error",
"from",
"aggregator",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/concurrency/error_recorder.go#L105-L112 |
136,150 | vitessio/vitess | go/vt/concurrency/error_recorder.go | Error | func (aer *AllErrorRecorder) Error() error {
return aer.AggrError(func(errors []error) error {
errs := make([]string, 0, len(errors))
for _, e := range errors {
errs = append(errs, e.Error())
}
return fmt.Errorf("%v", strings.Join(errs, ";"))
})
} | go | func (aer *AllErrorRecorder) Error() error {
return aer.AggrError(func(errors []error) error {
errs := make([]string, 0, len(errors))
for _, e := range errors {
errs = append(errs, e.Error())
}
return fmt.Errorf("%v", strings.Join(errs, ";"))
})
} | [
"func",
"(",
"aer",
"*",
"AllErrorRecorder",
")",
"Error",
"(",
")",
"error",
"{",
"return",
"aer",
".",
"AggrError",
"(",
"func",
"(",
"errors",
"[",
"]",
"error",
")",
"error",
"{",
"errs",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
... | // Error returns an aggregate of all errors by concatenation. | [
"Error",
"returns",
"an",
"aggregate",
"of",
"all",
"errors",
"by",
"concatenation",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/concurrency/error_recorder.go#L115-L123 |
136,151 | vitessio/vitess | go/vt/concurrency/error_recorder.go | ErrorStrings | func (aer *AllErrorRecorder) ErrorStrings() []string {
aer.mu.Lock()
defer aer.mu.Unlock()
if len(aer.Errors) == 0 {
return nil
}
errs := make([]string, 0, len(aer.Errors))
for _, e := range aer.Errors {
errs = append(errs, e.Error())
}
return errs
} | go | func (aer *AllErrorRecorder) ErrorStrings() []string {
aer.mu.Lock()
defer aer.mu.Unlock()
if len(aer.Errors) == 0 {
return nil
}
errs := make([]string, 0, len(aer.Errors))
for _, e := range aer.Errors {
errs = append(errs, e.Error())
}
return errs
} | [
"func",
"(",
"aer",
"*",
"AllErrorRecorder",
")",
"ErrorStrings",
"(",
")",
"[",
"]",
"string",
"{",
"aer",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"aer",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"len",
"(",
"aer",
".",
"Errors",
... | // ErrorStrings returns all errors as string array. | [
"ErrorStrings",
"returns",
"all",
"errors",
"as",
"string",
"array",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/concurrency/error_recorder.go#L126-L137 |
136,152 | vitessio/vitess | go/vt/concurrency/error_recorder.go | GetErrors | func (aer *AllErrorRecorder) GetErrors() []error {
aer.mu.Lock()
defer aer.mu.Unlock()
return aer.Errors
} | go | func (aer *AllErrorRecorder) GetErrors() []error {
aer.mu.Lock()
defer aer.mu.Unlock()
return aer.Errors
} | [
"func",
"(",
"aer",
"*",
"AllErrorRecorder",
")",
"GetErrors",
"(",
")",
"[",
"]",
"error",
"{",
"aer",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"aer",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"aer",
".",
"Errors",
"\n",
"}"
] | // GetErrors returns a reference to the internal errors array.
//
// Note that the array is not copied, so this should only be used
// once the recording is complete. | [
"GetErrors",
"returns",
"a",
"reference",
"to",
"the",
"internal",
"errors",
"array",
".",
"Note",
"that",
"the",
"array",
"is",
"not",
"copied",
"so",
"this",
"should",
"only",
"be",
"used",
"once",
"the",
"recording",
"is",
"complete",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/concurrency/error_recorder.go#L143-L147 |
136,153 | vitessio/vitess | go/vt/workflow/parallel_runner.go | NewParallelRunner | func NewParallelRunner(ctx context.Context, rootUINode *Node, cp *CheckpointWriter, tasks []*workflowpb.Task, executeFunc func(context.Context, *workflowpb.Task) error, concurrencyLevel level, enableApprovals bool) *ParallelRunner {
if len(tasks) < 1 {
log.Fatal("BUG: No tasks passed into ParallelRunner")
}
phase... | go | func NewParallelRunner(ctx context.Context, rootUINode *Node, cp *CheckpointWriter, tasks []*workflowpb.Task, executeFunc func(context.Context, *workflowpb.Task) error, concurrencyLevel level, enableApprovals bool) *ParallelRunner {
if len(tasks) < 1 {
log.Fatal("BUG: No tasks passed into ParallelRunner")
}
phase... | [
"func",
"NewParallelRunner",
"(",
"ctx",
"context",
".",
"Context",
",",
"rootUINode",
"*",
"Node",
",",
"cp",
"*",
"CheckpointWriter",
",",
"tasks",
"[",
"]",
"*",
"workflowpb",
".",
"Task",
",",
"executeFunc",
"func",
"(",
"context",
".",
"Context",
",",... | // NewParallelRunner returns a new ParallelRunner. | [
"NewParallelRunner",
"returns",
"a",
"new",
"ParallelRunner",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/parallel_runner.go#L84-L113 |
136,154 | vitessio/vitess | go/vt/workflow/parallel_runner.go | Run | func (p *ParallelRunner) Run() error {
// default value is 0. The task will not run in this case.
var parallelNum int
switch p.concurrencyLevel {
case Sequential:
parallelNum = 1
case Parallel:
parallelNum = len(p.tasks)
default:
log.Fatalf("BUG: Invalid concurrency level: %v", p.concurrencyLevel)
}
// se... | go | func (p *ParallelRunner) Run() error {
// default value is 0. The task will not run in this case.
var parallelNum int
switch p.concurrencyLevel {
case Sequential:
parallelNum = 1
case Parallel:
parallelNum = len(p.tasks)
default:
log.Fatalf("BUG: Invalid concurrency level: %v", p.concurrencyLevel)
}
// se... | [
"func",
"(",
"p",
"*",
"ParallelRunner",
")",
"Run",
"(",
")",
"error",
"{",
"// default value is 0. The task will not run in this case.",
"var",
"parallelNum",
"int",
"\n",
"switch",
"p",
".",
"concurrencyLevel",
"{",
"case",
"Sequential",
":",
"parallelNum",
"=",
... | // Run is the entry point for controlling task executions. | [
"Run",
"is",
"the",
"entry",
"point",
"for",
"controlling",
"task",
"executions",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/parallel_runner.go#L116-L162 |
136,155 | vitessio/vitess | go/vt/workflow/parallel_runner.go | Action | func (p *ParallelRunner) Action(ctx context.Context, path, name string) error {
switch name {
case actionNameRetry:
// Extract the path relative to the root node.
parts := strings.Split(path, "/")
taskID := strings.Join(parts[2:], "/")
return p.triggerRetry(taskID)
case actionNameApproveFirstTask:
p.mu.Loc... | go | func (p *ParallelRunner) Action(ctx context.Context, path, name string) error {
switch name {
case actionNameRetry:
// Extract the path relative to the root node.
parts := strings.Split(path, "/")
taskID := strings.Join(parts[2:], "/")
return p.triggerRetry(taskID)
case actionNameApproveFirstTask:
p.mu.Loc... | [
"func",
"(",
"p",
"*",
"ParallelRunner",
")",
"Action",
"(",
"ctx",
"context",
".",
"Context",
",",
"path",
",",
"name",
"string",
")",
"error",
"{",
"switch",
"name",
"{",
"case",
"actionNameRetry",
":",
"// Extract the path relative to the root node.",
"parts"... | // Action handles retrying, approval of the first task and approval of the
// remaining tasks actions. It implements the interface ActionListener. | [
"Action",
"handles",
"retrying",
"approval",
"of",
"the",
"first",
"task",
"and",
"approval",
"of",
"the",
"remaining",
"tasks",
"actions",
".",
"It",
"implements",
"the",
"interface",
"ActionListener",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/parallel_runner.go#L208-L238 |
136,156 | vitessio/vitess | go/vt/workflow/parallel_runner.go | VerifyAllTasksDone | func VerifyAllTasksDone(ctx context.Context, ts *topo.Server, uuid string) error {
return verifyAllTasksState(ctx, ts, uuid, workflowpb.TaskState_TaskDone)
} | go | func VerifyAllTasksDone(ctx context.Context, ts *topo.Server, uuid string) error {
return verifyAllTasksState(ctx, ts, uuid, workflowpb.TaskState_TaskDone)
} | [
"func",
"VerifyAllTasksDone",
"(",
"ctx",
"context",
".",
"Context",
",",
"ts",
"*",
"topo",
".",
"Server",
",",
"uuid",
"string",
")",
"error",
"{",
"return",
"verifyAllTasksState",
"(",
"ctx",
",",
"ts",
",",
"uuid",
",",
"workflowpb",
".",
"TaskState_Ta... | // VerifyAllTasksDone checks that all tasks are done in a workflow. This should only be used for test purposes. | [
"VerifyAllTasksDone",
"checks",
"that",
"all",
"tasks",
"are",
"done",
"in",
"a",
"workflow",
".",
"This",
"should",
"only",
"be",
"used",
"for",
"test",
"purposes",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/parallel_runner.go#L429-L431 |
136,157 | vitessio/vitess | go/vt/workflow/parallel_runner.go | verifyAllTasksState | func verifyAllTasksState(ctx context.Context, ts *topo.Server, uuid string, taskState workflowpb.TaskState) error {
checkpoint, err := checkpoint(ctx, ts, uuid)
if err != nil {
return err
}
for _, task := range checkpoint.Tasks {
if task.State != taskState || task.Error != "" {
return fmt.Errorf("task: %v s... | go | func verifyAllTasksState(ctx context.Context, ts *topo.Server, uuid string, taskState workflowpb.TaskState) error {
checkpoint, err := checkpoint(ctx, ts, uuid)
if err != nil {
return err
}
for _, task := range checkpoint.Tasks {
if task.State != taskState || task.Error != "" {
return fmt.Errorf("task: %v s... | [
"func",
"verifyAllTasksState",
"(",
"ctx",
"context",
".",
"Context",
",",
"ts",
"*",
"topo",
".",
"Server",
",",
"uuid",
"string",
",",
"taskState",
"workflowpb",
".",
"TaskState",
")",
"error",
"{",
"checkpoint",
",",
"err",
":=",
"checkpoint",
"(",
"ctx... | //verifyAllTasksState verifies that all tasks are in taskState. Only for tests purposes. | [
"verifyAllTasksState",
"verifies",
"that",
"all",
"tasks",
"are",
"in",
"taskState",
".",
"Only",
"for",
"tests",
"purposes",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/parallel_runner.go#L434-L446 |
136,158 | vitessio/vitess | go/vt/workflow/parallel_runner.go | verifyTask | func verifyTask(ctx context.Context, ts *topo.Server, uuid, taskID string, taskState workflowpb.TaskState, taskError string) error {
checkpoint, err := checkpoint(ctx, ts, uuid)
if err != nil {
return err
}
task := checkpoint.Tasks[taskID]
if task.State != taskState || task.Error != taskError {
return fmt.Err... | go | func verifyTask(ctx context.Context, ts *topo.Server, uuid, taskID string, taskState workflowpb.TaskState, taskError string) error {
checkpoint, err := checkpoint(ctx, ts, uuid)
if err != nil {
return err
}
task := checkpoint.Tasks[taskID]
if task.State != taskState || task.Error != taskError {
return fmt.Err... | [
"func",
"verifyTask",
"(",
"ctx",
"context",
".",
"Context",
",",
"ts",
"*",
"topo",
".",
"Server",
",",
"uuid",
",",
"taskID",
"string",
",",
"taskState",
"workflowpb",
".",
"TaskState",
",",
"taskError",
"string",
")",
"error",
"{",
"checkpoint",
",",
... | // verifyTask verifies that a task is in taskState. Only for test purposes. | [
"verifyTask",
"verifies",
"that",
"a",
"task",
"is",
"in",
"taskState",
".",
"Only",
"for",
"test",
"purposes",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/parallel_runner.go#L449-L460 |
136,159 | vitessio/vitess | go/vt/workflow/parallel_runner.go | checkpoint | func checkpoint(ctx context.Context, ts *topo.Server, uuid string) (*workflowpb.WorkflowCheckpoint, error) {
wi, err := ts.GetWorkflow(ctx, uuid)
if err != nil {
return nil, fmt.Errorf("fail to get workflow for: %v", uuid)
}
checkpoint := &workflowpb.WorkflowCheckpoint{}
if err := proto.Unmarshal(wi.Data, checkp... | go | func checkpoint(ctx context.Context, ts *topo.Server, uuid string) (*workflowpb.WorkflowCheckpoint, error) {
wi, err := ts.GetWorkflow(ctx, uuid)
if err != nil {
return nil, fmt.Errorf("fail to get workflow for: %v", uuid)
}
checkpoint := &workflowpb.WorkflowCheckpoint{}
if err := proto.Unmarshal(wi.Data, checkp... | [
"func",
"checkpoint",
"(",
"ctx",
"context",
".",
"Context",
",",
"ts",
"*",
"topo",
".",
"Server",
",",
"uuid",
"string",
")",
"(",
"*",
"workflowpb",
".",
"WorkflowCheckpoint",
",",
"error",
")",
"{",
"wi",
",",
"err",
":=",
"ts",
".",
"GetWorkflow",... | // checkpoint gets Worfklow from topo server. Only for test purposes. | [
"checkpoint",
"gets",
"Worfklow",
"from",
"topo",
"server",
".",
"Only",
"for",
"test",
"purposes",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/parallel_runner.go#L463-L473 |
136,160 | vitessio/vitess | go/vt/topo/stats_conn.go | NewStatsConn | func NewStatsConn(cell string, conn Conn) *StatsConn {
return &StatsConn{
cell: cell,
conn: conn,
}
} | go | func NewStatsConn(cell string, conn Conn) *StatsConn {
return &StatsConn{
cell: cell,
conn: conn,
}
} | [
"func",
"NewStatsConn",
"(",
"cell",
"string",
",",
"conn",
"Conn",
")",
"*",
"StatsConn",
"{",
"return",
"&",
"StatsConn",
"{",
"cell",
":",
"cell",
",",
"conn",
":",
"conn",
",",
"}",
"\n",
"}"
] | // NewStatsConn returns a StatsConn | [
"NewStatsConn",
"returns",
"a",
"StatsConn"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/stats_conn.go#L45-L50 |
136,161 | vitessio/vitess | go/vt/topo/stats_conn.go | ListDir | func (st *StatsConn) ListDir(ctx context.Context, dirPath string, full bool) ([]DirEntry, error) {
startTime := time.Now()
statsKey := []string{"ListDir", st.cell}
defer topoStatsConnTimings.Record(statsKey, startTime)
res, err := st.conn.ListDir(ctx, dirPath, full)
if err != nil {
topoStatsConnErrors.Add(statsK... | go | func (st *StatsConn) ListDir(ctx context.Context, dirPath string, full bool) ([]DirEntry, error) {
startTime := time.Now()
statsKey := []string{"ListDir", st.cell}
defer topoStatsConnTimings.Record(statsKey, startTime)
res, err := st.conn.ListDir(ctx, dirPath, full)
if err != nil {
topoStatsConnErrors.Add(statsK... | [
"func",
"(",
"st",
"*",
"StatsConn",
")",
"ListDir",
"(",
"ctx",
"context",
".",
"Context",
",",
"dirPath",
"string",
",",
"full",
"bool",
")",
"(",
"[",
"]",
"DirEntry",
",",
"error",
")",
"{",
"startTime",
":=",
"time",
".",
"Now",
"(",
")",
"\n"... | // ListDir is part of the Conn interface | [
"ListDir",
"is",
"part",
"of",
"the",
"Conn",
"interface"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/stats_conn.go#L53-L63 |
136,162 | vitessio/vitess | go/vt/topo/stats_conn.go | Create | func (st *StatsConn) Create(ctx context.Context, filePath string, contents []byte) (Version, error) {
startTime := time.Now()
statsKey := []string{"Create", st.cell}
defer topoStatsConnTimings.Record(statsKey, startTime)
res, err := st.conn.Create(ctx, filePath, contents)
if err != nil {
topoStatsConnErrors.Add(... | go | func (st *StatsConn) Create(ctx context.Context, filePath string, contents []byte) (Version, error) {
startTime := time.Now()
statsKey := []string{"Create", st.cell}
defer topoStatsConnTimings.Record(statsKey, startTime)
res, err := st.conn.Create(ctx, filePath, contents)
if err != nil {
topoStatsConnErrors.Add(... | [
"func",
"(",
"st",
"*",
"StatsConn",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"filePath",
"string",
",",
"contents",
"[",
"]",
"byte",
")",
"(",
"Version",
",",
"error",
")",
"{",
"startTime",
":=",
"time",
".",
"Now",
"(",
")",
"... | // Create is part of the Conn interface | [
"Create",
"is",
"part",
"of",
"the",
"Conn",
"interface"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/stats_conn.go#L66-L76 |
136,163 | vitessio/vitess | go/vt/topo/stats_conn.go | Lock | func (st *StatsConn) Lock(ctx context.Context, dirPath, contents string) (LockDescriptor, error) {
startTime := time.Now()
statsKey := []string{"Lock", st.cell}
defer topoStatsConnTimings.Record(statsKey, startTime)
res, err := st.conn.Lock(ctx, dirPath, contents)
if err != nil {
topoStatsConnErrors.Add(statsKey... | go | func (st *StatsConn) Lock(ctx context.Context, dirPath, contents string) (LockDescriptor, error) {
startTime := time.Now()
statsKey := []string{"Lock", st.cell}
defer topoStatsConnTimings.Record(statsKey, startTime)
res, err := st.conn.Lock(ctx, dirPath, contents)
if err != nil {
topoStatsConnErrors.Add(statsKey... | [
"func",
"(",
"st",
"*",
"StatsConn",
")",
"Lock",
"(",
"ctx",
"context",
".",
"Context",
",",
"dirPath",
",",
"contents",
"string",
")",
"(",
"LockDescriptor",
",",
"error",
")",
"{",
"startTime",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"statsKey",
... | // Lock is part of the Conn interface | [
"Lock",
"is",
"part",
"of",
"the",
"Conn",
"interface"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/stats_conn.go#L118-L128 |
136,164 | vitessio/vitess | go/vt/topo/stats_conn.go | Watch | func (st *StatsConn) Watch(ctx context.Context, filePath string) (current *WatchData, changes <-chan *WatchData, cancel CancelFunc) {
startTime := time.Now()
statsKey := []string{"Watch", st.cell}
defer topoStatsConnTimings.Record(statsKey, startTime)
return st.conn.Watch(ctx, filePath)
} | go | func (st *StatsConn) Watch(ctx context.Context, filePath string) (current *WatchData, changes <-chan *WatchData, cancel CancelFunc) {
startTime := time.Now()
statsKey := []string{"Watch", st.cell}
defer topoStatsConnTimings.Record(statsKey, startTime)
return st.conn.Watch(ctx, filePath)
} | [
"func",
"(",
"st",
"*",
"StatsConn",
")",
"Watch",
"(",
"ctx",
"context",
".",
"Context",
",",
"filePath",
"string",
")",
"(",
"current",
"*",
"WatchData",
",",
"changes",
"<-",
"chan",
"*",
"WatchData",
",",
"cancel",
"CancelFunc",
")",
"{",
"startTime"... | // Watch is part of the Conn interface | [
"Watch",
"is",
"part",
"of",
"the",
"Conn",
"interface"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/stats_conn.go#L131-L136 |
136,165 | vitessio/vitess | go/vt/topo/stats_conn.go | NewMasterParticipation | func (st *StatsConn) NewMasterParticipation(name, id string) (MasterParticipation, error) {
startTime := time.Now()
statsKey := []string{"NewMasterParticipation", st.cell}
defer topoStatsConnTimings.Record(statsKey, startTime)
res, err := st.conn.NewMasterParticipation(name, id)
if err != nil {
topoStatsConnErro... | go | func (st *StatsConn) NewMasterParticipation(name, id string) (MasterParticipation, error) {
startTime := time.Now()
statsKey := []string{"NewMasterParticipation", st.cell}
defer topoStatsConnTimings.Record(statsKey, startTime)
res, err := st.conn.NewMasterParticipation(name, id)
if err != nil {
topoStatsConnErro... | [
"func",
"(",
"st",
"*",
"StatsConn",
")",
"NewMasterParticipation",
"(",
"name",
",",
"id",
"string",
")",
"(",
"MasterParticipation",
",",
"error",
")",
"{",
"startTime",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"statsKey",
":=",
"[",
"]",
"string",
... | // NewMasterParticipation is part of the Conn interface | [
"NewMasterParticipation",
"is",
"part",
"of",
"the",
"Conn",
"interface"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/stats_conn.go#L139-L149 |
136,166 | vitessio/vitess | go/vt/topo/stats_conn.go | Close | func (st *StatsConn) Close() {
startTime := time.Now()
statsKey := []string{"Close", st.cell}
defer topoStatsConnTimings.Record(statsKey, startTime)
st.conn.Close()
} | go | func (st *StatsConn) Close() {
startTime := time.Now()
statsKey := []string{"Close", st.cell}
defer topoStatsConnTimings.Record(statsKey, startTime)
st.conn.Close()
} | [
"func",
"(",
"st",
"*",
"StatsConn",
")",
"Close",
"(",
")",
"{",
"startTime",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"statsKey",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"st",
".",
"cell",
"}",
"\n",
"defer",
"topoStatsConnTimings",
".",... | // Close is part of the Conn interface | [
"Close",
"is",
"part",
"of",
"the",
"Conn",
"interface"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/stats_conn.go#L152-L157 |
136,167 | vitessio/vitess | go/vt/vttablet/tabletmanager/vreplication/table_plan_builder.go | buildReplicatorPlan | func buildReplicatorPlan(filter *binlogdatapb.Filter, tableKeys map[string][]string, copyState map[string]*sqltypes.Result) (*ReplicatorPlan, error) {
plan := &ReplicatorPlan{
VStreamFilter: &binlogdatapb.Filter{},
TargetTables: make(map[string]*TablePlan),
TablePlans: make(map[string]*TablePlan),
tableKey... | go | func buildReplicatorPlan(filter *binlogdatapb.Filter, tableKeys map[string][]string, copyState map[string]*sqltypes.Result) (*ReplicatorPlan, error) {
plan := &ReplicatorPlan{
VStreamFilter: &binlogdatapb.Filter{},
TargetTables: make(map[string]*TablePlan),
TablePlans: make(map[string]*TablePlan),
tableKey... | [
"func",
"buildReplicatorPlan",
"(",
"filter",
"*",
"binlogdatapb",
".",
"Filter",
",",
"tableKeys",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
",",
"copyState",
"map",
"[",
"string",
"]",
"*",
"sqltypes",
".",
"Result",
")",
"(",
"*",
"ReplicatorPlan",... | // buildReplicatorPlan builds a ReplicatorPlan for the tables that match the filter.
// The filter is matched against the target schema. For every table matched,
// a table-specific rule is built to be sent to the source. We don't send the
// original rule to the source because it may not match the same tables as the
/... | [
"buildReplicatorPlan",
"builds",
"a",
"ReplicatorPlan",
"for",
"the",
"tables",
"that",
"match",
"the",
"filter",
".",
"The",
"filter",
"is",
"matched",
"against",
"the",
"target",
"schema",
".",
"For",
"every",
"table",
"matched",
"a",
"table",
"-",
"specific... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/table_plan_builder.go#L84-L137 |
136,168 | vitessio/vitess | go/vt/throttler/grpcthrottlerserver/grpcthrottlerserver.go | MaxRates | func (s *Server) MaxRates(_ context.Context, request *throttlerdatapb.MaxRatesRequest) (_ *throttlerdatapb.MaxRatesResponse, err error) {
defer servenv.HandlePanic("throttler", &err)
rates := s.manager.MaxRates()
return &throttlerdatapb.MaxRatesResponse{
Rates: rates,
}, nil
} | go | func (s *Server) MaxRates(_ context.Context, request *throttlerdatapb.MaxRatesRequest) (_ *throttlerdatapb.MaxRatesResponse, err error) {
defer servenv.HandlePanic("throttler", &err)
rates := s.manager.MaxRates()
return &throttlerdatapb.MaxRatesResponse{
Rates: rates,
}, nil
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"MaxRates",
"(",
"_",
"context",
".",
"Context",
",",
"request",
"*",
"throttlerdatapb",
".",
"MaxRatesRequest",
")",
"(",
"_",
"*",
"throttlerdatapb",
".",
"MaxRatesResponse",
",",
"err",
"error",
")",
"{",
"defer",
... | // MaxRates implements the gRPC server interface. It returns the current max
// rate for each throttler of the process. | [
"MaxRates",
"implements",
"the",
"gRPC",
"server",
"interface",
".",
"It",
"returns",
"the",
"current",
"max",
"rate",
"for",
"each",
"throttler",
"of",
"the",
"process",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/grpcthrottlerserver/grpcthrottlerserver.go#L44-L51 |
136,169 | vitessio/vitess | go/vt/throttler/grpcthrottlerserver/grpcthrottlerserver.go | SetMaxRate | func (s *Server) SetMaxRate(_ context.Context, request *throttlerdatapb.SetMaxRateRequest) (_ *throttlerdatapb.SetMaxRateResponse, err error) {
defer servenv.HandlePanic("throttler", &err)
names := s.manager.SetMaxRate(request.Rate)
return &throttlerdatapb.SetMaxRateResponse{
Names: names,
}, nil
} | go | func (s *Server) SetMaxRate(_ context.Context, request *throttlerdatapb.SetMaxRateRequest) (_ *throttlerdatapb.SetMaxRateResponse, err error) {
defer servenv.HandlePanic("throttler", &err)
names := s.manager.SetMaxRate(request.Rate)
return &throttlerdatapb.SetMaxRateResponse{
Names: names,
}, nil
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"SetMaxRate",
"(",
"_",
"context",
".",
"Context",
",",
"request",
"*",
"throttlerdatapb",
".",
"SetMaxRateRequest",
")",
"(",
"_",
"*",
"throttlerdatapb",
".",
"SetMaxRateResponse",
",",
"err",
"error",
")",
"{",
"def... | // SetMaxRate implements the gRPC server interface. It sets the rate on all
// throttlers controlled by the manager. | [
"SetMaxRate",
"implements",
"the",
"gRPC",
"server",
"interface",
".",
"It",
"sets",
"the",
"rate",
"on",
"all",
"throttlers",
"controlled",
"by",
"the",
"manager",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/grpcthrottlerserver/grpcthrottlerserver.go#L55-L62 |
136,170 | vitessio/vitess | go/vt/throttler/grpcthrottlerserver/grpcthrottlerserver.go | GetConfiguration | func (s *Server) GetConfiguration(_ context.Context, request *throttlerdatapb.GetConfigurationRequest) (_ *throttlerdatapb.GetConfigurationResponse, err error) {
defer servenv.HandlePanic("throttler", &err)
configurations, err := s.manager.GetConfiguration(request.ThrottlerName)
if err != nil {
return nil, err
}... | go | func (s *Server) GetConfiguration(_ context.Context, request *throttlerdatapb.GetConfigurationRequest) (_ *throttlerdatapb.GetConfigurationResponse, err error) {
defer servenv.HandlePanic("throttler", &err)
configurations, err := s.manager.GetConfiguration(request.ThrottlerName)
if err != nil {
return nil, err
}... | [
"func",
"(",
"s",
"*",
"Server",
")",
"GetConfiguration",
"(",
"_",
"context",
".",
"Context",
",",
"request",
"*",
"throttlerdatapb",
".",
"GetConfigurationRequest",
")",
"(",
"_",
"*",
"throttlerdatapb",
".",
"GetConfigurationResponse",
",",
"err",
"error",
... | // GetConfiguration implements the gRPC server interface. | [
"GetConfiguration",
"implements",
"the",
"gRPC",
"server",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/grpcthrottlerserver/grpcthrottlerserver.go#L65-L75 |
136,171 | vitessio/vitess | go/vt/throttler/grpcthrottlerserver/grpcthrottlerserver.go | UpdateConfiguration | func (s *Server) UpdateConfiguration(_ context.Context, request *throttlerdatapb.UpdateConfigurationRequest) (_ *throttlerdatapb.UpdateConfigurationResponse, err error) {
defer servenv.HandlePanic("throttler", &err)
names, err := s.manager.UpdateConfiguration(request.ThrottlerName, request.Configuration, request.Cop... | go | func (s *Server) UpdateConfiguration(_ context.Context, request *throttlerdatapb.UpdateConfigurationRequest) (_ *throttlerdatapb.UpdateConfigurationResponse, err error) {
defer servenv.HandlePanic("throttler", &err)
names, err := s.manager.UpdateConfiguration(request.ThrottlerName, request.Configuration, request.Cop... | [
"func",
"(",
"s",
"*",
"Server",
")",
"UpdateConfiguration",
"(",
"_",
"context",
".",
"Context",
",",
"request",
"*",
"throttlerdatapb",
".",
"UpdateConfigurationRequest",
")",
"(",
"_",
"*",
"throttlerdatapb",
".",
"UpdateConfigurationResponse",
",",
"err",
"e... | // UpdateConfiguration implements the gRPC server interface. | [
"UpdateConfiguration",
"implements",
"the",
"gRPC",
"server",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/grpcthrottlerserver/grpcthrottlerserver.go#L78-L88 |
136,172 | vitessio/vitess | go/vt/throttler/grpcthrottlerserver/grpcthrottlerserver.go | ResetConfiguration | func (s *Server) ResetConfiguration(_ context.Context, request *throttlerdatapb.ResetConfigurationRequest) (_ *throttlerdatapb.ResetConfigurationResponse, err error) {
defer servenv.HandlePanic("throttler", &err)
names, err := s.manager.ResetConfiguration(request.ThrottlerName)
if err != nil {
return nil, err
}
... | go | func (s *Server) ResetConfiguration(_ context.Context, request *throttlerdatapb.ResetConfigurationRequest) (_ *throttlerdatapb.ResetConfigurationResponse, err error) {
defer servenv.HandlePanic("throttler", &err)
names, err := s.manager.ResetConfiguration(request.ThrottlerName)
if err != nil {
return nil, err
}
... | [
"func",
"(",
"s",
"*",
"Server",
")",
"ResetConfiguration",
"(",
"_",
"context",
".",
"Context",
",",
"request",
"*",
"throttlerdatapb",
".",
"ResetConfigurationRequest",
")",
"(",
"_",
"*",
"throttlerdatapb",
".",
"ResetConfigurationResponse",
",",
"err",
"erro... | // ResetConfiguration implements the gRPC server interface. | [
"ResetConfiguration",
"implements",
"the",
"gRPC",
"server",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/grpcthrottlerserver/grpcthrottlerserver.go#L91-L101 |
136,173 | vitessio/vitess | go/vt/throttler/grpcthrottlerserver/grpcthrottlerserver.go | RegisterServer | func RegisterServer(s *grpc.Server, m throttler.Manager) {
throttlerservicepb.RegisterThrottlerServer(s, NewServer(m))
} | go | func RegisterServer(s *grpc.Server, m throttler.Manager) {
throttlerservicepb.RegisterThrottlerServer(s, NewServer(m))
} | [
"func",
"RegisterServer",
"(",
"s",
"*",
"grpc",
".",
"Server",
",",
"m",
"throttler",
".",
"Manager",
")",
"{",
"throttlerservicepb",
".",
"RegisterThrottlerServer",
"(",
"s",
",",
"NewServer",
"(",
"m",
")",
")",
"\n",
"}"
] | // RegisterServer registers a new throttler server instance with the gRPC server. | [
"RegisterServer",
"registers",
"a",
"new",
"throttler",
"server",
"instance",
"with",
"the",
"gRPC",
"server",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/grpcthrottlerserver/grpcthrottlerserver.go#L104-L106 |
136,174 | vitessio/vitess | go/vt/topo/etcd2topo/error.go | convertError | func convertError(err error, nodePath string) error {
if err == nil {
return nil
}
if typeErr, ok := err.(rpctypes.EtcdError); ok {
switch typeErr.Code() {
case codes.NotFound:
return topo.NewError(topo.NoNode, nodePath)
case codes.Unavailable, codes.DeadlineExceeded:
// The etcd2 client library may r... | go | func convertError(err error, nodePath string) error {
if err == nil {
return nil
}
if typeErr, ok := err.(rpctypes.EtcdError); ok {
switch typeErr.Code() {
case codes.NotFound:
return topo.NewError(topo.NoNode, nodePath)
case codes.Unavailable, codes.DeadlineExceeded:
// The etcd2 client library may r... | [
"func",
"convertError",
"(",
"err",
"error",
",",
"nodePath",
"string",
")",
"error",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"typeErr",
",",
"ok",
":=",
"err",
".",
"(",
"rpctypes",
".",
"EtcdError",
")",
";",
... | // convertError converts an etcd error into a topo error. All errors
// are either application-level errors, or context errors. | [
"convertError",
"converts",
"an",
"etcd",
"error",
"into",
"a",
"topo",
"error",
".",
"All",
"errors",
"are",
"either",
"application",
"-",
"level",
"errors",
"or",
"context",
"errors",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/etcd2topo/error.go#L42-L89 |
136,175 | vitessio/vitess | go/vt/vttablet/tabletserver/tabletenv/config.go | Init | func Init() {
switch *streamlog.QueryLogFormat {
case streamlog.QueryLogFormatText:
case streamlog.QueryLogFormatJSON:
default:
log.Exitf("Invalid querylog-format value %v: must be either text or json", *streamlog.QueryLogFormat)
}
if *queryLogHandler != "" {
StatsLogger.ServeLogs(*queryLogHandler, streamlog... | go | func Init() {
switch *streamlog.QueryLogFormat {
case streamlog.QueryLogFormatText:
case streamlog.QueryLogFormatJSON:
default:
log.Exitf("Invalid querylog-format value %v: must be either text or json", *streamlog.QueryLogFormat)
}
if *queryLogHandler != "" {
StatsLogger.ServeLogs(*queryLogHandler, streamlog... | [
"func",
"Init",
"(",
")",
"{",
"switch",
"*",
"streamlog",
".",
"QueryLogFormat",
"{",
"case",
"streamlog",
".",
"QueryLogFormatText",
":",
"case",
"streamlog",
".",
"QueryLogFormatJSON",
":",
"default",
":",
"log",
".",
"Exitf",
"(",
"\"",
"\"",
",",
"*",... | // Init must be called after flag.Parse, and before doing any other operations. | [
"Init",
"must",
"be",
"called",
"after",
"flag",
".",
"Parse",
"and",
"before",
"doing",
"any",
"other",
"operations",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletenv/config.go#L107-L122 |
136,176 | vitessio/vitess | go/vt/vttablet/tabletserver/tabletenv/config.go | verifyTransactionLimitConfig | func (c *TabletConfig) verifyTransactionLimitConfig() error {
actual, dryRun := c.EnableTransactionLimit, c.EnableTransactionLimitDryRun
if actual && dryRun {
return errors.New("only one of two flags allowed: -enable_transaction_limit or -enable_transaction_limit_dry_run")
}
// Skip other checks if this is not e... | go | func (c *TabletConfig) verifyTransactionLimitConfig() error {
actual, dryRun := c.EnableTransactionLimit, c.EnableTransactionLimitDryRun
if actual && dryRun {
return errors.New("only one of two flags allowed: -enable_transaction_limit or -enable_transaction_limit_dry_run")
}
// Skip other checks if this is not e... | [
"func",
"(",
"c",
"*",
"TabletConfig",
")",
"verifyTransactionLimitConfig",
"(",
")",
"error",
"{",
"actual",
",",
"dryRun",
":=",
"c",
".",
"EnableTransactionLimit",
",",
"c",
".",
"EnableTransactionLimitDryRun",
"\n",
"if",
"actual",
"&&",
"dryRun",
"{",
"re... | // verifyTransactionLimitConfig checks TransactionLimitConfig for sanity | [
"verifyTransactionLimitConfig",
"checks",
"TransactionLimitConfig",
"for",
"sanity"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletenv/config.go#L283-L310 |
136,177 | vitessio/vitess | go/vt/vttablet/tabletserver/tabletenv/config.go | VerifyConfig | func VerifyConfig() error {
if err := Config.verifyTransactionLimitConfig(); err != nil {
return err
}
if actual, dryRun := Config.EnableHotRowProtection, Config.EnableHotRowProtectionDryRun; actual && dryRun {
return errors.New("only one of two flags allowed: -enable_hot_row_protection or -enable_hot_row_protec... | go | func VerifyConfig() error {
if err := Config.verifyTransactionLimitConfig(); err != nil {
return err
}
if actual, dryRun := Config.EnableHotRowProtection, Config.EnableHotRowProtectionDryRun; actual && dryRun {
return errors.New("only one of two flags allowed: -enable_hot_row_protection or -enable_hot_row_protec... | [
"func",
"VerifyConfig",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"Config",
".",
"verifyTransactionLimitConfig",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"actual",
",",
"dryRun",
":=",
"Config",
".",
"EnableHotRowP... | // VerifyConfig checks "Config" for contradicting flags. | [
"VerifyConfig",
"checks",
"Config",
"for",
"contradicting",
"flags",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletenv/config.go#L317-L337 |
136,178 | vitessio/vitess | go/mysql/mysql56_gtid_set.go | SIDs | func (set Mysql56GTIDSet) SIDs() []SID {
sids := make([]SID, 0, len(set))
for sid := range set {
sids = append(sids, sid)
}
sort.Sort(sidList(sids))
return sids
} | go | func (set Mysql56GTIDSet) SIDs() []SID {
sids := make([]SID, 0, len(set))
for sid := range set {
sids = append(sids, sid)
}
sort.Sort(sidList(sids))
return sids
} | [
"func",
"(",
"set",
"Mysql56GTIDSet",
")",
"SIDs",
"(",
")",
"[",
"]",
"SID",
"{",
"sids",
":=",
"make",
"(",
"[",
"]",
"SID",
",",
"0",
",",
"len",
"(",
"set",
")",
")",
"\n",
"for",
"sid",
":=",
"range",
"set",
"{",
"sids",
"=",
"append",
"... | // SIDs returns a sorted list of SIDs in the set. | [
"SIDs",
"returns",
"a",
"sorted",
"list",
"of",
"SIDs",
"in",
"the",
"set",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/mysql56_gtid_set.go#L130-L137 |
136,179 | vitessio/vitess | go/mysql/mysql56_gtid_set.go | String | func (set Mysql56GTIDSet) String() string {
buf := &bytes.Buffer{}
for i, sid := range set.SIDs() {
if i != 0 {
buf.WriteByte(',')
}
buf.WriteString(sid.String())
for _, interval := range set[sid] {
buf.WriteByte(':')
buf.WriteString(strconv.FormatInt(interval.start, 10))
if interval.end != int... | go | func (set Mysql56GTIDSet) String() string {
buf := &bytes.Buffer{}
for i, sid := range set.SIDs() {
if i != 0 {
buf.WriteByte(',')
}
buf.WriteString(sid.String())
for _, interval := range set[sid] {
buf.WriteByte(':')
buf.WriteString(strconv.FormatInt(interval.start, 10))
if interval.end != int... | [
"func",
"(",
"set",
"Mysql56GTIDSet",
")",
"String",
"(",
")",
"string",
"{",
"buf",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n\n",
"for",
"i",
",",
"sid",
":=",
"range",
"set",
".",
"SIDs",
"(",
")",
"{",
"if",
"i",
"!=",
"0",
"{",
"buf"... | // String implements GTIDSet. | [
"String",
"implements",
"GTIDSet",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/mysql56_gtid_set.go#L151-L172 |
136,180 | vitessio/vitess | go/mysql/mysql56_gtid_set.go | ContainsGTID | func (set Mysql56GTIDSet) ContainsGTID(gtid GTID) bool {
gtid56, ok := gtid.(Mysql56GTID)
if !ok {
return false
}
for _, iv := range set[gtid56.Server] {
if iv.start > gtid56.Sequence {
// We assume intervals are sorted, so we can skip the rest.
return false
}
if gtid56.Sequence <= iv.end {
// Now... | go | func (set Mysql56GTIDSet) ContainsGTID(gtid GTID) bool {
gtid56, ok := gtid.(Mysql56GTID)
if !ok {
return false
}
for _, iv := range set[gtid56.Server] {
if iv.start > gtid56.Sequence {
// We assume intervals are sorted, so we can skip the rest.
return false
}
if gtid56.Sequence <= iv.end {
// Now... | [
"func",
"(",
"set",
"Mysql56GTIDSet",
")",
"ContainsGTID",
"(",
"gtid",
"GTID",
")",
"bool",
"{",
"gtid56",
",",
"ok",
":=",
"gtid",
".",
"(",
"Mysql56GTID",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"i... | // ContainsGTID implements GTIDSet. | [
"ContainsGTID",
"implements",
"GTIDSet",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/mysql56_gtid_set.go#L178-L196 |
136,181 | vitessio/vitess | go/mysql/mysql56_gtid_set.go | Contains | func (set Mysql56GTIDSet) Contains(other GTIDSet) bool {
other56, ok := other.(Mysql56GTIDSet)
if !ok {
return false
}
// Check each SID in the other set.
for sid, otherIntervals := range other56 {
i := 0
intervals := set[sid]
count := len(intervals)
// Check each interval for this SID in the other set... | go | func (set Mysql56GTIDSet) Contains(other GTIDSet) bool {
other56, ok := other.(Mysql56GTIDSet)
if !ok {
return false
}
// Check each SID in the other set.
for sid, otherIntervals := range other56 {
i := 0
intervals := set[sid]
count := len(intervals)
// Check each interval for this SID in the other set... | [
"func",
"(",
"set",
"Mysql56GTIDSet",
")",
"Contains",
"(",
"other",
"GTIDSet",
")",
"bool",
"{",
"other56",
",",
"ok",
":=",
"other",
".",
"(",
"Mysql56GTIDSet",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"// Check each SID i... | // Contains implements GTIDSet. | [
"Contains",
"implements",
"GTIDSet",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/mysql56_gtid_set.go#L199-L232 |
136,182 | vitessio/vitess | go/mysql/mysql56_gtid_set.go | Equal | func (set Mysql56GTIDSet) Equal(other GTIDSet) bool {
other56, ok := other.(Mysql56GTIDSet)
if !ok {
return false
}
// Check for same number of SIDs.
if len(set) != len(other56) {
return false
}
// Compare each SID.
for sid, intervals := range set {
otherIntervals := other56[sid]
// Check for same nu... | go | func (set Mysql56GTIDSet) Equal(other GTIDSet) bool {
other56, ok := other.(Mysql56GTIDSet)
if !ok {
return false
}
// Check for same number of SIDs.
if len(set) != len(other56) {
return false
}
// Compare each SID.
for sid, intervals := range set {
otherIntervals := other56[sid]
// Check for same nu... | [
"func",
"(",
"set",
"Mysql56GTIDSet",
")",
"Equal",
"(",
"other",
"GTIDSet",
")",
"bool",
"{",
"other56",
",",
"ok",
":=",
"other",
".",
"(",
"Mysql56GTIDSet",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"// Check for same numb... | // Equal implements GTIDSet. | [
"Equal",
"implements",
"GTIDSet",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/mysql56_gtid_set.go#L235-L266 |
136,183 | vitessio/vitess | go/mysql/mysql56_gtid_set.go | AddGTID | func (set Mysql56GTIDSet) AddGTID(gtid GTID) GTIDSet {
gtid56, ok := gtid.(Mysql56GTID)
if !ok {
return set
}
// If it's already in the set, we can return the same instance.
// This is safe because GTIDSets are immutable.
if set.ContainsGTID(gtid) {
return set
}
// Make a copy and add the new GTID in the ... | go | func (set Mysql56GTIDSet) AddGTID(gtid GTID) GTIDSet {
gtid56, ok := gtid.(Mysql56GTID)
if !ok {
return set
}
// If it's already in the set, we can return the same instance.
// This is safe because GTIDSets are immutable.
if set.ContainsGTID(gtid) {
return set
}
// Make a copy and add the new GTID in the ... | [
"func",
"(",
"set",
"Mysql56GTIDSet",
")",
"AddGTID",
"(",
"gtid",
"GTID",
")",
"GTIDSet",
"{",
"gtid56",
",",
"ok",
":=",
"gtid",
".",
"(",
"Mysql56GTID",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"set",
"\n",
"}",
"\n\n",
"// If it's already in the se... | // AddGTID implements GTIDSet. | [
"AddGTID",
"implements",
"GTIDSet",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/mysql56_gtid_set.go#L269-L335 |
136,184 | vitessio/vitess | go/vt/servenv/grpc_server.go | isGRPCEnabled | func isGRPCEnabled() bool {
if GRPCPort != nil && *GRPCPort != 0 {
return true
}
if SocketFile != nil && *SocketFile != "" {
return true
}
return false
} | go | func isGRPCEnabled() bool {
if GRPCPort != nil && *GRPCPort != 0 {
return true
}
if SocketFile != nil && *SocketFile != "" {
return true
}
return false
} | [
"func",
"isGRPCEnabled",
"(",
")",
"bool",
"{",
"if",
"GRPCPort",
"!=",
"nil",
"&&",
"*",
"GRPCPort",
"!=",
"0",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"if",
"SocketFile",
"!=",
"nil",
"&&",
"*",
"SocketFile",
"!=",
"\"",
"\"",
"{",
"return",
"tru... | // isGRPCEnabled returns true if gRPC server is set | [
"isGRPCEnabled",
"returns",
"true",
"if",
"gRPC",
"server",
"is",
"set"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/grpc_server.go#L100-L110 |
136,185 | vitessio/vitess | go/vt/servenv/grpc_server.go | createGRPCServer | func createGRPCServer() {
// skip if not registered
if !isGRPCEnabled() {
log.Infof("Skipping gRPC server creation")
return
}
grpccommon.EnableTracingOpt()
var opts []grpc.ServerOption
if GRPCPort != nil && *GRPCCert != "" && *GRPCKey != "" {
config, err := vttls.ServerConfig(*GRPCCert, *GRPCKey, *GRPCCA)... | go | func createGRPCServer() {
// skip if not registered
if !isGRPCEnabled() {
log.Infof("Skipping gRPC server creation")
return
}
grpccommon.EnableTracingOpt()
var opts []grpc.ServerOption
if GRPCPort != nil && *GRPCCert != "" && *GRPCKey != "" {
config, err := vttls.ServerConfig(*GRPCCert, *GRPCKey, *GRPCCA)... | [
"func",
"createGRPCServer",
"(",
")",
"{",
"// skip if not registered",
"if",
"!",
"isGRPCEnabled",
"(",
")",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"grpccommon",
".",
"EnableTracingOpt",
"(",
")",
"\n\n",
"var",... | // createGRPCServer create the gRPC server we will be using.
// It has to be called after flags are parsed, but before
// services register themselves. | [
"createGRPCServer",
"create",
"the",
"gRPC",
"server",
"we",
"will",
"be",
"using",
".",
"It",
"has",
"to",
"be",
"called",
"after",
"flags",
"are",
"parsed",
"but",
"before",
"services",
"register",
"themselves",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/grpc_server.go#L115-L175 |
136,186 | vitessio/vitess | go/vt/servenv/grpc_server.go | interceptors | func interceptors() []grpc.ServerOption {
interceptors := &serverInterceptorBuilder{}
if *GRPCAuth != "" {
log.Infof("enabling auth plugin %v", *GRPCAuth)
pluginInitializer := GetAuthenticator(*GRPCAuth)
authPluginImpl, err := pluginInitializer()
if err != nil {
log.Fatalf("Failed to load auth plugin: %v"... | go | func interceptors() []grpc.ServerOption {
interceptors := &serverInterceptorBuilder{}
if *GRPCAuth != "" {
log.Infof("enabling auth plugin %v", *GRPCAuth)
pluginInitializer := GetAuthenticator(*GRPCAuth)
authPluginImpl, err := pluginInitializer()
if err != nil {
log.Fatalf("Failed to load auth plugin: %v"... | [
"func",
"interceptors",
"(",
")",
"[",
"]",
"grpc",
".",
"ServerOption",
"{",
"interceptors",
":=",
"&",
"serverInterceptorBuilder",
"{",
"}",
"\n\n",
"if",
"*",
"GRPCAuth",
"!=",
"\"",
"\"",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"*",
"GRPCAu... | // We can only set a ServerInterceptor once, so we chain multiple interceptors into one | [
"We",
"can",
"only",
"set",
"a",
"ServerInterceptor",
"once",
"so",
"we",
"chain",
"multiple",
"interceptors",
"into",
"one"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/grpc_server.go#L178-L199 |
136,187 | vitessio/vitess | go/vt/servenv/grpc_server.go | WrapServerStream | func WrapServerStream(stream grpc.ServerStream) *WrappedServerStream {
if existing, ok := stream.(*WrappedServerStream); ok {
return existing
}
return &WrappedServerStream{ServerStream: stream, WrappedContext: stream.Context()}
} | go | func WrapServerStream(stream grpc.ServerStream) *WrappedServerStream {
if existing, ok := stream.(*WrappedServerStream); ok {
return existing
}
return &WrappedServerStream{ServerStream: stream, WrappedContext: stream.Context()}
} | [
"func",
"WrapServerStream",
"(",
"stream",
"grpc",
".",
"ServerStream",
")",
"*",
"WrappedServerStream",
"{",
"if",
"existing",
",",
"ok",
":=",
"stream",
".",
"(",
"*",
"WrappedServerStream",
")",
";",
"ok",
"{",
"return",
"existing",
"\n",
"}",
"\n",
"re... | // WrapServerStream returns a ServerStream that has the ability to overwrite context. | [
"WrapServerStream",
"returns",
"a",
"ServerStream",
"that",
"has",
"the",
"ability",
"to",
"overwrite",
"context",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/grpc_server.go#L279-L284 |
136,188 | vitessio/vitess | go/vt/servenv/grpc_server.go | Add | func (collector *serverInterceptorBuilder) Add(s grpc.StreamServerInterceptor, u grpc.UnaryServerInterceptor) {
collector.streamInterceptors = append(collector.streamInterceptors, s)
collector.unaryInterceptors = append(collector.unaryInterceptors, u)
} | go | func (collector *serverInterceptorBuilder) Add(s grpc.StreamServerInterceptor, u grpc.UnaryServerInterceptor) {
collector.streamInterceptors = append(collector.streamInterceptors, s)
collector.unaryInterceptors = append(collector.unaryInterceptors, u)
} | [
"func",
"(",
"collector",
"*",
"serverInterceptorBuilder",
")",
"Add",
"(",
"s",
"grpc",
".",
"StreamServerInterceptor",
",",
"u",
"grpc",
".",
"UnaryServerInterceptor",
")",
"{",
"collector",
".",
"streamInterceptors",
"=",
"append",
"(",
"collector",
".",
"str... | // Add adds interceptors to the builder | [
"Add",
"adds",
"interceptors",
"to",
"the",
"builder"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/grpc_server.go#L293-L296 |
136,189 | vitessio/vitess | go/vt/servenv/grpc_server.go | AddUnary | func (collector *serverInterceptorBuilder) AddUnary(u grpc.UnaryServerInterceptor) {
collector.unaryInterceptors = append(collector.unaryInterceptors, u)
} | go | func (collector *serverInterceptorBuilder) AddUnary(u grpc.UnaryServerInterceptor) {
collector.unaryInterceptors = append(collector.unaryInterceptors, u)
} | [
"func",
"(",
"collector",
"*",
"serverInterceptorBuilder",
")",
"AddUnary",
"(",
"u",
"grpc",
".",
"UnaryServerInterceptor",
")",
"{",
"collector",
".",
"unaryInterceptors",
"=",
"append",
"(",
"collector",
".",
"unaryInterceptors",
",",
"u",
")",
"\n",
"}"
] | // AddUnary adds a single unary interceptor to the builder | [
"AddUnary",
"adds",
"a",
"single",
"unary",
"interceptor",
"to",
"the",
"builder"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/grpc_server.go#L299-L301 |
136,190 | vitessio/vitess | go/vt/workflow/sleep_workflow.go | Run | func (sw *SleepWorkflow) Run(ctx context.Context, manager *Manager, wi *topo.WorkflowInfo) error {
// Save all values, create a UI Node.
sw.mu.Lock()
sw.manager = manager
sw.wi = wi
sw.node.Listener = sw
sw.node.Display = NodeDisplayDeterminate
sw.node.Actions = []*Action{
{
Name: pauseAction,
State: A... | go | func (sw *SleepWorkflow) Run(ctx context.Context, manager *Manager, wi *topo.WorkflowInfo) error {
// Save all values, create a UI Node.
sw.mu.Lock()
sw.manager = manager
sw.wi = wi
sw.node.Listener = sw
sw.node.Display = NodeDisplayDeterminate
sw.node.Actions = []*Action{
{
Name: pauseAction,
State: A... | [
"func",
"(",
"sw",
"*",
"SleepWorkflow",
")",
"Run",
"(",
"ctx",
"context",
".",
"Context",
",",
"manager",
"*",
"Manager",
",",
"wi",
"*",
"topo",
".",
"WorkflowInfo",
")",
"error",
"{",
"// Save all values, create a UI Node.",
"sw",
".",
"mu",
".",
"Lock... | // Run is part of the workflow.Workflow interface.
// It updates the UI every second, and checkpoints every 5 seconds. | [
"Run",
"is",
"part",
"of",
"the",
"workflow",
".",
"Workflow",
"interface",
".",
"It",
"updates",
"the",
"UI",
"every",
"second",
"and",
"checkpoints",
"every",
"5",
"seconds",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/sleep_workflow.go#L83-L139 |
136,191 | vitessio/vitess | go/vt/workflow/sleep_workflow.go | checkpointLocked | func (sw *SleepWorkflow) checkpointLocked(ctx context.Context) error {
var err error
sw.wi.Data, err = json.Marshal(sw.data)
if err != nil {
return err
}
err = sw.manager.TopoServer().SaveWorkflow(ctx, sw.wi)
if err != nil {
sw.logger.Errorf("SaveWorkflow failed: %v", err)
} else {
sw.logger.Infof("SaveWor... | go | func (sw *SleepWorkflow) checkpointLocked(ctx context.Context) error {
var err error
sw.wi.Data, err = json.Marshal(sw.data)
if err != nil {
return err
}
err = sw.manager.TopoServer().SaveWorkflow(ctx, sw.wi)
if err != nil {
sw.logger.Errorf("SaveWorkflow failed: %v", err)
} else {
sw.logger.Infof("SaveWor... | [
"func",
"(",
"sw",
"*",
"SleepWorkflow",
")",
"checkpointLocked",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"sw",
".",
"wi",
".",
"Data",
",",
"err",
"=",
"json",
".",
"Marshal",
"(",
"sw",
".",
"data",
... | // checkpointLocked saves a checkpoint in topo server.
// Needs to be called with the lock. | [
"checkpointLocked",
"saves",
"a",
"checkpoint",
"in",
"topo",
"server",
".",
"Needs",
"to",
"be",
"called",
"with",
"the",
"lock",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/sleep_workflow.go#L190-L203 |
136,192 | vitessio/vitess | go/vt/vtgate/vschema_stats.go | NewVSchemaStats | func NewVSchemaStats(vschema *vindexes.VSchema, errorMessage string) *VSchemaStats {
stats := &VSchemaStats{
Error: errorMessage,
Keyspaces: make([]*VSchemaKeyspaceStats, 0, len(vschema.Keyspaces)),
}
for n, k := range vschema.Keyspaces {
s := &VSchemaKeyspaceStats{
Keyspace: n,
}
if k.Keyspace != n... | go | func NewVSchemaStats(vschema *vindexes.VSchema, errorMessage string) *VSchemaStats {
stats := &VSchemaStats{
Error: errorMessage,
Keyspaces: make([]*VSchemaKeyspaceStats, 0, len(vschema.Keyspaces)),
}
for n, k := range vschema.Keyspaces {
s := &VSchemaKeyspaceStats{
Keyspace: n,
}
if k.Keyspace != n... | [
"func",
"NewVSchemaStats",
"(",
"vschema",
"*",
"vindexes",
".",
"VSchema",
",",
"errorMessage",
"string",
")",
"*",
"VSchemaStats",
"{",
"stats",
":=",
"&",
"VSchemaStats",
"{",
"Error",
":",
"errorMessage",
",",
"Keyspaces",
":",
"make",
"(",
"[",
"]",
"... | // NewVSchemaStats returns a new VSchemaStats from a VSchema. | [
"NewVSchemaStats",
"returns",
"a",
"new",
"VSchemaStats",
"from",
"a",
"VSchema",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vschema_stats.go#L44-L68 |
136,193 | vitessio/vitess | go/vt/vtgate/engine/ordered_aggregate.go | MarshalJSON | func (code AggregateOpcode) MarshalJSON() ([]byte, error) {
return ([]byte)(fmt.Sprintf("\"%s\"", code.String())), nil
} | go | func (code AggregateOpcode) MarshalJSON() ([]byte, error) {
return ([]byte)(fmt.Sprintf("\"%s\"", code.String())), nil
} | [
"func",
"(",
"code",
"AggregateOpcode",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"(",
"[",
"]",
"byte",
")",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"code",
".",
"String",
"(... | // MarshalJSON serializes the AggregateOpcode as a JSON string.
// It's used for testing and diagnostics. | [
"MarshalJSON",
"serializes",
"the",
"AggregateOpcode",
"as",
"a",
"JSON",
"string",
".",
"It",
"s",
"used",
"for",
"testing",
"and",
"diagnostics",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/ordered_aggregate.go#L90-L92 |
136,194 | vitessio/vitess | go/vt/vtgate/engine/ordered_aggregate.go | Execute | func (oa *OrderedAggregate) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
qr, err := oa.execute(vcursor, bindVars, wantfields)
if err != nil {
return nil, err
}
return qr.Truncate(oa.TruncateColumnCount), nil
} | go | func (oa *OrderedAggregate) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
qr, err := oa.execute(vcursor, bindVars, wantfields)
if err != nil {
return nil, err
}
return qr.Truncate(oa.TruncateColumnCount), nil
} | [
"func",
"(",
"oa",
"*",
"OrderedAggregate",
")",
"Execute",
"(",
"vcursor",
"VCursor",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
",",
"wantfields",
"bool",
")",
"(",
"*",
"sqltypes",
".",
"Result",
",",
"error",
")"... | // Execute is a Primitive function. | [
"Execute",
"is",
"a",
"Primitive",
"function",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/ordered_aggregate.go#L100-L106 |
136,195 | vitessio/vitess | go/vt/vtgate/engine/ordered_aggregate.go | StreamExecute | func (oa *OrderedAggregate) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
var current []sqltypes.Value
var fields []*querypb.Field
cb := func(qr *sqltypes.Result) error {
return callback(qr.Truncate(oa.TruncateColumnCount)... | go | func (oa *OrderedAggregate) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
var current []sqltypes.Value
var fields []*querypb.Field
cb := func(qr *sqltypes.Result) error {
return callback(qr.Truncate(oa.TruncateColumnCount)... | [
"func",
"(",
"oa",
"*",
"OrderedAggregate",
")",
"StreamExecute",
"(",
"vcursor",
"VCursor",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
",",
"wantfields",
"bool",
",",
"callback",
"func",
"(",
"*",
"sqltypes",
".",
"Re... | // StreamExecute is a Primitive function. | [
"StreamExecute",
"is",
"a",
"Primitive",
"function",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/ordered_aggregate.go#L149-L200 |
136,196 | vitessio/vitess | go/vt/vtgate/engine/ordered_aggregate.go | GetFields | func (oa *OrderedAggregate) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {
qr, err := oa.Input.GetFields(vcursor, bindVars)
if err != nil {
return nil, err
}
return qr.Truncate(oa.TruncateColumnCount), nil
} | go | func (oa *OrderedAggregate) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {
qr, err := oa.Input.GetFields(vcursor, bindVars)
if err != nil {
return nil, err
}
return qr.Truncate(oa.TruncateColumnCount), nil
} | [
"func",
"(",
"oa",
"*",
"OrderedAggregate",
")",
"GetFields",
"(",
"vcursor",
"VCursor",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
")",
"(",
"*",
"sqltypes",
".",
"Result",
",",
"error",
")",
"{",
"qr",
",",
"err"... | // GetFields is a Primitive function. | [
"GetFields",
"is",
"a",
"Primitive",
"function",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/ordered_aggregate.go#L203-L209 |
136,197 | vitessio/vitess | go/vt/vtgate/vindexes/binary.go | NewBinary | func NewBinary(name string, _ map[string]string) (Vindex, error) {
return &Binary{name: name}, nil
} | go | func NewBinary(name string, _ map[string]string) (Vindex, error) {
return &Binary{name: name}, nil
} | [
"func",
"NewBinary",
"(",
"name",
"string",
",",
"_",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"Vindex",
",",
"error",
")",
"{",
"return",
"&",
"Binary",
"{",
"name",
":",
"name",
"}",
",",
"nil",
"\n",
"}"
] | // NewBinary creates a new Binary. | [
"NewBinary",
"creates",
"a",
"new",
"Binary",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/binary.go#L38-L40 |
136,198 | vitessio/vitess | go/vt/topo/topoproto/srvkeyspace.go | SrvKeyspaceGetPartition | func SrvKeyspaceGetPartition(sk *topodatapb.SrvKeyspace, tabletType topodatapb.TabletType) *topodatapb.SrvKeyspace_KeyspacePartition {
for _, p := range sk.Partitions {
if p.ServedType == tabletType {
return p
}
}
return nil
} | go | func SrvKeyspaceGetPartition(sk *topodatapb.SrvKeyspace, tabletType topodatapb.TabletType) *topodatapb.SrvKeyspace_KeyspacePartition {
for _, p := range sk.Partitions {
if p.ServedType == tabletType {
return p
}
}
return nil
} | [
"func",
"SrvKeyspaceGetPartition",
"(",
"sk",
"*",
"topodatapb",
".",
"SrvKeyspace",
",",
"tabletType",
"topodatapb",
".",
"TabletType",
")",
"*",
"topodatapb",
".",
"SrvKeyspace_KeyspacePartition",
"{",
"for",
"_",
",",
"p",
":=",
"range",
"sk",
".",
"Partition... | // SrvKeyspaceGetPartition returns a Partition for the given tablet type,
// or nil if it's not there. | [
"SrvKeyspaceGetPartition",
"returns",
"a",
"Partition",
"for",
"the",
"given",
"tablet",
"type",
"or",
"nil",
"if",
"it",
"s",
"not",
"there",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/srvkeyspace.go#L53-L60 |
136,199 | vitessio/vitess | go/vt/sqlparser/normalizer.go | Normalize | func Normalize(stmt Statement, bindVars map[string]*querypb.BindVariable, prefix string) {
nz := newNormalizer(stmt, bindVars, prefix)
_ = Walk(nz.WalkStatement, stmt)
} | go | func Normalize(stmt Statement, bindVars map[string]*querypb.BindVariable, prefix string) {
nz := newNormalizer(stmt, bindVars, prefix)
_ = Walk(nz.WalkStatement, stmt)
} | [
"func",
"Normalize",
"(",
"stmt",
"Statement",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
",",
"prefix",
"string",
")",
"{",
"nz",
":=",
"newNormalizer",
"(",
"stmt",
",",
"bindVars",
",",
"prefix",
")",
"\n",
"_",
... | // Normalize changes the statement to use bind values, and
// updates the bind vars to those values. The supplied prefix
// is used to generate the bind var names. The function ensures
// that there are no collisions with existing bind vars.
// Within Select constructs, bind vars are deduped. This allows
// us to ident... | [
"Normalize",
"changes",
"the",
"statement",
"to",
"use",
"bind",
"values",
"and",
"updates",
"the",
"bind",
"vars",
"to",
"those",
"values",
".",
"The",
"supplied",
"prefix",
"is",
"used",
"to",
"generate",
"the",
"bind",
"var",
"names",
".",
"The",
"funct... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/normalizer.go#L34-L37 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.