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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
vitessio/vitess | go/vt/vtgate/vtgate.go | unambiguousKeyspaceBKSIQ | func unambiguousKeyspaceBKSIQ(queries []*vtgatepb.BoundKeyspaceIdQuery) string {
switch len(queries) {
case 0:
return ""
case 1:
return queries[0].Keyspace
default:
keyspace := queries[0].Keyspace
for _, q := range queries[1:] {
if q.Keyspace != keyspace {
// Request targets at least two different ke... | go | func unambiguousKeyspaceBKSIQ(queries []*vtgatepb.BoundKeyspaceIdQuery) string {
switch len(queries) {
case 0:
return ""
case 1:
return queries[0].Keyspace
default:
keyspace := queries[0].Keyspace
for _, q := range queries[1:] {
if q.Keyspace != keyspace {
// Request targets at least two different ke... | [
"func",
"unambiguousKeyspaceBKSIQ",
"(",
"queries",
"[",
"]",
"*",
"vtgatepb",
".",
"BoundKeyspaceIdQuery",
")",
"string",
"{",
"switch",
"len",
"(",
"queries",
")",
"{",
"case",
"0",
":",
"return",
"\"",
"\"",
"\n",
"case",
"1",
":",
"return",
"queries",
... | // unambiguousKeyspaceBKSIQ is a helper function used in the
// ExecuteBatchKeyspaceIds method to determine the "keyspace" label for the
// stats reporting.
// If all queries target the same keyspace, it returns that keyspace.
// Otherwise it returns an empty string. | [
"unambiguousKeyspaceBKSIQ",
"is",
"a",
"helper",
"function",
"used",
"in",
"the",
"ExecuteBatchKeyspaceIds",
"method",
"to",
"determine",
"the",
"keyspace",
"label",
"for",
"the",
"stats",
"reporting",
".",
"If",
"all",
"queries",
"target",
"the",
"same",
"keyspac... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L1132-L1148 | train |
vitessio/vitess | go/vt/vtgate/vtgate.go | unambiguousKeyspaceBSQ | func unambiguousKeyspaceBSQ(queries []*vtgatepb.BoundShardQuery) string {
switch len(queries) {
case 0:
return ""
case 1:
return queries[0].Keyspace
default:
keyspace := queries[0].Keyspace
for _, q := range queries[1:] {
if q.Keyspace != keyspace {
// Request targets at least two different keyspaces... | go | func unambiguousKeyspaceBSQ(queries []*vtgatepb.BoundShardQuery) string {
switch len(queries) {
case 0:
return ""
case 1:
return queries[0].Keyspace
default:
keyspace := queries[0].Keyspace
for _, q := range queries[1:] {
if q.Keyspace != keyspace {
// Request targets at least two different keyspaces... | [
"func",
"unambiguousKeyspaceBSQ",
"(",
"queries",
"[",
"]",
"*",
"vtgatepb",
".",
"BoundShardQuery",
")",
"string",
"{",
"switch",
"len",
"(",
"queries",
")",
"{",
"case",
"0",
":",
"return",
"\"",
"\"",
"\n",
"case",
"1",
":",
"return",
"queries",
"[",
... | // unambiguousKeyspaceBSQ is the same as unambiguousKeyspaceBKSIQ but for the
// ExecuteBatchShards method. We are intentionally duplicating the code here and
// do not try to generalize it because this may be less performant. | [
"unambiguousKeyspaceBSQ",
"is",
"the",
"same",
"as",
"unambiguousKeyspaceBKSIQ",
"but",
"for",
"the",
"ExecuteBatchShards",
"method",
".",
"We",
"are",
"intentionally",
"duplicating",
"the",
"code",
"here",
"and",
"do",
"not",
"try",
"to",
"generalize",
"it",
"bec... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vtgate.go#L1153-L1169 | train |
vitessio/vitess | go/vt/throttler/grpcthrottlerclient/grpcthrottlerclient.go | MaxRates | func (c *client) MaxRates(ctx context.Context) (map[string]int64, error) {
response, err := c.gRPCClient.MaxRates(ctx, &throttlerdatapb.MaxRatesRequest{})
if err != nil {
return nil, vterrors.FromGRPC(err)
}
return response.Rates, nil
} | go | func (c *client) MaxRates(ctx context.Context) (map[string]int64, error) {
response, err := c.gRPCClient.MaxRates(ctx, &throttlerdatapb.MaxRatesRequest{})
if err != nil {
return nil, vterrors.FromGRPC(err)
}
return response.Rates, nil
} | [
"func",
"(",
"c",
"*",
"client",
")",
"MaxRates",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"map",
"[",
"string",
"]",
"int64",
",",
"error",
")",
"{",
"response",
",",
"err",
":=",
"c",
".",
"gRPCClient",
".",
"MaxRates",
"(",
"ctx",
",",
... | // MaxRates is part of the throttlerclient.Client interface and returns the
// current max rate for each throttler of the process. | [
"MaxRates",
"is",
"part",
"of",
"the",
"throttlerclient",
".",
"Client",
"interface",
"and",
"returns",
"the",
"current",
"max",
"rate",
"for",
"each",
"throttler",
"of",
"the",
"process",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/grpcthrottlerclient/grpcthrottlerclient.go#L62-L68 | train |
vitessio/vitess | go/vt/throttler/grpcthrottlerclient/grpcthrottlerclient.go | SetMaxRate | func (c *client) SetMaxRate(ctx context.Context, rate int64) ([]string, error) {
request := &throttlerdatapb.SetMaxRateRequest{
Rate: rate,
}
response, err := c.gRPCClient.SetMaxRate(ctx, request)
if err != nil {
return nil, vterrors.FromGRPC(err)
}
return response.Names, nil
} | go | func (c *client) SetMaxRate(ctx context.Context, rate int64) ([]string, error) {
request := &throttlerdatapb.SetMaxRateRequest{
Rate: rate,
}
response, err := c.gRPCClient.SetMaxRate(ctx, request)
if err != nil {
return nil, vterrors.FromGRPC(err)
}
return response.Names, nil
} | [
"func",
"(",
"c",
"*",
"client",
")",
"SetMaxRate",
"(",
"ctx",
"context",
".",
"Context",
",",
"rate",
"int64",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"request",
":=",
"&",
"throttlerdatapb",
".",
"SetMaxRateRequest",
"{",
"Rate",
":",
... | // SetMaxRate is part of the throttlerclient.Client interface and sets the rate
// on all throttlers of the server. | [
"SetMaxRate",
"is",
"part",
"of",
"the",
"throttlerclient",
".",
"Client",
"interface",
"and",
"sets",
"the",
"rate",
"on",
"all",
"throttlers",
"of",
"the",
"server",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/grpcthrottlerclient/grpcthrottlerclient.go#L72-L82 | train |
vitessio/vitess | go/vt/throttler/grpcthrottlerclient/grpcthrottlerclient.go | GetConfiguration | func (c *client) GetConfiguration(ctx context.Context, throttlerName string) (map[string]*throttlerdatapb.Configuration, error) {
response, err := c.gRPCClient.GetConfiguration(ctx, &throttlerdatapb.GetConfigurationRequest{
ThrottlerName: throttlerName,
})
if err != nil {
return nil, vterrors.FromGRPC(err)
}
r... | go | func (c *client) GetConfiguration(ctx context.Context, throttlerName string) (map[string]*throttlerdatapb.Configuration, error) {
response, err := c.gRPCClient.GetConfiguration(ctx, &throttlerdatapb.GetConfigurationRequest{
ThrottlerName: throttlerName,
})
if err != nil {
return nil, vterrors.FromGRPC(err)
}
r... | [
"func",
"(",
"c",
"*",
"client",
")",
"GetConfiguration",
"(",
"ctx",
"context",
".",
"Context",
",",
"throttlerName",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"*",
"throttlerdatapb",
".",
"Configuration",
",",
"error",
")",
"{",
"response",
",",
"... | // GetConfiguration is part of the throttlerclient.Client interface. | [
"GetConfiguration",
"is",
"part",
"of",
"the",
"throttlerclient",
".",
"Client",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/grpcthrottlerclient/grpcthrottlerclient.go#L85-L93 | train |
vitessio/vitess | go/vt/throttler/grpcthrottlerclient/grpcthrottlerclient.go | UpdateConfiguration | func (c *client) UpdateConfiguration(ctx context.Context, throttlerName string, configuration *throttlerdatapb.Configuration, copyZeroValues bool) ([]string, error) {
response, err := c.gRPCClient.UpdateConfiguration(ctx, &throttlerdatapb.UpdateConfigurationRequest{
ThrottlerName: throttlerName,
Configuration: c... | go | func (c *client) UpdateConfiguration(ctx context.Context, throttlerName string, configuration *throttlerdatapb.Configuration, copyZeroValues bool) ([]string, error) {
response, err := c.gRPCClient.UpdateConfiguration(ctx, &throttlerdatapb.UpdateConfigurationRequest{
ThrottlerName: throttlerName,
Configuration: c... | [
"func",
"(",
"c",
"*",
"client",
")",
"UpdateConfiguration",
"(",
"ctx",
"context",
".",
"Context",
",",
"throttlerName",
"string",
",",
"configuration",
"*",
"throttlerdatapb",
".",
"Configuration",
",",
"copyZeroValues",
"bool",
")",
"(",
"[",
"]",
"string",... | // UpdateConfiguration is part of the throttlerclient.Client interface. | [
"UpdateConfiguration",
"is",
"part",
"of",
"the",
"throttlerclient",
".",
"Client",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/grpcthrottlerclient/grpcthrottlerclient.go#L96-L106 | train |
vitessio/vitess | go/vt/throttler/grpcthrottlerclient/grpcthrottlerclient.go | ResetConfiguration | func (c *client) ResetConfiguration(ctx context.Context, throttlerName string) ([]string, error) {
response, err := c.gRPCClient.ResetConfiguration(ctx, &throttlerdatapb.ResetConfigurationRequest{
ThrottlerName: throttlerName,
})
if err != nil {
return nil, vterrors.FromGRPC(err)
}
return response.Names, nil
} | go | func (c *client) ResetConfiguration(ctx context.Context, throttlerName string) ([]string, error) {
response, err := c.gRPCClient.ResetConfiguration(ctx, &throttlerdatapb.ResetConfigurationRequest{
ThrottlerName: throttlerName,
})
if err != nil {
return nil, vterrors.FromGRPC(err)
}
return response.Names, nil
} | [
"func",
"(",
"c",
"*",
"client",
")",
"ResetConfiguration",
"(",
"ctx",
"context",
".",
"Context",
",",
"throttlerName",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"response",
",",
"err",
":=",
"c",
".",
"gRPCClient",
".",
"ResetCo... | // ResetConfiguration is part of the throttlerclient.Client interface. | [
"ResetConfiguration",
"is",
"part",
"of",
"the",
"throttlerclient",
".",
"Client",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/grpcthrottlerclient/grpcthrottlerclient.go#L109-L117 | train |
vitessio/vitess | go/vt/mysqlctl/reparent.go | PopulateReparentJournal | func PopulateReparentJournal(timeCreatedNS int64, actionName, masterAlias string, pos mysql.Position) string {
posStr := mysql.EncodePosition(pos)
if len(posStr) > mysql.MaximumPositionSize {
posStr = posStr[:mysql.MaximumPositionSize]
}
return fmt.Sprintf("INSERT INTO _vt.reparent_journal "+
"(time_created_ns,... | go | func PopulateReparentJournal(timeCreatedNS int64, actionName, masterAlias string, pos mysql.Position) string {
posStr := mysql.EncodePosition(pos)
if len(posStr) > mysql.MaximumPositionSize {
posStr = posStr[:mysql.MaximumPositionSize]
}
return fmt.Sprintf("INSERT INTO _vt.reparent_journal "+
"(time_created_ns,... | [
"func",
"PopulateReparentJournal",
"(",
"timeCreatedNS",
"int64",
",",
"actionName",
",",
"masterAlias",
"string",
",",
"pos",
"mysql",
".",
"Position",
")",
"string",
"{",
"posStr",
":=",
"mysql",
".",
"EncodePosition",
"(",
"pos",
")",
"\n",
"if",
"len",
"... | // PopulateReparentJournal returns the SQL command to use to populate
// the _vt.reparent_journal table, as well as the time_created_ns
// value used. | [
"PopulateReparentJournal",
"returns",
"the",
"SQL",
"command",
"to",
"use",
"to",
"populate",
"the",
"_vt",
".",
"reparent_journal",
"table",
"as",
"well",
"as",
"the",
"time_created_ns",
"value",
"used",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/reparent.go#L56-L65 | train |
vitessio/vitess | go/vt/mysqlctl/reparent.go | WaitForReparentJournal | func (mysqld *Mysqld) WaitForReparentJournal(ctx context.Context, timeCreatedNS int64) error {
for {
qr, err := mysqld.FetchSuperQuery(ctx, queryReparentJournal(timeCreatedNS))
if err == nil && len(qr.Rows) == 1 {
// we have the row, we're done
return nil
}
// wait a little bit, interrupt if context is ... | go | func (mysqld *Mysqld) WaitForReparentJournal(ctx context.Context, timeCreatedNS int64) error {
for {
qr, err := mysqld.FetchSuperQuery(ctx, queryReparentJournal(timeCreatedNS))
if err == nil && len(qr.Rows) == 1 {
// we have the row, we're done
return nil
}
// wait a little bit, interrupt if context is ... | [
"func",
"(",
"mysqld",
"*",
"Mysqld",
")",
"WaitForReparentJournal",
"(",
"ctx",
"context",
".",
"Context",
",",
"timeCreatedNS",
"int64",
")",
"error",
"{",
"for",
"{",
"qr",
",",
"err",
":=",
"mysqld",
".",
"FetchSuperQuery",
"(",
"ctx",
",",
"queryRepar... | // WaitForReparentJournal will wait until the context is done for
// the row in the reparent_journal table. | [
"WaitForReparentJournal",
"will",
"wait",
"until",
"the",
"context",
"is",
"done",
"for",
"the",
"row",
"in",
"the",
"reparent_journal",
"table",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/reparent.go#L75-L91 | train |
vitessio/vitess | go/vt/mysqlctl/reparent.go | DemoteMaster | func (mysqld *Mysqld) DemoteMaster() (rp mysql.Position, err error) {
cmds := []string{
"FLUSH TABLES WITH READ LOCK",
"UNLOCK TABLES",
}
if err = mysqld.ExecuteSuperQueryList(context.TODO(), cmds); err != nil {
return rp, err
}
return mysqld.MasterPosition()
} | go | func (mysqld *Mysqld) DemoteMaster() (rp mysql.Position, err error) {
cmds := []string{
"FLUSH TABLES WITH READ LOCK",
"UNLOCK TABLES",
}
if err = mysqld.ExecuteSuperQueryList(context.TODO(), cmds); err != nil {
return rp, err
}
return mysqld.MasterPosition()
} | [
"func",
"(",
"mysqld",
"*",
"Mysqld",
")",
"DemoteMaster",
"(",
")",
"(",
"rp",
"mysql",
".",
"Position",
",",
"err",
"error",
")",
"{",
"cmds",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"}",
"\n",
"if",
"err",
"=",
"mysq... | // DemoteMaster will gracefully demote a master mysql instance to read only.
// If the master is still alive, then we need to demote it gracefully
// make it read-only, flush the writes and get the position | [
"DemoteMaster",
"will",
"gracefully",
"demote",
"a",
"master",
"mysql",
"instance",
"to",
"read",
"only",
".",
"If",
"the",
"master",
"is",
"still",
"alive",
"then",
"we",
"need",
"to",
"demote",
"it",
"gracefully",
"make",
"it",
"read",
"-",
"only",
"flus... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/reparent.go#L96-L105 | train |
vitessio/vitess | go/vt/mysqlctl/reparent.go | PromoteSlave | func (mysqld *Mysqld) PromoteSlave(hookExtraEnv map[string]string) (mysql.Position, error) {
ctx := context.TODO()
conn, err := getPoolReconnect(ctx, mysqld.dbaPool)
if err != nil {
return mysql.Position{}, err
}
defer conn.Recycle()
// Since we handle replication, just stop it.
cmds := []string{
conn.StopS... | go | func (mysqld *Mysqld) PromoteSlave(hookExtraEnv map[string]string) (mysql.Position, error) {
ctx := context.TODO()
conn, err := getPoolReconnect(ctx, mysqld.dbaPool)
if err != nil {
return mysql.Position{}, err
}
defer conn.Recycle()
// Since we handle replication, just stop it.
cmds := []string{
conn.StopS... | [
"func",
"(",
"mysqld",
"*",
"Mysqld",
")",
"PromoteSlave",
"(",
"hookExtraEnv",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"mysql",
".",
"Position",
",",
"error",
")",
"{",
"ctx",
":=",
"context",
".",
"TODO",
"(",
")",
"\n",
"conn",
",",
"err",
... | // PromoteSlave will promote a slave to be the new master. | [
"PromoteSlave",
"will",
"promote",
"a",
"slave",
"to",
"be",
"the",
"new",
"master",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/reparent.go#L108-L132 | train |
vitessio/vitess | go/vt/vtgate/gateway/gateway.go | RegisterCreator | func RegisterCreator(name string, gc Creator) {
if _, ok := creators[name]; ok {
log.Fatalf("Gateway %s already exists", name)
}
creators[name] = gc
} | go | func RegisterCreator(name string, gc Creator) {
if _, ok := creators[name]; ok {
log.Fatalf("Gateway %s already exists", name)
}
creators[name] = gc
} | [
"func",
"RegisterCreator",
"(",
"name",
"string",
",",
"gc",
"Creator",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"creators",
"[",
"name",
"]",
";",
"ok",
"{",
"log",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n",
"creators",
"[",... | // RegisterCreator registers a Creator with given name. | [
"RegisterCreator",
"registers",
"a",
"Creator",
"with",
"given",
"name",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/gateway.go#L88-L93 | train |
vitessio/vitess | go/vt/vtgate/gateway/gateway.go | GetCreator | func GetCreator() Creator {
gc, ok := creators[*implementation]
if !ok {
log.Exitf("No gateway registered as %s", *implementation)
}
return gc
} | go | func GetCreator() Creator {
gc, ok := creators[*implementation]
if !ok {
log.Exitf("No gateway registered as %s", *implementation)
}
return gc
} | [
"func",
"GetCreator",
"(",
")",
"Creator",
"{",
"gc",
",",
"ok",
":=",
"creators",
"[",
"*",
"implementation",
"]",
"\n",
"if",
"!",
"ok",
"{",
"log",
".",
"Exitf",
"(",
"\"",
"\"",
",",
"*",
"implementation",
")",
"\n",
"}",
"\n",
"return",
"gc",
... | // GetCreator returns the Creator specified by the gateway_implementation flag. | [
"GetCreator",
"returns",
"the",
"Creator",
"specified",
"by",
"the",
"gateway_implementation",
"flag",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/gateway.go#L96-L102 | train |
vitessio/vitess | go/stats/histogram.go | Add | func (h *Histogram) Add(value int64) {
for i := range h.labels {
if i == len(h.labels)-1 || value <= h.cutoffs[i] {
h.buckets[i].Add(1)
h.total.Add(value)
break
}
}
if h.hook != nil {
h.hook(value)
}
} | go | func (h *Histogram) Add(value int64) {
for i := range h.labels {
if i == len(h.labels)-1 || value <= h.cutoffs[i] {
h.buckets[i].Add(1)
h.total.Add(value)
break
}
}
if h.hook != nil {
h.hook(value)
}
} | [
"func",
"(",
"h",
"*",
"Histogram",
")",
"Add",
"(",
"value",
"int64",
")",
"{",
"for",
"i",
":=",
"range",
"h",
".",
"labels",
"{",
"if",
"i",
"==",
"len",
"(",
"h",
".",
"labels",
")",
"-",
"1",
"||",
"value",
"<=",
"h",
".",
"cutoffs",
"["... | // Add adds a new measurement to the Histogram. | [
"Add",
"adds",
"a",
"new",
"measurement",
"to",
"the",
"Histogram",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/histogram.go#L77-L88 | train |
vitessio/vitess | go/stats/histogram.go | Counts | func (h *Histogram) Counts() map[string]int64 {
counts := make(map[string]int64, len(h.labels))
for i, label := range h.labels {
counts[label] = h.buckets[i].Get()
}
return counts
} | go | func (h *Histogram) Counts() map[string]int64 {
counts := make(map[string]int64, len(h.labels))
for i, label := range h.labels {
counts[label] = h.buckets[i].Get()
}
return counts
} | [
"func",
"(",
"h",
"*",
"Histogram",
")",
"Counts",
"(",
")",
"map",
"[",
"string",
"]",
"int64",
"{",
"counts",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"int64",
",",
"len",
"(",
"h",
".",
"labels",
")",
")",
"\n",
"for",
"i",
",",
"label"... | // Counts returns a map from labels to the current count in the Histogram for that label. | [
"Counts",
"returns",
"a",
"map",
"from",
"labels",
"to",
"the",
"current",
"count",
"in",
"the",
"Histogram",
"for",
"that",
"label",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/histogram.go#L116-L122 | train |
vitessio/vitess | go/stats/histogram.go | Count | func (h *Histogram) Count() (count int64) {
for i := range h.buckets {
count += h.buckets[i].Get()
}
return
} | go | func (h *Histogram) Count() (count int64) {
for i := range h.buckets {
count += h.buckets[i].Get()
}
return
} | [
"func",
"(",
"h",
"*",
"Histogram",
")",
"Count",
"(",
")",
"(",
"count",
"int64",
")",
"{",
"for",
"i",
":=",
"range",
"h",
".",
"buckets",
"{",
"count",
"+=",
"h",
".",
"buckets",
"[",
"i",
"]",
".",
"Get",
"(",
")",
"\n",
"}",
"\n",
"retur... | // Count returns the number of times Add has been called. | [
"Count",
"returns",
"the",
"number",
"of",
"times",
"Add",
"has",
"been",
"called",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/histogram.go#L130-L135 | train |
vitessio/vitess | go/stats/histogram.go | Buckets | func (h *Histogram) Buckets() []int64 {
buckets := make([]int64, len(h.buckets))
for i := range h.buckets {
buckets[i] = h.buckets[i].Get()
}
return buckets
} | go | func (h *Histogram) Buckets() []int64 {
buckets := make([]int64, len(h.buckets))
for i := range h.buckets {
buckets[i] = h.buckets[i].Get()
}
return buckets
} | [
"func",
"(",
"h",
"*",
"Histogram",
")",
"Buckets",
"(",
")",
"[",
"]",
"int64",
"{",
"buckets",
":=",
"make",
"(",
"[",
"]",
"int64",
",",
"len",
"(",
"h",
".",
"buckets",
")",
")",
"\n",
"for",
"i",
":=",
"range",
"h",
".",
"buckets",
"{",
... | // Buckets returns a snapshot of the current values in all buckets. | [
"Buckets",
"returns",
"a",
"snapshot",
"of",
"the",
"current",
"values",
"in",
"all",
"buckets",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/histogram.go#L158-L164 | train |
vitessio/vitess | go/vt/callinfo/fakecallinfo/fakecallinfo.go | Text | func (fci *FakeCallInfo) Text() string {
return fmt.Sprintf("%s:%s(fakeRPC)", fci.Remote, fci.Method)
} | go | func (fci *FakeCallInfo) Text() string {
return fmt.Sprintf("%s:%s(fakeRPC)", fci.Remote, fci.Method)
} | [
"func",
"(",
"fci",
"*",
"FakeCallInfo",
")",
"Text",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fci",
".",
"Remote",
",",
"fci",
".",
"Method",
")",
"\n",
"}"
] | // Text returns the text. | [
"Text",
"returns",
"the",
"text",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/callinfo/fakecallinfo/fakecallinfo.go#L43-L45 | train |
vitessio/vitess | go/vt/mysqlctl/gcsbackupstorage/gcs.go | EndBackup | func (bh *GCSBackupHandle) EndBackup(ctx context.Context) error {
if bh.readOnly {
return fmt.Errorf("EndBackup cannot be called on read-only backup")
}
return nil
} | go | func (bh *GCSBackupHandle) EndBackup(ctx context.Context) error {
if bh.readOnly {
return fmt.Errorf("EndBackup cannot be called on read-only backup")
}
return nil
} | [
"func",
"(",
"bh",
"*",
"GCSBackupHandle",
")",
"EndBackup",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"if",
"bh",
".",
"readOnly",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"... | // EndBackup implements BackupHandle. | [
"EndBackup",
"implements",
"BackupHandle",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/gcsbackupstorage/gcs.go#L78-L83 | train |
vitessio/vitess | go/vt/mysqlctl/gcsbackupstorage/gcs.go | client | func (bs *GCSBackupStorage) client(ctx context.Context) (*storage.Client, error) {
bs.mu.Lock()
defer bs.mu.Unlock()
if bs._client == nil {
// The context needs to be valid for longer than just
// the creation context, so we create a new one, but
// keep the span information.
ctx = trace.CopySpan(context.Ba... | go | func (bs *GCSBackupStorage) client(ctx context.Context) (*storage.Client, error) {
bs.mu.Lock()
defer bs.mu.Unlock()
if bs._client == nil {
// The context needs to be valid for longer than just
// the creation context, so we create a new one, but
// keep the span information.
ctx = trace.CopySpan(context.Ba... | [
"func",
"(",
"bs",
"*",
"GCSBackupStorage",
")",
"client",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"storage",
".",
"Client",
",",
"error",
")",
"{",
"bs",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"bs",
".",
"mu",
".",
"Unloc... | // client returns the GCS Storage client instance.
// If there isn't one yet, it tries to create one. | [
"client",
"returns",
"the",
"GCS",
"Storage",
"client",
"instance",
".",
"If",
"there",
"isn",
"t",
"one",
"yet",
"it",
"tries",
"to",
"create",
"one",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/gcsbackupstorage/gcs.go#L224-L244 | train |
vitessio/vitess | go/vt/mysqlctl/gcsbackupstorage/gcs.go | objName | func objName(parts ...string) string {
if *root != "" {
return *root + "/" + strings.Join(parts, "/")
}
return strings.Join(parts, "/")
} | go | func objName(parts ...string) string {
if *root != "" {
return *root + "/" + strings.Join(parts, "/")
}
return strings.Join(parts, "/")
} | [
"func",
"objName",
"(",
"parts",
"...",
"string",
")",
"string",
"{",
"if",
"*",
"root",
"!=",
"\"",
"\"",
"{",
"return",
"*",
"root",
"+",
"\"",
"\"",
"+",
"strings",
".",
"Join",
"(",
"parts",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
... | // objName joins path parts into an object name.
// Unlike path.Join, it doesn't collapse ".." or strip trailing slashes.
// It also adds the value of the -gcs_backup_storage_root flag if set. | [
"objName",
"joins",
"path",
"parts",
"into",
"an",
"object",
"name",
".",
"Unlike",
"path",
".",
"Join",
"it",
"doesn",
"t",
"collapse",
"..",
"or",
"strip",
"trailing",
"slashes",
".",
"It",
"also",
"adds",
"the",
"value",
"of",
"the",
"-",
"gcs_backup_... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/gcsbackupstorage/gcs.go#L249-L254 | train |
vitessio/vitess | go/vt/automation/vtctlclient_wrapper.go | ExecuteVtctl | func ExecuteVtctl(ctx context.Context, server string, args []string) (string, error) {
var output bytes.Buffer
loggerToBufferFunc := createLoggerEventToBufferFunction(&output)
outputLogger := newOutputLogger(loggerToBufferFunc)
startMsg := fmt.Sprintf("Executing remote vtctl command: %v server: %v", args, server)
... | go | func ExecuteVtctl(ctx context.Context, server string, args []string) (string, error) {
var output bytes.Buffer
loggerToBufferFunc := createLoggerEventToBufferFunction(&output)
outputLogger := newOutputLogger(loggerToBufferFunc)
startMsg := fmt.Sprintf("Executing remote vtctl command: %v server: %v", args, server)
... | [
"func",
"ExecuteVtctl",
"(",
"ctx",
"context",
".",
"Context",
",",
"server",
"string",
",",
"args",
"[",
"]",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"output",
"bytes",
".",
"Buffer",
"\n",
"loggerToBufferFunc",
":=",
"createLoggerEve... | // ExecuteVtctl runs vtctl using vtctlclient. The stream of Event
// messages is concatenated into one output string.
// Additionally, the start and the end of the command will be logged to make
// it easier to debug which command was executed and how long it took. | [
"ExecuteVtctl",
"runs",
"vtctl",
"using",
"vtctlclient",
".",
"The",
"stream",
"of",
"Event",
"messages",
"is",
"concatenated",
"into",
"one",
"output",
"string",
".",
"Additionally",
"the",
"start",
"and",
"the",
"end",
"of",
"the",
"command",
"will",
"be",
... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/automation/vtctlclient_wrapper.go#L35-L54 | train |
vitessio/vitess | go/vt/automation/vtctlclient_wrapper.go | createLoggerEventToBufferFunction | func createLoggerEventToBufferFunction(output *bytes.Buffer) func(*logutilpb.Event) {
return func(e *logutilpb.Event) {
logutil.EventToBuffer(e, output)
output.WriteRune('\n')
}
} | go | func createLoggerEventToBufferFunction(output *bytes.Buffer) func(*logutilpb.Event) {
return func(e *logutilpb.Event) {
logutil.EventToBuffer(e, output)
output.WriteRune('\n')
}
} | [
"func",
"createLoggerEventToBufferFunction",
"(",
"output",
"*",
"bytes",
".",
"Buffer",
")",
"func",
"(",
"*",
"logutilpb",
".",
"Event",
")",
"{",
"return",
"func",
"(",
"e",
"*",
"logutilpb",
".",
"Event",
")",
"{",
"logutil",
".",
"EventToBuffer",
"(",... | // createLoggerEventToBufferFunction returns a function to add LoggerEvent
// structs to a given buffer, one line per event.
// The buffer can be used to return a multi-line string with all events. | [
"createLoggerEventToBufferFunction",
"returns",
"a",
"function",
"to",
"add",
"LoggerEvent",
"structs",
"to",
"a",
"given",
"buffer",
"one",
"line",
"per",
"event",
".",
"The",
"buffer",
"can",
"be",
"used",
"to",
"return",
"a",
"multi",
"-",
"line",
"string",... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/automation/vtctlclient_wrapper.go#L59-L64 | train |
vitessio/vitess | go/vt/grpcclient/client.go | RegisterGRPCDialOptions | func RegisterGRPCDialOptions(grpcDialOptionsFunc func(opts []grpc.DialOption) ([]grpc.DialOption, error)) {
grpcDialOptions = append(grpcDialOptions, grpcDialOptionsFunc)
} | go | func RegisterGRPCDialOptions(grpcDialOptionsFunc func(opts []grpc.DialOption) ([]grpc.DialOption, error)) {
grpcDialOptions = append(grpcDialOptions, grpcDialOptionsFunc)
} | [
"func",
"RegisterGRPCDialOptions",
"(",
"grpcDialOptionsFunc",
"func",
"(",
"opts",
"[",
"]",
"grpc",
".",
"DialOption",
")",
"(",
"[",
"]",
"grpc",
".",
"DialOption",
",",
"error",
")",
")",
"{",
"grpcDialOptions",
"=",
"append",
"(",
"grpcDialOptions",
","... | // RegisterGRPCDialOptions registers an implementation of AuthServer. | [
"RegisterGRPCDialOptions",
"registers",
"an",
"implementation",
"of",
"AuthServer",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/grpcclient/client.go#L51-L53 | train |
vitessio/vitess | go/vt/grpcclient/client.go | Dial | func Dial(target string, failFast FailFast, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
grpccommon.EnableTracingOpt()
newopts := []grpc.DialOption{
grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(*grpccommon.MaxMessageSize),
grpc.MaxCallSendMsgSize(*grpccommon.MaxMessageSize),
grpc.FailFast(b... | go | func Dial(target string, failFast FailFast, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
grpccommon.EnableTracingOpt()
newopts := []grpc.DialOption{
grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(*grpccommon.MaxMessageSize),
grpc.MaxCallSendMsgSize(*grpccommon.MaxMessageSize),
grpc.FailFast(b... | [
"func",
"Dial",
"(",
"target",
"string",
",",
"failFast",
"FailFast",
",",
"opts",
"...",
"grpc",
".",
"DialOption",
")",
"(",
"*",
"grpc",
".",
"ClientConn",
",",
"error",
")",
"{",
"grpccommon",
".",
"EnableTracingOpt",
"(",
")",
"\n",
"newopts",
":=",... | // Dial creates a grpc connection to the given target.
// failFast is a non-optional parameter because callers are required to specify
// what that should be. | [
"Dial",
"creates",
"a",
"grpc",
"connection",
"to",
"the",
"given",
"target",
".",
"failFast",
"is",
"a",
"non",
"-",
"optional",
"parameter",
"because",
"callers",
"are",
"required",
"to",
"specify",
"what",
"that",
"should",
"be",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/grpcclient/client.go#L58-L100 | train |
vitessio/vitess | go/vt/grpcclient/client.go | SecureDialOption | func SecureDialOption(cert, key, ca, name string) (grpc.DialOption, error) {
// No security options set, just return.
if (cert == "" || key == "") && ca == "" {
return grpc.WithInsecure(), nil
}
// Load the config.
config, err := vttls.ClientConfig(cert, key, ca, name)
if err != nil {
return nil, err
}
//... | go | func SecureDialOption(cert, key, ca, name string) (grpc.DialOption, error) {
// No security options set, just return.
if (cert == "" || key == "") && ca == "" {
return grpc.WithInsecure(), nil
}
// Load the config.
config, err := vttls.ClientConfig(cert, key, ca, name)
if err != nil {
return nil, err
}
//... | [
"func",
"SecureDialOption",
"(",
"cert",
",",
"key",
",",
"ca",
",",
"name",
"string",
")",
"(",
"grpc",
".",
"DialOption",
",",
"error",
")",
"{",
"// No security options set, just return.",
"if",
"(",
"cert",
"==",
"\"",
"\"",
"||",
"key",
"==",
"\"",
... | // SecureDialOption returns the gRPC dial option to use for the
// given client connection. It is either using TLS, or Insecure if
// nothing is set. | [
"SecureDialOption",
"returns",
"the",
"gRPC",
"dial",
"option",
"to",
"use",
"for",
"the",
"given",
"client",
"connection",
".",
"It",
"is",
"either",
"using",
"TLS",
"or",
"Insecure",
"if",
"nothing",
"is",
"set",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/grpcclient/client.go#L114-L129 | train |
vitessio/vitess | go/vt/grpcclient/client.go | Add | func (collector *clientInterceptorBuilder) Add(s grpc.StreamClientInterceptor, u grpc.UnaryClientInterceptor) {
collector.unaryInterceptors = append(collector.unaryInterceptors, u)
collector.streamInterceptors = append(collector.streamInterceptors, s)
} | go | func (collector *clientInterceptorBuilder) Add(s grpc.StreamClientInterceptor, u grpc.UnaryClientInterceptor) {
collector.unaryInterceptors = append(collector.unaryInterceptors, u)
collector.streamInterceptors = append(collector.streamInterceptors, s)
} | [
"func",
"(",
"collector",
"*",
"clientInterceptorBuilder",
")",
"Add",
"(",
"s",
"grpc",
".",
"StreamClientInterceptor",
",",
"u",
"grpc",
".",
"UnaryClientInterceptor",
")",
"{",
"collector",
".",
"unaryInterceptors",
"=",
"append",
"(",
"collector",
".",
"unar... | // Add adds interceptors to the chain of interceptors | [
"Add",
"adds",
"interceptors",
"to",
"the",
"chain",
"of",
"interceptors"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/grpcclient/client.go#L138-L141 | train |
vitessio/vitess | go/sqltypes/type.go | IsSigned | func IsSigned(t querypb.Type) bool {
return int(t)&(flagIsIntegral|flagIsUnsigned) == flagIsIntegral
} | go | func IsSigned(t querypb.Type) bool {
return int(t)&(flagIsIntegral|flagIsUnsigned) == flagIsIntegral
} | [
"func",
"IsSigned",
"(",
"t",
"querypb",
".",
"Type",
")",
"bool",
"{",
"return",
"int",
"(",
"t",
")",
"&",
"(",
"flagIsIntegral",
"|",
"flagIsUnsigned",
")",
"==",
"flagIsIntegral",
"\n",
"}"
] | // IsSigned returns true if querypb.Type is a signed integral.
// If you have a Value object, use its member function. | [
"IsSigned",
"returns",
"true",
"if",
"querypb",
".",
"Type",
"is",
"a",
"signed",
"integral",
".",
"If",
"you",
"have",
"a",
"Value",
"object",
"use",
"its",
"member",
"function",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/type.go#L49-L51 | train |
vitessio/vitess | go/sqltypes/type.go | IsQuoted | func IsQuoted(t querypb.Type) bool {
return (int(t)&flagIsQuoted == flagIsQuoted) && t != Bit
} | go | func IsQuoted(t querypb.Type) bool {
return (int(t)&flagIsQuoted == flagIsQuoted) && t != Bit
} | [
"func",
"IsQuoted",
"(",
"t",
"querypb",
".",
"Type",
")",
"bool",
"{",
"return",
"(",
"int",
"(",
"t",
")",
"&",
"flagIsQuoted",
"==",
"flagIsQuoted",
")",
"&&",
"t",
"!=",
"Bit",
"\n",
"}"
] | // IsQuoted returns true if querypb.Type is a quoted text or binary.
// If you have a Value object, use its member function. | [
"IsQuoted",
"returns",
"true",
"if",
"querypb",
".",
"Type",
"is",
"a",
"quoted",
"text",
"or",
"binary",
".",
"If",
"you",
"have",
"a",
"Value",
"object",
"use",
"its",
"member",
"function",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/type.go#L68-L70 | train |
vitessio/vitess | go/sqltypes/type.go | isNumber | func isNumber(t querypb.Type) bool {
return IsIntegral(t) || IsFloat(t) || t == Decimal
} | go | func isNumber(t querypb.Type) bool {
return IsIntegral(t) || IsFloat(t) || t == Decimal
} | [
"func",
"isNumber",
"(",
"t",
"querypb",
".",
"Type",
")",
"bool",
"{",
"return",
"IsIntegral",
"(",
"t",
")",
"||",
"IsFloat",
"(",
"t",
")",
"||",
"t",
"==",
"Decimal",
"\n",
"}"
] | // isNumber returns true if the type is any type of number. | [
"isNumber",
"returns",
"true",
"if",
"the",
"type",
"is",
"any",
"type",
"of",
"number",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/type.go#L85-L87 | train |
vitessio/vitess | go/sqltypes/type.go | modifyType | func modifyType(typ querypb.Type, flags int64) querypb.Type {
switch typ {
case Int8:
if flags&mysqlUnsigned != 0 {
return Uint8
}
return Int8
case Int16:
if flags&mysqlUnsigned != 0 {
return Uint16
}
return Int16
case Int32:
if flags&mysqlUnsigned != 0 {
return Uint32
}
return Int32
cas... | go | func modifyType(typ querypb.Type, flags int64) querypb.Type {
switch typ {
case Int8:
if flags&mysqlUnsigned != 0 {
return Uint8
}
return Int8
case Int16:
if flags&mysqlUnsigned != 0 {
return Uint16
}
return Int16
case Int32:
if flags&mysqlUnsigned != 0 {
return Uint32
}
return Int32
cas... | [
"func",
"modifyType",
"(",
"typ",
"querypb",
".",
"Type",
",",
"flags",
"int64",
")",
"querypb",
".",
"Type",
"{",
"switch",
"typ",
"{",
"case",
"Int8",
":",
"if",
"flags",
"&",
"mysqlUnsigned",
"!=",
"0",
"{",
"return",
"Uint8",
"\n",
"}",
"\n",
"re... | // modifyType modifies the vitess type based on the
// mysql flag. The function checks specific flags based
// on the type. This allows us to ignore stray flags
// that MySQL occasionally sets. | [
"modifyType",
"modifies",
"the",
"vitess",
"type",
"based",
"on",
"the",
"mysql",
"flag",
".",
"The",
"function",
"checks",
"specific",
"flags",
"based",
"on",
"the",
"type",
".",
"This",
"allows",
"us",
"to",
"ignore",
"stray",
"flags",
"that",
"MySQL",
"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/type.go#L186-L236 | train |
vitessio/vitess | go/sqltypes/type.go | MySQLToType | func MySQLToType(mysqlType, flags int64) (typ querypb.Type, err error) {
result, ok := mysqlToType[mysqlType]
if !ok {
return 0, fmt.Errorf("unsupported type: %d", mysqlType)
}
return modifyType(result, flags), nil
} | go | func MySQLToType(mysqlType, flags int64) (typ querypb.Type, err error) {
result, ok := mysqlToType[mysqlType]
if !ok {
return 0, fmt.Errorf("unsupported type: %d", mysqlType)
}
return modifyType(result, flags), nil
} | [
"func",
"MySQLToType",
"(",
"mysqlType",
",",
"flags",
"int64",
")",
"(",
"typ",
"querypb",
".",
"Type",
",",
"err",
"error",
")",
"{",
"result",
",",
"ok",
":=",
"mysqlToType",
"[",
"mysqlType",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"0",
",",
... | // MySQLToType computes the vitess type from mysql type and flags. | [
"MySQLToType",
"computes",
"the",
"vitess",
"type",
"from",
"mysql",
"type",
"and",
"flags",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/type.go#L239-L245 | train |
vitessio/vitess | go/sqltypes/type.go | TypeToMySQL | func TypeToMySQL(typ querypb.Type) (mysqlType, flags int64) {
val := typeToMySQL[typ]
return val.typ, val.flags
} | go | func TypeToMySQL(typ querypb.Type) (mysqlType, flags int64) {
val := typeToMySQL[typ]
return val.typ, val.flags
} | [
"func",
"TypeToMySQL",
"(",
"typ",
"querypb",
".",
"Type",
")",
"(",
"mysqlType",
",",
"flags",
"int64",
")",
"{",
"val",
":=",
"typeToMySQL",
"[",
"typ",
"]",
"\n",
"return",
"val",
".",
"typ",
",",
"val",
".",
"flags",
"\n",
"}"
] | // TypeToMySQL returns the equivalent mysql type and flag for a vitess type. | [
"TypeToMySQL",
"returns",
"the",
"equivalent",
"mysql",
"type",
"and",
"flag",
"for",
"a",
"vitess",
"type",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/type.go#L285-L288 | train |
vitessio/vitess | go/vt/tableacl/tableacl.go | Valid | func (tacl *tableACL) Valid() bool {
tacl.RLock()
defer tacl.RUnlock()
return tacl.entries != nil
} | go | func (tacl *tableACL) Valid() bool {
tacl.RLock()
defer tacl.RUnlock()
return tacl.entries != nil
} | [
"func",
"(",
"tacl",
"*",
"tableACL",
")",
"Valid",
"(",
")",
"bool",
"{",
"tacl",
".",
"RLock",
"(",
")",
"\n",
"defer",
"tacl",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"tacl",
".",
"entries",
"!=",
"nil",
"\n",
"}"
] | // Valid returns whether the tableACL is valid.
// Currently it only checks that it has been initialized. | [
"Valid",
"returns",
"whether",
"the",
"tableACL",
"is",
"valid",
".",
"Currently",
"it",
"only",
"checks",
"that",
"it",
"has",
"been",
"initialized",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/tableacl/tableacl.go#L206-L210 | train |
vitessio/vitess | go/vt/tableacl/tableacl.go | ValidateProto | func ValidateProto(config *tableaclpb.Config) (err error) {
t := patricia.NewTrie()
for _, group := range config.TableGroups {
for _, name := range group.TableNamesOrPrefixes {
var prefix patricia.Prefix
if strings.HasSuffix(name, "%") {
prefix = []byte(strings.TrimSuffix(name, "%"))
} else {
prefi... | go | func ValidateProto(config *tableaclpb.Config) (err error) {
t := patricia.NewTrie()
for _, group := range config.TableGroups {
for _, name := range group.TableNamesOrPrefixes {
var prefix patricia.Prefix
if strings.HasSuffix(name, "%") {
prefix = []byte(strings.TrimSuffix(name, "%"))
} else {
prefi... | [
"func",
"ValidateProto",
"(",
"config",
"*",
"tableaclpb",
".",
"Config",
")",
"(",
"err",
"error",
")",
"{",
"t",
":=",
"patricia",
".",
"NewTrie",
"(",
")",
"\n",
"for",
"_",
",",
"group",
":=",
"range",
"config",
".",
"TableGroups",
"{",
"for",
"_... | // ValidateProto returns an error if the given proto has problems
// that would cause InitFromProto to fail. | [
"ValidateProto",
"returns",
"an",
"error",
"if",
"the",
"given",
"proto",
"has",
"problems",
"that",
"would",
"cause",
"InitFromProto",
"to",
"fail",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/tableacl/tableacl.go#L214-L240 | train |
vitessio/vitess | go/vt/tableacl/tableacl.go | Authorized | func Authorized(table string, role Role) *ACLResult {
return currentTableACL.Authorized(table, role)
} | go | func Authorized(table string, role Role) *ACLResult {
return currentTableACL.Authorized(table, role)
} | [
"func",
"Authorized",
"(",
"table",
"string",
",",
"role",
"Role",
")",
"*",
"ACLResult",
"{",
"return",
"currentTableACL",
".",
"Authorized",
"(",
"table",
",",
"role",
")",
"\n",
"}"
] | // Authorized returns the list of entities who have the specified role on a tablel. | [
"Authorized",
"returns",
"the",
"list",
"of",
"entities",
"who",
"have",
"the",
"specified",
"role",
"on",
"a",
"tablel",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/tableacl/tableacl.go#L243-L245 | train |
vitessio/vitess | go/vt/tableacl/tableacl.go | Register | func Register(name string, factory acl.Factory) {
mu.Lock()
defer mu.Unlock()
if _, ok := acls[name]; ok {
panic(fmt.Sprintf("register a registered key: %s", name))
}
acls[name] = factory
} | go | func Register(name string, factory acl.Factory) {
mu.Lock()
defer mu.Unlock()
if _, ok := acls[name]; ok {
panic(fmt.Sprintf("register a registered key: %s", name))
}
acls[name] = factory
} | [
"func",
"Register",
"(",
"name",
"string",
",",
"factory",
"acl",
".",
"Factory",
")",
"{",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"acls",
"[",
"name",
"]",
";",
"ok",
"{",
... | // Register registers an AclFactory. | [
"Register",
"registers",
"an",
"AclFactory",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/tableacl/tableacl.go#L288-L295 | train |
vitessio/vitess | go/vt/tableacl/tableacl.go | GetCurrentACLFactory | func GetCurrentACLFactory() (acl.Factory, error) {
mu.Lock()
defer mu.Unlock()
if len(acls) == 0 {
return nil, fmt.Errorf("no AclFactories registered")
}
if defaultACL == "" {
if len(acls) == 1 {
for _, aclFactory := range acls {
return aclFactory, nil
}
}
return nil, errors.New("there are more t... | go | func GetCurrentACLFactory() (acl.Factory, error) {
mu.Lock()
defer mu.Unlock()
if len(acls) == 0 {
return nil, fmt.Errorf("no AclFactories registered")
}
if defaultACL == "" {
if len(acls) == 1 {
for _, aclFactory := range acls {
return aclFactory, nil
}
}
return nil, errors.New("there are more t... | [
"func",
"GetCurrentACLFactory",
"(",
")",
"(",
"acl",
".",
"Factory",
",",
"error",
")",
"{",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"len",
"(",
"acls",
")",
"==",
"0",
"{",
"return",
"nil",
",",
... | // GetCurrentACLFactory returns current table acl implementation. | [
"GetCurrentACLFactory",
"returns",
"current",
"table",
"acl",
"implementation",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/tableacl/tableacl.go#L305-L323 | train |
vitessio/vitess | go/vt/wrangler/tablet.go | InitTablet | func (wr *Wrangler) InitTablet(ctx context.Context, tablet *topodatapb.Tablet, allowMasterOverride, createShardAndKeyspace, allowUpdate bool) error {
shard, kr, err := topo.ValidateShardName(tablet.Shard)
if err != nil {
return err
}
tablet.Shard = shard
tablet.KeyRange = kr
// get the shard, possibly creating... | go | func (wr *Wrangler) InitTablet(ctx context.Context, tablet *topodatapb.Tablet, allowMasterOverride, createShardAndKeyspace, allowUpdate bool) error {
shard, kr, err := topo.ValidateShardName(tablet.Shard)
if err != nil {
return err
}
tablet.Shard = shard
tablet.KeyRange = kr
// get the shard, possibly creating... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"InitTablet",
"(",
"ctx",
"context",
".",
"Context",
",",
"tablet",
"*",
"topodatapb",
".",
"Tablet",
",",
"allowMasterOverride",
",",
"createShardAndKeyspace",
",",
"allowUpdate",
"bool",
")",
"error",
"{",
"shard",
... | // Tablet related methods for wrangler
// InitTablet creates or updates a tablet. If no parent is specified
// in the tablet, and the tablet has a slave type, we will find the
// appropriate parent. If createShardAndKeyspace is true and the
// parent keyspace or shard don't exist, they will be created. If
// allowUpda... | [
"Tablet",
"related",
"methods",
"for",
"wrangler",
"InitTablet",
"creates",
"or",
"updates",
"a",
"tablet",
".",
"If",
"no",
"parent",
"is",
"specified",
"in",
"the",
"tablet",
"and",
"the",
"tablet",
"has",
"a",
"slave",
"type",
"we",
"will",
"find",
"the... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/tablet.go#L41-L99 | train |
vitessio/vitess | go/vt/wrangler/tablet.go | ChangeSlaveType | func (wr *Wrangler) ChangeSlaveType(ctx context.Context, tabletAlias *topodatapb.TabletAlias, tabletType topodatapb.TabletType) error {
// Load tablet to find endpoint, and keyspace and shard assignment.
ti, err := wr.ts.GetTablet(ctx, tabletAlias)
if err != nil {
return err
}
if !topo.IsTrivialTypeChange(ti.Ty... | go | func (wr *Wrangler) ChangeSlaveType(ctx context.Context, tabletAlias *topodatapb.TabletAlias, tabletType topodatapb.TabletType) error {
// Load tablet to find endpoint, and keyspace and shard assignment.
ti, err := wr.ts.GetTablet(ctx, tabletAlias)
if err != nil {
return err
}
if !topo.IsTrivialTypeChange(ti.Ty... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"ChangeSlaveType",
"(",
"ctx",
"context",
".",
"Context",
",",
"tabletAlias",
"*",
"topodatapb",
".",
"TabletAlias",
",",
"tabletType",
"topodatapb",
".",
"TabletType",
")",
"error",
"{",
"// Load tablet to find endpoint, a... | // ChangeSlaveType changes the type of tablet and recomputes all
// necessary derived paths in the serving graph, if necessary.
//
// Note we don't update the master record in the Shard here, as we
// can't ChangeType from and out of master anyway. | [
"ChangeSlaveType",
"changes",
"the",
"type",
"of",
"tablet",
"and",
"recomputes",
"all",
"necessary",
"derived",
"paths",
"in",
"the",
"serving",
"graph",
"if",
"necessary",
".",
"Note",
"we",
"don",
"t",
"update",
"the",
"master",
"record",
"in",
"the",
"Sh... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/tablet.go#L149-L162 | train |
vitessio/vitess | go/vt/wrangler/tablet.go | RefreshTabletState | func (wr *Wrangler) RefreshTabletState(ctx context.Context, tabletAlias *topodatapb.TabletAlias) error {
// Load tablet to find endpoint, and keyspace and shard assignment.
ti, err := wr.ts.GetTablet(ctx, tabletAlias)
if err != nil {
return err
}
// and ask the tablet to refresh itself
return wr.tmc.RefreshSta... | go | func (wr *Wrangler) RefreshTabletState(ctx context.Context, tabletAlias *topodatapb.TabletAlias) error {
// Load tablet to find endpoint, and keyspace and shard assignment.
ti, err := wr.ts.GetTablet(ctx, tabletAlias)
if err != nil {
return err
}
// and ask the tablet to refresh itself
return wr.tmc.RefreshSta... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"RefreshTabletState",
"(",
"ctx",
"context",
".",
"Context",
",",
"tabletAlias",
"*",
"topodatapb",
".",
"TabletAlias",
")",
"error",
"{",
"// Load tablet to find endpoint, and keyspace and shard assignment.",
"ti",
",",
"err",... | // RefreshTabletState refreshes tablet state | [
"RefreshTabletState",
"refreshes",
"tablet",
"state"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/tablet.go#L165-L174 | train |
vitessio/vitess | go/vt/wrangler/tablet.go | ExecuteFetchAsApp | func (wr *Wrangler) ExecuteFetchAsApp(ctx context.Context, tabletAlias *topodatapb.TabletAlias, usePool bool, query string, maxRows int) (*querypb.QueryResult, error) {
ti, err := wr.ts.GetTablet(ctx, tabletAlias)
if err != nil {
return nil, err
}
return wr.tmc.ExecuteFetchAsApp(ctx, ti.Tablet, usePool, []byte(qu... | go | func (wr *Wrangler) ExecuteFetchAsApp(ctx context.Context, tabletAlias *topodatapb.TabletAlias, usePool bool, query string, maxRows int) (*querypb.QueryResult, error) {
ti, err := wr.ts.GetTablet(ctx, tabletAlias)
if err != nil {
return nil, err
}
return wr.tmc.ExecuteFetchAsApp(ctx, ti.Tablet, usePool, []byte(qu... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"ExecuteFetchAsApp",
"(",
"ctx",
"context",
".",
"Context",
",",
"tabletAlias",
"*",
"topodatapb",
".",
"TabletAlias",
",",
"usePool",
"bool",
",",
"query",
"string",
",",
"maxRows",
"int",
")",
"(",
"*",
"querypb",... | // ExecuteFetchAsApp executes a query remotely using the App pool | [
"ExecuteFetchAsApp",
"executes",
"a",
"query",
"remotely",
"using",
"the",
"App",
"pool"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/tablet.go#L177-L183 | train |
vitessio/vitess | go/vt/wrangler/tablet.go | VReplicationExec | func (wr *Wrangler) VReplicationExec(ctx context.Context, tabletAlias *topodatapb.TabletAlias, query string) (*querypb.QueryResult, error) {
ti, err := wr.ts.GetTablet(ctx, tabletAlias)
if err != nil {
return nil, err
}
return wr.tmc.VReplicationExec(ctx, ti.Tablet, query)
} | go | func (wr *Wrangler) VReplicationExec(ctx context.Context, tabletAlias *topodatapb.TabletAlias, query string) (*querypb.QueryResult, error) {
ti, err := wr.ts.GetTablet(ctx, tabletAlias)
if err != nil {
return nil, err
}
return wr.tmc.VReplicationExec(ctx, ti.Tablet, query)
} | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"VReplicationExec",
"(",
"ctx",
"context",
".",
"Context",
",",
"tabletAlias",
"*",
"topodatapb",
".",
"TabletAlias",
",",
"query",
"string",
")",
"(",
"*",
"querypb",
".",
"QueryResult",
",",
"error",
")",
"{",
"... | // VReplicationExec executes a query remotely using the DBA pool | [
"VReplicationExec",
"executes",
"a",
"query",
"remotely",
"using",
"the",
"DBA",
"pool"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/tablet.go#L195-L201 | train |
vitessio/vitess | go/vt/vttablet/tabletserver/splitquery/splitter.go | NewSplitter | func NewSplitter(splitParams *SplitParams, algorithm SplitAlgorithmInterface) *Splitter {
var splitter Splitter
splitter.splitParams = splitParams
splitter.algorithm = algorithm
splitter.splitParams = splitParams
splitColumns := algorithm.getSplitColumns()
splitter.startBindVariableNames = make([]string, 0, len(... | go | func NewSplitter(splitParams *SplitParams, algorithm SplitAlgorithmInterface) *Splitter {
var splitter Splitter
splitter.splitParams = splitParams
splitter.algorithm = algorithm
splitter.splitParams = splitParams
splitColumns := algorithm.getSplitColumns()
splitter.startBindVariableNames = make([]string, 0, len(... | [
"func",
"NewSplitter",
"(",
"splitParams",
"*",
"SplitParams",
",",
"algorithm",
"SplitAlgorithmInterface",
")",
"*",
"Splitter",
"{",
"var",
"splitter",
"Splitter",
"\n",
"splitter",
".",
"splitParams",
"=",
"splitParams",
"\n",
"splitter",
".",
"algorithm",
"=",... | // NewSplitter creates a new Splitter object. | [
"NewSplitter",
"creates",
"a",
"new",
"Splitter",
"object",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/splitter.go#L42-L59 | train |
vitessio/vitess | go/vt/vttablet/tabletserver/splitquery/splitter.go | initQueryPartSQLs | func (splitter *Splitter) initQueryPartSQLs() {
splitColumns := convertColumnsToExpr(splitter.algorithm.getSplitColumns())
startBindVariables := convertBindVariableNamesToExpr(splitter.startBindVariableNames)
endBindVariables := convertBindVariableNamesToExpr(splitter.endBindVariableNames)
splitColsLessThanEnd := c... | go | func (splitter *Splitter) initQueryPartSQLs() {
splitColumns := convertColumnsToExpr(splitter.algorithm.getSplitColumns())
startBindVariables := convertBindVariableNamesToExpr(splitter.startBindVariableNames)
endBindVariables := convertBindVariableNamesToExpr(splitter.endBindVariableNames)
splitColsLessThanEnd := c... | [
"func",
"(",
"splitter",
"*",
"Splitter",
")",
"initQueryPartSQLs",
"(",
")",
"{",
"splitColumns",
":=",
"convertColumnsToExpr",
"(",
"splitter",
".",
"algorithm",
".",
"getSplitColumns",
"(",
")",
")",
"\n",
"startBindVariables",
":=",
"convertBindVariableNamesToEx... | // initQueryPartSQLs initializes the firstQueryPartSQL, middleQueryPartSQL and lastQueryPartSQL
// fields. | [
"initQueryPartSQLs",
"initializes",
"the",
"firstQueryPartSQL",
"middleQueryPartSQL",
"and",
"lastQueryPartSQL",
"fields",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/splitter.go#L83-L106 | train |
vitessio/vitess | go/vt/vttablet/tabletserver/splitquery/splitter.go | queryWithAdditionalWhere | func queryWithAdditionalWhere(
selectAST *sqlparser.Select, addedWhere sqlparser.Expr) *sqlparser.Select {
result := *selectAST // Create a shallow-copy of 'selectAST'
addAndTermToWhereClause(&result, addedWhere)
return &result
} | go | func queryWithAdditionalWhere(
selectAST *sqlparser.Select, addedWhere sqlparser.Expr) *sqlparser.Select {
result := *selectAST // Create a shallow-copy of 'selectAST'
addAndTermToWhereClause(&result, addedWhere)
return &result
} | [
"func",
"queryWithAdditionalWhere",
"(",
"selectAST",
"*",
"sqlparser",
".",
"Select",
",",
"addedWhere",
"sqlparser",
".",
"Expr",
")",
"*",
"sqlparser",
".",
"Select",
"{",
"result",
":=",
"*",
"selectAST",
"// Create a shallow-copy of 'selectAST'",
"\n",
"addAndT... | // queryWithAdditionalWhere returns a copy of the given SELECT query with 'addedWhere' ANDed with
// the query's WHERE clause. If the query does not already have a WHERE clause, 'addedWhere'
// becomes the query's WHERE clause. | [
"queryWithAdditionalWhere",
"returns",
"a",
"copy",
"of",
"the",
"given",
"SELECT",
"query",
"with",
"addedWhere",
"ANDed",
"with",
"the",
"query",
"s",
"WHERE",
"clause",
".",
"If",
"the",
"query",
"does",
"not",
"already",
"have",
"a",
"WHERE",
"clause",
"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/splitter.go#L249-L254 | train |
vitessio/vitess | go/vt/vtgate/gateway/shard_error.go | NewShardError | func NewShardError(in error, target *querypb.Target, tablet *topodatapb.Tablet) error {
if in == nil {
return nil
}
if tablet != nil {
return vterrors.Wrapf(in, "target: %s.%s.%s, used tablet: %s", target.Keyspace, target.Shard, topoproto.TabletTypeLString(target.TabletType), topotools.TabletIdent(tablet))
}
i... | go | func NewShardError(in error, target *querypb.Target, tablet *topodatapb.Tablet) error {
if in == nil {
return nil
}
if tablet != nil {
return vterrors.Wrapf(in, "target: %s.%s.%s, used tablet: %s", target.Keyspace, target.Shard, topoproto.TabletTypeLString(target.TabletType), topotools.TabletIdent(tablet))
}
i... | [
"func",
"NewShardError",
"(",
"in",
"error",
",",
"target",
"*",
"querypb",
".",
"Target",
",",
"tablet",
"*",
"topodatapb",
".",
"Tablet",
")",
"error",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"tablet",
"!=",
"nil"... | // NewShardError returns a new error with the shard info amended. | [
"NewShardError",
"returns",
"a",
"new",
"error",
"with",
"the",
"shard",
"info",
"amended",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/shard_error.go#L29-L40 | train |
vitessio/vitess | go/vt/vtgate/planbuilder/update.go | buildUpdatePlan | func buildUpdatePlan(upd *sqlparser.Update, vschema ContextVSchema) (*engine.Update, error) {
eupd := &engine.Update{
ChangedVindexValues: make(map[string][]sqltypes.PlanValue),
}
pb := newPrimitiveBuilder(vschema, newJointab(sqlparser.GetBindvars(upd)))
ro, err := pb.processDMLTable(upd.TableExprs)
if err != ni... | go | func buildUpdatePlan(upd *sqlparser.Update, vschema ContextVSchema) (*engine.Update, error) {
eupd := &engine.Update{
ChangedVindexValues: make(map[string][]sqltypes.PlanValue),
}
pb := newPrimitiveBuilder(vschema, newJointab(sqlparser.GetBindvars(upd)))
ro, err := pb.processDMLTable(upd.TableExprs)
if err != ni... | [
"func",
"buildUpdatePlan",
"(",
"upd",
"*",
"sqlparser",
".",
"Update",
",",
"vschema",
"ContextVSchema",
")",
"(",
"*",
"engine",
".",
"Update",
",",
"error",
")",
"{",
"eupd",
":=",
"&",
"engine",
".",
"Update",
"{",
"ChangedVindexValues",
":",
"make",
... | // buildUpdatePlan builds the instructions for an UPDATE statement. | [
"buildUpdatePlan",
"builds",
"the",
"instructions",
"for",
"an",
"UPDATE",
"statement",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/update.go#L33-L109 | train |
vitessio/vitess | go/vt/vtgate/planbuilder/update.go | buildChangedVindexesValues | func buildChangedVindexesValues(eupd *engine.Update, update *sqlparser.Update, colVindexes []*vindexes.ColumnVindex) (map[string][]sqltypes.PlanValue, error) {
changedVindexes := make(map[string][]sqltypes.PlanValue)
for i, vindex := range colVindexes {
var vindexValues []sqltypes.PlanValue
for _, vcol := range v... | go | func buildChangedVindexesValues(eupd *engine.Update, update *sqlparser.Update, colVindexes []*vindexes.ColumnVindex) (map[string][]sqltypes.PlanValue, error) {
changedVindexes := make(map[string][]sqltypes.PlanValue)
for i, vindex := range colVindexes {
var vindexValues []sqltypes.PlanValue
for _, vcol := range v... | [
"func",
"buildChangedVindexesValues",
"(",
"eupd",
"*",
"engine",
".",
"Update",
",",
"update",
"*",
"sqlparser",
".",
"Update",
",",
"colVindexes",
"[",
"]",
"*",
"vindexes",
".",
"ColumnVindex",
")",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"sqltypes",
... | // buildChangedVindexesValues adds to the plan all the lookup vindexes that are changing.
// Updates can only be performed to secondary lookup vindexes with no complex expressions
// in the set clause. | [
"buildChangedVindexesValues",
"adds",
"to",
"the",
"plan",
"all",
"the",
"lookup",
"vindexes",
"that",
"are",
"changing",
".",
"Updates",
"can",
"only",
"be",
"performed",
"to",
"secondary",
"lookup",
"vindexes",
"with",
"no",
"complex",
"expressions",
"in",
"th... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/update.go#L114-L160 | train |
vitessio/vitess | go/vt/vtgate/planbuilder/update.go | dmlFormatter | func dmlFormatter(buf *sqlparser.TrackedBuffer, node sqlparser.SQLNode) {
switch node := node.(type) {
case sqlparser.TableName:
node.Name.Format(buf)
return
}
node.Format(buf)
} | go | func dmlFormatter(buf *sqlparser.TrackedBuffer, node sqlparser.SQLNode) {
switch node := node.(type) {
case sqlparser.TableName:
node.Name.Format(buf)
return
}
node.Format(buf)
} | [
"func",
"dmlFormatter",
"(",
"buf",
"*",
"sqlparser",
".",
"TrackedBuffer",
",",
"node",
"sqlparser",
".",
"SQLNode",
")",
"{",
"switch",
"node",
":=",
"node",
".",
"(",
"type",
")",
"{",
"case",
"sqlparser",
".",
"TableName",
":",
"node",
".",
"Name",
... | // dmlFormatter strips out keyspace name from dmls. | [
"dmlFormatter",
"strips",
"out",
"keyspace",
"name",
"from",
"dmls",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/update.go#L190-L197 | train |
vitessio/vitess | go/vt/vtgate/planbuilder/update.go | getDMLRouting | func getDMLRouting(where *sqlparser.Where, table *vindexes.Table) (vindexes.Vindex, []sqltypes.PlanValue, error) {
if where == nil {
return nil, nil, errors.New("unsupported: multi-shard where clause in DML")
}
for _, index := range table.Ordered {
if !index.Vindex.IsUnique() {
continue
}
if pv, ok := get... | go | func getDMLRouting(where *sqlparser.Where, table *vindexes.Table) (vindexes.Vindex, []sqltypes.PlanValue, error) {
if where == nil {
return nil, nil, errors.New("unsupported: multi-shard where clause in DML")
}
for _, index := range table.Ordered {
if !index.Vindex.IsUnique() {
continue
}
if pv, ok := get... | [
"func",
"getDMLRouting",
"(",
"where",
"*",
"sqlparser",
".",
"Where",
",",
"table",
"*",
"vindexes",
".",
"Table",
")",
"(",
"vindexes",
".",
"Vindex",
",",
"[",
"]",
"sqltypes",
".",
"PlanValue",
",",
"error",
")",
"{",
"if",
"where",
"==",
"nil",
... | // getDMLRouting returns the vindex and values for the DML,
// If it cannot find a unique vindex match, it returns an error. | [
"getDMLRouting",
"returns",
"the",
"vindex",
"and",
"values",
"for",
"the",
"DML",
"If",
"it",
"cannot",
"find",
"a",
"unique",
"vindex",
"match",
"it",
"returns",
"an",
"error",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/update.go#L207-L220 | train |
vitessio/vitess | go/vt/vtgate/planbuilder/update.go | getMatch | func getMatch(node sqlparser.Expr, col sqlparser.ColIdent) (pv sqltypes.PlanValue, ok bool) {
filters := splitAndExpression(nil, node)
for _, filter := range filters {
filter = skipParenthesis(filter)
if parenthesis, ok := node.(*sqlparser.ParenExpr); ok {
if pv, ok := getMatch(parenthesis.Expr, col); ok {
... | go | func getMatch(node sqlparser.Expr, col sqlparser.ColIdent) (pv sqltypes.PlanValue, ok bool) {
filters := splitAndExpression(nil, node)
for _, filter := range filters {
filter = skipParenthesis(filter)
if parenthesis, ok := node.(*sqlparser.ParenExpr); ok {
if pv, ok := getMatch(parenthesis.Expr, col); ok {
... | [
"func",
"getMatch",
"(",
"node",
"sqlparser",
".",
"Expr",
",",
"col",
"sqlparser",
".",
"ColIdent",
")",
"(",
"pv",
"sqltypes",
".",
"PlanValue",
",",
"ok",
"bool",
")",
"{",
"filters",
":=",
"splitAndExpression",
"(",
"nil",
",",
"node",
")",
"\n",
"... | // getMatch returns the matched value if there is an equality
// constraint on the specified column that can be used to
// decide on a route. | [
"getMatch",
"returns",
"the",
"matched",
"value",
"if",
"there",
"is",
"an",
"equality",
"constraint",
"on",
"the",
"specified",
"column",
"that",
"can",
"be",
"used",
"to",
"decide",
"on",
"a",
"route",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/update.go#L225-L255 | train |
vitessio/vitess | go/vt/vttablet/grpctabletconn/conn.go | DialTablet | func DialTablet(tablet *topodatapb.Tablet, failFast grpcclient.FailFast) (queryservice.QueryService, error) {
// create the RPC client
addr := ""
if grpcPort, ok := tablet.PortMap["grpc"]; ok {
addr = netutil.JoinHostPort(tablet.Hostname, grpcPort)
} else {
addr = tablet.Hostname
}
opt, err := grpcclient.Secu... | go | func DialTablet(tablet *topodatapb.Tablet, failFast grpcclient.FailFast) (queryservice.QueryService, error) {
// create the RPC client
addr := ""
if grpcPort, ok := tablet.PortMap["grpc"]; ok {
addr = netutil.JoinHostPort(tablet.Hostname, grpcPort)
} else {
addr = tablet.Hostname
}
opt, err := grpcclient.Secu... | [
"func",
"DialTablet",
"(",
"tablet",
"*",
"topodatapb",
".",
"Tablet",
",",
"failFast",
"grpcclient",
".",
"FailFast",
")",
"(",
"queryservice",
".",
"QueryService",
",",
"error",
")",
"{",
"// create the RPC client",
"addr",
":=",
"\"",
"\"",
"\n",
"if",
"g... | // DialTablet creates and initializes gRPCQueryClient. | [
"DialTablet",
"creates",
"and",
"initializes",
"gRPCQueryClient",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctabletconn/conn.go#L64-L89 | train |
vitessio/vitess | go/vt/vttablet/grpctabletconn/conn.go | StreamExecute | func (conn *gRPCQueryClient) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]*querypb.BindVariable, transactionID int64, options *querypb.ExecuteOptions, callback func(*sqltypes.Result) error) error {
// All streaming clients should follow the code pattern below.
// The fi... | go | func (conn *gRPCQueryClient) StreamExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]*querypb.BindVariable, transactionID int64, options *querypb.ExecuteOptions, callback func(*sqltypes.Result) error) error {
// All streaming clients should follow the code pattern below.
// The fi... | [
"func",
"(",
"conn",
"*",
"gRPCQueryClient",
")",
"StreamExecute",
"(",
"ctx",
"context",
".",
"Context",
",",
"target",
"*",
"querypb",
".",
"Target",
",",
"query",
"string",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",... | // StreamExecute executes the query and streams results back through callback. | [
"StreamExecute",
"executes",
"the",
"query",
"and",
"streams",
"results",
"back",
"through",
"callback",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctabletconn/conn.go#L142-L197 | train |
vitessio/vitess | go/vt/vttablet/grpctabletconn/conn.go | Begin | func (conn *gRPCQueryClient) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (transactionID int64, err error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
return 0, tabletconn.ConnClosed
}
req := &querypb.BeginRequest{
Target: target,
Effective... | go | func (conn *gRPCQueryClient) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (transactionID int64, err error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
return 0, tabletconn.ConnClosed
}
req := &querypb.BeginRequest{
Target: target,
Effective... | [
"func",
"(",
"conn",
"*",
"gRPCQueryClient",
")",
"Begin",
"(",
"ctx",
"context",
".",
"Context",
",",
"target",
"*",
"querypb",
".",
"Target",
",",
"options",
"*",
"querypb",
".",
"ExecuteOptions",
")",
"(",
"transactionID",
"int64",
",",
"err",
"error",
... | // Begin starts a transaction. | [
"Begin",
"starts",
"a",
"transaction",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctabletconn/conn.go#L200-L218 | train |
vitessio/vitess | go/vt/vttablet/grpctabletconn/conn.go | Commit | func (conn *gRPCQueryClient) Commit(ctx context.Context, target *querypb.Target, transactionID int64) error {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
return tabletconn.ConnClosed
}
req := &querypb.CommitRequest{
Target: target,
EffectiveCallerId: callerid.EffectiveCallerIDFrom... | go | func (conn *gRPCQueryClient) Commit(ctx context.Context, target *querypb.Target, transactionID int64) error {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
return tabletconn.ConnClosed
}
req := &querypb.CommitRequest{
Target: target,
EffectiveCallerId: callerid.EffectiveCallerIDFrom... | [
"func",
"(",
"conn",
"*",
"gRPCQueryClient",
")",
"Commit",
"(",
"ctx",
"context",
".",
"Context",
",",
"target",
"*",
"querypb",
".",
"Target",
",",
"transactionID",
"int64",
")",
"error",
"{",
"conn",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",... | // Commit commits the ongoing transaction. | [
"Commit",
"commits",
"the",
"ongoing",
"transaction",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctabletconn/conn.go#L221-L239 | train |
vitessio/vitess | go/vt/vttablet/grpctabletconn/conn.go | BeginExecute | func (conn *gRPCQueryClient) BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]*querypb.BindVariable, options *querypb.ExecuteOptions) (result *sqltypes.Result, transactionID int64, err error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
return nil, 0, tab... | go | func (conn *gRPCQueryClient) BeginExecute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]*querypb.BindVariable, options *querypb.ExecuteOptions) (result *sqltypes.Result, transactionID int64, err error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
return nil, 0, tab... | [
"func",
"(",
"conn",
"*",
"gRPCQueryClient",
")",
"BeginExecute",
"(",
"ctx",
"context",
".",
"Context",
",",
"target",
"*",
"querypb",
".",
"Target",
",",
"query",
"string",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
... | // BeginExecute starts a transaction and runs an Execute. | [
"BeginExecute",
"starts",
"a",
"transaction",
"and",
"runs",
"an",
"Execute",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctabletconn/conn.go#L439-L464 | train |
vitessio/vitess | go/vt/vttablet/grpctabletconn/conn.go | BeginExecuteBatch | func (conn *gRPCQueryClient) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []*querypb.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) (results []sqltypes.Result, transactionID int64, err error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
return nil, 0, ta... | go | func (conn *gRPCQueryClient) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []*querypb.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) (results []sqltypes.Result, transactionID int64, err error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
return nil, 0, ta... | [
"func",
"(",
"conn",
"*",
"gRPCQueryClient",
")",
"BeginExecuteBatch",
"(",
"ctx",
"context",
".",
"Context",
",",
"target",
"*",
"querypb",
".",
"Target",
",",
"queries",
"[",
"]",
"*",
"querypb",
".",
"BoundQuery",
",",
"asTransaction",
"bool",
",",
"opt... | // BeginExecuteBatch starts a transaction and runs an ExecuteBatch. | [
"BeginExecuteBatch",
"starts",
"a",
"transaction",
"and",
"runs",
"an",
"ExecuteBatch",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctabletconn/conn.go#L467-L491 | train |
vitessio/vitess | go/vt/vttablet/grpctabletconn/conn.go | SplitQuery | func (conn *gRPCQueryClient) SplitQuery(
ctx context.Context,
target *querypb.Target,
query *querypb.BoundQuery,
splitColumns []string,
splitCount int64,
numRowsPerQueryPart int64,
algorithm querypb.SplitQueryRequest_Algorithm) (queries []*querypb.QuerySplit, err error) {
conn.mu.RLock()
defer conn.mu.RUnlock... | go | func (conn *gRPCQueryClient) SplitQuery(
ctx context.Context,
target *querypb.Target,
query *querypb.BoundQuery,
splitColumns []string,
splitCount int64,
numRowsPerQueryPart int64,
algorithm querypb.SplitQueryRequest_Algorithm) (queries []*querypb.QuerySplit, err error) {
conn.mu.RLock()
defer conn.mu.RUnlock... | [
"func",
"(",
"conn",
"*",
"gRPCQueryClient",
")",
"SplitQuery",
"(",
"ctx",
"context",
".",
"Context",
",",
"target",
"*",
"querypb",
".",
"Target",
",",
"query",
"*",
"querypb",
".",
"BoundQuery",
",",
"splitColumns",
"[",
"]",
"string",
",",
"splitCount"... | // SplitQuery is the stub for TabletServer.SplitQuery RPC | [
"SplitQuery",
"is",
"the",
"stub",
"for",
"TabletServer",
".",
"SplitQuery",
"RPC"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctabletconn/conn.go#L561-L592 | train |
vitessio/vitess | go/vt/vttablet/grpctabletconn/conn.go | StreamHealth | func (conn *gRPCQueryClient) StreamHealth(ctx context.Context, callback func(*querypb.StreamHealthResponse) error) error {
// Please see comments in StreamExecute to see how this works.
ctx, cancel := context.WithCancel(ctx)
defer cancel()
stream, err := func() (queryservicepb.Query_StreamHealthClient, error) {
... | go | func (conn *gRPCQueryClient) StreamHealth(ctx context.Context, callback func(*querypb.StreamHealthResponse) error) error {
// Please see comments in StreamExecute to see how this works.
ctx, cancel := context.WithCancel(ctx)
defer cancel()
stream, err := func() (queryservicepb.Query_StreamHealthClient, error) {
... | [
"func",
"(",
"conn",
"*",
"gRPCQueryClient",
")",
"StreamHealth",
"(",
"ctx",
"context",
".",
"Context",
",",
"callback",
"func",
"(",
"*",
"querypb",
".",
"StreamHealthResponse",
")",
"error",
")",
"error",
"{",
"// Please see comments in StreamExecute to see how t... | // StreamHealth starts a streaming RPC for VTTablet health status updates. | [
"StreamHealth",
"starts",
"a",
"streaming",
"RPC",
"for",
"VTTablet",
"health",
"status",
"updates",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctabletconn/conn.go#L595-L628 | train |
vitessio/vitess | go/vt/vttablet/grpctabletconn/conn.go | UpdateStream | func (conn *gRPCQueryClient) UpdateStream(ctx context.Context, target *querypb.Target, position string, timestamp int64, callback func(*querypb.StreamEvent) error) error {
// Please see comments in StreamExecute to see how this works.
ctx, cancel := context.WithCancel(ctx)
defer cancel()
stream, err := func() (que... | go | func (conn *gRPCQueryClient) UpdateStream(ctx context.Context, target *querypb.Target, position string, timestamp int64, callback func(*querypb.StreamEvent) error) error {
// Please see comments in StreamExecute to see how this works.
ctx, cancel := context.WithCancel(ctx)
defer cancel()
stream, err := func() (que... | [
"func",
"(",
"conn",
"*",
"gRPCQueryClient",
")",
"UpdateStream",
"(",
"ctx",
"context",
".",
"Context",
",",
"target",
"*",
"querypb",
".",
"Target",
",",
"position",
"string",
",",
"timestamp",
"int64",
",",
"callback",
"func",
"(",
"*",
"querypb",
".",
... | // UpdateStream starts a streaming query to VTTablet. | [
"UpdateStream",
"starts",
"a",
"streaming",
"query",
"to",
"VTTablet",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctabletconn/conn.go#L631-L671 | train |
vitessio/vitess | go/vt/vttablet/grpctabletconn/conn.go | VStream | func (conn *gRPCQueryClient) VStream(ctx context.Context, target *querypb.Target, position string, filter *binlogdatapb.Filter, send func([]*binlogdatapb.VEvent) error) error {
stream, err := func() (queryservicepb.Query_VStreamClient, error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
retur... | go | func (conn *gRPCQueryClient) VStream(ctx context.Context, target *querypb.Target, position string, filter *binlogdatapb.Filter, send func([]*binlogdatapb.VEvent) error) error {
stream, err := func() (queryservicepb.Query_VStreamClient, error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc == nil {
retur... | [
"func",
"(",
"conn",
"*",
"gRPCQueryClient",
")",
"VStream",
"(",
"ctx",
"context",
".",
"Context",
",",
"target",
"*",
"querypb",
".",
"Target",
",",
"position",
"string",
",",
"filter",
"*",
"binlogdatapb",
".",
"Filter",
",",
"send",
"func",
"(",
"[",... | // VStream starts a VReplication stream. | [
"VStream",
"starts",
"a",
"VReplication",
"stream",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctabletconn/conn.go#L674-L715 | train |
vitessio/vitess | go/vt/vttablet/grpctabletconn/conn.go | VStreamRows | func (conn *gRPCQueryClient) VStreamRows(ctx context.Context, target *querypb.Target, query string, lastpk *querypb.QueryResult, send func(*binlogdatapb.VStreamRowsResponse) error) error {
stream, err := func() (queryservicepb.Query_VStreamRowsClient, error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc =... | go | func (conn *gRPCQueryClient) VStreamRows(ctx context.Context, target *querypb.Target, query string, lastpk *querypb.QueryResult, send func(*binlogdatapb.VStreamRowsResponse) error) error {
stream, err := func() (queryservicepb.Query_VStreamRowsClient, error) {
conn.mu.RLock()
defer conn.mu.RUnlock()
if conn.cc =... | [
"func",
"(",
"conn",
"*",
"gRPCQueryClient",
")",
"VStreamRows",
"(",
"ctx",
"context",
".",
"Context",
",",
"target",
"*",
"querypb",
".",
"Target",
",",
"query",
"string",
",",
"lastpk",
"*",
"querypb",
".",
"QueryResult",
",",
"send",
"func",
"(",
"*"... | // VStreamRows streams rows of a query from the specified starting point. | [
"VStreamRows",
"streams",
"rows",
"of",
"a",
"query",
"from",
"the",
"specified",
"starting",
"point",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctabletconn/conn.go#L718-L756 | train |
vitessio/vitess | go/vt/vttablet/grpctabletconn/conn.go | Close | func (conn *gRPCQueryClient) Close(ctx context.Context) error {
conn.mu.Lock()
defer conn.mu.Unlock()
if conn.cc == nil {
return nil
}
cc := conn.cc
conn.cc = nil
return cc.Close()
} | go | func (conn *gRPCQueryClient) Close(ctx context.Context) error {
conn.mu.Lock()
defer conn.mu.Unlock()
if conn.cc == nil {
return nil
}
cc := conn.cc
conn.cc = nil
return cc.Close()
} | [
"func",
"(",
"conn",
"*",
"gRPCQueryClient",
")",
"Close",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"conn",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"conn",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"conn",
".",
"cc... | // Close closes underlying gRPC channel. | [
"Close",
"closes",
"underlying",
"gRPC",
"channel",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctabletconn/conn.go#L763-L773 | train |
vitessio/vitess | go/mysql/replication_position.go | Equal | func (rp Position) Equal(other Position) bool {
if rp.GTIDSet == nil {
return other.GTIDSet == nil
}
return rp.GTIDSet.Equal(other.GTIDSet)
} | go | func (rp Position) Equal(other Position) bool {
if rp.GTIDSet == nil {
return other.GTIDSet == nil
}
return rp.GTIDSet.Equal(other.GTIDSet)
} | [
"func",
"(",
"rp",
"Position",
")",
"Equal",
"(",
"other",
"Position",
")",
"bool",
"{",
"if",
"rp",
".",
"GTIDSet",
"==",
"nil",
"{",
"return",
"other",
".",
"GTIDSet",
"==",
"nil",
"\n",
"}",
"\n",
"return",
"rp",
".",
"GTIDSet",
".",
"Equal",
"(... | // Equal returns true if this position is equal to another. | [
"Equal",
"returns",
"true",
"if",
"this",
"position",
"is",
"equal",
"to",
"another",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/replication_position.go#L62-L67 | train |
vitessio/vitess | go/mysql/replication_position.go | AtLeast | func (rp Position) AtLeast(other Position) bool {
if rp.GTIDSet == nil {
return other.GTIDSet == nil
}
return rp.GTIDSet.Contains(other.GTIDSet)
} | go | func (rp Position) AtLeast(other Position) bool {
if rp.GTIDSet == nil {
return other.GTIDSet == nil
}
return rp.GTIDSet.Contains(other.GTIDSet)
} | [
"func",
"(",
"rp",
"Position",
")",
"AtLeast",
"(",
"other",
"Position",
")",
"bool",
"{",
"if",
"rp",
".",
"GTIDSet",
"==",
"nil",
"{",
"return",
"other",
".",
"GTIDSet",
"==",
"nil",
"\n",
"}",
"\n",
"return",
"rp",
".",
"GTIDSet",
".",
"Contains",... | // AtLeast returns true if this position is equal to or after another. | [
"AtLeast",
"returns",
"true",
"if",
"this",
"position",
"is",
"equal",
"to",
"or",
"after",
"another",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/replication_position.go#L70-L75 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.