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,400 | vitessio/vitess | go/mysql/replication_position.go | AppendGTID | func AppendGTID(rp Position, gtid GTID) Position {
if gtid == nil {
return rp
}
if rp.GTIDSet == nil {
return Position{GTIDSet: gtid.GTIDSet()}
}
return Position{GTIDSet: rp.GTIDSet.AddGTID(gtid)}
} | go | func AppendGTID(rp Position, gtid GTID) Position {
if gtid == nil {
return rp
}
if rp.GTIDSet == nil {
return Position{GTIDSet: gtid.GTIDSet()}
}
return Position{GTIDSet: rp.GTIDSet.AddGTID(gtid)}
} | [
"func",
"AppendGTID",
"(",
"rp",
"Position",
",",
"gtid",
"GTID",
")",
"Position",
"{",
"if",
"gtid",
"==",
"nil",
"{",
"return",
"rp",
"\n",
"}",
"\n",
"if",
"rp",
".",
"GTIDSet",
"==",
"nil",
"{",
"return",
"Position",
"{",
"GTIDSet",
":",
"gtid",
... | // AppendGTID returns a new Position that represents the position
// after the given GTID is replicated. | [
"AppendGTID",
"returns",
"a",
"new",
"Position",
"that",
"represents",
"the",
"position",
"after",
"the",
"given",
"GTID",
"is",
"replicated",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/replication_position.go#L93-L101 |
136,401 | vitessio/vitess | go/mysql/replication_position.go | MustParsePosition | func MustParsePosition(flavor, value string) Position {
rp, err := ParsePosition(flavor, value)
if err != nil {
panic(err)
}
return rp
} | go | func MustParsePosition(flavor, value string) Position {
rp, err := ParsePosition(flavor, value)
if err != nil {
panic(err)
}
return rp
} | [
"func",
"MustParsePosition",
"(",
"flavor",
",",
"value",
"string",
")",
"Position",
"{",
"rp",
",",
"err",
":=",
"ParsePosition",
"(",
"flavor",
",",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"retu... | // MustParsePosition calls ParsePosition and panics
// on error. | [
"MustParsePosition",
"calls",
"ParsePosition",
"and",
"panics",
"on",
"error",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/replication_position.go#L105-L111 |
136,402 | vitessio/vitess | go/mysql/replication_position.go | EncodePosition | func EncodePosition(rp Position) string {
if rp.GTIDSet == nil {
return ""
}
return fmt.Sprintf("%s/%s", rp.GTIDSet.Flavor(), rp.GTIDSet.String())
} | go | func EncodePosition(rp Position) string {
if rp.GTIDSet == nil {
return ""
}
return fmt.Sprintf("%s/%s", rp.GTIDSet.Flavor(), rp.GTIDSet.String())
} | [
"func",
"EncodePosition",
"(",
"rp",
"Position",
")",
"string",
"{",
"if",
"rp",
".",
"GTIDSet",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"rp",
".",
"GTIDSet",
".",
"Flavor",
"(... | // EncodePosition returns a string that contains both the flavor
// and value of the Position, so that the correct parser can be
// selected when that string is passed to DecodePosition. | [
"EncodePosition",
"returns",
"a",
"string",
"that",
"contains",
"both",
"the",
"flavor",
"and",
"value",
"of",
"the",
"Position",
"so",
"that",
"the",
"correct",
"parser",
"can",
"be",
"selected",
"when",
"that",
"string",
"is",
"passed",
"to",
"DecodePosition... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/replication_position.go#L116-L121 |
136,403 | vitessio/vitess | go/mysql/replication_position.go | DecodePosition | func DecodePosition(s string) (rp Position, err error) {
if s == "" {
return rp, nil
}
parts := strings.SplitN(s, "/", 2)
if len(parts) != 2 {
// There is no flavor. Try looking for a default parser.
return ParsePosition("", s)
}
return ParsePosition(parts[0], parts[1])
} | go | func DecodePosition(s string) (rp Position, err error) {
if s == "" {
return rp, nil
}
parts := strings.SplitN(s, "/", 2)
if len(parts) != 2 {
// There is no flavor. Try looking for a default parser.
return ParsePosition("", s)
}
return ParsePosition(parts[0], parts[1])
} | [
"func",
"DecodePosition",
"(",
"s",
"string",
")",
"(",
"rp",
"Position",
",",
"err",
"error",
")",
"{",
"if",
"s",
"==",
"\"",
"\"",
"{",
"return",
"rp",
",",
"nil",
"\n",
"}",
"\n\n",
"parts",
":=",
"strings",
".",
"SplitN",
"(",
"s",
",",
"\""... | // DecodePosition converts a string in the format returned by
// EncodePosition back into a Position value with the
// correct underlying flavor. | [
"DecodePosition",
"converts",
"a",
"string",
"in",
"the",
"format",
"returned",
"by",
"EncodePosition",
"back",
"into",
"a",
"Position",
"value",
"with",
"the",
"correct",
"underlying",
"flavor",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/replication_position.go#L126-L137 |
136,404 | vitessio/vitess | go/mysql/replication_position.go | ParsePosition | func ParsePosition(flavor, value string) (rp Position, err error) {
parser := gtidSetParsers[flavor]
if parser == nil {
return rp, vterrors.Errorf(vtrpc.Code_INTERNAL, "parse error: unknown GTIDSet flavor %#v", flavor)
}
gtidSet, err := parser(value)
if err != nil {
return rp, err
}
rp.GTIDSet = gtidSet
ret... | go | func ParsePosition(flavor, value string) (rp Position, err error) {
parser := gtidSetParsers[flavor]
if parser == nil {
return rp, vterrors.Errorf(vtrpc.Code_INTERNAL, "parse error: unknown GTIDSet flavor %#v", flavor)
}
gtidSet, err := parser(value)
if err != nil {
return rp, err
}
rp.GTIDSet = gtidSet
ret... | [
"func",
"ParsePosition",
"(",
"flavor",
",",
"value",
"string",
")",
"(",
"rp",
"Position",
",",
"err",
"error",
")",
"{",
"parser",
":=",
"gtidSetParsers",
"[",
"flavor",
"]",
"\n",
"if",
"parser",
"==",
"nil",
"{",
"return",
"rp",
",",
"vterrors",
".... | // ParsePosition calls the parser for the specified flavor. | [
"ParsePosition",
"calls",
"the",
"parser",
"for",
"the",
"specified",
"flavor",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/replication_position.go#L140-L151 |
136,405 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/engine.go | Close | func (se *Engine) Close() {
se.mu.Lock()
defer se.mu.Unlock()
if !se.isOpen {
return
}
se.ticks.Stop()
se.conns.Close()
se.tables = make(map[string]*Table)
se.notifiers = make(map[string]notifier)
se.isOpen = false
} | go | func (se *Engine) Close() {
se.mu.Lock()
defer se.mu.Unlock()
if !se.isOpen {
return
}
se.ticks.Stop()
se.conns.Close()
se.tables = make(map[string]*Table)
se.notifiers = make(map[string]notifier)
se.isOpen = false
} | [
"func",
"(",
"se",
"*",
"Engine",
")",
"Close",
"(",
")",
"{",
"se",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"se",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"!",
"se",
".",
"isOpen",
"{",
"return",
"\n",
"}",
"\n",
"se",
".",... | // Close shuts down Engine and is idempotent.
// It can be re-opened after Close. | [
"Close",
"shuts",
"down",
"Engine",
"and",
"is",
"idempotent",
".",
"It",
"can",
"be",
"re",
"-",
"opened",
"after",
"Close",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/engine.go#L195-L206 |
136,406 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/engine.go | MakeNonMaster | func (se *Engine) MakeNonMaster() {
// This function is tested through endtoend test.
se.mu.Lock()
defer se.mu.Unlock()
for _, t := range se.tables {
if t.SequenceInfo != nil {
t.SequenceInfo.Lock()
t.SequenceInfo.NextVal = 0
t.SequenceInfo.LastVal = 0
t.SequenceInfo.Unlock()
}
}
} | go | func (se *Engine) MakeNonMaster() {
// This function is tested through endtoend test.
se.mu.Lock()
defer se.mu.Unlock()
for _, t := range se.tables {
if t.SequenceInfo != nil {
t.SequenceInfo.Lock()
t.SequenceInfo.NextVal = 0
t.SequenceInfo.LastVal = 0
t.SequenceInfo.Unlock()
}
}
} | [
"func",
"(",
"se",
"*",
"Engine",
")",
"MakeNonMaster",
"(",
")",
"{",
"// This function is tested through endtoend test.",
"se",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"se",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"t",
":=... | // MakeNonMaster clears the sequence caches to make sure that
// they don't get accidentally reused after losing mastership. | [
"MakeNonMaster",
"clears",
"the",
"sequence",
"caches",
"to",
"make",
"sure",
"that",
"they",
"don",
"t",
"get",
"accidentally",
"reused",
"after",
"losing",
"mastership",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/engine.go#L210-L222 |
136,407 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/engine.go | Reload | func (se *Engine) Reload(ctx context.Context) error {
se.mu.Lock()
defer se.mu.Unlock()
if !se.isOpen {
return nil
}
defer tabletenv.LogError()
curTime, tableData, err := func() (int64, *sqltypes.Result, error) {
conn, err := se.conns.Get(ctx)
if err != nil {
return 0, nil, err
}
defer conn.Recycle(... | go | func (se *Engine) Reload(ctx context.Context) error {
se.mu.Lock()
defer se.mu.Unlock()
if !se.isOpen {
return nil
}
defer tabletenv.LogError()
curTime, tableData, err := func() (int64, *sqltypes.Result, error) {
conn, err := se.conns.Get(ctx)
if err != nil {
return 0, nil, err
}
defer conn.Recycle(... | [
"func",
"(",
"se",
"*",
"Engine",
")",
"Reload",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"se",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"se",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"!",
"se",
".",
"isOpen",
... | // Reload reloads the schema info from the db.
// Any tables that have changed since the last load are updated.
// This is a no-op if the Engine is closed. | [
"Reload",
"reloads",
"the",
"schema",
"info",
"from",
"the",
"db",
".",
"Any",
"tables",
"that",
"have",
"changed",
"since",
"the",
"last",
"load",
"are",
"updated",
".",
"This",
"is",
"a",
"no",
"-",
"op",
"if",
"the",
"Engine",
"is",
"closed",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/engine.go#L227-L290 |
136,408 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/engine.go | tableWasCreatedOrAltered | func (se *Engine) tableWasCreatedOrAltered(ctx context.Context, tableName string) error {
if !se.isOpen {
return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "DDL called on closed schema")
}
conn, err := se.conns.Get(ctx)
if err != nil {
return err
}
defer conn.Recycle()
tableData, err := conn.Exec(ctx, mysql.Bas... | go | func (se *Engine) tableWasCreatedOrAltered(ctx context.Context, tableName string) error {
if !se.isOpen {
return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "DDL called on closed schema")
}
conn, err := se.conns.Get(ctx)
if err != nil {
return err
}
defer conn.Recycle()
tableData, err := conn.Exec(ctx, mysql.Bas... | [
"func",
"(",
"se",
"*",
"Engine",
")",
"tableWasCreatedOrAltered",
"(",
"ctx",
"context",
".",
"Context",
",",
"tableName",
"string",
")",
"error",
"{",
"if",
"!",
"se",
".",
"isOpen",
"{",
"return",
"vterrors",
".",
"Errorf",
"(",
"vtrpcpb",
".",
"Code_... | // tableWasCreatedOrAltered must be called if a DDL was applied to that table.
// the se.mu mutex _must_ be locked before entering this method | [
"tableWasCreatedOrAltered",
"must",
"be",
"called",
"if",
"a",
"DDL",
"was",
"applied",
"to",
"that",
"table",
".",
"the",
"se",
".",
"mu",
"mutex",
"_must_",
"be",
"locked",
"before",
"entering",
"this",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/engine.go#L309-L356 |
136,409 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/engine.go | RegisterNotifier | func (se *Engine) RegisterNotifier(name string, f notifier) {
se.mu.Lock()
defer se.mu.Unlock()
if !se.isOpen {
return
}
se.notifiers[name] = f
var created []string
for tableName := range se.tables {
created = append(created, tableName)
}
f(se.tables, created, nil, nil)
} | go | func (se *Engine) RegisterNotifier(name string, f notifier) {
se.mu.Lock()
defer se.mu.Unlock()
if !se.isOpen {
return
}
se.notifiers[name] = f
var created []string
for tableName := range se.tables {
created = append(created, tableName)
}
f(se.tables, created, nil, nil)
} | [
"func",
"(",
"se",
"*",
"Engine",
")",
"RegisterNotifier",
"(",
"name",
"string",
",",
"f",
"notifier",
")",
"{",
"se",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"se",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"!",
"se",
".",
"isOp... | // RegisterNotifier registers the function for schema change notification.
// It also causes an immediate notification to the caller. The notified
// function must not change the map or its contents. The only exception
// is the sequence table where the values can be changed using the lock. | [
"RegisterNotifier",
"registers",
"the",
"function",
"for",
"schema",
"change",
"notification",
".",
"It",
"also",
"causes",
"an",
"immediate",
"notification",
"to",
"the",
"caller",
".",
"The",
"notified",
"function",
"must",
"not",
"change",
"the",
"map",
"or",... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/engine.go#L362-L375 |
136,410 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/engine.go | UnregisterNotifier | func (se *Engine) UnregisterNotifier(name string) {
se.mu.Lock()
defer se.mu.Unlock()
if !se.isOpen {
return
}
delete(se.notifiers, name)
} | go | func (se *Engine) UnregisterNotifier(name string) {
se.mu.Lock()
defer se.mu.Unlock()
if !se.isOpen {
return
}
delete(se.notifiers, name)
} | [
"func",
"(",
"se",
"*",
"Engine",
")",
"UnregisterNotifier",
"(",
"name",
"string",
")",
"{",
"se",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"se",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"!",
"se",
".",
"isOpen",
"{",
"return",
... | // UnregisterNotifier unregisters the notifier function. | [
"UnregisterNotifier",
"unregisters",
"the",
"notifier",
"function",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/engine.go#L378-L386 |
136,411 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/engine.go | broadcast | func (se *Engine) broadcast(created, altered, dropped []string) {
s := make(map[string]*Table, len(se.tables))
for k, v := range se.tables {
s[k] = v
}
for _, f := range se.notifiers {
f(s, created, altered, dropped)
}
} | go | func (se *Engine) broadcast(created, altered, dropped []string) {
s := make(map[string]*Table, len(se.tables))
for k, v := range se.tables {
s[k] = v
}
for _, f := range se.notifiers {
f(s, created, altered, dropped)
}
} | [
"func",
"(",
"se",
"*",
"Engine",
")",
"broadcast",
"(",
"created",
",",
"altered",
",",
"dropped",
"[",
"]",
"string",
")",
"{",
"s",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"Table",
",",
"len",
"(",
"se",
".",
"tables",
")",
")",
"... | // broadcast must be called while holding a lock on se.mu. | [
"broadcast",
"must",
"be",
"called",
"while",
"holding",
"a",
"lock",
"on",
"se",
".",
"mu",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/engine.go#L389-L397 |
136,412 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/engine.go | GetTable | func (se *Engine) GetTable(tableName sqlparser.TableIdent) *Table {
se.mu.Lock()
defer se.mu.Unlock()
return se.tables[tableName.String()]
} | go | func (se *Engine) GetTable(tableName sqlparser.TableIdent) *Table {
se.mu.Lock()
defer se.mu.Unlock()
return se.tables[tableName.String()]
} | [
"func",
"(",
"se",
"*",
"Engine",
")",
"GetTable",
"(",
"tableName",
"sqlparser",
".",
"TableIdent",
")",
"*",
"Table",
"{",
"se",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"se",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"se",
".... | // GetTable returns the info for a table. | [
"GetTable",
"returns",
"the",
"info",
"for",
"a",
"table",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/engine.go#L400-L404 |
136,413 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/engine.go | GetSchema | func (se *Engine) GetSchema() map[string]*Table {
se.mu.Lock()
defer se.mu.Unlock()
tables := make(map[string]*Table, len(se.tables))
for k, v := range se.tables {
tables[k] = v
}
return tables
} | go | func (se *Engine) GetSchema() map[string]*Table {
se.mu.Lock()
defer se.mu.Unlock()
tables := make(map[string]*Table, len(se.tables))
for k, v := range se.tables {
tables[k] = v
}
return tables
} | [
"func",
"(",
"se",
"*",
"Engine",
")",
"GetSchema",
"(",
")",
"map",
"[",
"string",
"]",
"*",
"Table",
"{",
"se",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"se",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"tables",
":=",
"make",
"(",
"m... | // GetSchema returns the current The Tables are a shared
// data structure and must be treated as read-only. | [
"GetSchema",
"returns",
"the",
"current",
"The",
"Tables",
"are",
"a",
"shared",
"data",
"structure",
"and",
"must",
"be",
"treated",
"as",
"read",
"-",
"only",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/engine.go#L408-L416 |
136,414 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/engine.go | SetReloadTime | func (se *Engine) SetReloadTime(reloadTime time.Duration) {
se.mu.Lock()
defer se.mu.Unlock()
se.ticks.Trigger()
se.ticks.SetInterval(reloadTime)
se.reloadTime = reloadTime
} | go | func (se *Engine) SetReloadTime(reloadTime time.Duration) {
se.mu.Lock()
defer se.mu.Unlock()
se.ticks.Trigger()
se.ticks.SetInterval(reloadTime)
se.reloadTime = reloadTime
} | [
"func",
"(",
"se",
"*",
"Engine",
")",
"SetReloadTime",
"(",
"reloadTime",
"time",
".",
"Duration",
")",
"{",
"se",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"se",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"se",
".",
"ticks",
".",
"Trigger... | // SetReloadTime changes how often the schema is reloaded. This
// call also triggers an immediate reload. | [
"SetReloadTime",
"changes",
"how",
"often",
"the",
"schema",
"is",
"reloaded",
".",
"This",
"call",
"also",
"triggers",
"an",
"immediate",
"reload",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/engine.go#L420-L426 |
136,415 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/engine.go | ReloadTime | func (se *Engine) ReloadTime() time.Duration {
se.mu.Lock()
defer se.mu.Unlock()
return se.reloadTime
} | go | func (se *Engine) ReloadTime() time.Duration {
se.mu.Lock()
defer se.mu.Unlock()
return se.reloadTime
} | [
"func",
"(",
"se",
"*",
"Engine",
")",
"ReloadTime",
"(",
")",
"time",
".",
"Duration",
"{",
"se",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"se",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"se",
".",
"reloadTime",
"\n",
"}"
] | // ReloadTime returns schema info reload time. | [
"ReloadTime",
"returns",
"schema",
"info",
"reload",
"time",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/engine.go#L429-L433 |
136,416 | vitessio/vitess | go/vt/vtgate/buffer/flags.go | setToString | func setToString(set map[string]bool) string {
result := ""
for item := range set {
if result != "" {
result += ", "
}
result += item
}
return result
} | go | func setToString(set map[string]bool) string {
result := ""
for item := range set {
if result != "" {
result += ", "
}
result += item
}
return result
} | [
"func",
"setToString",
"(",
"set",
"map",
"[",
"string",
"]",
"bool",
")",
"string",
"{",
"result",
":=",
"\"",
"\"",
"\n",
"for",
"item",
":=",
"range",
"set",
"{",
"if",
"result",
"!=",
"\"",
"\"",
"{",
"result",
"+=",
"\"",
"\"",
"\n",
"}",
"\... | // setToString joins the set to a ", " separated string. | [
"setToString",
"joins",
"the",
"set",
"to",
"a",
"separated",
"string",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/buffer/flags.go#L114-L123 |
136,417 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | withCallerIDContext | func withCallerIDContext(ctx context.Context, effectiveCallerID *vtrpcpb.CallerID) context.Context {
immediate, dnsNames := immediateCallerID(ctx)
if immediate == "" && *useEffective && effectiveCallerID != nil {
immediate = effectiveCallerID.Principal
}
if immediate == "" {
immediate = unsecureClient
}
retur... | go | func withCallerIDContext(ctx context.Context, effectiveCallerID *vtrpcpb.CallerID) context.Context {
immediate, dnsNames := immediateCallerID(ctx)
if immediate == "" && *useEffective && effectiveCallerID != nil {
immediate = effectiveCallerID.Principal
}
if immediate == "" {
immediate = unsecureClient
}
retur... | [
"func",
"withCallerIDContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"effectiveCallerID",
"*",
"vtrpcpb",
".",
"CallerID",
")",
"context",
".",
"Context",
"{",
"immediate",
",",
"dnsNames",
":=",
"immediateCallerID",
"(",
"ctx",
")",
"\n",
"if",
"immedia... | // withCallerIDContext creates a context that extracts what we need
// from the incoming call and can be forwarded for use when talking to vttablet. | [
"withCallerIDContext",
"creates",
"a",
"context",
"that",
"extracts",
"what",
"we",
"need",
"from",
"the",
"incoming",
"call",
"and",
"can",
"be",
"forwarded",
"for",
"use",
"when",
"talking",
"to",
"vttablet",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L87-L98 |
136,418 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | Execute | func (vtg *VTGate) Execute(ctx context.Context, request *vtgatepb.ExecuteRequest) (response *vtgatepb.ExecuteResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
// Handle backward compatibility.
session := request.Session
if session == nil {
session = &vtga... | go | func (vtg *VTGate) Execute(ctx context.Context, request *vtgatepb.ExecuteRequest) (response *vtgatepb.ExecuteResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
// Handle backward compatibility.
session := request.Session
if session == nil {
session = &vtga... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"Execute",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"vtgatepb",
".",
"ExecuteRequest",
")",
"(",
"response",
"*",
"vtgatepb",
".",
"ExecuteResponse",
",",
"err",
"error",
")",
"{",
"defer",
"vtg"... | // Execute is the RPC version of vtgateservice.VTGateService method | [
"Execute",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L101-L122 |
136,419 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | ExecuteBatch | func (vtg *VTGate) ExecuteBatch(ctx context.Context, request *vtgatepb.ExecuteBatchRequest) (response *vtgatepb.ExecuteBatchResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
sqlQueries := make([]string, len(request.Queries))
bindVars := make([]map[string]*que... | go | func (vtg *VTGate) ExecuteBatch(ctx context.Context, request *vtgatepb.ExecuteBatchRequest) (response *vtgatepb.ExecuteBatchResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
sqlQueries := make([]string, len(request.Queries))
bindVars := make([]map[string]*que... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"ExecuteBatch",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"vtgatepb",
".",
"ExecuteBatchRequest",
")",
"(",
"response",
"*",
"vtgatepb",
".",
"ExecuteBatchResponse",
",",
"err",
"error",
")",
"{",
"... | // ExecuteBatch is the RPC version of vtgateservice.VTGateService method | [
"ExecuteBatch",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L125-L151 |
136,420 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | StreamExecute | func (vtg *VTGate) StreamExecute(request *vtgatepb.StreamExecuteRequest, stream vtgateservicepb.Vitess_StreamExecuteServer) (err error) {
defer vtg.server.HandlePanic(&err)
ctx := withCallerIDContext(stream.Context(), request.CallerId)
// Handle backward compatibility.
session := request.Session
if session == nil... | go | func (vtg *VTGate) StreamExecute(request *vtgatepb.StreamExecuteRequest, stream vtgateservicepb.Vitess_StreamExecuteServer) (err error) {
defer vtg.server.HandlePanic(&err)
ctx := withCallerIDContext(stream.Context(), request.CallerId)
// Handle backward compatibility.
session := request.Session
if session == nil... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"StreamExecute",
"(",
"request",
"*",
"vtgatepb",
".",
"StreamExecuteRequest",
",",
"stream",
"vtgateservicepb",
".",
"Vitess_StreamExecuteServer",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"vtg",
".",
"server",
".",
... | // StreamExecute is the RPC version of vtgateservice.VTGateService method | [
"StreamExecute",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L154-L177 |
136,421 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | ExecuteShards | func (vtg *VTGate) ExecuteShards(ctx context.Context, request *vtgatepb.ExecuteShardsRequest) (response *vtgatepb.ExecuteShardsResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
result, err := vtg.server.ExecuteShards(ctx,
request.Query.Sql,
request.Query.B... | go | func (vtg *VTGate) ExecuteShards(ctx context.Context, request *vtgatepb.ExecuteShardsRequest) (response *vtgatepb.ExecuteShardsResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
result, err := vtg.server.ExecuteShards(ctx,
request.Query.Sql,
request.Query.B... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"ExecuteShards",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"vtgatepb",
".",
"ExecuteShardsRequest",
")",
"(",
"response",
"*",
"vtgatepb",
".",
"ExecuteShardsResponse",
",",
"err",
"error",
")",
"{",
... | // ExecuteShards is the RPC version of vtgateservice.VTGateService method | [
"ExecuteShards",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L180-L197 |
136,422 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | ExecuteKeyspaceIds | func (vtg *VTGate) ExecuteKeyspaceIds(ctx context.Context, request *vtgatepb.ExecuteKeyspaceIdsRequest) (response *vtgatepb.ExecuteKeyspaceIdsResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
result, err := vtg.server.ExecuteKeyspaceIds(ctx,
request.Query.Sq... | go | func (vtg *VTGate) ExecuteKeyspaceIds(ctx context.Context, request *vtgatepb.ExecuteKeyspaceIdsRequest) (response *vtgatepb.ExecuteKeyspaceIdsResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
result, err := vtg.server.ExecuteKeyspaceIds(ctx,
request.Query.Sq... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"ExecuteKeyspaceIds",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"vtgatepb",
".",
"ExecuteKeyspaceIdsRequest",
")",
"(",
"response",
"*",
"vtgatepb",
".",
"ExecuteKeyspaceIdsResponse",
",",
"err",
"error",... | // ExecuteKeyspaceIds is the RPC version of vtgateservice.VTGateService method | [
"ExecuteKeyspaceIds",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L200-L217 |
136,423 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | ExecuteKeyRanges | func (vtg *VTGate) ExecuteKeyRanges(ctx context.Context, request *vtgatepb.ExecuteKeyRangesRequest) (response *vtgatepb.ExecuteKeyRangesResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
result, err := vtg.server.ExecuteKeyRanges(ctx,
request.Query.Sql,
req... | go | func (vtg *VTGate) ExecuteKeyRanges(ctx context.Context, request *vtgatepb.ExecuteKeyRangesRequest) (response *vtgatepb.ExecuteKeyRangesResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
result, err := vtg.server.ExecuteKeyRanges(ctx,
request.Query.Sql,
req... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"ExecuteKeyRanges",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"vtgatepb",
".",
"ExecuteKeyRangesRequest",
")",
"(",
"response",
"*",
"vtgatepb",
".",
"ExecuteKeyRangesResponse",
",",
"err",
"error",
")"... | // ExecuteKeyRanges is the RPC version of vtgateservice.VTGateService method | [
"ExecuteKeyRanges",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L220-L237 |
136,424 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | ExecuteEntityIds | func (vtg *VTGate) ExecuteEntityIds(ctx context.Context, request *vtgatepb.ExecuteEntityIdsRequest) (response *vtgatepb.ExecuteEntityIdsResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
result, err := vtg.server.ExecuteEntityIds(ctx,
request.Query.Sql,
req... | go | func (vtg *VTGate) ExecuteEntityIds(ctx context.Context, request *vtgatepb.ExecuteEntityIdsRequest) (response *vtgatepb.ExecuteEntityIdsResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
result, err := vtg.server.ExecuteEntityIds(ctx,
request.Query.Sql,
req... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"ExecuteEntityIds",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"vtgatepb",
".",
"ExecuteEntityIdsRequest",
")",
"(",
"response",
"*",
"vtgatepb",
".",
"ExecuteEntityIdsResponse",
",",
"err",
"error",
")"... | // ExecuteEntityIds is the RPC version of vtgateservice.VTGateService method | [
"ExecuteEntityIds",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L240-L258 |
136,425 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | ExecuteBatchKeyspaceIds | func (vtg *VTGate) ExecuteBatchKeyspaceIds(ctx context.Context, request *vtgatepb.ExecuteBatchKeyspaceIdsRequest) (response *vtgatepb.ExecuteBatchKeyspaceIdsResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
result, err := vtg.server.ExecuteBatchKeyspaceIds(ctx... | go | func (vtg *VTGate) ExecuteBatchKeyspaceIds(ctx context.Context, request *vtgatepb.ExecuteBatchKeyspaceIdsRequest) (response *vtgatepb.ExecuteBatchKeyspaceIdsResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
result, err := vtg.server.ExecuteBatchKeyspaceIds(ctx... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"ExecuteBatchKeyspaceIds",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"vtgatepb",
".",
"ExecuteBatchKeyspaceIdsRequest",
")",
"(",
"response",
"*",
"vtgatepb",
".",
"ExecuteBatchKeyspaceIdsResponse",
",",
"e... | // ExecuteBatchKeyspaceIds is the RPC version of
// vtgateservice.VTGateService method | [
"ExecuteBatchKeyspaceIds",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L279-L293 |
136,426 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | StreamExecuteShards | func (vtg *VTGate) StreamExecuteShards(request *vtgatepb.StreamExecuteShardsRequest, stream vtgateservicepb.Vitess_StreamExecuteShardsServer) (err error) {
defer vtg.server.HandlePanic(&err)
ctx := withCallerIDContext(stream.Context(), request.CallerId)
vtgErr := vtg.server.StreamExecuteShards(ctx,
request.Query.S... | go | func (vtg *VTGate) StreamExecuteShards(request *vtgatepb.StreamExecuteShardsRequest, stream vtgateservicepb.Vitess_StreamExecuteShardsServer) (err error) {
defer vtg.server.HandlePanic(&err)
ctx := withCallerIDContext(stream.Context(), request.CallerId)
vtgErr := vtg.server.StreamExecuteShards(ctx,
request.Query.S... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"StreamExecuteShards",
"(",
"request",
"*",
"vtgatepb",
".",
"StreamExecuteShardsRequest",
",",
"stream",
"vtgateservicepb",
".",
"Vitess_StreamExecuteShardsServer",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"vtg",
".",
... | // StreamExecuteShards is the RPC version of vtgateservice.VTGateService method | [
"StreamExecuteShards",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L296-L314 |
136,427 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | StreamExecuteKeyspaceIds | func (vtg *VTGate) StreamExecuteKeyspaceIds(request *vtgatepb.StreamExecuteKeyspaceIdsRequest, stream vtgateservicepb.Vitess_StreamExecuteKeyspaceIdsServer) (err error) {
defer vtg.server.HandlePanic(&err)
ctx := withCallerIDContext(stream.Context(), request.CallerId)
vtgErr := vtg.server.StreamExecuteKeyspaceIds(ct... | go | func (vtg *VTGate) StreamExecuteKeyspaceIds(request *vtgatepb.StreamExecuteKeyspaceIdsRequest, stream vtgateservicepb.Vitess_StreamExecuteKeyspaceIdsServer) (err error) {
defer vtg.server.HandlePanic(&err)
ctx := withCallerIDContext(stream.Context(), request.CallerId)
vtgErr := vtg.server.StreamExecuteKeyspaceIds(ct... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"StreamExecuteKeyspaceIds",
"(",
"request",
"*",
"vtgatepb",
".",
"StreamExecuteKeyspaceIdsRequest",
",",
"stream",
"vtgateservicepb",
".",
"Vitess_StreamExecuteKeyspaceIdsServer",
")",
"(",
"err",
"error",
")",
"{",
"defer",
... | // StreamExecuteKeyspaceIds is the RPC version of
// vtgateservice.VTGateService method | [
"StreamExecuteKeyspaceIds",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L318-L336 |
136,428 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | StreamExecuteKeyRanges | func (vtg *VTGate) StreamExecuteKeyRanges(request *vtgatepb.StreamExecuteKeyRangesRequest, stream vtgateservicepb.Vitess_StreamExecuteKeyRangesServer) (err error) {
defer vtg.server.HandlePanic(&err)
ctx := withCallerIDContext(stream.Context(), request.CallerId)
vtgErr := vtg.server.StreamExecuteKeyRanges(ctx,
req... | go | func (vtg *VTGate) StreamExecuteKeyRanges(request *vtgatepb.StreamExecuteKeyRangesRequest, stream vtgateservicepb.Vitess_StreamExecuteKeyRangesServer) (err error) {
defer vtg.server.HandlePanic(&err)
ctx := withCallerIDContext(stream.Context(), request.CallerId)
vtgErr := vtg.server.StreamExecuteKeyRanges(ctx,
req... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"StreamExecuteKeyRanges",
"(",
"request",
"*",
"vtgatepb",
".",
"StreamExecuteKeyRangesRequest",
",",
"stream",
"vtgateservicepb",
".",
"Vitess_StreamExecuteKeyRangesServer",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"vtg",... | // StreamExecuteKeyRanges is the RPC version of
// vtgateservice.VTGateService method | [
"StreamExecuteKeyRanges",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L340-L358 |
136,429 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | Begin | func (vtg *VTGate) Begin(ctx context.Context, request *vtgatepb.BeginRequest) (response *vtgatepb.BeginResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
session, vtgErr := vtg.server.Begin(ctx, request.SingleDb)
if vtgErr == nil {
return &vtgatepb.BeginResp... | go | func (vtg *VTGate) Begin(ctx context.Context, request *vtgatepb.BeginRequest) (response *vtgatepb.BeginResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
session, vtgErr := vtg.server.Begin(ctx, request.SingleDb)
if vtgErr == nil {
return &vtgatepb.BeginResp... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"Begin",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"vtgatepb",
".",
"BeginRequest",
")",
"(",
"response",
"*",
"vtgatepb",
".",
"BeginResponse",
",",
"err",
"error",
")",
"{",
"defer",
"vtg",
".... | // Begin is the RPC version of vtgateservice.VTGateService method | [
"Begin",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L361-L371 |
136,430 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | Commit | func (vtg *VTGate) Commit(ctx context.Context, request *vtgatepb.CommitRequest) (response *vtgatepb.CommitResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
vtgErr := vtg.server.Commit(ctx, request.Atomic, request.Session)
response = &vtgatepb.CommitResponse{}... | go | func (vtg *VTGate) Commit(ctx context.Context, request *vtgatepb.CommitRequest) (response *vtgatepb.CommitResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
vtgErr := vtg.server.Commit(ctx, request.Atomic, request.Session)
response = &vtgatepb.CommitResponse{}... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"Commit",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"vtgatepb",
".",
"CommitRequest",
")",
"(",
"response",
"*",
"vtgatepb",
".",
"CommitResponse",
",",
"err",
"error",
")",
"{",
"defer",
"vtg",
... | // Commit is the RPC version of vtgateservice.VTGateService method | [
"Commit",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L374-L383 |
136,431 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | Rollback | func (vtg *VTGate) Rollback(ctx context.Context, request *vtgatepb.RollbackRequest) (response *vtgatepb.RollbackResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
vtgErr := vtg.server.Rollback(ctx, request.Session)
response = &vtgatepb.RollbackResponse{}
if v... | go | func (vtg *VTGate) Rollback(ctx context.Context, request *vtgatepb.RollbackRequest) (response *vtgatepb.RollbackResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
vtgErr := vtg.server.Rollback(ctx, request.Session)
response = &vtgatepb.RollbackResponse{}
if v... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"Rollback",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"vtgatepb",
".",
"RollbackRequest",
")",
"(",
"response",
"*",
"vtgatepb",
".",
"RollbackResponse",
",",
"err",
"error",
")",
"{",
"defer",
"v... | // Rollback is the RPC version of vtgateservice.VTGateService method | [
"Rollback",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L386-L395 |
136,432 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | ResolveTransaction | func (vtg *VTGate) ResolveTransaction(ctx context.Context, request *vtgatepb.ResolveTransactionRequest) (response *vtgatepb.ResolveTransactionResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
vtgErr := vtg.server.ResolveTransaction(ctx, request.Dtid)
response... | go | func (vtg *VTGate) ResolveTransaction(ctx context.Context, request *vtgatepb.ResolveTransactionRequest) (response *vtgatepb.ResolveTransactionResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
vtgErr := vtg.server.ResolveTransaction(ctx, request.Dtid)
response... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"ResolveTransaction",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"vtgatepb",
".",
"ResolveTransactionRequest",
")",
"(",
"response",
"*",
"vtgatepb",
".",
"ResolveTransactionResponse",
",",
"err",
"error",... | // ResolveTransaction is the RPC version of vtgateservice.VTGateService method | [
"ResolveTransaction",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L398-L407 |
136,433 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | MessageStream | func (vtg *VTGate) MessageStream(request *vtgatepb.MessageStreamRequest, stream vtgateservicepb.Vitess_MessageStreamServer) (err error) {
defer vtg.server.HandlePanic(&err)
ctx := withCallerIDContext(stream.Context(), request.CallerId)
vtgErr := vtg.server.MessageStream(ctx, request.Keyspace, request.Shard, request.... | go | func (vtg *VTGate) MessageStream(request *vtgatepb.MessageStreamRequest, stream vtgateservicepb.Vitess_MessageStreamServer) (err error) {
defer vtg.server.HandlePanic(&err)
ctx := withCallerIDContext(stream.Context(), request.CallerId)
vtgErr := vtg.server.MessageStream(ctx, request.Keyspace, request.Shard, request.... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"MessageStream",
"(",
"request",
"*",
"vtgatepb",
".",
"MessageStreamRequest",
",",
"stream",
"vtgateservicepb",
".",
"Vitess_MessageStreamServer",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"vtg",
".",
"server",
".",
... | // MessageStream is the RPC version of vtgateservice.VTGateService method | [
"MessageStream",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L410-L421 |
136,434 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | MessageAck | func (vtg *VTGate) MessageAck(ctx context.Context, request *vtgatepb.MessageAckRequest) (response *querypb.MessageAckResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
count, vtgErr := vtg.server.MessageAck(ctx, request.Keyspace, request.Name, request.Ids)
if ... | go | func (vtg *VTGate) MessageAck(ctx context.Context, request *vtgatepb.MessageAckRequest) (response *querypb.MessageAckResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
count, vtgErr := vtg.server.MessageAck(ctx, request.Keyspace, request.Name, request.Ids)
if ... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"MessageAck",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"vtgatepb",
".",
"MessageAckRequest",
")",
"(",
"response",
"*",
"querypb",
".",
"MessageAckResponse",
",",
"err",
"error",
")",
"{",
"defer",... | // MessageAck is the RPC version of vtgateservice.VTGateService method | [
"MessageAck",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L424-L436 |
136,435 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | SplitQuery | func (vtg *VTGate) SplitQuery(ctx context.Context, request *vtgatepb.SplitQueryRequest) (response *vtgatepb.SplitQueryResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
splits, vtgErr := vtg.server.SplitQuery(
ctx,
request.Keyspace,
request.Query.Sql,
... | go | func (vtg *VTGate) SplitQuery(ctx context.Context, request *vtgatepb.SplitQueryRequest) (response *vtgatepb.SplitQueryResponse, err error) {
defer vtg.server.HandlePanic(&err)
ctx = withCallerIDContext(ctx, request.CallerId)
splits, vtgErr := vtg.server.SplitQuery(
ctx,
request.Keyspace,
request.Query.Sql,
... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"SplitQuery",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"vtgatepb",
".",
"SplitQueryRequest",
")",
"(",
"response",
"*",
"vtgatepb",
".",
"SplitQueryResponse",
",",
"err",
"error",
")",
"{",
"defer"... | // SplitQuery is the RPC version of vtgateservice.VTGateService method | [
"SplitQuery",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L455-L474 |
136,436 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | GetSrvKeyspace | func (vtg *VTGate) GetSrvKeyspace(ctx context.Context, request *vtgatepb.GetSrvKeyspaceRequest) (response *vtgatepb.GetSrvKeyspaceResponse, err error) {
defer vtg.server.HandlePanic(&err)
sk, vtgErr := vtg.server.GetSrvKeyspace(ctx, request.Keyspace)
if vtgErr != nil {
return nil, vterrors.ToGRPC(vtgErr)
}
retur... | go | func (vtg *VTGate) GetSrvKeyspace(ctx context.Context, request *vtgatepb.GetSrvKeyspaceRequest) (response *vtgatepb.GetSrvKeyspaceResponse, err error) {
defer vtg.server.HandlePanic(&err)
sk, vtgErr := vtg.server.GetSrvKeyspace(ctx, request.Keyspace)
if vtgErr != nil {
return nil, vterrors.ToGRPC(vtgErr)
}
retur... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"GetSrvKeyspace",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"vtgatepb",
".",
"GetSrvKeyspaceRequest",
")",
"(",
"response",
"*",
"vtgatepb",
".",
"GetSrvKeyspaceResponse",
",",
"err",
"error",
")",
"{... | // GetSrvKeyspace is the RPC version of vtgateservice.VTGateService method | [
"GetSrvKeyspace",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L477-L486 |
136,437 | vitessio/vitess | go/vt/vtgate/grpcvtgateservice/server.go | UpdateStream | func (vtg *VTGate) UpdateStream(request *vtgatepb.UpdateStreamRequest, stream vtgateservicepb.Vitess_UpdateStreamServer) (err error) {
defer vtg.server.HandlePanic(&err)
ctx := withCallerIDContext(stream.Context(), request.CallerId)
vtgErr := vtg.server.UpdateStream(ctx,
request.Keyspace,
request.Shard,
reques... | go | func (vtg *VTGate) UpdateStream(request *vtgatepb.UpdateStreamRequest, stream vtgateservicepb.Vitess_UpdateStreamServer) (err error) {
defer vtg.server.HandlePanic(&err)
ctx := withCallerIDContext(stream.Context(), request.CallerId)
vtgErr := vtg.server.UpdateStream(ctx,
request.Keyspace,
request.Shard,
reques... | [
"func",
"(",
"vtg",
"*",
"VTGate",
")",
"UpdateStream",
"(",
"request",
"*",
"vtgatepb",
".",
"UpdateStreamRequest",
",",
"stream",
"vtgateservicepb",
".",
"Vitess_UpdateStreamServer",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"vtg",
".",
"server",
".",
"... | // UpdateStream is the RPC version of vtgateservice.VTGateService method | [
"UpdateStream",
"is",
"the",
"RPC",
"version",
"of",
"vtgateservice",
".",
"VTGateService",
"method"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L489-L508 |
136,438 | vitessio/vitess | go/vt/dbconnpool/connection.go | ExecuteFetch | func (dbc *DBConnection) ExecuteFetch(query string, maxrows int, wantfields bool) (*sqltypes.Result, error) {
defer dbc.mysqlStats.Record("Exec", time.Now())
mqr, err := dbc.Conn.ExecuteFetch(query, maxrows, wantfields)
if err != nil {
dbc.handleError(err)
return nil, err
}
return mqr, nil
} | go | func (dbc *DBConnection) ExecuteFetch(query string, maxrows int, wantfields bool) (*sqltypes.Result, error) {
defer dbc.mysqlStats.Record("Exec", time.Now())
mqr, err := dbc.Conn.ExecuteFetch(query, maxrows, wantfields)
if err != nil {
dbc.handleError(err)
return nil, err
}
return mqr, nil
} | [
"func",
"(",
"dbc",
"*",
"DBConnection",
")",
"ExecuteFetch",
"(",
"query",
"string",
",",
"maxrows",
"int",
",",
"wantfields",
"bool",
")",
"(",
"*",
"sqltypes",
".",
"Result",
",",
"error",
")",
"{",
"defer",
"dbc",
".",
"mysqlStats",
".",
"Record",
... | // ExecuteFetch overwrites mysql.Conn.ExecuteFetch. | [
"ExecuteFetch",
"overwrites",
"mysql",
".",
"Conn",
".",
"ExecuteFetch",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/dbconnpool/connection.go#L46-L54 |
136,439 | vitessio/vitess | go/vt/dbconnpool/connection.go | ExecuteStreamFetch | func (dbc *DBConnection) ExecuteStreamFetch(query string, callback func(*sqltypes.Result) error, streamBufferSize int) error {
defer dbc.mysqlStats.Record("ExecStream", time.Now())
err := dbc.Conn.ExecuteStreamFetch(query)
if err != nil {
dbc.handleError(err)
return err
}
defer dbc.CloseResult()
// first ca... | go | func (dbc *DBConnection) ExecuteStreamFetch(query string, callback func(*sqltypes.Result) error, streamBufferSize int) error {
defer dbc.mysqlStats.Record("ExecStream", time.Now())
err := dbc.Conn.ExecuteStreamFetch(query)
if err != nil {
dbc.handleError(err)
return err
}
defer dbc.CloseResult()
// first ca... | [
"func",
"(",
"dbc",
"*",
"DBConnection",
")",
"ExecuteStreamFetch",
"(",
"query",
"string",
",",
"callback",
"func",
"(",
"*",
"sqltypes",
".",
"Result",
")",
"error",
",",
"streamBufferSize",
"int",
")",
"error",
"{",
"defer",
"dbc",
".",
"mysqlStats",
".... | // ExecuteStreamFetch overwrites mysql.Conn.ExecuteStreamFetch. | [
"ExecuteStreamFetch",
"overwrites",
"mysql",
".",
"Conn",
".",
"ExecuteStreamFetch",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/dbconnpool/connection.go#L57-L115 |
136,440 | vitessio/vitess | go/vt/dbconnpool/connection.go | NewDBConnection | func NewDBConnection(info *mysql.ConnParams, mysqlStats *stats.Timings) (*DBConnection, error) {
start := time.Now()
defer mysqlStats.Record("Connect", start)
params, err := dbconfigs.WithCredentials(info)
if err != nil {
return nil, err
}
ctx := context.Background()
c, err := mysql.Connect(ctx, params)
if er... | go | func NewDBConnection(info *mysql.ConnParams, mysqlStats *stats.Timings) (*DBConnection, error) {
start := time.Now()
defer mysqlStats.Record("Connect", start)
params, err := dbconfigs.WithCredentials(info)
if err != nil {
return nil, err
}
ctx := context.Background()
c, err := mysql.Connect(ctx, params)
if er... | [
"func",
"NewDBConnection",
"(",
"info",
"*",
"mysql",
".",
"ConnParams",
",",
"mysqlStats",
"*",
"stats",
".",
"Timings",
")",
"(",
"*",
"DBConnection",
",",
"error",
")",
"{",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"defer",
"mysqlStats",
"... | // NewDBConnection returns a new DBConnection based on the ConnParams
// and will use the provided stats to collect timing. | [
"NewDBConnection",
"returns",
"a",
"new",
"DBConnection",
"based",
"on",
"the",
"ConnParams",
"and",
"will",
"use",
"the",
"provided",
"stats",
"to",
"collect",
"timing",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/dbconnpool/connection.go#L119-L132 |
136,441 | vitessio/vitess | go/vt/vtgate/buffer/timeout_thread.go | waitForEntry | func (tt *timeoutThread) waitForEntry(e *entry) bool {
windowExceeded := time.NewTimer(time.Until(e.deadline))
defer windowExceeded.Stop()
select {
// a) Always check these channels, regardless of the state.
case <-tt.maxDuration.C:
// Max duration is up. Stop buffering. Do not error out entries explicitly.
t... | go | func (tt *timeoutThread) waitForEntry(e *entry) bool {
windowExceeded := time.NewTimer(time.Until(e.deadline))
defer windowExceeded.Stop()
select {
// a) Always check these channels, regardless of the state.
case <-tt.maxDuration.C:
// Max duration is up. Stop buffering. Do not error out entries explicitly.
t... | [
"func",
"(",
"tt",
"*",
"timeoutThread",
")",
"waitForEntry",
"(",
"e",
"*",
"entry",
")",
"bool",
"{",
"windowExceeded",
":=",
"time",
".",
"NewTimer",
"(",
"time",
".",
"Until",
"(",
"e",
".",
"deadline",
")",
")",
"\n",
"defer",
"windowExceeded",
".... | // waitForEntry blocks until "e" exceeds its buffering window or buffering stops
// in general. It returns true if the timeout thread should stop. | [
"waitForEntry",
"blocks",
"until",
"e",
"exceeds",
"its",
"buffering",
"window",
"or",
"buffering",
"stops",
"in",
"general",
".",
"It",
"returns",
"true",
"if",
"the",
"timeout",
"thread",
"should",
"stop",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/buffer/timeout_thread.go#L97-L124 |
136,442 | vitessio/vitess | go/vt/vtgate/buffer/timeout_thread.go | waitForNonEmptyQueue | func (tt *timeoutThread) waitForNonEmptyQueue() bool {
tt.mu.Lock()
queueNotEmpty := tt.queueNotEmpty
tt.mu.Unlock()
select {
// a) Always check these channels, regardless of the state.
case <-tt.maxDuration.C:
// Max duration is up. Stop buffering. Do not error out entries explicitly.
tt.sb.stopBufferingDue... | go | func (tt *timeoutThread) waitForNonEmptyQueue() bool {
tt.mu.Lock()
queueNotEmpty := tt.queueNotEmpty
tt.mu.Unlock()
select {
// a) Always check these channels, regardless of the state.
case <-tt.maxDuration.C:
// Max duration is up. Stop buffering. Do not error out entries explicitly.
tt.sb.stopBufferingDue... | [
"func",
"(",
"tt",
"*",
"timeoutThread",
")",
"waitForNonEmptyQueue",
"(",
")",
"bool",
"{",
"tt",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"queueNotEmpty",
":=",
"tt",
".",
"queueNotEmpty",
"\n",
"tt",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"sel... | // waitForNonEmptyQueue blocks until the buffer queue gets a new element or
// the timeout thread should be stopped.
// It returns true if the timeout thread should stop. | [
"waitForNonEmptyQueue",
"blocks",
"until",
"the",
"buffer",
"queue",
"gets",
"a",
"new",
"element",
"or",
"the",
"timeout",
"thread",
"should",
"be",
"stopped",
".",
"It",
"returns",
"true",
"if",
"the",
"timeout",
"thread",
"should",
"stop",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/buffer/timeout_thread.go#L129-L148 |
136,443 | vitessio/vitess | go/vt/vttime/interval.go | NewInterval | func NewInterval(earliest, latest time.Time) (Interval, error) {
if latest.Sub(earliest) < 0 {
return Interval{}, fmt.Errorf("NewInterval: earliest has to be smaller or equal to latest, but got: earliest=%v latest=%v", earliest, latest)
}
return Interval{
earliest: earliest,
latest: latest,
}, nil
} | go | func NewInterval(earliest, latest time.Time) (Interval, error) {
if latest.Sub(earliest) < 0 {
return Interval{}, fmt.Errorf("NewInterval: earliest has to be smaller or equal to latest, but got: earliest=%v latest=%v", earliest, latest)
}
return Interval{
earliest: earliest,
latest: latest,
}, nil
} | [
"func",
"NewInterval",
"(",
"earliest",
",",
"latest",
"time",
".",
"Time",
")",
"(",
"Interval",
",",
"error",
")",
"{",
"if",
"latest",
".",
"Sub",
"(",
"earliest",
")",
"<",
"0",
"{",
"return",
"Interval",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(... | // NewInterval creates a new Interval from the provided times.
// earliest has to be smaller or equal to latest, or an error is returned. | [
"NewInterval",
"creates",
"a",
"new",
"Interval",
"from",
"the",
"provided",
"times",
".",
"earliest",
"has",
"to",
"be",
"smaller",
"or",
"equal",
"to",
"latest",
"or",
"an",
"error",
"is",
"returned",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttime/interval.go#L32-L40 |
136,444 | vitessio/vitess | go/vt/vttime/interval.go | Less | func (i Interval) Less(other Interval) bool {
return i.latest.Sub(other.earliest) < 0
} | go | func (i Interval) Less(other Interval) bool {
return i.latest.Sub(other.earliest) < 0
} | [
"func",
"(",
"i",
"Interval",
")",
"Less",
"(",
"other",
"Interval",
")",
"bool",
"{",
"return",
"i",
".",
"latest",
".",
"Sub",
"(",
"other",
".",
"earliest",
")",
"<",
"0",
"\n",
"}"
] | // Less returns true if the provided interval is earlier than the parameter.
// Since both intervals are inclusive, comparison has to be strict. | [
"Less",
"returns",
"true",
"if",
"the",
"provided",
"interval",
"is",
"earlier",
"than",
"the",
"parameter",
".",
"Since",
"both",
"intervals",
"are",
"inclusive",
"comparison",
"has",
"to",
"be",
"strict",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttime/interval.go#L58-L60 |
136,445 | vitessio/vitess | go/vt/servenv/grpc_server_auth_static.go | Authenticate | func (sa *StaticAuthPlugin) Authenticate(ctx context.Context, fullMethod string) (context.Context, error) {
if md, ok := metadata.FromIncomingContext(ctx); ok {
if len(md["username"]) == 0 || len(md["password"]) == 0 {
return nil, status.Errorf(codes.Unauthenticated, "username and password must be provided")
}
... | go | func (sa *StaticAuthPlugin) Authenticate(ctx context.Context, fullMethod string) (context.Context, error) {
if md, ok := metadata.FromIncomingContext(ctx); ok {
if len(md["username"]) == 0 || len(md["password"]) == 0 {
return nil, status.Errorf(codes.Unauthenticated, "username and password must be provided")
}
... | [
"func",
"(",
"sa",
"*",
"StaticAuthPlugin",
")",
"Authenticate",
"(",
"ctx",
"context",
".",
"Context",
",",
"fullMethod",
"string",
")",
"(",
"context",
".",
"Context",
",",
"error",
")",
"{",
"if",
"md",
",",
"ok",
":=",
"metadata",
".",
"FromIncomingC... | // Authenticate implements AuthPlugin interface. This method will be used inside a middleware in grpc_server to authenticate
// incoming requests. | [
"Authenticate",
"implements",
"AuthPlugin",
"interface",
".",
"This",
"method",
"will",
"be",
"used",
"inside",
"a",
"middleware",
"in",
"grpc_server",
"to",
"authenticate",
"incoming",
"requests",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/grpc_server_auth_static.go#L56-L71 |
136,446 | vitessio/vitess | go/vt/logutil/purge.go | purgeLogsOnce | func purgeLogsOnce(now time.Time, dir, program string, keep time.Duration) {
current := make(map[string]bool)
for _, level := range levels {
c, err := os.Readlink(path.Join(dir, fmt.Sprintf("%s.%s", program, level)))
if err != nil {
continue
}
current[c] = true
}
files, err := filepath.Glob(path.Join(di... | go | func purgeLogsOnce(now time.Time, dir, program string, keep time.Duration) {
current := make(map[string]bool)
for _, level := range levels {
c, err := os.Readlink(path.Join(dir, fmt.Sprintf("%s.%s", program, level)))
if err != nil {
continue
}
current[c] = true
}
files, err := filepath.Glob(path.Join(di... | [
"func",
"purgeLogsOnce",
"(",
"now",
"time",
".",
"Time",
",",
"dir",
",",
"program",
"string",
",",
"keep",
"time",
".",
"Duration",
")",
"{",
"current",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"level",
":... | // purgeLogsOnce removes logfiles for program for dir, if their age
// relative to now is greater than keep. | [
"purgeLogsOnce",
"removes",
"logfiles",
"for",
"program",
"for",
"dir",
"if",
"their",
"age",
"relative",
"to",
"now",
"is",
"greater",
"than",
"keep",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/purge.go#L49-L75 |
136,447 | vitessio/vitess | go/vt/logutil/purge.go | PurgeLogs | func PurgeLogs() {
f := flag.Lookup("log_dir")
if f == nil {
panic("the logging module doesn't specify a log_dir flag")
}
if *keepLogs == 0*time.Second {
return
}
logDir := f.Value.String()
program := filepath.Base(os.Args[0])
timer := time.NewTimer(*purgeLogsInterval)
for range timer.C {
purgeLogsOnce... | go | func PurgeLogs() {
f := flag.Lookup("log_dir")
if f == nil {
panic("the logging module doesn't specify a log_dir flag")
}
if *keepLogs == 0*time.Second {
return
}
logDir := f.Value.String()
program := filepath.Base(os.Args[0])
timer := time.NewTimer(*purgeLogsInterval)
for range timer.C {
purgeLogsOnce... | [
"func",
"PurgeLogs",
"(",
")",
"{",
"f",
":=",
"flag",
".",
"Lookup",
"(",
"\"",
"\"",
")",
"\n",
"if",
"f",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"*",
"keepLogs",
"==",
"0",
"*",
"time",
".",
"Second",
"{"... | // PurgeLogs removes any log files that were started more than
// keepLogs ago and that aren't the current log. | [
"PurgeLogs",
"removes",
"any",
"log",
"files",
"that",
"were",
"started",
"more",
"than",
"keepLogs",
"ago",
"and",
"that",
"aren",
"t",
"the",
"current",
"log",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/purge.go#L79-L95 |
136,448 | vitessio/vitess | go/vt/vterrors/proto3.go | ToVTRPC | func ToVTRPC(err error) *vtrpcpb.RPCError {
if err == nil {
return nil
}
code := Code(err)
return &vtrpcpb.RPCError{
LegacyCode: CodeToLegacyErrorCode(code),
Code: code,
Message: err.Error(),
}
} | go | func ToVTRPC(err error) *vtrpcpb.RPCError {
if err == nil {
return nil
}
code := Code(err)
return &vtrpcpb.RPCError{
LegacyCode: CodeToLegacyErrorCode(code),
Code: code,
Message: err.Error(),
}
} | [
"func",
"ToVTRPC",
"(",
"err",
"error",
")",
"*",
"vtrpcpb",
".",
"RPCError",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"code",
":=",
"Code",
"(",
"err",
")",
"\n",
"return",
"&",
"vtrpcpb",
".",
"RPCError",
"{",
"Legacy... | // ToVTRPC converts from vtError to a vtrpcpb.RPCError. | [
"ToVTRPC",
"converts",
"from",
"vtError",
"to",
"a",
"vtrpcpb",
".",
"RPCError",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vterrors/proto3.go#L42-L52 |
136,449 | vitessio/vitess | go/fileutil/wildcards.go | HasWildcard | func HasWildcard(path string) bool {
for i := 0; i < len(path); i++ {
switch path[i] {
case '\\':
if i+1 >= len(path) {
return true
}
i++
case '*', '?', '[':
return true
}
}
return false
} | go | func HasWildcard(path string) bool {
for i := 0; i < len(path); i++ {
switch path[i] {
case '\\':
if i+1 >= len(path) {
return true
}
i++
case '*', '?', '[':
return true
}
}
return false
} | [
"func",
"HasWildcard",
"(",
"path",
"string",
")",
"bool",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"path",
")",
";",
"i",
"++",
"{",
"switch",
"path",
"[",
"i",
"]",
"{",
"case",
"'\\\\'",
":",
"if",
"i",
"+",
"1",
">=",
"len",... | // HasWildcard checks if a string has a wildcard in it. In the cases
// where we detect a bad pattern, we return 'true', and let the path.Match
// function find it. | [
"HasWildcard",
"checks",
"if",
"a",
"string",
"has",
"a",
"wildcard",
"in",
"it",
".",
"In",
"the",
"cases",
"where",
"we",
"detect",
"a",
"bad",
"pattern",
"we",
"return",
"true",
"and",
"let",
"the",
"path",
".",
"Match",
"function",
"find",
"it",
".... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/fileutil/wildcards.go#L23-L36 |
136,450 | vitessio/vitess | go/event/hooks.go | Add | func (h *Hooks) Add(f func()) {
h.mu.Lock()
defer h.mu.Unlock()
h.funcs = append(h.funcs, f)
} | go | func (h *Hooks) Add(f func()) {
h.mu.Lock()
defer h.mu.Unlock()
h.funcs = append(h.funcs, f)
} | [
"func",
"(",
"h",
"*",
"Hooks",
")",
"Add",
"(",
"f",
"func",
"(",
")",
")",
"{",
"h",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"h",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"h",
".",
"funcs",
"=",
"append",
"(",
"h",
".",
"funcs... | // Add appends the given function to the list to be triggered. | [
"Add",
"appends",
"the",
"given",
"function",
"to",
"the",
"list",
"to",
"be",
"triggered",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/event/hooks.go#L31-L35 |
136,451 | vitessio/vitess | go/vt/worker/legacy_split_clone.go | NewLegacySplitCloneWorker | func NewLegacySplitCloneWorker(wr *wrangler.Wrangler, cell, keyspace, shard string, excludeTables []string, sourceReaderCount, destinationPackCount, destinationWriterCount, minHealthyRdonlyTablets int, maxTPS int64) (Worker, error) {
if maxTPS != throttler.MaxRateModuleDisabled {
wr.Logger().Infof("throttling enable... | go | func NewLegacySplitCloneWorker(wr *wrangler.Wrangler, cell, keyspace, shard string, excludeTables []string, sourceReaderCount, destinationPackCount, destinationWriterCount, minHealthyRdonlyTablets int, maxTPS int64) (Worker, error) {
if maxTPS != throttler.MaxRateModuleDisabled {
wr.Logger().Infof("throttling enable... | [
"func",
"NewLegacySplitCloneWorker",
"(",
"wr",
"*",
"wrangler",
".",
"Wrangler",
",",
"cell",
",",
"keyspace",
",",
"shard",
"string",
",",
"excludeTables",
"[",
"]",
"string",
",",
"sourceReaderCount",
",",
"destinationPackCount",
",",
"destinationWriterCount",
... | // NewLegacySplitCloneWorker returns a new LegacySplitCloneWorker object. | [
"NewLegacySplitCloneWorker",
"returns",
"a",
"new",
"LegacySplitCloneWorker",
"object",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/legacy_split_clone.go#L102-L133 |
136,452 | vitessio/vitess | go/vt/worker/legacy_split_clone.go | Run | func (scw *LegacySplitCloneWorker) Run(ctx context.Context) error {
resetVars()
// Run the command.
err := scw.run(ctx)
// Cleanup.
scw.setState(WorkerStateCleanUp)
// Reverse any changes e.g. setting the tablet type of a source RDONLY tablet.
cerr := scw.cleaner.CleanUp(scw.wr)
if cerr != nil {
if err != n... | go | func (scw *LegacySplitCloneWorker) Run(ctx context.Context) error {
resetVars()
// Run the command.
err := scw.run(ctx)
// Cleanup.
scw.setState(WorkerStateCleanUp)
// Reverse any changes e.g. setting the tablet type of a source RDONLY tablet.
cerr := scw.cleaner.CleanUp(scw.wr)
if cerr != nil {
if err != n... | [
"func",
"(",
"scw",
"*",
"LegacySplitCloneWorker",
")",
"Run",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"resetVars",
"(",
")",
"\n\n",
"// Run the command.",
"err",
":=",
"scw",
".",
"run",
"(",
"ctx",
")",
"\n\n",
"// Cleanup.",
"scw",
... | // Run implements the Worker interface | [
"Run",
"implements",
"the",
"Worker",
"interface"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/legacy_split_clone.go#L197-L235 |
136,453 | vitessio/vitess | go/vt/worker/legacy_split_clone.go | processData | func (scw *LegacySplitCloneWorker) processData(ctx context.Context, dbNames []string, td *tabletmanagerdatapb.TableDefinition, tableIndex int, rr ResultReader, rowSplitter *RowSplitter, insertChannels []chan string, destinationPackCount int) error {
// Store the baseCmd per destination shard because each tablet may ha... | go | func (scw *LegacySplitCloneWorker) processData(ctx context.Context, dbNames []string, td *tabletmanagerdatapb.TableDefinition, tableIndex int, rr ResultReader, rowSplitter *RowSplitter, insertChannels []chan string, destinationPackCount int) error {
// Store the baseCmd per destination shard because each tablet may ha... | [
"func",
"(",
"scw",
"*",
"LegacySplitCloneWorker",
")",
"processData",
"(",
"ctx",
"context",
".",
"Context",
",",
"dbNames",
"[",
"]",
"string",
",",
"td",
"*",
"tabletmanagerdatapb",
".",
"TableDefinition",
",",
"tableIndex",
"int",
",",
"rr",
"ResultReader"... | // processData pumps the data out of the provided QueryResultReader.
// It returns any error the source encounters. | [
"processData",
"pumps",
"the",
"data",
"out",
"of",
"the",
"provided",
"QueryResultReader",
".",
"It",
"returns",
"any",
"error",
"the",
"source",
"encounters",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/legacy_split_clone.go#L658-L707 |
136,454 | vitessio/vitess | go/vt/throttler/throttler.go | updateMaxRate | func (t *Throttler) updateMaxRate() {
// Set it to infinite initially.
maxRate := int64(math.MaxInt64)
// Find out the new max rate (minimum among all modules).
for _, m := range t.modules {
if moduleMaxRate := m.MaxRate(); moduleMaxRate < maxRate {
maxRate = moduleMaxRate
}
}
// Set the new max rate on ... | go | func (t *Throttler) updateMaxRate() {
// Set it to infinite initially.
maxRate := int64(math.MaxInt64)
// Find out the new max rate (minimum among all modules).
for _, m := range t.modules {
if moduleMaxRate := m.MaxRate(); moduleMaxRate < maxRate {
maxRate = moduleMaxRate
}
}
// Set the new max rate on ... | [
"func",
"(",
"t",
"*",
"Throttler",
")",
"updateMaxRate",
"(",
")",
"{",
"// Set it to infinite initially.",
"maxRate",
":=",
"int64",
"(",
"math",
".",
"MaxInt64",
")",
"\n\n",
"// Find out the new max rate (minimum among all modules).",
"for",
"_",
",",
"m",
":=",... | // updateMaxRate recalculates the current max rate and updates all
// threadThrottlers accordingly.
// The rate changes when the number of thread changes or a module updated its
// max rate. | [
"updateMaxRate",
"recalculates",
"the",
"current",
"max",
"rate",
"and",
"updates",
"all",
"threadThrottlers",
"accordingly",
".",
"The",
"rate",
"changes",
"when",
"the",
"number",
"of",
"thread",
"changes",
"or",
"a",
"module",
"updated",
"its",
"max",
"rate",... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/throttler.go#L245-L283 |
136,455 | vitessio/vitess | go/vt/throttler/throttler.go | UpdateConfiguration | func (t *Throttler) UpdateConfiguration(configuration *throttlerdatapb.Configuration, copyZeroValues bool) error {
return t.maxReplicationLagModule.updateConfiguration(configuration, copyZeroValues)
} | go | func (t *Throttler) UpdateConfiguration(configuration *throttlerdatapb.Configuration, copyZeroValues bool) error {
return t.maxReplicationLagModule.updateConfiguration(configuration, copyZeroValues)
} | [
"func",
"(",
"t",
"*",
"Throttler",
")",
"UpdateConfiguration",
"(",
"configuration",
"*",
"throttlerdatapb",
".",
"Configuration",
",",
"copyZeroValues",
"bool",
")",
"error",
"{",
"return",
"t",
".",
"maxReplicationLagModule",
".",
"updateConfiguration",
"(",
"c... | // UpdateConfiguration updates the configuration of the MaxReplicationLag module. | [
"UpdateConfiguration",
"updates",
"the",
"configuration",
"of",
"the",
"MaxReplicationLag",
"module",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/throttler.go#L308-L310 |
136,456 | vitessio/vitess | go/vt/vtgate/planbuilder/limit.go | newLimit | func newLimit(bldr builder) *limit {
return &limit{
order: bldr.Order() + 1,
resultColumns: bldr.ResultColumns(),
input: bldr,
elimit: &engine.Limit{},
}
} | go | func newLimit(bldr builder) *limit {
return &limit{
order: bldr.Order() + 1,
resultColumns: bldr.ResultColumns(),
input: bldr,
elimit: &engine.Limit{},
}
} | [
"func",
"newLimit",
"(",
"bldr",
"builder",
")",
"*",
"limit",
"{",
"return",
"&",
"limit",
"{",
"order",
":",
"bldr",
".",
"Order",
"(",
")",
"+",
"1",
",",
"resultColumns",
":",
"bldr",
".",
"ResultColumns",
"(",
")",
",",
"input",
":",
"bldr",
"... | // newLimit builds a new limit. | [
"newLimit",
"builds",
"a",
"new",
"limit",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/limit.go#L39-L46 |
136,457 | vitessio/vitess | go/vt/vtgate/planbuilder/limit.go | SetLimit | func (l *limit) SetLimit(limit *sqlparser.Limit) error {
count, ok := limit.Rowcount.(*sqlparser.SQLVal)
if !ok {
return fmt.Errorf("unexpected expression in LIMIT: %v", sqlparser.String(limit))
}
pv, err := sqlparser.NewPlanValue(count)
if err != nil {
return err
}
l.elimit.Count = pv
switch offset := lim... | go | func (l *limit) SetLimit(limit *sqlparser.Limit) error {
count, ok := limit.Rowcount.(*sqlparser.SQLVal)
if !ok {
return fmt.Errorf("unexpected expression in LIMIT: %v", sqlparser.String(limit))
}
pv, err := sqlparser.NewPlanValue(count)
if err != nil {
return err
}
l.elimit.Count = pv
switch offset := lim... | [
"func",
"(",
"l",
"*",
"limit",
")",
"SetLimit",
"(",
"limit",
"*",
"sqlparser",
".",
"Limit",
")",
"error",
"{",
"count",
",",
"ok",
":=",
"limit",
".",
"Rowcount",
".",
"(",
"*",
"sqlparser",
".",
"SQLVal",
")",
"\n",
"if",
"!",
"ok",
"{",
"ret... | // SetLimit sets the limit for the primitive. It calls the underlying
// primitive's SetUpperLimit, which is an optimization hint that informs
// the underlying primitive that it doesn't need to return more rows than
// specified. | [
"SetLimit",
"sets",
"the",
"limit",
"for",
"the",
"primitive",
".",
"It",
"calls",
"the",
"underlying",
"primitive",
"s",
"SetUpperLimit",
"which",
"is",
"an",
"optimization",
"hint",
"that",
"informs",
"the",
"underlying",
"primitive",
"that",
"it",
"doesn",
... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/limit.go#L109-L135 |
136,458 | vitessio/vitess | go/stats/counters.go | ResetAll | func (c *counters) ResetAll() {
c.mu.Lock()
defer c.mu.Unlock()
c.counts = make(map[string]*int64)
} | go | func (c *counters) ResetAll() {
c.mu.Lock()
defer c.mu.Unlock()
c.counts = make(map[string]*int64)
} | [
"func",
"(",
"c",
"*",
"counters",
")",
"ResetAll",
"(",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"c",
".",
"counts",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"i... | // ResetAll resets all counter values and clears all keys. | [
"ResetAll",
"resets",
"all",
"counter",
"values",
"and",
"clears",
"all",
"keys",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L91-L95 |
136,459 | vitessio/vitess | go/stats/counters.go | ZeroAll | func (c *counters) ZeroAll() {
c.mu.Lock()
defer c.mu.Unlock()
for _, a := range c.counts {
atomic.StoreInt64(a, int64(0))
}
} | go | func (c *counters) ZeroAll() {
c.mu.Lock()
defer c.mu.Unlock()
for _, a := range c.counts {
atomic.StoreInt64(a, int64(0))
}
} | [
"func",
"(",
"c",
"*",
"counters",
")",
"ZeroAll",
"(",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"c",
".",
"counts",
"{",
"atomic",
"... | // ZeroAll resets all counter values to zero | [
"ZeroAll",
"resets",
"all",
"counter",
"values",
"to",
"zero"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L98-L104 |
136,460 | vitessio/vitess | go/stats/counters.go | Reset | func (c *counters) Reset(name string) {
a := c.getValueAddr(name)
atomic.StoreInt64(a, int64(0))
} | go | func (c *counters) Reset(name string) {
a := c.getValueAddr(name)
atomic.StoreInt64(a, int64(0))
} | [
"func",
"(",
"c",
"*",
"counters",
")",
"Reset",
"(",
"name",
"string",
")",
"{",
"a",
":=",
"c",
".",
"getValueAddr",
"(",
"name",
")",
"\n",
"atomic",
".",
"StoreInt64",
"(",
"a",
",",
"int64",
"(",
"0",
")",
")",
"\n",
"}"
] | // Reset resets a specific counter value to 0. | [
"Reset",
"resets",
"a",
"specific",
"counter",
"value",
"to",
"0",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L107-L110 |
136,461 | vitessio/vitess | go/stats/counters.go | NewCountersWithSingleLabel | func NewCountersWithSingleLabel(name, help, label string, tags ...string) *CountersWithSingleLabel {
c := &CountersWithSingleLabel{
counters: counters{
counts: make(map[string]*int64),
help: help,
},
label: label,
}
for _, tag := range tags {
c.counts[tag] = new(int64)
}
if name != "" {
publish(... | go | func NewCountersWithSingleLabel(name, help, label string, tags ...string) *CountersWithSingleLabel {
c := &CountersWithSingleLabel{
counters: counters{
counts: make(map[string]*int64),
help: help,
},
label: label,
}
for _, tag := range tags {
c.counts[tag] = new(int64)
}
if name != "" {
publish(... | [
"func",
"NewCountersWithSingleLabel",
"(",
"name",
",",
"help",
",",
"label",
"string",
",",
"tags",
"...",
"string",
")",
"*",
"CountersWithSingleLabel",
"{",
"c",
":=",
"&",
"CountersWithSingleLabel",
"{",
"counters",
":",
"counters",
"{",
"counts",
":",
"ma... | // NewCountersWithSingleLabel create a new Counters instance.
// If name is set, the variable gets published.
// The function also accepts an optional list of tags that pre-creates them
// initialized to 0.
// label is a category name used to organize the tags. It is currently only
// used by Prometheus, but not by the... | [
"NewCountersWithSingleLabel",
"create",
"a",
"new",
"Counters",
"instance",
".",
"If",
"name",
"is",
"set",
"the",
"variable",
"gets",
"published",
".",
"The",
"function",
"also",
"accepts",
"an",
"optional",
"list",
"of",
"tags",
"that",
"pre",
"-",
"creates"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L143-L159 |
136,462 | vitessio/vitess | go/stats/counters.go | NewCountersWithMultiLabels | func NewCountersWithMultiLabels(name, help string, labels []string) *CountersWithMultiLabels {
t := &CountersWithMultiLabels{
counters: counters{
counts: make(map[string]*int64),
help: help},
labels: labels,
}
if name != "" {
publish(name, t)
}
return t
} | go | func NewCountersWithMultiLabels(name, help string, labels []string) *CountersWithMultiLabels {
t := &CountersWithMultiLabels{
counters: counters{
counts: make(map[string]*int64),
help: help},
labels: labels,
}
if name != "" {
publish(name, t)
}
return t
} | [
"func",
"NewCountersWithMultiLabels",
"(",
"name",
",",
"help",
"string",
",",
"labels",
"[",
"]",
"string",
")",
"*",
"CountersWithMultiLabels",
"{",
"t",
":=",
"&",
"CountersWithMultiLabels",
"{",
"counters",
":",
"counters",
"{",
"counts",
":",
"make",
"(",... | // NewCountersWithMultiLabels creates a new CountersWithMultiLabels
// instance, and publishes it if name is set. | [
"NewCountersWithMultiLabels",
"creates",
"a",
"new",
"CountersWithMultiLabels",
"instance",
"and",
"publishes",
"it",
"if",
"name",
"is",
"set",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L190-L202 |
136,463 | vitessio/vitess | go/stats/counters.go | NewCountersFuncWithMultiLabels | func NewCountersFuncWithMultiLabels(name, help string, labels []string, f func() map[string]int64) *CountersFuncWithMultiLabels {
t := &CountersFuncWithMultiLabels{
f: f,
help: help,
labels: labels,
}
if name != "" {
publish(name, t)
}
return t
} | go | func NewCountersFuncWithMultiLabels(name, help string, labels []string, f func() map[string]int64) *CountersFuncWithMultiLabels {
t := &CountersFuncWithMultiLabels{
f: f,
help: help,
labels: labels,
}
if name != "" {
publish(name, t)
}
return t
} | [
"func",
"NewCountersFuncWithMultiLabels",
"(",
"name",
",",
"help",
"string",
",",
"labels",
"[",
"]",
"string",
",",
"f",
"func",
"(",
")",
"map",
"[",
"string",
"]",
"int64",
")",
"*",
"CountersFuncWithMultiLabels",
"{",
"t",
":=",
"&",
"CountersFuncWithMu... | // NewCountersFuncWithMultiLabels creates a new CountersFuncWithMultiLabels
// mapping to the provided function. | [
"NewCountersFuncWithMultiLabels",
"creates",
"a",
"new",
"CountersFuncWithMultiLabels",
"mapping",
"to",
"the",
"provided",
"function",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L269-L280 |
136,464 | vitessio/vitess | go/stats/counters.go | NewGaugesWithSingleLabel | func NewGaugesWithSingleLabel(name, help, label string, tags ...string) *GaugesWithSingleLabel {
g := &GaugesWithSingleLabel{
CountersWithSingleLabel: CountersWithSingleLabel{
counters: counters{
counts: make(map[string]*int64),
help: help,
},
label: label,
},
}
for _, tag := range tags {
g... | go | func NewGaugesWithSingleLabel(name, help, label string, tags ...string) *GaugesWithSingleLabel {
g := &GaugesWithSingleLabel{
CountersWithSingleLabel: CountersWithSingleLabel{
counters: counters{
counts: make(map[string]*int64),
help: help,
},
label: label,
},
}
for _, tag := range tags {
g... | [
"func",
"NewGaugesWithSingleLabel",
"(",
"name",
",",
"help",
",",
"label",
"string",
",",
"tags",
"...",
"string",
")",
"*",
"GaugesWithSingleLabel",
"{",
"g",
":=",
"&",
"GaugesWithSingleLabel",
"{",
"CountersWithSingleLabel",
":",
"CountersWithSingleLabel",
"{",
... | // NewGaugesWithSingleLabel creates a new GaugesWithSingleLabel and
// publishes it if the name is set. | [
"NewGaugesWithSingleLabel",
"creates",
"a",
"new",
"GaugesWithSingleLabel",
"and",
"publishes",
"it",
"if",
"the",
"name",
"is",
"set",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L316-L334 |
136,465 | vitessio/vitess | go/stats/counters.go | Set | func (g *GaugesWithSingleLabel) Set(name string, value int64) {
a := g.getValueAddr(name)
atomic.StoreInt64(a, value)
} | go | func (g *GaugesWithSingleLabel) Set(name string, value int64) {
a := g.getValueAddr(name)
atomic.StoreInt64(a, value)
} | [
"func",
"(",
"g",
"*",
"GaugesWithSingleLabel",
")",
"Set",
"(",
"name",
"string",
",",
"value",
"int64",
")",
"{",
"a",
":=",
"g",
".",
"getValueAddr",
"(",
"name",
")",
"\n",
"atomic",
".",
"StoreInt64",
"(",
"a",
",",
"value",
")",
"\n",
"}"
] | // Set sets the value of a named gauge. | [
"Set",
"sets",
"the",
"value",
"of",
"a",
"named",
"gauge",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L337-L340 |
136,466 | vitessio/vitess | go/stats/counters.go | Add | func (g *GaugesWithSingleLabel) Add(name string, value int64) {
a := g.getValueAddr(name)
atomic.AddInt64(a, value)
} | go | func (g *GaugesWithSingleLabel) Add(name string, value int64) {
a := g.getValueAddr(name)
atomic.AddInt64(a, value)
} | [
"func",
"(",
"g",
"*",
"GaugesWithSingleLabel",
")",
"Add",
"(",
"name",
"string",
",",
"value",
"int64",
")",
"{",
"a",
":=",
"g",
".",
"getValueAddr",
"(",
"name",
")",
"\n",
"atomic",
".",
"AddInt64",
"(",
"a",
",",
"value",
")",
"\n",
"}"
] | // Add adds a value to a named gauge. | [
"Add",
"adds",
"a",
"value",
"to",
"a",
"named",
"gauge",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L343-L346 |
136,467 | vitessio/vitess | go/stats/counters.go | NewGaugesWithMultiLabels | func NewGaugesWithMultiLabels(name, help string, labels []string) *GaugesWithMultiLabels {
t := &GaugesWithMultiLabels{
CountersWithMultiLabels: CountersWithMultiLabels{
counters: counters{
counts: make(map[string]*int64),
help: help,
},
labels: labels,
}}
if name != "" {
publish(name, t)
}
... | go | func NewGaugesWithMultiLabels(name, help string, labels []string) *GaugesWithMultiLabels {
t := &GaugesWithMultiLabels{
CountersWithMultiLabels: CountersWithMultiLabels{
counters: counters{
counts: make(map[string]*int64),
help: help,
},
labels: labels,
}}
if name != "" {
publish(name, t)
}
... | [
"func",
"NewGaugesWithMultiLabels",
"(",
"name",
",",
"help",
"string",
",",
"labels",
"[",
"]",
"string",
")",
"*",
"GaugesWithMultiLabels",
"{",
"t",
":=",
"&",
"GaugesWithMultiLabels",
"{",
"CountersWithMultiLabels",
":",
"CountersWithMultiLabels",
"{",
"counters... | // NewGaugesWithMultiLabels creates a new GaugesWithMultiLabels instance,
// and publishes it if name is set. | [
"NewGaugesWithMultiLabels",
"creates",
"a",
"new",
"GaugesWithMultiLabels",
"instance",
"and",
"publishes",
"it",
"if",
"name",
"is",
"set",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L356-L370 |
136,468 | vitessio/vitess | go/stats/counters.go | NewGaugesFuncWithMultiLabels | func NewGaugesFuncWithMultiLabels(name, help string, labels []string, f func() map[string]int64) *GaugesFuncWithMultiLabels {
t := &GaugesFuncWithMultiLabels{
CountersFuncWithMultiLabels: CountersFuncWithMultiLabels{
f: f,
help: help,
labels: labels,
}}
if name != "" {
publish(name, t)
}
ret... | go | func NewGaugesFuncWithMultiLabels(name, help string, labels []string, f func() map[string]int64) *GaugesFuncWithMultiLabels {
t := &GaugesFuncWithMultiLabels{
CountersFuncWithMultiLabels: CountersFuncWithMultiLabels{
f: f,
help: help,
labels: labels,
}}
if name != "" {
publish(name, t)
}
ret... | [
"func",
"NewGaugesFuncWithMultiLabels",
"(",
"name",
",",
"help",
"string",
",",
"labels",
"[",
"]",
"string",
",",
"f",
"func",
"(",
")",
"map",
"[",
"string",
"]",
"int64",
")",
"*",
"GaugesFuncWithMultiLabels",
"{",
"t",
":=",
"&",
"GaugesFuncWithMultiLab... | // NewGaugesFuncWithMultiLabels creates a new GaugesFuncWithMultiLabels
// mapping to the provided function. | [
"NewGaugesFuncWithMultiLabels",
"creates",
"a",
"new",
"GaugesFuncWithMultiLabels",
"mapping",
"to",
"the",
"provided",
"function",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L401-L414 |
136,469 | vitessio/vitess | go/vt/topotools/utils.go | FindTabletByHostAndPort | func FindTabletByHostAndPort(tabletMap map[string]*topo.TabletInfo, addr, portName string, port int32) (*topodatapb.TabletAlias, error) {
for _, ti := range tabletMap {
if ti.Hostname == addr && ti.PortMap[portName] == port {
return ti.Alias, nil
}
}
return nil, topo.NewError(topo.NoNode, addr+":"+portName)
} | go | func FindTabletByHostAndPort(tabletMap map[string]*topo.TabletInfo, addr, portName string, port int32) (*topodatapb.TabletAlias, error) {
for _, ti := range tabletMap {
if ti.Hostname == addr && ti.PortMap[portName] == port {
return ti.Alias, nil
}
}
return nil, topo.NewError(topo.NoNode, addr+":"+portName)
} | [
"func",
"FindTabletByHostAndPort",
"(",
"tabletMap",
"map",
"[",
"string",
"]",
"*",
"topo",
".",
"TabletInfo",
",",
"addr",
",",
"portName",
"string",
",",
"port",
"int32",
")",
"(",
"*",
"topodatapb",
".",
"TabletAlias",
",",
"error",
")",
"{",
"for",
... | // FindTabletByHostAndPort searches within a tablet map for tablets. | [
"FindTabletByHostAndPort",
"searches",
"within",
"a",
"tablet",
"map",
"for",
"tablets",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/utils.go#L34-L41 |
136,470 | vitessio/vitess | go/vt/topotools/utils.go | GetAllTablets | func GetAllTablets(ctx context.Context, ts *topo.Server, cell string) ([]*topo.TabletInfo, error) {
aliases, err := ts.GetTabletsByCell(ctx, cell)
if err != nil {
return nil, err
}
sort.Sort(topoproto.TabletAliasList(aliases))
tabletMap, err := ts.GetTabletMap(ctx, aliases)
if err != nil {
// we got another ... | go | func GetAllTablets(ctx context.Context, ts *topo.Server, cell string) ([]*topo.TabletInfo, error) {
aliases, err := ts.GetTabletsByCell(ctx, cell)
if err != nil {
return nil, err
}
sort.Sort(topoproto.TabletAliasList(aliases))
tabletMap, err := ts.GetTabletMap(ctx, aliases)
if err != nil {
// we got another ... | [
"func",
"GetAllTablets",
"(",
"ctx",
"context",
".",
"Context",
",",
"ts",
"*",
"topo",
".",
"Server",
",",
"cell",
"string",
")",
"(",
"[",
"]",
"*",
"topo",
".",
"TabletInfo",
",",
"error",
")",
"{",
"aliases",
",",
"err",
":=",
"ts",
".",
"GetTa... | // GetAllTablets returns a sorted list of tablets. | [
"GetAllTablets",
"returns",
"a",
"sorted",
"list",
"of",
"tablets",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/utils.go#L44-L69 |
136,471 | vitessio/vitess | go/vt/topotools/utils.go | GetAllTabletsAcrossCells | func GetAllTabletsAcrossCells(ctx context.Context, ts *topo.Server) ([]*topo.TabletInfo, error) {
cells, err := ts.GetKnownCells(ctx)
if err != nil {
return nil, err
}
results := make([][]*topo.TabletInfo, len(cells))
errors := make([]error, len(cells))
wg := sync.WaitGroup{}
wg.Add(len(cells))
for i, cell :... | go | func GetAllTabletsAcrossCells(ctx context.Context, ts *topo.Server) ([]*topo.TabletInfo, error) {
cells, err := ts.GetKnownCells(ctx)
if err != nil {
return nil, err
}
results := make([][]*topo.TabletInfo, len(cells))
errors := make([]error, len(cells))
wg := sync.WaitGroup{}
wg.Add(len(cells))
for i, cell :... | [
"func",
"GetAllTabletsAcrossCells",
"(",
"ctx",
"context",
".",
"Context",
",",
"ts",
"*",
"topo",
".",
"Server",
")",
"(",
"[",
"]",
"*",
"topo",
".",
"TabletInfo",
",",
"error",
")",
"{",
"cells",
",",
"err",
":=",
"ts",
".",
"GetKnownCells",
"(",
... | // GetAllTabletsAcrossCells returns all tablets from known cells.
// If it returns topo.ErrPartialResult, then the list is valid, but partial. | [
"GetAllTabletsAcrossCells",
"returns",
"all",
"tablets",
"from",
"known",
"cells",
".",
"If",
"it",
"returns",
"topo",
".",
"ErrPartialResult",
"then",
"the",
"list",
"is",
"valid",
"but",
"partial",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/utils.go#L73-L101 |
136,472 | vitessio/vitess | go/vt/topotools/utils.go | CopyMapKeys | func CopyMapKeys(m interface{}, typeHint interface{}) interface{} {
mapVal := reflect.ValueOf(m)
keys := reflect.MakeSlice(reflect.TypeOf(typeHint), 0, mapVal.Len())
for _, k := range mapVal.MapKeys() {
keys = reflect.Append(keys, k)
}
return keys.Interface()
} | go | func CopyMapKeys(m interface{}, typeHint interface{}) interface{} {
mapVal := reflect.ValueOf(m)
keys := reflect.MakeSlice(reflect.TypeOf(typeHint), 0, mapVal.Len())
for _, k := range mapVal.MapKeys() {
keys = reflect.Append(keys, k)
}
return keys.Interface()
} | [
"func",
"CopyMapKeys",
"(",
"m",
"interface",
"{",
"}",
",",
"typeHint",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"mapVal",
":=",
"reflect",
".",
"ValueOf",
"(",
"m",
")",
"\n",
"keys",
":=",
"reflect",
".",
"MakeSlice",
"(",
"reflect",
... | // CopyMapKeys copies keys from from map m into a new slice with the
// type specified by typeHint. Reflection can't make a new slice type
// just based on the key type AFAICT. | [
"CopyMapKeys",
"copies",
"keys",
"from",
"from",
"map",
"m",
"into",
"a",
"new",
"slice",
"with",
"the",
"type",
"specified",
"by",
"typeHint",
".",
"Reflection",
"can",
"t",
"make",
"a",
"new",
"slice",
"type",
"just",
"based",
"on",
"the",
"key",
"type... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/utils.go#L125-L132 |
136,473 | vitessio/vitess | go/vt/topotools/utils.go | CopyMapValues | func CopyMapValues(m interface{}, typeHint interface{}) interface{} {
mapVal := reflect.ValueOf(m)
vals := reflect.MakeSlice(reflect.TypeOf(typeHint), 0, mapVal.Len())
for _, k := range mapVal.MapKeys() {
vals = reflect.Append(vals, mapVal.MapIndex(k))
}
return vals.Interface()
} | go | func CopyMapValues(m interface{}, typeHint interface{}) interface{} {
mapVal := reflect.ValueOf(m)
vals := reflect.MakeSlice(reflect.TypeOf(typeHint), 0, mapVal.Len())
for _, k := range mapVal.MapKeys() {
vals = reflect.Append(vals, mapVal.MapIndex(k))
}
return vals.Interface()
} | [
"func",
"CopyMapValues",
"(",
"m",
"interface",
"{",
"}",
",",
"typeHint",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"mapVal",
":=",
"reflect",
".",
"ValueOf",
"(",
"m",
")",
"\n",
"vals",
":=",
"reflect",
".",
"MakeSlice",
"(",
"reflect"... | // CopyMapValues copies values from from map m into a new slice with the
// type specified by typeHint. Reflection can't make a new slice type
// just based on the key type AFAICT. | [
"CopyMapValues",
"copies",
"values",
"from",
"from",
"map",
"m",
"into",
"a",
"new",
"slice",
"with",
"the",
"type",
"specified",
"by",
"typeHint",
".",
"Reflection",
"can",
"t",
"make",
"a",
"new",
"slice",
"type",
"just",
"based",
"on",
"the",
"key",
"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/utils.go#L137-L144 |
136,474 | vitessio/vitess | go/vt/topotools/utils.go | MapKeys | func MapKeys(m interface{}) []interface{} {
keys := make([]interface{}, 0, 16)
mapVal := reflect.ValueOf(m)
for _, kv := range mapVal.MapKeys() {
keys = append(keys, kv.Interface())
}
return keys
} | go | func MapKeys(m interface{}) []interface{} {
keys := make([]interface{}, 0, 16)
mapVal := reflect.ValueOf(m)
for _, kv := range mapVal.MapKeys() {
keys = append(keys, kv.Interface())
}
return keys
} | [
"func",
"MapKeys",
"(",
"m",
"interface",
"{",
"}",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"keys",
":=",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"0",
",",
"16",
")",
"\n",
"mapVal",
":=",
"reflect",
".",
"ValueOf",
"(",
"m",
")",... | // MapKeys returns an array with th provided map keys. | [
"MapKeys",
"returns",
"an",
"array",
"with",
"th",
"provided",
"map",
"keys",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/utils.go#L147-L154 |
136,475 | vitessio/vitess | go/vt/vttablet/tabletmanager/vreplication/engine.go | NewEngine | func NewEngine(ts *topo.Server, cell string, mysqld mysqlctl.MysqlDaemon, dbClientFactory func() binlogplayer.DBClient, dbName string) *Engine {
vre := &Engine{
controllers: make(map[int]*controller),
ts: ts,
cell: cell,
mysqld: mysqld,
dbClientFactory: dbClientFactory,
... | go | func NewEngine(ts *topo.Server, cell string, mysqld mysqlctl.MysqlDaemon, dbClientFactory func() binlogplayer.DBClient, dbName string) *Engine {
vre := &Engine{
controllers: make(map[int]*controller),
ts: ts,
cell: cell,
mysqld: mysqld,
dbClientFactory: dbClientFactory,
... | [
"func",
"NewEngine",
"(",
"ts",
"*",
"topo",
".",
"Server",
",",
"cell",
"string",
",",
"mysqld",
"mysqlctl",
".",
"MysqlDaemon",
",",
"dbClientFactory",
"func",
"(",
")",
"binlogplayer",
".",
"DBClient",
",",
"dbName",
"string",
")",
"*",
"Engine",
"{",
... | // NewEngine creates a new Engine.
// A nil ts means that the Engine is disabled. | [
"NewEngine",
"creates",
"a",
"new",
"Engine",
".",
"A",
"nil",
"ts",
"means",
"that",
"the",
"Engine",
"is",
"disabled",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/engine.go#L69-L79 |
136,476 | vitessio/vitess | go/vt/vttablet/tabletmanager/vreplication/engine.go | executeFetchMaybeCreateTable | func (vre *Engine) executeFetchMaybeCreateTable(dbClient binlogplayer.DBClient, query string, maxrows int) (qr *sqltypes.Result, err error) {
qr, err = dbClient.ExecuteFetch(query, maxrows)
if err == nil {
return
}
// If it's a bad table or db, it could be because _vt.vreplication wasn't created.
// In that ca... | go | func (vre *Engine) executeFetchMaybeCreateTable(dbClient binlogplayer.DBClient, query string, maxrows int) (qr *sqltypes.Result, err error) {
qr, err = dbClient.ExecuteFetch(query, maxrows)
if err == nil {
return
}
// If it's a bad table or db, it could be because _vt.vreplication wasn't created.
// In that ca... | [
"func",
"(",
"vre",
"*",
"Engine",
")",
"executeFetchMaybeCreateTable",
"(",
"dbClient",
"binlogplayer",
".",
"DBClient",
",",
"query",
"string",
",",
"maxrows",
"int",
")",
"(",
"qr",
"*",
"sqltypes",
".",
"Result",
",",
"err",
"error",
")",
"{",
"qr",
... | // executeFetchMaybeCreateTable calls DBClient.ExecuteFetch and does one retry if
// there's a failure due to mysql.ERNoSuchTable or mysql.ERBadDb which can be fixed
// by re-creating the _vt.vreplication table. | [
"executeFetchMaybeCreateTable",
"calls",
"DBClient",
".",
"ExecuteFetch",
"and",
"does",
"one",
"retry",
"if",
"there",
"s",
"a",
"failure",
"due",
"to",
"mysql",
".",
"ERNoSuchTable",
"or",
"mysql",
".",
"ERBadDb",
"which",
"can",
"be",
"fixed",
"by",
"re",
... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/engine.go#L106-L142 |
136,477 | vitessio/vitess | go/vt/vttablet/tabletmanager/vreplication/engine.go | IsOpen | func (vre *Engine) IsOpen() bool {
vre.mu.Lock()
defer vre.mu.Unlock()
return vre.isOpen
} | go | func (vre *Engine) IsOpen() bool {
vre.mu.Lock()
defer vre.mu.Unlock()
return vre.isOpen
} | [
"func",
"(",
"vre",
"*",
"Engine",
")",
"IsOpen",
"(",
")",
"bool",
"{",
"vre",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"vre",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"vre",
".",
"isOpen",
"\n",
"}"
] | // IsOpen returns true if Engine is open. | [
"IsOpen",
"returns",
"true",
"if",
"Engine",
"is",
"open",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/engine.go#L176-L180 |
136,478 | vitessio/vitess | go/vt/vttablet/tabletmanager/vreplication/engine.go | WaitForPos | func (vre *Engine) WaitForPos(ctx context.Context, id int, pos string) error {
mPos, err := mysql.DecodePosition(pos)
if err != nil {
return err
}
if err := func() error {
vre.mu.Lock()
defer vre.mu.Unlock()
if !vre.isOpen {
return errors.New("vreplication engine is closed")
}
// Ensure that the en... | go | func (vre *Engine) WaitForPos(ctx context.Context, id int, pos string) error {
mPos, err := mysql.DecodePosition(pos)
if err != nil {
return err
}
if err := func() error {
vre.mu.Lock()
defer vre.mu.Unlock()
if !vre.isOpen {
return errors.New("vreplication engine is closed")
}
// Ensure that the en... | [
"func",
"(",
"vre",
"*",
"Engine",
")",
"WaitForPos",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"int",
",",
"pos",
"string",
")",
"error",
"{",
"mPos",
",",
"err",
":=",
"mysql",
".",
"DecodePosition",
"(",
"pos",
")",
"\n",
"if",
"err",
"!... | // WaitForPos waits for the replication to reach the specified position. | [
"WaitForPos",
"waits",
"for",
"the",
"replication",
"to",
"reach",
"the",
"specified",
"position",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/engine.go#L298-L356 |
136,479 | vitessio/vitess | go/vt/vttablet/tabletmanager/vreplication/engine.go | updateStats | func (vre *Engine) updateStats() {
globalStats.mu.Lock()
defer globalStats.mu.Unlock()
globalStats.isOpen = vre.isOpen
globalStats.controllers = make(map[int]*controller, len(vre.controllers))
for id, ct := range vre.controllers {
globalStats.controllers[id] = ct
}
} | go | func (vre *Engine) updateStats() {
globalStats.mu.Lock()
defer globalStats.mu.Unlock()
globalStats.isOpen = vre.isOpen
globalStats.controllers = make(map[int]*controller, len(vre.controllers))
for id, ct := range vre.controllers {
globalStats.controllers[id] = ct
}
} | [
"func",
"(",
"vre",
"*",
"Engine",
")",
"updateStats",
"(",
")",
"{",
"globalStats",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"globalStats",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"globalStats",
".",
"isOpen",
"=",
"vre",
".",
"isOpen",
... | // UpdateStats must be called with lock held. | [
"UpdateStats",
"must",
"be",
"called",
"with",
"lock",
"held",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/engine.go#L359-L368 |
136,480 | vitessio/vitess | go/vt/vttablet/tabletmanager/vreplication/engine.go | rowToMap | func rowToMap(qr *sqltypes.Result, rownum int) (map[string]string, error) {
row := qr.Rows[rownum]
m := make(map[string]string, len(row))
for i, fld := range qr.Fields {
if row[i].IsNull() {
continue
}
m[fld.Name] = row[i].ToString()
}
return m, nil
} | go | func rowToMap(qr *sqltypes.Result, rownum int) (map[string]string, error) {
row := qr.Rows[rownum]
m := make(map[string]string, len(row))
for i, fld := range qr.Fields {
if row[i].IsNull() {
continue
}
m[fld.Name] = row[i].ToString()
}
return m, nil
} | [
"func",
"rowToMap",
"(",
"qr",
"*",
"sqltypes",
".",
"Result",
",",
"rownum",
"int",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"row",
":=",
"qr",
".",
"Rows",
"[",
"rownum",
"]",
"\n",
"m",
":=",
"make",
"(",
"map",
... | // rowToMap converts a row into a map for easier processing. | [
"rowToMap",
"converts",
"a",
"row",
"into",
"a",
"map",
"for",
"easier",
"processing",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/engine.go#L401-L411 |
136,481 | vitessio/vitess | go/vt/vtgate/engine/insert.go | NewQueryInsert | func NewQueryInsert(opcode InsertOpcode, keyspace *vindexes.Keyspace, query string) *Insert {
return &Insert{
Opcode: opcode,
Keyspace: keyspace,
Query: query,
}
} | go | func NewQueryInsert(opcode InsertOpcode, keyspace *vindexes.Keyspace, query string) *Insert {
return &Insert{
Opcode: opcode,
Keyspace: keyspace,
Query: query,
}
} | [
"func",
"NewQueryInsert",
"(",
"opcode",
"InsertOpcode",
",",
"keyspace",
"*",
"vindexes",
".",
"Keyspace",
",",
"query",
"string",
")",
"*",
"Insert",
"{",
"return",
"&",
"Insert",
"{",
"Opcode",
":",
"opcode",
",",
"Keyspace",
":",
"keyspace",
",",
"Quer... | // NewQueryInsert creates an Insert with a query string. | [
"NewQueryInsert",
"creates",
"an",
"Insert",
"with",
"a",
"query",
"string",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L86-L92 |
136,482 | vitessio/vitess | go/vt/vtgate/engine/insert.go | NewSimpleInsert | func NewSimpleInsert(opcode InsertOpcode, table *vindexes.Table, keyspace *vindexes.Keyspace) *Insert {
return &Insert{
Opcode: opcode,
Table: table,
Keyspace: keyspace,
}
} | go | func NewSimpleInsert(opcode InsertOpcode, table *vindexes.Table, keyspace *vindexes.Keyspace) *Insert {
return &Insert{
Opcode: opcode,
Table: table,
Keyspace: keyspace,
}
} | [
"func",
"NewSimpleInsert",
"(",
"opcode",
"InsertOpcode",
",",
"table",
"*",
"vindexes",
".",
"Table",
",",
"keyspace",
"*",
"vindexes",
".",
"Keyspace",
")",
"*",
"Insert",
"{",
"return",
"&",
"Insert",
"{",
"Opcode",
":",
"opcode",
",",
"Table",
":",
"... | // NewSimpleInsert creates an Insert for a Table. | [
"NewSimpleInsert",
"creates",
"an",
"Insert",
"for",
"a",
"Table",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L95-L101 |
136,483 | vitessio/vitess | go/vt/vtgate/engine/insert.go | NewInsert | func NewInsert(opcode InsertOpcode, keyspace *vindexes.Keyspace, vindexValues []sqltypes.PlanValue, table *vindexes.Table, prefix string, mid []string, suffix string) *Insert {
return &Insert{
Opcode: opcode,
Keyspace: keyspace,
VindexValues: vindexValues,
Table: table,
Prefix: prefix,... | go | func NewInsert(opcode InsertOpcode, keyspace *vindexes.Keyspace, vindexValues []sqltypes.PlanValue, table *vindexes.Table, prefix string, mid []string, suffix string) *Insert {
return &Insert{
Opcode: opcode,
Keyspace: keyspace,
VindexValues: vindexValues,
Table: table,
Prefix: prefix,... | [
"func",
"NewInsert",
"(",
"opcode",
"InsertOpcode",
",",
"keyspace",
"*",
"vindexes",
".",
"Keyspace",
",",
"vindexValues",
"[",
"]",
"sqltypes",
".",
"PlanValue",
",",
"table",
"*",
"vindexes",
".",
"Table",
",",
"prefix",
"string",
",",
"mid",
"[",
"]",
... | // NewInsert creates a new Insert. | [
"NewInsert",
"creates",
"a",
"new",
"Insert",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L104-L114 |
136,484 | vitessio/vitess | go/vt/vtgate/engine/insert.go | MarshalJSON | func (ins *Insert) MarshalJSON() ([]byte, error) {
var tname string
if ins.Table != nil {
tname = ins.Table.Name.String()
}
marshalInsert := struct {
Opcode InsertOpcode
Keyspace *vindexes.Keyspace `json:",omitempty"`
Query string `json:",omitempty"`
... | go | func (ins *Insert) MarshalJSON() ([]byte, error) {
var tname string
if ins.Table != nil {
tname = ins.Table.Name.String()
}
marshalInsert := struct {
Opcode InsertOpcode
Keyspace *vindexes.Keyspace `json:",omitempty"`
Query string `json:",omitempty"`
... | [
"func",
"(",
"ins",
"*",
"Insert",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"tname",
"string",
"\n",
"if",
"ins",
".",
"Table",
"!=",
"nil",
"{",
"tname",
"=",
"ins",
".",
"Table",
".",
"Name",
".",
"S... | // MarshalJSON serializes the Insert into a JSON representation.
// It's used for testing and diagnostics. | [
"MarshalJSON",
"serializes",
"the",
"Insert",
"into",
"a",
"JSON",
"representation",
".",
"It",
"s",
"used",
"for",
"testing",
"and",
"diagnostics",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L118-L149 |
136,485 | vitessio/vitess | go/vt/vtgate/engine/insert.go | processGenerate | func (ins *Insert) processGenerate(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (insertID int64, err error) {
if ins.Generate == nil {
return 0, nil
}
// Scan input values to compute the number of values to generate, and
// keep track of where they should be filled.
resolved, err := ins.Generate.... | go | func (ins *Insert) processGenerate(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (insertID int64, err error) {
if ins.Generate == nil {
return 0, nil
}
// Scan input values to compute the number of values to generate, and
// keep track of where they should be filled.
resolved, err := ins.Generate.... | [
"func",
"(",
"ins",
"*",
"Insert",
")",
"processGenerate",
"(",
"vcursor",
"VCursor",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
")",
"(",
"insertID",
"int64",
",",
"err",
"error",
")",
"{",
"if",
"ins",
".",
"Gene... | // processGenerate generates new values using a sequence if necessary.
// If no value was generated, it returns 0. Values are generated only
// for cases where none are supplied. | [
"processGenerate",
"generates",
"new",
"values",
"using",
"a",
"sequence",
"if",
"necessary",
".",
"If",
"no",
"value",
"was",
"generated",
"it",
"returns",
"0",
".",
"Values",
"are",
"generated",
"only",
"for",
"cases",
"where",
"none",
"are",
"supplied",
"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L279-L330 |
136,486 | vitessio/vitess | go/vt/vtgate/engine/insert.go | processPrimary | func (ins *Insert) processPrimary(vcursor VCursor, vindexKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable) ([][]byte, error) {
var flattenedVindexKeys []sqltypes.Value
// TODO: @rafael - this will change once vindex Primary keys also support multicolumns
for _, val := ra... | go | func (ins *Insert) processPrimary(vcursor VCursor, vindexKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable) ([][]byte, error) {
var flattenedVindexKeys []sqltypes.Value
// TODO: @rafael - this will change once vindex Primary keys also support multicolumns
for _, val := ra... | [
"func",
"(",
"ins",
"*",
"Insert",
")",
"processPrimary",
"(",
"vcursor",
"VCursor",
",",
"vindexKeys",
"[",
"]",
"[",
"]",
"sqltypes",
".",
"Value",
",",
"colVindex",
"*",
"vindexes",
".",
"ColumnVindex",
",",
"bv",
"map",
"[",
"string",
"]",
"*",
"qu... | // processPrimary maps the primary vindex values to the kesypace ids. | [
"processPrimary",
"maps",
"the",
"primary",
"vindex",
"values",
"to",
"the",
"kesypace",
"ids",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L455-L493 |
136,487 | vitessio/vitess | go/vt/vtgate/engine/insert.go | processOwned | func (ins *Insert) processOwned(vcursor VCursor, vindexColumnsKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable, ksids [][]byte) error {
for rowNum, rowColumnKeys := range vindexColumnsKeys {
for colIdx, vindexKey := range rowColumnKeys {
col := colVindex.Columns[colId... | go | func (ins *Insert) processOwned(vcursor VCursor, vindexColumnsKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable, ksids [][]byte) error {
for rowNum, rowColumnKeys := range vindexColumnsKeys {
for colIdx, vindexKey := range rowColumnKeys {
col := colVindex.Columns[colId... | [
"func",
"(",
"ins",
"*",
"Insert",
")",
"processOwned",
"(",
"vcursor",
"VCursor",
",",
"vindexColumnsKeys",
"[",
"]",
"[",
"]",
"sqltypes",
".",
"Value",
",",
"colVindex",
"*",
"vindexes",
".",
"ColumnVindex",
",",
"bv",
"map",
"[",
"string",
"]",
"*",
... | // processOwned creates vindex entries for the values of an owned column for InsertSharded. | [
"processOwned",
"creates",
"vindex",
"entries",
"for",
"the",
"values",
"of",
"an",
"owned",
"column",
"for",
"InsertSharded",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L496-L504 |
136,488 | vitessio/vitess | go/vt/vtgate/engine/insert.go | processOwnedIgnore | func (ins *Insert) processOwnedIgnore(vcursor VCursor, vindexColumnsKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable, ksids [][]byte) error {
var createIndexes []int
var createKeys [][]sqltypes.Value
var createKsids [][]byte
for rowNum, rowColumnKeys := range vindexCol... | go | func (ins *Insert) processOwnedIgnore(vcursor VCursor, vindexColumnsKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable, ksids [][]byte) error {
var createIndexes []int
var createKeys [][]sqltypes.Value
var createKsids [][]byte
for rowNum, rowColumnKeys := range vindexCol... | [
"func",
"(",
"ins",
"*",
"Insert",
")",
"processOwnedIgnore",
"(",
"vcursor",
"VCursor",
",",
"vindexColumnsKeys",
"[",
"]",
"[",
"]",
"sqltypes",
".",
"Value",
",",
"colVindex",
"*",
"vindexes",
".",
"ColumnVindex",
",",
"bv",
"map",
"[",
"string",
"]",
... | // processOwnedIgnore creates vindex entries for the values of an owned column for InsertShardedIgnore. | [
"processOwnedIgnore",
"creates",
"vindex",
"entries",
"for",
"the",
"values",
"of",
"an",
"owned",
"column",
"for",
"InsertShardedIgnore",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L507-L552 |
136,489 | vitessio/vitess | go/vt/vtgate/engine/insert.go | processUnowned | func (ins *Insert) processUnowned(vcursor VCursor, vindexColumnsKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable, ksids [][]byte) error {
var reverseIndexes []int
var reverseKsids [][]byte
var verifyIndexes []int
var verifyKeys []sqltypes.Value
var verifyKsids [][]byte... | go | func (ins *Insert) processUnowned(vcursor VCursor, vindexColumnsKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable, ksids [][]byte) error {
var reverseIndexes []int
var reverseKsids [][]byte
var verifyIndexes []int
var verifyKeys []sqltypes.Value
var verifyKsids [][]byte... | [
"func",
"(",
"ins",
"*",
"Insert",
")",
"processUnowned",
"(",
"vcursor",
"VCursor",
",",
"vindexColumnsKeys",
"[",
"]",
"[",
"]",
"sqltypes",
".",
"Value",
",",
"colVindex",
"*",
"vindexes",
".",
"ColumnVindex",
",",
"bv",
"map",
"[",
"string",
"]",
"*"... | // processUnowned either reverse maps or validates the values for an unowned column. | [
"processUnowned",
"either",
"reverse",
"maps",
"or",
"validates",
"the",
"values",
"for",
"an",
"unowned",
"column",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L555-L626 |
136,490 | vitessio/vitess | go/cmd/vtctl/vtctl.go | installSignalHandlers | func installSignalHandlers(cancel func()) {
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGTERM, syscall.SIGINT)
go func() {
<-sigChan
// we got a signal, cancel the current ctx
cancel()
}()
} | go | func installSignalHandlers(cancel func()) {
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGTERM, syscall.SIGINT)
go func() {
<-sigChan
// we got a signal, cancel the current ctx
cancel()
}()
} | [
"func",
"installSignalHandlers",
"(",
"cancel",
"func",
"(",
")",
")",
"{",
"sigChan",
":=",
"make",
"(",
"chan",
"os",
".",
"Signal",
",",
"1",
")",
"\n",
"signal",
".",
"Notify",
"(",
"sigChan",
",",
"syscall",
".",
"SIGTERM",
",",
"syscall",
".",
... | // signal handling, centralized here | [
"signal",
"handling",
"centralized",
"here"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cmd/vtctl/vtctl.go#L59-L67 |
136,491 | vitessio/vitess | go/vt/topo/errors.go | NewError | func NewError(code ErrorCode, node string) error {
var message string
switch code {
case NodeExists:
message = fmt.Sprintf("node already exists: %s", node)
case NoNode:
message = fmt.Sprintf("node doesn't exist: %s", node)
case NodeNotEmpty:
message = fmt.Sprintf("node not empty: %s", node)
case Timeout:
... | go | func NewError(code ErrorCode, node string) error {
var message string
switch code {
case NodeExists:
message = fmt.Sprintf("node already exists: %s", node)
case NoNode:
message = fmt.Sprintf("node doesn't exist: %s", node)
case NodeNotEmpty:
message = fmt.Sprintf("node not empty: %s", node)
case Timeout:
... | [
"func",
"NewError",
"(",
"code",
"ErrorCode",
",",
"node",
"string",
")",
"error",
"{",
"var",
"message",
"string",
"\n",
"switch",
"code",
"{",
"case",
"NodeExists",
":",
"message",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"node",
")",
"\n",
... | // NewError creates a new topo error. | [
"NewError",
"creates",
"a",
"new",
"topo",
"error",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/errors.go#L46-L74 |
136,492 | vitessio/vitess | go/vt/topo/errors.go | IsErrType | func IsErrType(err error, code ErrorCode) bool {
if e, ok := err.(Error); ok {
return e.code == code
}
return false
} | go | func IsErrType(err error, code ErrorCode) bool {
if e, ok := err.(Error); ok {
return e.code == code
}
return false
} | [
"func",
"IsErrType",
"(",
"err",
"error",
",",
"code",
"ErrorCode",
")",
"bool",
"{",
"if",
"e",
",",
"ok",
":=",
"err",
".",
"(",
"Error",
")",
";",
"ok",
"{",
"return",
"e",
".",
"code",
"==",
"code",
"\n",
"}",
"\n",
"return",
"false",
"\n",
... | // IsErrType returns true if the error has the specified ErrorCode. | [
"IsErrType",
"returns",
"true",
"if",
"the",
"error",
"has",
"the",
"specified",
"ErrorCode",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/errors.go#L82-L87 |
136,493 | vitessio/vitess | go/vt/vtgate/planbuilder/join.go | newJoin | func newJoin(lpb, rpb *primitiveBuilder, ajoin *sqlparser.JoinTableExpr) error {
// This function converts ON clauses to WHERE clauses. The WHERE clause
// scope can see all tables, whereas the ON clause can only see the
// participants of the JOIN. However, since the ON clause doesn't allow
// external references,... | go | func newJoin(lpb, rpb *primitiveBuilder, ajoin *sqlparser.JoinTableExpr) error {
// This function converts ON clauses to WHERE clauses. The WHERE clause
// scope can see all tables, whereas the ON clause can only see the
// participants of the JOIN. However, since the ON clause doesn't allow
// external references,... | [
"func",
"newJoin",
"(",
"lpb",
",",
"rpb",
"*",
"primitiveBuilder",
",",
"ajoin",
"*",
"sqlparser",
".",
"JoinTableExpr",
")",
"error",
"{",
"// This function converts ON clauses to WHERE clauses. The WHERE clause",
"// scope can see all tables, whereas the ON clause can only see... | // newJoin makes a new join using the two planBuilder. ajoin can be nil
// if the join is on a ',' operator. lpb will contain the resulting join.
// rpb will be discarded. | [
"newJoin",
"makes",
"a",
"new",
"join",
"using",
"the",
"two",
"planBuilder",
".",
"ajoin",
"can",
"be",
"nil",
"if",
"the",
"join",
"is",
"on",
"a",
"operator",
".",
"lpb",
"will",
"contain",
"the",
"resulting",
"join",
".",
"rpb",
"will",
"be",
"disc... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/join.go#L71-L113 |
136,494 | vitessio/vitess | go/vt/workflow/manager.go | NewManager | func NewManager(ts *topo.Server) *Manager {
return &Manager{
ts: ts,
nodeManager: NewNodeManager(),
started: make(chan struct{}),
workflows: make(map[string]*runningWorkflow),
}
} | go | func NewManager(ts *topo.Server) *Manager {
return &Manager{
ts: ts,
nodeManager: NewNodeManager(),
started: make(chan struct{}),
workflows: make(map[string]*runningWorkflow),
}
} | [
"func",
"NewManager",
"(",
"ts",
"*",
"topo",
".",
"Server",
")",
"*",
"Manager",
"{",
"return",
"&",
"Manager",
"{",
"ts",
":",
"ts",
",",
"nodeManager",
":",
"NewNodeManager",
"(",
")",
",",
"started",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
... | // NewManager creates an initialized Manager. | [
"NewManager",
"creates",
"an",
"initialized",
"Manager",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L127-L134 |
136,495 | vitessio/vitess | go/vt/workflow/manager.go | Run | func (m *Manager) Run(ctx context.Context) {
// Save the context for all other jobs usage, and to indicate
// the manager is running.
m.mu.Lock()
if m.ctx != nil {
m.mu.Unlock()
panic("Manager is already running")
}
m.ctx = ctx
m.loadAndStartJobsLocked()
// Signal the successful startup.
close(m.started)
... | go | func (m *Manager) Run(ctx context.Context) {
// Save the context for all other jobs usage, and to indicate
// the manager is running.
m.mu.Lock()
if m.ctx != nil {
m.mu.Unlock()
panic("Manager is already running")
}
m.ctx = ctx
m.loadAndStartJobsLocked()
// Signal the successful startup.
close(m.started)
... | [
"func",
"(",
"m",
"*",
"Manager",
")",
"Run",
"(",
"ctx",
"context",
".",
"Context",
")",
"{",
"// Save the context for all other jobs usage, and to indicate",
"// the manager is running.",
"m",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"if",
"m",
".",
"ctx",
"!... | // Run is the main entry point for the Manager. It will read each
// checkpoint from the topo Server, and for the ones that are in the
// Running state, will load them in memory and run them.
// It will not return until ctx is canceled. | [
"Run",
"is",
"the",
"main",
"entry",
"point",
"for",
"the",
"Manager",
".",
"It",
"will",
"read",
"each",
"checkpoint",
"from",
"the",
"topo",
"Server",
"and",
"for",
"the",
"ones",
"that",
"are",
"in",
"the",
"Running",
"state",
"will",
"load",
"them",
... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L157-L190 |
136,496 | vitessio/vitess | go/vt/workflow/manager.go | loadAndStartJobsLocked | func (m *Manager) loadAndStartJobsLocked() {
uuids, err := m.ts.GetWorkflowNames(m.ctx)
if err != nil {
log.Errorf("GetWorkflowNames failed to find existing workflows: %v", err)
return
}
for _, uuid := range uuids {
// Load workflows from the topo server, only look at
// 'Running' ones.
wi, err := m.ts.G... | go | func (m *Manager) loadAndStartJobsLocked() {
uuids, err := m.ts.GetWorkflowNames(m.ctx)
if err != nil {
log.Errorf("GetWorkflowNames failed to find existing workflows: %v", err)
return
}
for _, uuid := range uuids {
// Load workflows from the topo server, only look at
// 'Running' ones.
wi, err := m.ts.G... | [
"func",
"(",
"m",
"*",
"Manager",
")",
"loadAndStartJobsLocked",
"(",
")",
"{",
"uuids",
",",
"err",
":=",
"m",
".",
"ts",
".",
"GetWorkflowNames",
"(",
"m",
".",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"... | // loadAndStartJobsLocked will try to load and start all existing jobs
// in the topo Server. It needs to be run holding m.mu. | [
"loadAndStartJobsLocked",
"will",
"try",
"to",
"load",
"and",
"start",
"all",
"existing",
"jobs",
"in",
"the",
"topo",
"Server",
".",
"It",
"needs",
"to",
"be",
"run",
"holding",
"m",
".",
"mu",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L213-L240 |
136,497 | vitessio/vitess | go/vt/workflow/manager.go | Create | func (m *Manager) Create(ctx context.Context, factoryName string, args []string) (string, error) {
m.mu.Lock()
defer m.mu.Unlock()
// Find the factory.
factory, ok := factories[factoryName]
if !ok {
return "", fmt.Errorf("no factory named %v is registered", factoryName)
}
// Create the initial workflowpb.Wor... | go | func (m *Manager) Create(ctx context.Context, factoryName string, args []string) (string, error) {
m.mu.Lock()
defer m.mu.Unlock()
// Find the factory.
factory, ok := factories[factoryName]
if !ok {
return "", fmt.Errorf("no factory named %v is registered", factoryName)
}
// Create the initial workflowpb.Wor... | [
"func",
"(",
"m",
"*",
"Manager",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"factoryName",
"string",
",",
"args",
"[",
"]",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"m",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer... | // Create creates a workflow from the given factory name with the
// provided args. Returns the unique UUID of the workflow. The
// workflowpb.Workflow object is saved in the topo server after
// creation. | [
"Create",
"creates",
"a",
"workflow",
"from",
"the",
"given",
"factory",
"name",
"with",
"the",
"provided",
"args",
".",
"Returns",
"the",
"unique",
"UUID",
"of",
"the",
"workflow",
".",
"The",
"workflowpb",
".",
"Workflow",
"object",
"is",
"saved",
"in",
... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L246-L283 |
136,498 | vitessio/vitess | go/vt/workflow/manager.go | Stop | func (m *Manager) Stop(ctx context.Context, uuid string) error {
// Find the workflow, mark it as stopped.
m.mu.Lock()
rw, ok := m.workflows[uuid]
if !ok {
m.mu.Unlock()
return fmt.Errorf("no running workflow with uuid %v", uuid)
}
rw.stopped = true
m.mu.Unlock()
// Cancel the running guy, and waits for it... | go | func (m *Manager) Stop(ctx context.Context, uuid string) error {
// Find the workflow, mark it as stopped.
m.mu.Lock()
rw, ok := m.workflows[uuid]
if !ok {
m.mu.Unlock()
return fmt.Errorf("no running workflow with uuid %v", uuid)
}
rw.stopped = true
m.mu.Unlock()
// Cancel the running guy, and waits for it... | [
"func",
"(",
"m",
"*",
"Manager",
")",
"Stop",
"(",
"ctx",
"context",
".",
"Context",
",",
"uuid",
"string",
")",
"error",
"{",
"// Find the workflow, mark it as stopped.",
"m",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"rw",
",",
"ok",
":=",
"m",
".",
... | // Stop stops the running workflow. It will cancel its context and
// wait for it to exit. | [
"Stop",
"stops",
"the",
"running",
"workflow",
".",
"It",
"will",
"cancel",
"its",
"context",
"and",
"wait",
"for",
"it",
"to",
"exit",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L416-L436 |
136,499 | vitessio/vitess | go/vt/workflow/manager.go | Delete | func (m *Manager) Delete(ctx context.Context, uuid string) error {
m.mu.Lock()
defer m.mu.Unlock()
rw, ok := m.workflows[uuid]
if !ok {
return fmt.Errorf("no workflow with uuid %v", uuid)
}
if rw.wi.State == workflowpb.WorkflowState_Running {
return fmt.Errorf("cannot delete running workflow")
}
if err := ... | go | func (m *Manager) Delete(ctx context.Context, uuid string) error {
m.mu.Lock()
defer m.mu.Unlock()
rw, ok := m.workflows[uuid]
if !ok {
return fmt.Errorf("no workflow with uuid %v", uuid)
}
if rw.wi.State == workflowpb.WorkflowState_Running {
return fmt.Errorf("cannot delete running workflow")
}
if err := ... | [
"func",
"(",
"m",
"*",
"Manager",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"uuid",
"string",
")",
"error",
"{",
"m",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"rw",
",",
... | // Delete deletes the finished or not started workflow. | [
"Delete",
"deletes",
"the",
"finished",
"or",
"not",
"started",
"workflow",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L439-L456 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.