id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
135,400 | vitessio/vitess | go/vt/vttablet/tabletserver/vstreamer/vstreamer.go | Stream | func (vs *vstreamer) Stream() error {
defer vs.cancel()
pos, err := mysql.DecodePosition(vs.startPos)
if err != nil {
return err
}
vs.pos = pos
// Ensure se is Open. If vttablet came up in a non_serving role,
// the schema engine may not have been initialized.
if err := vs.se.Open(); err != nil {
return w... | go | func (vs *vstreamer) Stream() error {
defer vs.cancel()
pos, err := mysql.DecodePosition(vs.startPos)
if err != nil {
return err
}
vs.pos = pos
// Ensure se is Open. If vttablet came up in a non_serving role,
// the schema engine may not have been initialized.
if err := vs.se.Open(); err != nil {
return w... | [
"func",
"(",
"vs",
"*",
"vstreamer",
")",
"Stream",
"(",
")",
"error",
"{",
"defer",
"vs",
".",
"cancel",
"(",
")",
"\n\n",
"pos",
",",
"err",
":=",
"mysql",
".",
"DecodePosition",
"(",
"vs",
".",
"startPos",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // Stream runs a single-threaded loop. | [
"Stream",
"runs",
"a",
"single",
"-",
"threaded",
"loop",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go#L102-L129 |
135,401 | vitessio/vitess | go/vt/vttablet/tabletserver/query_engine.go | AddStats | func (ep *TabletPlan) AddStats(queryCount int64, duration, mysqlTime time.Duration, rowCount, errorCount int64) {
ep.mu.Lock()
ep.QueryCount += queryCount
ep.Time += duration
ep.MysqlTime += mysqlTime
ep.RowCount += rowCount
ep.ErrorCount += errorCount
ep.mu.Unlock()
} | go | func (ep *TabletPlan) AddStats(queryCount int64, duration, mysqlTime time.Duration, rowCount, errorCount int64) {
ep.mu.Lock()
ep.QueryCount += queryCount
ep.Time += duration
ep.MysqlTime += mysqlTime
ep.RowCount += rowCount
ep.ErrorCount += errorCount
ep.mu.Unlock()
} | [
"func",
"(",
"ep",
"*",
"TabletPlan",
")",
"AddStats",
"(",
"queryCount",
"int64",
",",
"duration",
",",
"mysqlTime",
"time",
".",
"Duration",
",",
"rowCount",
",",
"errorCount",
"int64",
")",
"{",
"ep",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"ep",
... | // AddStats updates the stats for the current TabletPlan. | [
"AddStats",
"updates",
"the",
"stats",
"for",
"the",
"current",
"TabletPlan",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L79-L87 |
135,402 | vitessio/vitess | go/vt/vttablet/tabletserver/query_engine.go | buildAuthorized | func (ep *TabletPlan) buildAuthorized() {
ep.Authorized = make([]*tableacl.ACLResult, len(ep.Permissions))
for i, perm := range ep.Permissions {
ep.Authorized[i] = tableacl.Authorized(perm.TableName, perm.Role)
}
} | go | func (ep *TabletPlan) buildAuthorized() {
ep.Authorized = make([]*tableacl.ACLResult, len(ep.Permissions))
for i, perm := range ep.Permissions {
ep.Authorized[i] = tableacl.Authorized(perm.TableName, perm.Role)
}
} | [
"func",
"(",
"ep",
"*",
"TabletPlan",
")",
"buildAuthorized",
"(",
")",
"{",
"ep",
".",
"Authorized",
"=",
"make",
"(",
"[",
"]",
"*",
"tableacl",
".",
"ACLResult",
",",
"len",
"(",
"ep",
".",
"Permissions",
")",
")",
"\n",
"for",
"i",
",",
"perm",... | // buildAuthorized builds 'Authorized', which is the runtime part for 'Permissions'. | [
"buildAuthorized",
"builds",
"Authorized",
"which",
"is",
"the",
"runtime",
"part",
"for",
"Permissions",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L102-L107 |
135,403 | vitessio/vitess | go/vt/vttablet/tabletserver/query_engine.go | Open | func (qe *QueryEngine) Open() error {
qe.conns.Open(qe.dbconfigs.AppWithDB(), qe.dbconfigs.DbaWithDB(), qe.dbconfigs.AppDebugWithDB())
conn, err := qe.conns.Get(tabletenv.LocalContext())
if err != nil {
qe.conns.Close()
return err
}
qe.binlogFormat, err = conn.VerifyMode(qe.strictTransTables)
conn.Recycle()
... | go | func (qe *QueryEngine) Open() error {
qe.conns.Open(qe.dbconfigs.AppWithDB(), qe.dbconfigs.DbaWithDB(), qe.dbconfigs.AppDebugWithDB())
conn, err := qe.conns.Get(tabletenv.LocalContext())
if err != nil {
qe.conns.Close()
return err
}
qe.binlogFormat, err = conn.VerifyMode(qe.strictTransTables)
conn.Recycle()
... | [
"func",
"(",
"qe",
"*",
"QueryEngine",
")",
"Open",
"(",
")",
"error",
"{",
"qe",
".",
"conns",
".",
"Open",
"(",
"qe",
".",
"dbconfigs",
".",
"AppWithDB",
"(",
")",
",",
"qe",
".",
"dbconfigs",
".",
"DbaWithDB",
"(",
")",
",",
"qe",
".",
"dbconf... | // Open must be called before sending requests to QueryEngine. | [
"Open",
"must",
"be",
"called",
"before",
"sending",
"requests",
"to",
"QueryEngine",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L285-L304 |
135,404 | vitessio/vitess | go/vt/vttablet/tabletserver/query_engine.go | Close | func (qe *QueryEngine) Close() {
// Close in reverse order of Open.
qe.se.UnregisterNotifier("qe")
qe.plans.Clear()
qe.tables = make(map[string]*schema.Table)
qe.streamConns.Close()
qe.conns.Close()
} | go | func (qe *QueryEngine) Close() {
// Close in reverse order of Open.
qe.se.UnregisterNotifier("qe")
qe.plans.Clear()
qe.tables = make(map[string]*schema.Table)
qe.streamConns.Close()
qe.conns.Close()
} | [
"func",
"(",
"qe",
"*",
"QueryEngine",
")",
"Close",
"(",
")",
"{",
"// Close in reverse order of Open.",
"qe",
".",
"se",
".",
"UnregisterNotifier",
"(",
"\"",
"\"",
")",
"\n",
"qe",
".",
"plans",
".",
"Clear",
"(",
")",
"\n",
"qe",
".",
"tables",
"="... | // Close must be called to shut down QueryEngine.
// You must ensure that no more queries will be sent
// before calling Close. | [
"Close",
"must",
"be",
"called",
"to",
"shut",
"down",
"QueryEngine",
".",
"You",
"must",
"ensure",
"that",
"no",
"more",
"queries",
"will",
"be",
"sent",
"before",
"calling",
"Close",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L309-L316 |
135,405 | vitessio/vitess | go/vt/vttablet/tabletserver/query_engine.go | GetPlan | func (qe *QueryEngine) GetPlan(ctx context.Context, logStats *tabletenv.LogStats, sql string, skipQueryPlanCache bool) (*TabletPlan, error) {
span, ctx := trace.NewSpan(ctx, "QueryEngine.GetPlan")
defer span.Finish()
if plan := qe.getQuery(sql); plan != nil {
return plan, nil
}
// Obtain read lock to prevent s... | go | func (qe *QueryEngine) GetPlan(ctx context.Context, logStats *tabletenv.LogStats, sql string, skipQueryPlanCache bool) (*TabletPlan, error) {
span, ctx := trace.NewSpan(ctx, "QueryEngine.GetPlan")
defer span.Finish()
if plan := qe.getQuery(sql); plan != nil {
return plan, nil
}
// Obtain read lock to prevent s... | [
"func",
"(",
"qe",
"*",
"QueryEngine",
")",
"GetPlan",
"(",
"ctx",
"context",
".",
"Context",
",",
"logStats",
"*",
"tabletenv",
".",
"LogStats",
",",
"sql",
"string",
",",
"skipQueryPlanCache",
"bool",
")",
"(",
"*",
"TabletPlan",
",",
"error",
")",
"{"... | // GetPlan returns the TabletPlan that for the query. Plans are cached in a cache.LRUCache. | [
"GetPlan",
"returns",
"the",
"TabletPlan",
"that",
"for",
"the",
"query",
".",
"Plans",
"are",
"cached",
"in",
"a",
"cache",
".",
"LRUCache",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L319-L370 |
135,406 | vitessio/vitess | go/vt/vttablet/tabletserver/query_engine.go | getQueryConn | func (qe *QueryEngine) getQueryConn(ctx context.Context) (*connpool.DBConn, error) {
waiterCount := qe.queryPoolWaiters.Add(1)
defer qe.queryPoolWaiters.Add(-1)
if waiterCount > qe.queryPoolWaiterCap.Get() {
return nil, vterrors.New(vtrpcpb.Code_RESOURCE_EXHAUSTED, "query pool waiter count exceeded")
}
timeout... | go | func (qe *QueryEngine) getQueryConn(ctx context.Context) (*connpool.DBConn, error) {
waiterCount := qe.queryPoolWaiters.Add(1)
defer qe.queryPoolWaiters.Add(-1)
if waiterCount > qe.queryPoolWaiterCap.Get() {
return nil, vterrors.New(vtrpcpb.Code_RESOURCE_EXHAUSTED, "query pool waiter count exceeded")
}
timeout... | [
"func",
"(",
"qe",
"*",
"QueryEngine",
")",
"getQueryConn",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"connpool",
".",
"DBConn",
",",
"error",
")",
"{",
"waiterCount",
":=",
"qe",
".",
"queryPoolWaiters",
".",
"Add",
"(",
"1",
")",
"\n",
... | // getQueryConn returns a connection from the query pool using either
// the conn pool timeout if configured, or the original context query timeout | [
"getQueryConn",
"returns",
"a",
"connection",
"from",
"the",
"query",
"pool",
"using",
"either",
"the",
"conn",
"pool",
"timeout",
"if",
"configured",
"or",
"the",
"original",
"context",
"query",
"timeout"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L374-L393 |
135,407 | vitessio/vitess | go/vt/vttablet/tabletserver/query_engine.go | GetStreamPlan | func (qe *QueryEngine) GetStreamPlan(sql string) (*TabletPlan, error) {
qe.mu.RLock()
defer qe.mu.RUnlock()
splan, err := planbuilder.BuildStreaming(sql, qe.tables)
if err != nil {
return nil, err
}
plan := &TabletPlan{Plan: splan}
plan.Rules = qe.queryRuleSources.FilterByPlan(sql, plan.PlanID, plan.TableName(... | go | func (qe *QueryEngine) GetStreamPlan(sql string) (*TabletPlan, error) {
qe.mu.RLock()
defer qe.mu.RUnlock()
splan, err := planbuilder.BuildStreaming(sql, qe.tables)
if err != nil {
return nil, err
}
plan := &TabletPlan{Plan: splan}
plan.Rules = qe.queryRuleSources.FilterByPlan(sql, plan.PlanID, plan.TableName(... | [
"func",
"(",
"qe",
"*",
"QueryEngine",
")",
"GetStreamPlan",
"(",
"sql",
"string",
")",
"(",
"*",
"TabletPlan",
",",
"error",
")",
"{",
"qe",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"qe",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n",
"spla... | // GetStreamPlan is similar to GetPlan, but doesn't use the cache
// and doesn't enforce a limit. It just returns the parsed query. | [
"GetStreamPlan",
"is",
"similar",
"to",
"GetPlan",
"but",
"doesn",
"t",
"use",
"the",
"cache",
"and",
"doesn",
"t",
"enforce",
"a",
"limit",
".",
"It",
"just",
"returns",
"the",
"parsed",
"query",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L397-L408 |
135,408 | vitessio/vitess | go/vt/vttablet/tabletserver/query_engine.go | GetMessageStreamPlan | func (qe *QueryEngine) GetMessageStreamPlan(name string) (*TabletPlan, error) {
qe.mu.RLock()
defer qe.mu.RUnlock()
splan, err := planbuilder.BuildMessageStreaming(name, qe.tables)
if err != nil {
return nil, err
}
plan := &TabletPlan{Plan: splan}
plan.Rules = qe.queryRuleSources.FilterByPlan("stream from "+na... | go | func (qe *QueryEngine) GetMessageStreamPlan(name string) (*TabletPlan, error) {
qe.mu.RLock()
defer qe.mu.RUnlock()
splan, err := planbuilder.BuildMessageStreaming(name, qe.tables)
if err != nil {
return nil, err
}
plan := &TabletPlan{Plan: splan}
plan.Rules = qe.queryRuleSources.FilterByPlan("stream from "+na... | [
"func",
"(",
"qe",
"*",
"QueryEngine",
")",
"GetMessageStreamPlan",
"(",
"name",
"string",
")",
"(",
"*",
"TabletPlan",
",",
"error",
")",
"{",
"qe",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"qe",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n",... | // GetMessageStreamPlan builds a plan for Message streaming. | [
"GetMessageStreamPlan",
"builds",
"a",
"plan",
"for",
"Message",
"streaming",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L411-L422 |
135,409 | vitessio/vitess | go/vt/vttablet/tabletserver/query_engine.go | IsMySQLReachable | func (qe *QueryEngine) IsMySQLReachable() bool {
conn, err := dbconnpool.NewDBConnection(qe.dbconfigs.AppWithDB(), tabletenv.MySQLStats)
if err != nil {
if mysql.IsConnErr(err) {
return false
}
log.Warningf("checking MySQL, unexpected error: %v", err)
return true
}
conn.Close()
return true
} | go | func (qe *QueryEngine) IsMySQLReachable() bool {
conn, err := dbconnpool.NewDBConnection(qe.dbconfigs.AppWithDB(), tabletenv.MySQLStats)
if err != nil {
if mysql.IsConnErr(err) {
return false
}
log.Warningf("checking MySQL, unexpected error: %v", err)
return true
}
conn.Close()
return true
} | [
"func",
"(",
"qe",
"*",
"QueryEngine",
")",
"IsMySQLReachable",
"(",
")",
"bool",
"{",
"conn",
",",
"err",
":=",
"dbconnpool",
".",
"NewDBConnection",
"(",
"qe",
".",
"dbconfigs",
".",
"AppWithDB",
"(",
")",
",",
"tabletenv",
".",
"MySQLStats",
")",
"\n"... | // IsMySQLReachable returns true if we can connect to MySQL. | [
"IsMySQLReachable",
"returns",
"true",
"if",
"we",
"can",
"connect",
"to",
"MySQL",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L430-L441 |
135,410 | vitessio/vitess | go/vt/vttablet/tabletserver/query_engine.go | getQuery | func (qe *QueryEngine) getQuery(sql string) *TabletPlan {
if cacheResult, ok := qe.plans.Get(sql); ok {
return cacheResult.(*TabletPlan)
}
return nil
} | go | func (qe *QueryEngine) getQuery(sql string) *TabletPlan {
if cacheResult, ok := qe.plans.Get(sql); ok {
return cacheResult.(*TabletPlan)
}
return nil
} | [
"func",
"(",
"qe",
"*",
"QueryEngine",
")",
"getQuery",
"(",
"sql",
"string",
")",
"*",
"TabletPlan",
"{",
"if",
"cacheResult",
",",
"ok",
":=",
"qe",
".",
"plans",
".",
"Get",
"(",
"sql",
")",
";",
"ok",
"{",
"return",
"cacheResult",
".",
"(",
"*"... | // getQuery fetches the plan and makes it the most recent. | [
"getQuery",
"fetches",
"the",
"plan",
"and",
"makes",
"it",
"the",
"most",
"recent",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L453-L458 |
135,411 | vitessio/vitess | go/vt/vttablet/tabletserver/query_engine.go | peekQuery | func (qe *QueryEngine) peekQuery(sql string) *TabletPlan {
if cacheResult, ok := qe.plans.Peek(sql); ok {
return cacheResult.(*TabletPlan)
}
return nil
} | go | func (qe *QueryEngine) peekQuery(sql string) *TabletPlan {
if cacheResult, ok := qe.plans.Peek(sql); ok {
return cacheResult.(*TabletPlan)
}
return nil
} | [
"func",
"(",
"qe",
"*",
"QueryEngine",
")",
"peekQuery",
"(",
"sql",
"string",
")",
"*",
"TabletPlan",
"{",
"if",
"cacheResult",
",",
"ok",
":=",
"qe",
".",
"plans",
".",
"Peek",
"(",
"sql",
")",
";",
"ok",
"{",
"return",
"cacheResult",
".",
"(",
"... | // peekQuery fetches the plan without changing the LRU order. | [
"peekQuery",
"fetches",
"the",
"plan",
"without",
"changing",
"the",
"LRU",
"order",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L461-L466 |
135,412 | vitessio/vitess | go/vt/vttablet/tabletserver/query_engine.go | SetQueryPlanCacheCap | func (qe *QueryEngine) SetQueryPlanCacheCap(size int) {
if size <= 0 {
size = 1
}
qe.plans.SetCapacity(int64(size))
} | go | func (qe *QueryEngine) SetQueryPlanCacheCap(size int) {
if size <= 0 {
size = 1
}
qe.plans.SetCapacity(int64(size))
} | [
"func",
"(",
"qe",
"*",
"QueryEngine",
")",
"SetQueryPlanCacheCap",
"(",
"size",
"int",
")",
"{",
"if",
"size",
"<=",
"0",
"{",
"size",
"=",
"1",
"\n",
"}",
"\n",
"qe",
".",
"plans",
".",
"SetCapacity",
"(",
"int64",
"(",
"size",
")",
")",
"\n",
... | // SetQueryPlanCacheCap sets the query plan cache capacity. | [
"SetQueryPlanCacheCap",
"sets",
"the",
"query",
"plan",
"cache",
"capacity",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L469-L474 |
135,413 | vitessio/vitess | go/vt/vttablet/tabletserver/query_engine.go | AddStats | func (qe *QueryEngine) AddStats(planName, tableName string, queryCount int64, duration, mysqlTime time.Duration, rowCount, errorCount int64) {
key := tableName + "." + planName
qe.queryStatsMu.RLock()
stats, ok := qe.queryStats[key]
qe.queryStatsMu.RUnlock()
if !ok {
// Check again with the write lock held and... | go | func (qe *QueryEngine) AddStats(planName, tableName string, queryCount int64, duration, mysqlTime time.Duration, rowCount, errorCount int64) {
key := tableName + "." + planName
qe.queryStatsMu.RLock()
stats, ok := qe.queryStats[key]
qe.queryStatsMu.RUnlock()
if !ok {
// Check again with the write lock held and... | [
"func",
"(",
"qe",
"*",
"QueryEngine",
")",
"AddStats",
"(",
"planName",
",",
"tableName",
"string",
",",
"queryCount",
"int64",
",",
"duration",
",",
"mysqlTime",
"time",
".",
"Duration",
",",
"rowCount",
",",
"errorCount",
"int64",
")",
"{",
"key",
":=",... | // AddStats adds the given stats for the planName.tableName | [
"AddStats",
"adds",
"the",
"given",
"stats",
"for",
"the",
"planName",
".",
"tableName"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_engine.go#L492-L517 |
135,414 | vitessio/vitess | go/vt/mysqlctl/s3backupstorage/s3.go | AddFile | func (bh *S3BackupHandle) AddFile(ctx context.Context, filename string, filesize int64) (io.WriteCloser, error) {
if bh.readOnly {
return nil, fmt.Errorf("AddFile cannot be called on read-only backup")
}
// Calculate s3 upload part size using the source filesize
partSizeBytes := s3manager.DefaultUploadPartSize
... | go | func (bh *S3BackupHandle) AddFile(ctx context.Context, filename string, filesize int64) (io.WriteCloser, error) {
if bh.readOnly {
return nil, fmt.Errorf("AddFile cannot be called on read-only backup")
}
// Calculate s3 upload part size using the source filesize
partSizeBytes := s3manager.DefaultUploadPartSize
... | [
"func",
"(",
"bh",
"*",
"S3BackupHandle",
")",
"AddFile",
"(",
"ctx",
"context",
".",
"Context",
",",
"filename",
"string",
",",
"filesize",
"int64",
")",
"(",
"io",
".",
"WriteCloser",
",",
"error",
")",
"{",
"if",
"bh",
".",
"readOnly",
"{",
"return"... | // AddFile is part of the backupstorage.BackupHandle interface. | [
"AddFile",
"is",
"part",
"of",
"the",
"backupstorage",
".",
"BackupHandle",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/s3backupstorage/s3.go#L103-L146 |
135,415 | vitessio/vitess | go/vt/mysqlctl/s3backupstorage/s3.go | EndBackup | func (bh *S3BackupHandle) EndBackup(ctx context.Context) error {
if bh.readOnly {
return fmt.Errorf("EndBackup cannot be called on read-only backup")
}
bh.waitGroup.Wait()
return bh.errors.Error()
} | go | func (bh *S3BackupHandle) EndBackup(ctx context.Context) error {
if bh.readOnly {
return fmt.Errorf("EndBackup cannot be called on read-only backup")
}
bh.waitGroup.Wait()
return bh.errors.Error()
} | [
"func",
"(",
"bh",
"*",
"S3BackupHandle",
")",
"EndBackup",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"if",
"bh",
".",
"readOnly",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"bh",
".",
"waitGroup",
"... | // EndBackup is part of the backupstorage.BackupHandle interface. | [
"EndBackup",
"is",
"part",
"of",
"the",
"backupstorage",
".",
"BackupHandle",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/s3backupstorage/s3.go#L149-L155 |
135,416 | vitessio/vitess | go/vt/mysqlctl/s3backupstorage/s3.go | ReadFile | func (bh *S3BackupHandle) ReadFile(ctx context.Context, filename string) (io.ReadCloser, error) {
if !bh.readOnly {
return nil, fmt.Errorf("ReadFile cannot be called on read-write backup")
}
object := objName(bh.dir, bh.name, filename)
out, err := bh.client.GetObject(&s3.GetObjectInput{
Bucket: bucket,
Key: ... | go | func (bh *S3BackupHandle) ReadFile(ctx context.Context, filename string) (io.ReadCloser, error) {
if !bh.readOnly {
return nil, fmt.Errorf("ReadFile cannot be called on read-write backup")
}
object := objName(bh.dir, bh.name, filename)
out, err := bh.client.GetObject(&s3.GetObjectInput{
Bucket: bucket,
Key: ... | [
"func",
"(",
"bh",
"*",
"S3BackupHandle",
")",
"ReadFile",
"(",
"ctx",
"context",
".",
"Context",
",",
"filename",
"string",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"if",
"!",
"bh",
".",
"readOnly",
"{",
"return",
"nil",
",",
"fmt"... | // ReadFile is part of the backupstorage.BackupHandle interface. | [
"ReadFile",
"is",
"part",
"of",
"the",
"backupstorage",
".",
"BackupHandle",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/s3backupstorage/s3.go#L166-L179 |
135,417 | vitessio/vitess | go/vt/mysqlctl/s3backupstorage/s3.go | ListBackups | func (bs *S3BackupStorage) ListBackups(ctx context.Context, dir string) ([]backupstorage.BackupHandle, error) {
log.Infof("ListBackups: [s3] dir: %v, bucket: %v", dir, *bucket)
c, err := bs.client()
if err != nil {
return nil, err
}
searchPrefix := objName(dir, "")
query := &s3.ListObjectsV2Input{
Bucket: ... | go | func (bs *S3BackupStorage) ListBackups(ctx context.Context, dir string) ([]backupstorage.BackupHandle, error) {
log.Infof("ListBackups: [s3] dir: %v, bucket: %v", dir, *bucket)
c, err := bs.client()
if err != nil {
return nil, err
}
searchPrefix := objName(dir, "")
query := &s3.ListObjectsV2Input{
Bucket: ... | [
"func",
"(",
"bs",
"*",
"S3BackupStorage",
")",
"ListBackups",
"(",
"ctx",
"context",
".",
"Context",
",",
"dir",
"string",
")",
"(",
"[",
"]",
"backupstorage",
".",
"BackupHandle",
",",
"error",
")",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"... | // ListBackups is part of the backupstorage.BackupStorage interface. | [
"ListBackups",
"is",
"part",
"of",
"the",
"backupstorage",
".",
"BackupStorage",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/s3backupstorage/s3.go#L190-L236 |
135,418 | vitessio/vitess | go/vt/mysqlctl/s3backupstorage/s3.go | StartBackup | func (bs *S3BackupStorage) StartBackup(ctx context.Context, dir, name string) (backupstorage.BackupHandle, error) {
log.Infof("StartBackup: [s3] dir: %v, name: %v, bucket: %v", dir, name, *bucket)
c, err := bs.client()
if err != nil {
return nil, err
}
return &S3BackupHandle{
client: c,
bs: bs,
di... | go | func (bs *S3BackupStorage) StartBackup(ctx context.Context, dir, name string) (backupstorage.BackupHandle, error) {
log.Infof("StartBackup: [s3] dir: %v, name: %v, bucket: %v", dir, name, *bucket)
c, err := bs.client()
if err != nil {
return nil, err
}
return &S3BackupHandle{
client: c,
bs: bs,
di... | [
"func",
"(",
"bs",
"*",
"S3BackupStorage",
")",
"StartBackup",
"(",
"ctx",
"context",
".",
"Context",
",",
"dir",
",",
"name",
"string",
")",
"(",
"backupstorage",
".",
"BackupHandle",
",",
"error",
")",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
... | // StartBackup is part of the backupstorage.BackupStorage interface. | [
"StartBackup",
"is",
"part",
"of",
"the",
"backupstorage",
".",
"BackupStorage",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/s3backupstorage/s3.go#L239-L253 |
135,419 | vitessio/vitess | go/vt/mysqlctl/s3backupstorage/s3.go | RemoveBackup | func (bs *S3BackupStorage) RemoveBackup(ctx context.Context, dir, name string) error {
log.Infof("RemoveBackup: [s3] dir: %v, name: %v, bucket: %v", dir, name, *bucket)
c, err := bs.client()
if err != nil {
return err
}
query := &s3.ListObjectsV2Input{
Bucket: bucket,
Prefix: objName(dir, name),
}
for {... | go | func (bs *S3BackupStorage) RemoveBackup(ctx context.Context, dir, name string) error {
log.Infof("RemoveBackup: [s3] dir: %v, name: %v, bucket: %v", dir, name, *bucket)
c, err := bs.client()
if err != nil {
return err
}
query := &s3.ListObjectsV2Input{
Bucket: bucket,
Prefix: objName(dir, name),
}
for {... | [
"func",
"(",
"bs",
"*",
"S3BackupStorage",
")",
"RemoveBackup",
"(",
"ctx",
"context",
".",
"Context",
",",
"dir",
",",
"name",
"string",
")",
"error",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"dir",
",",
"name",
",",
"*",
"bucket",
")",
"\n... | // RemoveBackup is part of the backupstorage.BackupStorage interface. | [
"RemoveBackup",
"is",
"part",
"of",
"the",
"backupstorage",
".",
"BackupStorage",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/s3backupstorage/s3.go#L256-L307 |
135,420 | vitessio/vitess | go/vt/mysqlctl/s3backupstorage/s3.go | getLogLevel | func getLogLevel() *aws.LogLevelType {
l := new(aws.LogLevelType)
*l = aws.LogOff // default setting
if level, found := logNameMap[*requiredLogLevel]; found {
*l = level // adjust as required
}
return l
} | go | func getLogLevel() *aws.LogLevelType {
l := new(aws.LogLevelType)
*l = aws.LogOff // default setting
if level, found := logNameMap[*requiredLogLevel]; found {
*l = level // adjust as required
}
return l
} | [
"func",
"getLogLevel",
"(",
")",
"*",
"aws",
".",
"LogLevelType",
"{",
"l",
":=",
"new",
"(",
"aws",
".",
"LogLevelType",
")",
"\n",
"*",
"l",
"=",
"aws",
".",
"LogOff",
"// default setting",
"\n",
"if",
"level",
",",
"found",
":=",
"logNameMap",
"[",
... | // getLogLevel converts the string loglevel to an aws.LogLevelType | [
"getLogLevel",
"converts",
"the",
"string",
"loglevel",
"to",
"an",
"aws",
".",
"LogLevelType"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/s3backupstorage/s3.go#L320-L327 |
135,421 | vitessio/vitess | go/vt/worker/executor.go | fetchLoop | func (e *executor) fetchLoop(ctx context.Context, insertChannel chan string) error {
for {
select {
case cmd, ok := <-insertChannel:
if !ok {
// no more to read, we're done
return nil
}
if err := e.fetchWithRetries(ctx, func(ctx context.Context, tablet *topodatapb.Tablet) error {
_, err := e.w... | go | func (e *executor) fetchLoop(ctx context.Context, insertChannel chan string) error {
for {
select {
case cmd, ok := <-insertChannel:
if !ok {
// no more to read, we're done
return nil
}
if err := e.fetchWithRetries(ctx, func(ctx context.Context, tablet *topodatapb.Tablet) error {
_, err := e.w... | [
"func",
"(",
"e",
"*",
"executor",
")",
"fetchLoop",
"(",
"ctx",
"context",
".",
"Context",
",",
"insertChannel",
"chan",
"string",
")",
"error",
"{",
"for",
"{",
"select",
"{",
"case",
"cmd",
",",
"ok",
":=",
"<-",
"insertChannel",
":",
"if",
"!",
"... | // fetchLoop loops over the provided insertChannel and sends the commands to the
// current master. | [
"fetchLoop",
"loops",
"over",
"the",
"provided",
"insertChannel",
"and",
"sends",
"the",
"commands",
"to",
"the",
"current",
"master",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/executor.go#L68-L89 |
135,422 | vitessio/vitess | go/vt/worker/executor.go | checkError | func (e *executor) checkError(ctx context.Context, err error, isRetry bool, master *discovery.TabletStats) (bool, error) {
tabletString := fmt.Sprintf("%v (%v/%v)", topoproto.TabletAliasString(master.Tablet.Alias), e.keyspace, e.shard)
// first see if it was a context timeout.
select {
case <-ctx.Done():
if ctx.... | go | func (e *executor) checkError(ctx context.Context, err error, isRetry bool, master *discovery.TabletStats) (bool, error) {
tabletString := fmt.Sprintf("%v (%v/%v)", topoproto.TabletAliasString(master.Tablet.Alias), e.keyspace, e.shard)
// first see if it was a context timeout.
select {
case <-ctx.Done():
if ctx.... | [
"func",
"(",
"e",
"*",
"executor",
")",
"checkError",
"(",
"ctx",
"context",
".",
"Context",
",",
"err",
"error",
",",
"isRetry",
"bool",
",",
"master",
"*",
"discovery",
".",
"TabletStats",
")",
"(",
"bool",
",",
"error",
")",
"{",
"tabletString",
":=... | // checkError returns true if the error can be ignored and the command
// succeeded, false if the error is retryable and a non-nil error if the
// command must not be retried. | [
"checkError",
"returns",
"true",
"if",
"the",
"error",
"can",
"be",
"ignored",
"and",
"the",
"command",
"succeeded",
"false",
"if",
"the",
"error",
"is",
"retryable",
"and",
"a",
"non",
"-",
"nil",
"error",
"if",
"the",
"command",
"must",
"not",
"be",
"r... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/executor.go#L197-L248 |
135,423 | vitessio/vitess | go/vt/status/status.go | MakeVtctldRedirect | func MakeVtctldRedirect(text string, q map[string]string) template.HTML {
query := url.Values{}
for k, v := range q {
query.Set(k, v)
}
url := "explorers/redirect" + "?" + query.Encode()
return VtctldLink(text, url)
} | go | func MakeVtctldRedirect(text string, q map[string]string) template.HTML {
query := url.Values{}
for k, v := range q {
query.Set(k, v)
}
url := "explorers/redirect" + "?" + query.Encode()
return VtctldLink(text, url)
} | [
"func",
"MakeVtctldRedirect",
"(",
"text",
"string",
",",
"q",
"map",
"[",
"string",
"]",
"string",
")",
"template",
".",
"HTML",
"{",
"query",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"q",
"{",
"query",
".",... | // MakeVtctldRedirect returns an absolute vtctld url that will
// redirect to the page for the topology object specified in q. | [
"MakeVtctldRedirect",
"returns",
"an",
"absolute",
"vtctld",
"url",
"that",
"will",
"redirect",
"to",
"the",
"page",
"for",
"the",
"topology",
"object",
"specified",
"in",
"q",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/status/status.go#L37-L44 |
135,424 | vitessio/vitess | go/vt/status/status.go | VtctldLink | func VtctldLink(text, urlPath string) template.HTML {
if *vtctldAddr == "" {
return template.HTML(text)
}
var fullURL string
if strings.HasSuffix(*vtctldAddr, "/") {
fullURL = *vtctldAddr + urlPath
} else {
fullURL = *vtctldAddr + "/" + urlPath
}
return template.HTML(fmt.Sprintf(`<a href="%v">%v</a>`, ful... | go | func VtctldLink(text, urlPath string) template.HTML {
if *vtctldAddr == "" {
return template.HTML(text)
}
var fullURL string
if strings.HasSuffix(*vtctldAddr, "/") {
fullURL = *vtctldAddr + urlPath
} else {
fullURL = *vtctldAddr + "/" + urlPath
}
return template.HTML(fmt.Sprintf(`<a href="%v">%v</a>`, ful... | [
"func",
"VtctldLink",
"(",
"text",
",",
"urlPath",
"string",
")",
"template",
".",
"HTML",
"{",
"if",
"*",
"vtctldAddr",
"==",
"\"",
"\"",
"{",
"return",
"template",
".",
"HTML",
"(",
"text",
")",
"\n",
"}",
"\n",
"var",
"fullURL",
"string",
"\n",
"i... | // VtctldLink returns the HTML to display a link to the fully
// qualified vtctld url whose path is given as parameter.
// If no vtctld_addr flag was passed in, we just return the text with no link. | [
"VtctldLink",
"returns",
"the",
"HTML",
"to",
"display",
"a",
"link",
"to",
"the",
"fully",
"qualified",
"vtctld",
"url",
"whose",
"path",
"is",
"given",
"as",
"parameter",
".",
"If",
"no",
"vtctld_addr",
"flag",
"was",
"passed",
"in",
"we",
"just",
"retur... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/status/status.go#L49-L61 |
135,425 | vitessio/vitess | go/vt/status/status.go | VtctldKeyspace | func VtctldKeyspace(keyspace string) template.HTML {
return MakeVtctldRedirect(keyspace,
map[string]string{
"type": "keyspace",
"keyspace": keyspace,
})
} | go | func VtctldKeyspace(keyspace string) template.HTML {
return MakeVtctldRedirect(keyspace,
map[string]string{
"type": "keyspace",
"keyspace": keyspace,
})
} | [
"func",
"VtctldKeyspace",
"(",
"keyspace",
"string",
")",
"template",
".",
"HTML",
"{",
"return",
"MakeVtctldRedirect",
"(",
"keyspace",
",",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"keyspace",
",",
... | // VtctldKeyspace returns the keyspace name, possibly linked to the
// keyspace page in vtctld. | [
"VtctldKeyspace",
"returns",
"the",
"keyspace",
"name",
"possibly",
"linked",
"to",
"the",
"keyspace",
"page",
"in",
"vtctld",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/status/status.go#L65-L71 |
135,426 | vitessio/vitess | go/vt/status/status.go | VtctldShard | func VtctldShard(keyspace, shard string) template.HTML {
return MakeVtctldRedirect(shard, map[string]string{
"type": "shard",
"keyspace": keyspace,
"shard": shard,
})
} | go | func VtctldShard(keyspace, shard string) template.HTML {
return MakeVtctldRedirect(shard, map[string]string{
"type": "shard",
"keyspace": keyspace,
"shard": shard,
})
} | [
"func",
"VtctldShard",
"(",
"keyspace",
",",
"shard",
"string",
")",
"template",
".",
"HTML",
"{",
"return",
"MakeVtctldRedirect",
"(",
"shard",
",",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"keyspace... | // VtctldShard returns the shard name, possibly linked to the shard
// page in vtctld. | [
"VtctldShard",
"returns",
"the",
"shard",
"name",
"possibly",
"linked",
"to",
"the",
"shard",
"page",
"in",
"vtctld",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/status/status.go#L75-L81 |
135,427 | vitessio/vitess | go/vt/status/status.go | VtctldSrvKeyspace | func VtctldSrvKeyspace(cell, keyspace string) template.HTML {
return MakeVtctldRedirect(keyspace, map[string]string{
"type": "srv_keyspace",
"cell": cell,
"keyspace": keyspace,
})
} | go | func VtctldSrvKeyspace(cell, keyspace string) template.HTML {
return MakeVtctldRedirect(keyspace, map[string]string{
"type": "srv_keyspace",
"cell": cell,
"keyspace": keyspace,
})
} | [
"func",
"VtctldSrvKeyspace",
"(",
"cell",
",",
"keyspace",
"string",
")",
"template",
".",
"HTML",
"{",
"return",
"MakeVtctldRedirect",
"(",
"keyspace",
",",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"... | // VtctldSrvKeyspace returns the keyspace name, possibly linked to the
// SrvKeyspace page in vtctld. | [
"VtctldSrvKeyspace",
"returns",
"the",
"keyspace",
"name",
"possibly",
"linked",
"to",
"the",
"SrvKeyspace",
"page",
"in",
"vtctld",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/status/status.go#L91-L97 |
135,428 | vitessio/vitess | go/vt/status/status.go | VtctldTablet | func VtctldTablet(aliasName string) template.HTML {
return MakeVtctldRedirect(aliasName, map[string]string{
"type": "tablet",
"alias": aliasName,
})
} | go | func VtctldTablet(aliasName string) template.HTML {
return MakeVtctldRedirect(aliasName, map[string]string{
"type": "tablet",
"alias": aliasName,
})
} | [
"func",
"VtctldTablet",
"(",
"aliasName",
"string",
")",
"template",
".",
"HTML",
"{",
"return",
"MakeVtctldRedirect",
"(",
"aliasName",
",",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"aliasName",
",",
... | // VtctldTablet returns the tablet alias, possibly linked to the
// Tablet page in vtctld. | [
"VtctldTablet",
"returns",
"the",
"tablet",
"alias",
"possibly",
"linked",
"to",
"the",
"Tablet",
"page",
"in",
"vtctld",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/status/status.go#L113-L118 |
135,429 | vitessio/vitess | go/stats/opentsdb/opentsdb.go | sendDataPoints | func sendDataPoints(data []dataPoint) error {
json, err := json.Marshal(data)
if err != nil {
return err
}
resp, err := http.Post(*openTsdbURI, "application/json", bytes.NewReader(json))
if err != nil {
return err
}
resp.Body.Close()
return nil
} | go | func sendDataPoints(data []dataPoint) error {
json, err := json.Marshal(data)
if err != nil {
return err
}
resp, err := http.Post(*openTsdbURI, "application/json", bytes.NewReader(json))
if err != nil {
return err
}
resp.Body.Close()
return nil
} | [
"func",
"sendDataPoints",
"(",
"data",
"[",
"]",
"dataPoint",
")",
"error",
"{",
"json",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"resp",
",",
"err",
":=",
... | // sendDataPoints pushes a list of data points to openTSDB.
// All other code in this file is just to support getting this function called
// with all stats represented as data points. | [
"sendDataPoints",
"pushes",
"a",
"list",
"of",
"data",
"points",
"to",
"openTSDB",
".",
"All",
"other",
"code",
"in",
"this",
"file",
"is",
"just",
"to",
"support",
"getting",
"this",
"function",
"called",
"with",
"all",
"stats",
"represented",
"as",
"data",... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/opentsdb/opentsdb.go#L36-L48 |
135,430 | vitessio/vitess | go/stats/opentsdb/opentsdb.go | Init | func Init(prefix string) {
// Needs to happen in servenv.OnRun() instead of init because it requires flag parsing and logging
servenv.OnRun(func() {
if *openTsdbURI == "" {
return
}
backend := &openTSDBBackend{
prefix: prefix,
// If you want to global service values like host, service name, git revisi... | go | func Init(prefix string) {
// Needs to happen in servenv.OnRun() instead of init because it requires flag parsing and logging
servenv.OnRun(func() {
if *openTsdbURI == "" {
return
}
backend := &openTSDBBackend{
prefix: prefix,
// If you want to global service values like host, service name, git revisi... | [
"func",
"Init",
"(",
"prefix",
"string",
")",
"{",
"// Needs to happen in servenv.OnRun() instead of init because it requires flag parsing and logging",
"servenv",
".",
"OnRun",
"(",
"func",
"(",
")",
"{",
"if",
"*",
"openTsdbURI",
"==",
"\"",
"\"",
"{",
"return",
"\n... | // Init attempts to create a singleton openTSDBBackend and register it as a PushBackend.
// If it fails to create one, this is a noop. The prefix argument is an optional string
// to prepend to the name of every data point reported. | [
"Init",
"attempts",
"to",
"create",
"a",
"singleton",
"openTSDBBackend",
"and",
"register",
"it",
"as",
"a",
"PushBackend",
".",
"If",
"it",
"fails",
"to",
"create",
"one",
"this",
"is",
"a",
"noop",
".",
"The",
"prefix",
"argument",
"is",
"an",
"optional"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/opentsdb/opentsdb.go#L71-L99 |
135,431 | vitessio/vitess | go/stats/opentsdb/opentsdb.go | makeLabel | func makeLabel(labelName string, labelVal string) map[string]string {
return map[string]string{labelName: labelVal}
} | go | func makeLabel(labelName string, labelVal string) map[string]string {
return map[string]string{labelName: labelVal}
} | [
"func",
"makeLabel",
"(",
"labelName",
"string",
",",
"labelVal",
"string",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"return",
"map",
"[",
"string",
"]",
"string",
"{",
"labelName",
":",
"labelVal",
"}",
"\n",
"}"
] | // makeLabel builds a tag list with a single label + value. | [
"makeLabel",
"builds",
"a",
"tag",
"list",
"with",
"a",
"single",
"label",
"+",
"value",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/opentsdb/opentsdb.go#L242-L244 |
135,432 | vitessio/vitess | go/stats/opentsdb/opentsdb.go | addUnrecognizedExpvars | func (dc *dataCollector) addUnrecognizedExpvars(prefix string, obj map[string]interface{}) {
for k, v := range obj {
prefix := combineMetricName(prefix, k)
switch v := v.(type) {
case map[string]interface{}:
dc.addUnrecognizedExpvars(prefix, v)
case float64:
dc.addFloat(prefix, v, nil)
}
}
} | go | func (dc *dataCollector) addUnrecognizedExpvars(prefix string, obj map[string]interface{}) {
for k, v := range obj {
prefix := combineMetricName(prefix, k)
switch v := v.(type) {
case map[string]interface{}:
dc.addUnrecognizedExpvars(prefix, v)
case float64:
dc.addFloat(prefix, v, nil)
}
}
} | [
"func",
"(",
"dc",
"*",
"dataCollector",
")",
"addUnrecognizedExpvars",
"(",
"prefix",
"string",
",",
"obj",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"obj",
"{",
"prefix",
":=",
"combineMetricName",... | // addUnrecognizedExpvars recurses into a json object to pull out float64 variables to report. | [
"addUnrecognizedExpvars",
"recurses",
"into",
"a",
"json",
"object",
"to",
"pull",
"out",
"float64",
"variables",
"to",
"report",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/opentsdb/opentsdb.go#L258-L268 |
135,433 | vitessio/vitess | go/stats/opentsdb/opentsdb.go | addTimings | func (dc *dataCollector) addTimings(labels []string, timings *stats.Timings, prefix string) {
histograms := timings.Histograms()
for labelValsCombined, histogram := range histograms {
// If you prefer millisecond timings over nanoseconds you can pass 1000000 here instead of 1.
dc.addHistogram(histogram, 1, prefix... | go | func (dc *dataCollector) addTimings(labels []string, timings *stats.Timings, prefix string) {
histograms := timings.Histograms()
for labelValsCombined, histogram := range histograms {
// If you prefer millisecond timings over nanoseconds you can pass 1000000 here instead of 1.
dc.addHistogram(histogram, 1, prefix... | [
"func",
"(",
"dc",
"*",
"dataCollector",
")",
"addTimings",
"(",
"labels",
"[",
"]",
"string",
",",
"timings",
"*",
"stats",
".",
"Timings",
",",
"prefix",
"string",
")",
"{",
"histograms",
":=",
"timings",
".",
"Histograms",
"(",
")",
"\n",
"for",
"la... | // addTimings converts a vitess Timings stat to something opentsdb can deal with. | [
"addTimings",
"converts",
"a",
"vitess",
"Timings",
"stat",
"to",
"something",
"opentsdb",
"can",
"deal",
"with",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/opentsdb/opentsdb.go#L271-L277 |
135,434 | vitessio/vitess | go/mysql/server.go | NewFromListener | func NewFromListener(l net.Listener, authServer AuthServer, handler Handler, connReadTimeout time.Duration, connWriteTimeout time.Duration) (*Listener, error) {
cfg := ListenerConfig{
Listener: l,
AuthServer: authServer,
Handler: handler,
ConnReadTimeout: connReadTimeout,
Conn... | go | func NewFromListener(l net.Listener, authServer AuthServer, handler Handler, connReadTimeout time.Duration, connWriteTimeout time.Duration) (*Listener, error) {
cfg := ListenerConfig{
Listener: l,
AuthServer: authServer,
Handler: handler,
ConnReadTimeout: connReadTimeout,
Conn... | [
"func",
"NewFromListener",
"(",
"l",
"net",
".",
"Listener",
",",
"authServer",
"AuthServer",
",",
"handler",
"Handler",
",",
"connReadTimeout",
"time",
".",
"Duration",
",",
"connWriteTimeout",
"time",
".",
"Duration",
")",
"(",
"*",
"Listener",
",",
"error",... | // NewFromListener creares a new mysql listener from an existing net.Listener | [
"NewFromListener",
"creares",
"a",
"new",
"mysql",
"listener",
"from",
"an",
"existing",
"net",
".",
"Listener"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/server.go#L160-L170 |
135,435 | vitessio/vitess | go/mysql/server.go | NewListenerWithConfig | func NewListenerWithConfig(cfg ListenerConfig) (*Listener, error) {
var l net.Listener
if cfg.Listener != nil {
l = cfg.Listener
} else {
listener, err := net.Listen(cfg.Protocol, cfg.Address)
if err != nil {
return nil, err
}
l = listener
}
return &Listener{
authServer: cfg.AuthServer,
h... | go | func NewListenerWithConfig(cfg ListenerConfig) (*Listener, error) {
var l net.Listener
if cfg.Listener != nil {
l = cfg.Listener
} else {
listener, err := net.Listen(cfg.Protocol, cfg.Address)
if err != nil {
return nil, err
}
l = listener
}
return &Listener{
authServer: cfg.AuthServer,
h... | [
"func",
"NewListenerWithConfig",
"(",
"cfg",
"ListenerConfig",
")",
"(",
"*",
"Listener",
",",
"error",
")",
"{",
"var",
"l",
"net",
".",
"Listener",
"\n",
"if",
"cfg",
".",
"Listener",
"!=",
"nil",
"{",
"l",
"=",
"cfg",
".",
"Listener",
"\n",
"}",
"... | // NewListenerWithConfig creates new listener using provided config. There are
// no default values for config, so caller should ensure its correctness. | [
"NewListenerWithConfig",
"creates",
"new",
"listener",
"using",
"provided",
"config",
".",
"There",
"are",
"no",
"default",
"values",
"for",
"config",
"so",
"caller",
"should",
"ensure",
"its",
"correctness",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/server.go#L197-L219 |
135,436 | vitessio/vitess | go/mysql/server.go | Accept | func (l *Listener) Accept() {
for {
conn, err := l.listener.Accept()
if err != nil {
// Close() was probably called.
return
}
acceptTime := time.Now()
connectionID := l.connectionID
l.connectionID++
connCount.Add(1)
connAccept.Add(1)
go l.handle(conn, connectionID, acceptTime)
}
} | go | func (l *Listener) Accept() {
for {
conn, err := l.listener.Accept()
if err != nil {
// Close() was probably called.
return
}
acceptTime := time.Now()
connectionID := l.connectionID
l.connectionID++
connCount.Add(1)
connAccept.Add(1)
go l.handle(conn, connectionID, acceptTime)
}
} | [
"func",
"(",
"l",
"*",
"Listener",
")",
"Accept",
"(",
")",
"{",
"for",
"{",
"conn",
",",
"err",
":=",
"l",
".",
"listener",
".",
"Accept",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Close() was probably called.",
"return",
"\n",
"}",
"\n\n",... | // Accept runs an accept loop until the listener is closed. | [
"Accept",
"runs",
"an",
"accept",
"loop",
"until",
"the",
"listener",
"is",
"closed",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/server.go#L227-L245 |
135,437 | vitessio/vitess | go/mysql/server.go | Shutdown | func (l *Listener) Shutdown() {
if l.shutdown.CompareAndSwap(false, true) {
l.Close()
}
} | go | func (l *Listener) Shutdown() {
if l.shutdown.CompareAndSwap(false, true) {
l.Close()
}
} | [
"func",
"(",
"l",
"*",
"Listener",
")",
"Shutdown",
"(",
")",
"{",
"if",
"l",
".",
"shutdown",
".",
"CompareAndSwap",
"(",
"false",
",",
"true",
")",
"{",
"l",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"}"
] | // Shutdown closes listener and fails any Ping requests from existing connections.
// This can be used for graceful shutdown, to let clients know that they should reconnect to another server. | [
"Shutdown",
"closes",
"listener",
"and",
"fails",
"any",
"Ping",
"requests",
"from",
"existing",
"connections",
".",
"This",
"can",
"be",
"used",
"for",
"graceful",
"shutdown",
"to",
"let",
"clients",
"know",
"that",
"they",
"should",
"reconnect",
"to",
"anoth... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/server.go#L455-L459 |
135,438 | vitessio/vitess | go/mysql/server.go | writeHandshakeV10 | func (c *Conn) writeHandshakeV10(serverVersion string, authServer AuthServer, enableTLS bool) ([]byte, error) {
capabilities := CapabilityClientLongPassword |
CapabilityClientLongFlag |
CapabilityClientConnectWithDB |
CapabilityClientProtocol41 |
CapabilityClientTransactions |
CapabilityClientSecureConnectio... | go | func (c *Conn) writeHandshakeV10(serverVersion string, authServer AuthServer, enableTLS bool) ([]byte, error) {
capabilities := CapabilityClientLongPassword |
CapabilityClientLongFlag |
CapabilityClientConnectWithDB |
CapabilityClientProtocol41 |
CapabilityClientTransactions |
CapabilityClientSecureConnectio... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"writeHandshakeV10",
"(",
"serverVersion",
"string",
",",
"authServer",
"AuthServer",
",",
"enableTLS",
"bool",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"capabilities",
":=",
"CapabilityClientLongPassword",
"|",
... | // writeHandshakeV10 writes the Initial Handshake Packet, server side.
// It returns the salt data. | [
"writeHandshakeV10",
"writes",
"the",
"Initial",
"Handshake",
"Packet",
"server",
"side",
".",
"It",
"returns",
"the",
"salt",
"data",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/server.go#L467-L565 |
135,439 | vitessio/vitess | go/mysql/server.go | writeAuthSwitchRequest | func (c *Conn) writeAuthSwitchRequest(pluginName string, pluginData []byte) error {
length := 1 + // AuthSwitchRequestPacket
len(pluginName) + 1 + // 0-terminated pluginName
len(pluginData)
data := c.startEphemeralPacket(length)
pos := 0
// Packet header.
pos = writeByte(data, pos, AuthSwitchRequestPacket)
... | go | func (c *Conn) writeAuthSwitchRequest(pluginName string, pluginData []byte) error {
length := 1 + // AuthSwitchRequestPacket
len(pluginName) + 1 + // 0-terminated pluginName
len(pluginData)
data := c.startEphemeralPacket(length)
pos := 0
// Packet header.
pos = writeByte(data, pos, AuthSwitchRequestPacket)
... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"writeAuthSwitchRequest",
"(",
"pluginName",
"string",
",",
"pluginData",
"[",
"]",
"byte",
")",
"error",
"{",
"length",
":=",
"1",
"+",
"// AuthSwitchRequestPacket",
"len",
"(",
"pluginName",
")",
"+",
"1",
"+",
"// 0-t... | // writeAuthSwitchRequest writes an auth switch request packet. | [
"writeAuthSwitchRequest",
"writes",
"an",
"auth",
"switch",
"request",
"packet",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/server.go#L743-L765 |
135,440 | vitessio/vitess | go/mysql/server.go | tlsVersionToString | func tlsVersionToString(version uint16) string {
switch version {
case tls.VersionSSL30:
return versionSSL30
case tls.VersionTLS10:
return versionTLS10
case tls.VersionTLS11:
return versionTLS11
case tls.VersionTLS12:
return versionTLS12
default:
return versionTLSUnknown
}
} | go | func tlsVersionToString(version uint16) string {
switch version {
case tls.VersionSSL30:
return versionSSL30
case tls.VersionTLS10:
return versionTLS10
case tls.VersionTLS11:
return versionTLS11
case tls.VersionTLS12:
return versionTLS12
default:
return versionTLSUnknown
}
} | [
"func",
"tlsVersionToString",
"(",
"version",
"uint16",
")",
"string",
"{",
"switch",
"version",
"{",
"case",
"tls",
".",
"VersionSSL30",
":",
"return",
"versionSSL30",
"\n",
"case",
"tls",
".",
"VersionTLS10",
":",
"return",
"versionTLS10",
"\n",
"case",
"tls... | // Whenever we move to a new version of go, we will need add any new supported TLS versions here | [
"Whenever",
"we",
"move",
"to",
"a",
"new",
"version",
"of",
"go",
"we",
"will",
"need",
"add",
"any",
"new",
"supported",
"TLS",
"versions",
"here"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/server.go#L768-L781 |
135,441 | vitessio/vitess | go/vt/vtgate/vindexes/numeric_static_map.go | NewNumericStaticMap | func NewNumericStaticMap(name string, params map[string]string) (Vindex, error) {
jsonPath, ok := params["json_path"]
if !ok {
return nil, errors.New("NumericStaticMap: Could not find `json_path` param in vschema")
}
lt, err := loadNumericLookupTable(jsonPath)
if err != nil {
return nil, err
}
return &Nume... | go | func NewNumericStaticMap(name string, params map[string]string) (Vindex, error) {
jsonPath, ok := params["json_path"]
if !ok {
return nil, errors.New("NumericStaticMap: Could not find `json_path` param in vschema")
}
lt, err := loadNumericLookupTable(jsonPath)
if err != nil {
return nil, err
}
return &Nume... | [
"func",
"NewNumericStaticMap",
"(",
"name",
"string",
",",
"params",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"Vindex",
",",
"error",
")",
"{",
"jsonPath",
",",
"ok",
":=",
"params",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
... | // NewNumericStaticMap creates a NumericStaticMap vindex. | [
"NewNumericStaticMap",
"creates",
"a",
"NumericStaticMap",
"vindex",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/numeric_static_map.go#L51-L66 |
135,442 | vitessio/vitess | go/vt/vtgate/vindexes/numeric_static_map.go | Verify | func (vind *NumericStaticMap) Verify(_ VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error) {
out := make([]bool, len(ids))
for i := range ids {
var keybytes [8]byte
num, err := sqltypes.ToUint64(ids[i])
if err != nil {
return nil, vterrors.Wrap(err, "NumericStaticMap.Verify")
}
lookupNum, ok :... | go | func (vind *NumericStaticMap) Verify(_ VCursor, ids []sqltypes.Value, ksids [][]byte) ([]bool, error) {
out := make([]bool, len(ids))
for i := range ids {
var keybytes [8]byte
num, err := sqltypes.ToUint64(ids[i])
if err != nil {
return nil, vterrors.Wrap(err, "NumericStaticMap.Verify")
}
lookupNum, ok :... | [
"func",
"(",
"vind",
"*",
"NumericStaticMap",
")",
"Verify",
"(",
"_",
"VCursor",
",",
"ids",
"[",
"]",
"sqltypes",
".",
"Value",
",",
"ksids",
"[",
"]",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"bool",
",",
"error",
")",
"{",
"out",
":=",
"make",
... | // Verify returns true if ids and ksids match. | [
"Verify",
"returns",
"true",
"if",
"ids",
"and",
"ksids",
"match",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/numeric_static_map.go#L89-L105 |
135,443 | vitessio/vitess | go/mysql/binlog_event.go | String | func (q Query) String() string {
return fmt.Sprintf("{Database: %q, Charset: %v, SQL: %q}",
q.Database, q.Charset, q.SQL)
} | go | func (q Query) String() string {
return fmt.Sprintf("{Database: %q, Charset: %v, SQL: %q}",
q.Database, q.Charset, q.SQL)
} | [
"func",
"(",
"q",
"Query",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"q",
".",
"Database",
",",
"q",
".",
"Charset",
",",
"q",
".",
"SQL",
")",
"\n",
"}"
] | // String pretty-prints a Query. | [
"String",
"pretty",
"-",
"prints",
"a",
"Query",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event.go#L169-L172 |
135,444 | vitessio/vitess | go/mysql/binlog_event.go | NewServerBitmap | func NewServerBitmap(count int) Bitmap {
byteSize := (count + 7) / 8
return Bitmap{
data: make([]byte, byteSize),
count: count,
}
} | go | func NewServerBitmap(count int) Bitmap {
byteSize := (count + 7) / 8
return Bitmap{
data: make([]byte, byteSize),
count: count,
}
} | [
"func",
"NewServerBitmap",
"(",
"count",
"int",
")",
"Bitmap",
"{",
"byteSize",
":=",
"(",
"count",
"+",
"7",
")",
"/",
"8",
"\n",
"return",
"Bitmap",
"{",
"data",
":",
"make",
"(",
"[",
"]",
"byte",
",",
"byteSize",
")",
",",
"count",
":",
"count"... | // NewServerBitmap returns a bitmap that can hold 'count' bits. | [
"NewServerBitmap",
"returns",
"a",
"bitmap",
"that",
"can",
"hold",
"count",
"bits",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event.go#L257-L263 |
135,445 | vitessio/vitess | go/mysql/binlog_event.go | Bit | func (b *Bitmap) Bit(index int) bool {
byteIndex := index / 8
bitMask := byte(1 << (uint(index) & 0x7))
return b.data[byteIndex]&bitMask > 0
} | go | func (b *Bitmap) Bit(index int) bool {
byteIndex := index / 8
bitMask := byte(1 << (uint(index) & 0x7))
return b.data[byteIndex]&bitMask > 0
} | [
"func",
"(",
"b",
"*",
"Bitmap",
")",
"Bit",
"(",
"index",
"int",
")",
"bool",
"{",
"byteIndex",
":=",
"index",
"/",
"8",
"\n",
"bitMask",
":=",
"byte",
"(",
"1",
"<<",
"(",
"uint",
"(",
"index",
")",
"&",
"0x7",
")",
")",
"\n",
"return",
"b",
... | // Bit returned the value of a given bit in the Bitmap. | [
"Bit",
"returned",
"the",
"value",
"of",
"a",
"given",
"bit",
"in",
"the",
"Bitmap",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event.go#L271-L275 |
135,446 | vitessio/vitess | go/mysql/binlog_event.go | Set | func (b *Bitmap) Set(index int, value bool) {
byteIndex := index / 8
bitMask := byte(1 << (uint(index) & 0x7))
if value {
b.data[byteIndex] |= bitMask
} else {
b.data[byteIndex] &= 0xff - bitMask
}
} | go | func (b *Bitmap) Set(index int, value bool) {
byteIndex := index / 8
bitMask := byte(1 << (uint(index) & 0x7))
if value {
b.data[byteIndex] |= bitMask
} else {
b.data[byteIndex] &= 0xff - bitMask
}
} | [
"func",
"(",
"b",
"*",
"Bitmap",
")",
"Set",
"(",
"index",
"int",
",",
"value",
"bool",
")",
"{",
"byteIndex",
":=",
"index",
"/",
"8",
"\n",
"bitMask",
":=",
"byte",
"(",
"1",
"<<",
"(",
"uint",
"(",
"index",
")",
"&",
"0x7",
")",
")",
"\n",
... | // Set sets the given boolean value. | [
"Set",
"sets",
"the",
"given",
"boolean",
"value",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event.go#L278-L286 |
135,447 | vitessio/vitess | go/mysql/binlog_event.go | BitCount | func (b *Bitmap) BitCount() int {
sum := 0
for i := 0; i < b.count; i++ {
if b.Bit(i) {
sum++
}
}
return sum
} | go | func (b *Bitmap) BitCount() int {
sum := 0
for i := 0; i < b.count; i++ {
if b.Bit(i) {
sum++
}
}
return sum
} | [
"func",
"(",
"b",
"*",
"Bitmap",
")",
"BitCount",
"(",
")",
"int",
"{",
"sum",
":=",
"0",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"b",
".",
"count",
";",
"i",
"++",
"{",
"if",
"b",
".",
"Bit",
"(",
"i",
")",
"{",
"sum",
"++",
"\n",
... | // BitCount returns how many bits are set in the bitmap.
// Note values that are not used may be set to 0 or 1,
// hence the non-efficient logic. | [
"BitCount",
"returns",
"how",
"many",
"bits",
"are",
"set",
"in",
"the",
"bitmap",
".",
"Note",
"values",
"that",
"are",
"not",
"used",
"may",
"be",
"set",
"to",
"0",
"or",
"1",
"hence",
"the",
"non",
"-",
"efficient",
"logic",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event.go#L291-L299 |
135,448 | vitessio/vitess | go/vt/binlog/event_streamer.go | NewEventStreamer | func NewEventStreamer(cp *mysql.ConnParams, se *schema.Engine, startPos mysql.Position, timestamp int64, sendEvent sendEventFunc) *EventStreamer {
evs := &EventStreamer{
sendEvent: sendEvent,
}
evs.bls = NewStreamer(cp, se, nil, startPos, timestamp, evs.transactionToEvent)
evs.bls.extractPK = true
return evs
} | go | func NewEventStreamer(cp *mysql.ConnParams, se *schema.Engine, startPos mysql.Position, timestamp int64, sendEvent sendEventFunc) *EventStreamer {
evs := &EventStreamer{
sendEvent: sendEvent,
}
evs.bls = NewStreamer(cp, se, nil, startPos, timestamp, evs.transactionToEvent)
evs.bls.extractPK = true
return evs
} | [
"func",
"NewEventStreamer",
"(",
"cp",
"*",
"mysql",
".",
"ConnParams",
",",
"se",
"*",
"schema",
".",
"Engine",
",",
"startPos",
"mysql",
".",
"Position",
",",
"timestamp",
"int64",
",",
"sendEvent",
"sendEventFunc",
")",
"*",
"EventStreamer",
"{",
"evs",
... | // NewEventStreamer returns a new EventStreamer on top of a Streamer | [
"NewEventStreamer",
"returns",
"a",
"new",
"EventStreamer",
"on",
"top",
"of",
"a",
"Streamer"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/event_streamer.go#L54-L61 |
135,449 | vitessio/vitess | go/vt/binlog/event_streamer.go | Stream | func (evs *EventStreamer) Stream(ctx context.Context) error {
return evs.bls.Stream(ctx)
} | go | func (evs *EventStreamer) Stream(ctx context.Context) error {
return evs.bls.Stream(ctx)
} | [
"func",
"(",
"evs",
"*",
"EventStreamer",
")",
"Stream",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"return",
"evs",
".",
"bls",
".",
"Stream",
"(",
"ctx",
")",
"\n",
"}"
] | // Stream starts streaming updates | [
"Stream",
"starts",
"streaming",
"updates"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/event_streamer.go#L64-L66 |
135,450 | vitessio/vitess | go/vt/topo/consultopo/error.go | convertError | func convertError(err error, nodePath string) error {
switch err {
case context.Canceled:
return topo.NewError(topo.Interrupted, nodePath)
case context.DeadlineExceeded:
return topo.NewError(topo.Timeout, nodePath)
}
return err
} | go | func convertError(err error, nodePath string) error {
switch err {
case context.Canceled:
return topo.NewError(topo.Interrupted, nodePath)
case context.DeadlineExceeded:
return topo.NewError(topo.Timeout, nodePath)
}
return err
} | [
"func",
"convertError",
"(",
"err",
"error",
",",
"nodePath",
"string",
")",
"error",
"{",
"switch",
"err",
"{",
"case",
"context",
".",
"Canceled",
":",
"return",
"topo",
".",
"NewError",
"(",
"topo",
".",
"Interrupted",
",",
"nodePath",
")",
"\n",
"cas... | // convertError converts a context error into a topo error. All errors
// are either application-level errors, or context errors. | [
"convertError",
"converts",
"a",
"context",
"error",
"into",
"a",
"topo",
"error",
".",
"All",
"errors",
"are",
"either",
"application",
"-",
"level",
"errors",
"or",
"context",
"errors",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/consultopo/error.go#L40-L48 |
135,451 | vitessio/vitess | go/vt/vttablet/tabletserver/messager/cache.go | newCache | func newCache(size int) *cache {
mc := &cache{
size: size,
inQueue: make(map[string]*MessageRow),
inFlight: make(map[string]bool),
}
return mc
} | go | func newCache(size int) *cache {
mc := &cache{
size: size,
inQueue: make(map[string]*MessageRow),
inFlight: make(map[string]bool),
}
return mc
} | [
"func",
"newCache",
"(",
"size",
"int",
")",
"*",
"cache",
"{",
"mc",
":=",
"&",
"cache",
"{",
"size",
":",
"size",
",",
"inQueue",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"MessageRow",
")",
",",
"inFlight",
":",
"make",
"(",
"map",
"["... | // NewMessagerCache creates a new cache. | [
"NewMessagerCache",
"creates",
"a",
"new",
"cache",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/cache.go#L96-L103 |
135,452 | vitessio/vitess | go/vt/vttablet/tabletserver/messager/cache.go | Add | func (mc *cache) Add(mr *MessageRow) bool {
mc.mu.Lock()
defer mc.mu.Unlock()
if len(mc.sendQueue) >= mc.size {
return false
}
id := mr.Row[0].ToString()
if mc.inFlight[id] {
return true
}
if _, ok := mc.inQueue[id]; ok {
return true
}
heap.Push(&mc.sendQueue, mr)
mc.inQueue[id] = mr
return true
} | go | func (mc *cache) Add(mr *MessageRow) bool {
mc.mu.Lock()
defer mc.mu.Unlock()
if len(mc.sendQueue) >= mc.size {
return false
}
id := mr.Row[0].ToString()
if mc.inFlight[id] {
return true
}
if _, ok := mc.inQueue[id]; ok {
return true
}
heap.Push(&mc.sendQueue, mr)
mc.inQueue[id] = mr
return true
} | [
"func",
"(",
"mc",
"*",
"cache",
")",
"Add",
"(",
"mr",
"*",
"MessageRow",
")",
"bool",
"{",
"mc",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mc",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"len",
"(",
"mc",
".",
"sendQueue",
")",... | // Add adds a MessageRow to the cache. It returns
// false if the cache is full. | [
"Add",
"adds",
"a",
"MessageRow",
"to",
"the",
"cache",
".",
"It",
"returns",
"false",
"if",
"the",
"cache",
"is",
"full",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/cache.go#L116-L132 |
135,453 | vitessio/vitess | go/vt/vttablet/tabletserver/messager/cache.go | Pop | func (mc *cache) Pop() *MessageRow {
mc.mu.Lock()
defer mc.mu.Unlock()
for {
if len(mc.sendQueue) == 0 {
return nil
}
mr := heap.Pop(&mc.sendQueue).(*MessageRow)
// If message was previously marked as defunct, drop
// it and continue.
if mr.defunct {
continue
}
id := mr.Row[0].ToString()
// ... | go | func (mc *cache) Pop() *MessageRow {
mc.mu.Lock()
defer mc.mu.Unlock()
for {
if len(mc.sendQueue) == 0 {
return nil
}
mr := heap.Pop(&mc.sendQueue).(*MessageRow)
// If message was previously marked as defunct, drop
// it and continue.
if mr.defunct {
continue
}
id := mr.Row[0].ToString()
// ... | [
"func",
"(",
"mc",
"*",
"cache",
")",
"Pop",
"(",
")",
"*",
"MessageRow",
"{",
"mc",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mc",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"{",
"if",
"len",
"(",
"mc",
".",
"sendQueue",
")",
... | // Pop removes the next MessageRow. Once the
// message has been sent, Discard must be called.
// The discard has to happen as a separate operation
// to prevent the poller thread from repopulating the
// message while it's being sent.
// If the Cache is empty Pop returns nil. | [
"Pop",
"removes",
"the",
"next",
"MessageRow",
".",
"Once",
"the",
"message",
"has",
"been",
"sent",
"Discard",
"must",
"be",
"called",
".",
"The",
"discard",
"has",
"to",
"happen",
"as",
"a",
"separate",
"operation",
"to",
"prevent",
"the",
"poller",
"thr... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/cache.go#L140-L160 |
135,454 | vitessio/vitess | go/vt/vttablet/tabletserver/messager/cache.go | Discard | func (mc *cache) Discard(ids []string) {
mc.mu.Lock()
defer mc.mu.Unlock()
for _, id := range ids {
if mr := mc.inQueue[id]; mr != nil {
// The row is still in the queue somewhere. Mark
// it as defunct. It will be "garbage collected" later.
mr.defunct = true
}
delete(mc.inQueue, id)
delete(mc.inFli... | go | func (mc *cache) Discard(ids []string) {
mc.mu.Lock()
defer mc.mu.Unlock()
for _, id := range ids {
if mr := mc.inQueue[id]; mr != nil {
// The row is still in the queue somewhere. Mark
// it as defunct. It will be "garbage collected" later.
mr.defunct = true
}
delete(mc.inQueue, id)
delete(mc.inFli... | [
"func",
"(",
"mc",
"*",
"cache",
")",
"Discard",
"(",
"ids",
"[",
"]",
"string",
")",
"{",
"mc",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mc",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"id",
":=",
"range",
"ids",
"... | // Discard forgets the specified id. | [
"Discard",
"forgets",
"the",
"specified",
"id",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/cache.go#L163-L175 |
135,455 | vitessio/vitess | go/vt/vttablet/tabletserver/messager/cache.go | Size | func (mc *cache) Size() int {
mc.mu.Lock()
defer mc.mu.Unlock()
return mc.size
} | go | func (mc *cache) Size() int {
mc.mu.Lock()
defer mc.mu.Unlock()
return mc.size
} | [
"func",
"(",
"mc",
"*",
"cache",
")",
"Size",
"(",
")",
"int",
"{",
"mc",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mc",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"mc",
".",
"size",
"\n",
"}"
] | // Size returns the max size of cache. | [
"Size",
"returns",
"the",
"max",
"size",
"of",
"cache",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/cache.go#L178-L182 |
135,456 | vitessio/vitess | go/vt/dtids/dtids.go | New | func New(mmShard *vtgatepb.Session_ShardSession) string {
return fmt.Sprintf("%s:%s:%d", mmShard.Target.Keyspace, mmShard.Target.Shard, mmShard.TransactionId)
} | go | func New(mmShard *vtgatepb.Session_ShardSession) string {
return fmt.Sprintf("%s:%s:%d", mmShard.Target.Keyspace, mmShard.Target.Shard, mmShard.TransactionId)
} | [
"func",
"New",
"(",
"mmShard",
"*",
"vtgatepb",
".",
"Session_ShardSession",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"mmShard",
".",
"Target",
".",
"Keyspace",
",",
"mmShard",
".",
"Target",
".",
"Shard",
",",
"mmShard"... | // New generates a dtid based on Session_ShardSession. | [
"New",
"generates",
"a",
"dtid",
"based",
"on",
"Session_ShardSession",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/dtids/dtids.go#L34-L36 |
135,457 | vitessio/vitess | go/vt/dtids/dtids.go | ShardSession | func ShardSession(dtid string) (*vtgatepb.Session_ShardSession, error) {
splits := strings.Split(dtid, ":")
if len(splits) != 3 {
return nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "invalid parts in dtid: %s", dtid)
}
target := &querypb.Target{
Keyspace: splits[0],
Shard: splits[1],
TabletTyp... | go | func ShardSession(dtid string) (*vtgatepb.Session_ShardSession, error) {
splits := strings.Split(dtid, ":")
if len(splits) != 3 {
return nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "invalid parts in dtid: %s", dtid)
}
target := &querypb.Target{
Keyspace: splits[0],
Shard: splits[1],
TabletTyp... | [
"func",
"ShardSession",
"(",
"dtid",
"string",
")",
"(",
"*",
"vtgatepb",
".",
"Session_ShardSession",
",",
"error",
")",
"{",
"splits",
":=",
"strings",
".",
"Split",
"(",
"dtid",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"splits",
")",
"!=",
"3... | // ShardSession builds a Session_ShardSession from a dtid. | [
"ShardSession",
"builds",
"a",
"Session_ShardSession",
"from",
"a",
"dtid",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/dtids/dtids.go#L39-L57 |
135,458 | vitessio/vitess | go/vt/dtids/dtids.go | TransactionID | func TransactionID(dtid string) (int64, error) {
splits := strings.Split(dtid, ":")
if len(splits) != 3 {
return 0, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "invalid parts in dtid: %s", dtid)
}
txid, err := strconv.ParseInt(splits[2], 10, 0)
if err != nil {
return 0, vterrors.Errorf(vtrpcpb.Code_INVALID_... | go | func TransactionID(dtid string) (int64, error) {
splits := strings.Split(dtid, ":")
if len(splits) != 3 {
return 0, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "invalid parts in dtid: %s", dtid)
}
txid, err := strconv.ParseInt(splits[2], 10, 0)
if err != nil {
return 0, vterrors.Errorf(vtrpcpb.Code_INVALID_... | [
"func",
"TransactionID",
"(",
"dtid",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"splits",
":=",
"strings",
".",
"Split",
"(",
"dtid",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"splits",
")",
"!=",
"3",
"{",
"return",
"0",
",",
"vte... | // TransactionID extracts the original transaction ID from the dtid. | [
"TransactionID",
"extracts",
"the",
"original",
"transaction",
"ID",
"from",
"the",
"dtid",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/dtids/dtids.go#L60-L70 |
135,459 | vitessio/vitess | go/cmd/vtexplain/vtexplain.go | flagUsage | func flagUsage(f *flag.Flag) {
s := fmt.Sprintf(" -%s", f.Name) // Two spaces before -; see next two comments.
name, usage := flag.UnquoteUsage(f)
if len(name) > 0 {
s += " " + name
}
// Boolean flags of one ASCII letter are so common we
// treat them specially, putting their usage on the same line.
if len(s)... | go | func flagUsage(f *flag.Flag) {
s := fmt.Sprintf(" -%s", f.Name) // Two spaces before -; see next two comments.
name, usage := flag.UnquoteUsage(f)
if len(name) > 0 {
s += " " + name
}
// Boolean flags of one ASCII letter are so common we
// treat them specially, putting their usage on the same line.
if len(s)... | [
"func",
"flagUsage",
"(",
"f",
"*",
"flag",
".",
"Flag",
")",
"{",
"s",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"Name",
")",
"// Two spaces before -; see next two comments.",
"\n",
"name",
",",
"usage",
":=",
"flag",
".",
"UnquoteUsa... | // Cloned from the source to print out the usage for a given flag | [
"Cloned",
"from",
"the",
"source",
"to",
"print",
"out",
"the",
"usage",
"for",
"a",
"given",
"flag"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cmd/vtexplain/vtexplain.go#L74-L97 |
135,460 | vitessio/vitess | go/cmd/vtexplain/vtexplain.go | getFileParam | func getFileParam(flag, flagFile, name string) (string, error) {
if flag != "" {
if flagFile != "" {
return "", fmt.Errorf("action requires only one of %v or %v-file", name, name)
}
return flag, nil
}
if flagFile == "" {
return "", fmt.Errorf("action requires one of %v or %v-file", name, name)
}
data, ... | go | func getFileParam(flag, flagFile, name string) (string, error) {
if flag != "" {
if flagFile != "" {
return "", fmt.Errorf("action requires only one of %v or %v-file", name, name)
}
return flag, nil
}
if flagFile == "" {
return "", fmt.Errorf("action requires one of %v or %v-file", name, name)
}
data, ... | [
"func",
"getFileParam",
"(",
"flag",
",",
"flagFile",
",",
"name",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"flag",
"!=",
"\"",
"\"",
"{",
"if",
"flagFile",
"!=",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
... | // getFileParam returns a string containing either flag is not "",
// or the content of the file named flagFile | [
"getFileParam",
"returns",
"a",
"string",
"containing",
"either",
"flag",
"is",
"not",
"or",
"the",
"content",
"of",
"the",
"file",
"named",
"flagFile"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cmd/vtexplain/vtexplain.go#L107-L123 |
135,461 | vitessio/vitess | go/vt/mysqlctl/replication.go | WaitForSlaveStart | func WaitForSlaveStart(mysqld MysqlDaemon, slaveStartDeadline int) error {
var rowMap map[string]string
for slaveWait := 0; slaveWait < slaveStartDeadline; slaveWait++ {
status, err := mysqld.SlaveStatus()
if err != nil {
return err
}
if status.SlaveRunning() {
return nil
}
time.Sleep(time.Second)
... | go | func WaitForSlaveStart(mysqld MysqlDaemon, slaveStartDeadline int) error {
var rowMap map[string]string
for slaveWait := 0; slaveWait < slaveStartDeadline; slaveWait++ {
status, err := mysqld.SlaveStatus()
if err != nil {
return err
}
if status.SlaveRunning() {
return nil
}
time.Sleep(time.Second)
... | [
"func",
"WaitForSlaveStart",
"(",
"mysqld",
"MysqlDaemon",
",",
"slaveStartDeadline",
"int",
")",
"error",
"{",
"var",
"rowMap",
"map",
"[",
"string",
"]",
"string",
"\n",
"for",
"slaveWait",
":=",
"0",
";",
"slaveWait",
"<",
"slaveStartDeadline",
";",
"slaveW... | // WaitForSlaveStart waits until the deadline for replication to start.
// This validates the current master is correct and can be connected to. | [
"WaitForSlaveStart",
"waits",
"until",
"the",
"deadline",
"for",
"replication",
"to",
"start",
".",
"This",
"validates",
"the",
"current",
"master",
"is",
"correct",
"and",
"can",
"be",
"connected",
"to",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/replication.go#L42-L67 |
135,462 | vitessio/vitess | go/vt/mysqlctl/replication.go | StartSlave | func (mysqld *Mysqld) StartSlave(hookExtraEnv map[string]string) error {
ctx := context.TODO()
conn, err := getPoolReconnect(ctx, mysqld.dbaPool)
if err != nil {
return err
}
defer conn.Recycle()
if err := mysqld.executeSuperQueryListConn(ctx, conn, []string{conn.StartSlaveCommand()}); err != nil {
return er... | go | func (mysqld *Mysqld) StartSlave(hookExtraEnv map[string]string) error {
ctx := context.TODO()
conn, err := getPoolReconnect(ctx, mysqld.dbaPool)
if err != nil {
return err
}
defer conn.Recycle()
if err := mysqld.executeSuperQueryListConn(ctx, conn, []string{conn.StartSlaveCommand()}); err != nil {
return er... | [
"func",
"(",
"mysqld",
"*",
"Mysqld",
")",
"StartSlave",
"(",
"hookExtraEnv",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"ctx",
":=",
"context",
".",
"TODO",
"(",
")",
"\n",
"conn",
",",
"err",
":=",
"getPoolReconnect",
"(",
"ctx",
",",
... | // StartSlave starts a slave. | [
"StartSlave",
"starts",
"a",
"slave",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/replication.go#L70-L85 |
135,463 | vitessio/vitess | go/vt/mysqlctl/replication.go | StartSlaveUntilAfter | func (mysqld *Mysqld) StartSlaveUntilAfter(ctx context.Context, targetPos mysql.Position) error {
conn, err := getPoolReconnect(ctx, mysqld.dbaPool)
if err != nil {
return err
}
defer conn.Recycle()
queries := []string{conn.StartSlaveUntilAfterCommand(targetPos)}
return mysqld.executeSuperQueryListConn(ctx, c... | go | func (mysqld *Mysqld) StartSlaveUntilAfter(ctx context.Context, targetPos mysql.Position) error {
conn, err := getPoolReconnect(ctx, mysqld.dbaPool)
if err != nil {
return err
}
defer conn.Recycle()
queries := []string{conn.StartSlaveUntilAfterCommand(targetPos)}
return mysqld.executeSuperQueryListConn(ctx, c... | [
"func",
"(",
"mysqld",
"*",
"Mysqld",
")",
"StartSlaveUntilAfter",
"(",
"ctx",
"context",
".",
"Context",
",",
"targetPos",
"mysql",
".",
"Position",
")",
"error",
"{",
"conn",
",",
"err",
":=",
"getPoolReconnect",
"(",
"ctx",
",",
"mysqld",
".",
"dbaPool"... | // StartSlaveUntilAfter starts a slave until replication has come to `targetPos`, then it stops replication | [
"StartSlaveUntilAfter",
"starts",
"a",
"slave",
"until",
"replication",
"has",
"come",
"to",
"targetPos",
"then",
"it",
"stops",
"replication"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/replication.go#L88-L98 |
135,464 | vitessio/vitess | go/vt/mysqlctl/replication.go | GetMysqlPort | func (mysqld *Mysqld) GetMysqlPort() (int32, error) {
qr, err := mysqld.FetchSuperQuery(context.TODO(), "SHOW VARIABLES LIKE 'port'")
if err != nil {
return 0, err
}
if len(qr.Rows) != 1 {
return 0, errors.New("no port variable in mysql")
}
utemp, err := sqltypes.ToUint64(qr.Rows[0][1])
if err != nil {
ret... | go | func (mysqld *Mysqld) GetMysqlPort() (int32, error) {
qr, err := mysqld.FetchSuperQuery(context.TODO(), "SHOW VARIABLES LIKE 'port'")
if err != nil {
return 0, err
}
if len(qr.Rows) != 1 {
return 0, errors.New("no port variable in mysql")
}
utemp, err := sqltypes.ToUint64(qr.Rows[0][1])
if err != nil {
ret... | [
"func",
"(",
"mysqld",
"*",
"Mysqld",
")",
"GetMysqlPort",
"(",
")",
"(",
"int32",
",",
"error",
")",
"{",
"qr",
",",
"err",
":=",
"mysqld",
".",
"FetchSuperQuery",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"... | // GetMysqlPort returns mysql port | [
"GetMysqlPort",
"returns",
"mysql",
"port"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/replication.go#L118-L131 |
135,465 | vitessio/vitess | go/vt/mysqlctl/replication.go | IsReadOnly | func (mysqld *Mysqld) IsReadOnly() (bool, error) {
qr, err := mysqld.FetchSuperQuery(context.TODO(), "SHOW VARIABLES LIKE 'read_only'")
if err != nil {
return true, err
}
if len(qr.Rows) != 1 {
return true, errors.New("no read_only variable in mysql")
}
if qr.Rows[0][1].ToString() == "ON" {
return true, nil... | go | func (mysqld *Mysqld) IsReadOnly() (bool, error) {
qr, err := mysqld.FetchSuperQuery(context.TODO(), "SHOW VARIABLES LIKE 'read_only'")
if err != nil {
return true, err
}
if len(qr.Rows) != 1 {
return true, errors.New("no read_only variable in mysql")
}
if qr.Rows[0][1].ToString() == "ON" {
return true, nil... | [
"func",
"(",
"mysqld",
"*",
"Mysqld",
")",
"IsReadOnly",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"qr",
",",
"err",
":=",
"mysqld",
".",
"FetchSuperQuery",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!="... | // IsReadOnly return true if the instance is read only | [
"IsReadOnly",
"return",
"true",
"if",
"the",
"instance",
"is",
"read",
"only"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/replication.go#L134-L146 |
135,466 | vitessio/vitess | go/vt/mysqlctl/replication.go | WaitMasterPos | func (mysqld *Mysqld) WaitMasterPos(ctx context.Context, targetPos mysql.Position) error {
// Get a connection.
conn, err := getPoolReconnect(ctx, mysqld.dbaPool)
if err != nil {
return err
}
defer conn.Recycle()
// Find the query to run, run it.
query, err := conn.WaitUntilPositionCommand(ctx, targetPos)
if... | go | func (mysqld *Mysqld) WaitMasterPos(ctx context.Context, targetPos mysql.Position) error {
// Get a connection.
conn, err := getPoolReconnect(ctx, mysqld.dbaPool)
if err != nil {
return err
}
defer conn.Recycle()
// Find the query to run, run it.
query, err := conn.WaitUntilPositionCommand(ctx, targetPos)
if... | [
"func",
"(",
"mysqld",
"*",
"Mysqld",
")",
"WaitMasterPos",
"(",
"ctx",
"context",
".",
"Context",
",",
"targetPos",
"mysql",
".",
"Position",
")",
"error",
"{",
"// Get a connection.",
"conn",
",",
"err",
":=",
"getPoolReconnect",
"(",
"ctx",
",",
"mysqld",... | // WaitMasterPos lets slaves wait to given replication position | [
"WaitMasterPos",
"lets",
"slaves",
"wait",
"to",
"given",
"replication",
"position"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/replication.go#L176-L204 |
135,467 | vitessio/vitess | go/vt/mysqlctl/replication.go | SlaveStatus | func (mysqld *Mysqld) SlaveStatus() (mysql.SlaveStatus, error) {
conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool)
if err != nil {
return mysql.SlaveStatus{}, err
}
defer conn.Recycle()
return conn.ShowSlaveStatus()
} | go | func (mysqld *Mysqld) SlaveStatus() (mysql.SlaveStatus, error) {
conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool)
if err != nil {
return mysql.SlaveStatus{}, err
}
defer conn.Recycle()
return conn.ShowSlaveStatus()
} | [
"func",
"(",
"mysqld",
"*",
"Mysqld",
")",
"SlaveStatus",
"(",
")",
"(",
"mysql",
".",
"SlaveStatus",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"getPoolReconnect",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"mysqld",
".",
"dbaPool",
")",
"\n... | // SlaveStatus returns the slave replication statuses | [
"SlaveStatus",
"returns",
"the",
"slave",
"replication",
"statuses"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/replication.go#L207-L215 |
135,468 | vitessio/vitess | go/vt/mysqlctl/replication.go | MasterPosition | func (mysqld *Mysqld) MasterPosition() (mysql.Position, error) {
conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool)
if err != nil {
return mysql.Position{}, err
}
defer conn.Recycle()
return conn.MasterPosition()
} | go | func (mysqld *Mysqld) MasterPosition() (mysql.Position, error) {
conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool)
if err != nil {
return mysql.Position{}, err
}
defer conn.Recycle()
return conn.MasterPosition()
} | [
"func",
"(",
"mysqld",
"*",
"Mysqld",
")",
"MasterPosition",
"(",
")",
"(",
"mysql",
".",
"Position",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"getPoolReconnect",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"mysqld",
".",
"dbaPool",
")",
"\n... | // MasterPosition returns the master replication position. | [
"MasterPosition",
"returns",
"the",
"master",
"replication",
"position",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/replication.go#L218-L226 |
135,469 | vitessio/vitess | go/vt/mysqlctl/replication.go | SetSlavePosition | func (mysqld *Mysqld) SetSlavePosition(ctx context.Context, pos mysql.Position) error {
conn, err := getPoolReconnect(ctx, mysqld.dbaPool)
if err != nil {
return err
}
defer conn.Recycle()
cmds := conn.SetSlavePositionCommands(pos)
log.Infof("Executing commands to set slave position: %v", cmds)
return mysqld.... | go | func (mysqld *Mysqld) SetSlavePosition(ctx context.Context, pos mysql.Position) error {
conn, err := getPoolReconnect(ctx, mysqld.dbaPool)
if err != nil {
return err
}
defer conn.Recycle()
cmds := conn.SetSlavePositionCommands(pos)
log.Infof("Executing commands to set slave position: %v", cmds)
return mysqld.... | [
"func",
"(",
"mysqld",
"*",
"Mysqld",
")",
"SetSlavePosition",
"(",
"ctx",
"context",
".",
"Context",
",",
"pos",
"mysql",
".",
"Position",
")",
"error",
"{",
"conn",
",",
"err",
":=",
"getPoolReconnect",
"(",
"ctx",
",",
"mysqld",
".",
"dbaPool",
")",
... | // SetSlavePosition sets the replication position at which the slave will resume
// when its replication is started. | [
"SetSlavePosition",
"sets",
"the",
"replication",
"position",
"at",
"which",
"the",
"slave",
"will",
"resume",
"when",
"its",
"replication",
"is",
"started",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/replication.go#L230-L240 |
135,470 | vitessio/vitess | go/vt/mysqlctl/replication.go | ResetReplication | func (mysqld *Mysqld) ResetReplication(ctx context.Context) error {
conn, connErr := getPoolReconnect(ctx, mysqld.dbaPool)
if connErr != nil {
return connErr
}
defer conn.Recycle()
cmds := conn.ResetReplicationCommands()
return mysqld.executeSuperQueryListConn(ctx, conn, cmds)
} | go | func (mysqld *Mysqld) ResetReplication(ctx context.Context) error {
conn, connErr := getPoolReconnect(ctx, mysqld.dbaPool)
if connErr != nil {
return connErr
}
defer conn.Recycle()
cmds := conn.ResetReplicationCommands()
return mysqld.executeSuperQueryListConn(ctx, conn, cmds)
} | [
"func",
"(",
"mysqld",
"*",
"Mysqld",
")",
"ResetReplication",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"conn",
",",
"connErr",
":=",
"getPoolReconnect",
"(",
"ctx",
",",
"mysqld",
".",
"dbaPool",
")",
"\n",
"if",
"connErr",
"!=",
"nil",... | // ResetReplication resets all replication for this host. | [
"ResetReplication",
"resets",
"all",
"replication",
"for",
"this",
"host",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/replication.go#L268-L277 |
135,471 | vitessio/vitess | go/vt/mysqlctl/replication.go | FindSlaves | func FindSlaves(mysqld MysqlDaemon) ([]string, error) {
qr, err := mysqld.FetchSuperQuery(context.TODO(), "SHOW PROCESSLIST")
if err != nil {
return nil, err
}
addrs := make([]string, 0, 32)
for _, row := range qr.Rows {
// Check for prefix, since it could be "Binlog Dump GTID".
if strings.HasPrefix(row[colC... | go | func FindSlaves(mysqld MysqlDaemon) ([]string, error) {
qr, err := mysqld.FetchSuperQuery(context.TODO(), "SHOW PROCESSLIST")
if err != nil {
return nil, err
}
addrs := make([]string, 0, 32)
for _, row := range qr.Rows {
// Check for prefix, since it could be "Binlog Dump GTID".
if strings.HasPrefix(row[colC... | [
"func",
"FindSlaves",
"(",
"mysqld",
"MysqlDaemon",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"qr",
",",
"err",
":=",
"mysqld",
".",
"FetchSuperQuery",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!="... | // FindSlaves gets IP addresses for all currently connected slaves. | [
"FindSlaves",
"gets",
"IP",
"addresses",
"for",
"all",
"currently",
"connected",
"slaves",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/replication.go#L304-L335 |
135,472 | vitessio/vitess | go/vt/mysqlctl/replication.go | EnableBinlogPlayback | func (mysqld *Mysqld) EnableBinlogPlayback() error {
// Get a connection.
conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool)
if err != nil {
return err
}
defer conn.Recycle()
// See if we have a command to run, and run it.
cmd := conn.EnableBinlogPlaybackCommand()
if cmd == "" {
return nil
}
i... | go | func (mysqld *Mysqld) EnableBinlogPlayback() error {
// Get a connection.
conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool)
if err != nil {
return err
}
defer conn.Recycle()
// See if we have a command to run, and run it.
cmd := conn.EnableBinlogPlaybackCommand()
if cmd == "" {
return nil
}
i... | [
"func",
"(",
"mysqld",
"*",
"Mysqld",
")",
"EnableBinlogPlayback",
"(",
")",
"error",
"{",
"// Get a connection.",
"conn",
",",
"err",
":=",
"getPoolReconnect",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"mysqld",
".",
"dbaPool",
")",
"\n",
"if",
"err",
... | // EnableBinlogPlayback prepares the server to play back events from a binlog stream.
// Whatever it does for a given flavor, it must be idempotent. | [
"EnableBinlogPlayback",
"prepares",
"the",
"server",
"to",
"play",
"back",
"events",
"from",
"a",
"binlog",
"stream",
".",
"Whatever",
"it",
"does",
"for",
"a",
"given",
"flavor",
"it",
"must",
"be",
"idempotent",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/replication.go#L339-L359 |
135,473 | vitessio/vitess | go/vt/mysqlctl/replication.go | SemiSyncEnabled | func (mysqld *Mysqld) SemiSyncEnabled() (master, slave bool) {
vars, err := mysqld.fetchVariables(context.TODO(), "rpl_semi_sync_%_enabled")
if err != nil {
return false, false
}
master = (vars["rpl_semi_sync_master_enabled"] == "ON")
slave = (vars["rpl_semi_sync_slave_enabled"] == "ON")
return master, slave
} | go | func (mysqld *Mysqld) SemiSyncEnabled() (master, slave bool) {
vars, err := mysqld.fetchVariables(context.TODO(), "rpl_semi_sync_%_enabled")
if err != nil {
return false, false
}
master = (vars["rpl_semi_sync_master_enabled"] == "ON")
slave = (vars["rpl_semi_sync_slave_enabled"] == "ON")
return master, slave
} | [
"func",
"(",
"mysqld",
"*",
"Mysqld",
")",
"SemiSyncEnabled",
"(",
")",
"(",
"master",
",",
"slave",
"bool",
")",
"{",
"vars",
",",
"err",
":=",
"mysqld",
".",
"fetchVariables",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"if... | // SemiSyncEnabled returns whether semi-sync is enabled for master or slave.
// If the semi-sync plugin is not loaded, we assume semi-sync is disabled. | [
"SemiSyncEnabled",
"returns",
"whether",
"semi",
"-",
"sync",
"is",
"enabled",
"for",
"master",
"or",
"slave",
".",
"If",
"the",
"semi",
"-",
"sync",
"plugin",
"is",
"not",
"loaded",
"we",
"assume",
"semi",
"-",
"sync",
"is",
"disabled",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/replication.go#L410-L418 |
135,474 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | RegisterFakeVTGateConnDialer | func RegisterFakeVTGateConnDialer() (*FakeVTGateConn, string) {
protocol := "fake"
impl := &FakeVTGateConn{
execMap: make(map[string]*queryResponse),
splitQueryMap: make(map[string]*splitQueryResponse),
}
vtgateconn.RegisterDialer(protocol, func(ctx context.Context, address string) (vtgateconn.Impl, error... | go | func RegisterFakeVTGateConnDialer() (*FakeVTGateConn, string) {
protocol := "fake"
impl := &FakeVTGateConn{
execMap: make(map[string]*queryResponse),
splitQueryMap: make(map[string]*splitQueryResponse),
}
vtgateconn.RegisterDialer(protocol, func(ctx context.Context, address string) (vtgateconn.Impl, error... | [
"func",
"RegisterFakeVTGateConnDialer",
"(",
")",
"(",
"*",
"FakeVTGateConn",
",",
"string",
")",
"{",
"protocol",
":=",
"\"",
"\"",
"\n",
"impl",
":=",
"&",
"FakeVTGateConn",
"{",
"execMap",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"queryResponse... | // RegisterFakeVTGateConnDialer registers the proper dialer for this fake,
// and returns the underlying instance that will be returned by the dialer,
// and the protocol to use to get this fake. | [
"RegisterFakeVTGateConnDialer",
"registers",
"the",
"proper",
"dialer",
"for",
"this",
"fake",
"and",
"returns",
"the",
"underlying",
"instance",
"that",
"will",
"be",
"returned",
"by",
"the",
"dialer",
"and",
"the",
"protocol",
"to",
"use",
"to",
"get",
"this",... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L91-L101 |
135,475 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | AddQuery | func (conn *FakeVTGateConn) AddQuery(
sql string,
bindVariables map[string]*querypb.BindVariable,
session *vtgatepb.Session,
expectedResult *sqltypes.Result) {
conn.execMap[sql] = &queryResponse{
execQuery: &queryExecute{
SQL: sql,
BindVariables: bindVariables,
Session: session,
},
r... | go | func (conn *FakeVTGateConn) AddQuery(
sql string,
bindVariables map[string]*querypb.BindVariable,
session *vtgatepb.Session,
expectedResult *sqltypes.Result) {
conn.execMap[sql] = &queryResponse{
execQuery: &queryExecute{
SQL: sql,
BindVariables: bindVariables,
Session: session,
},
r... | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"AddQuery",
"(",
"sql",
"string",
",",
"bindVariables",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
",",
"session",
"*",
"vtgatepb",
".",
"Session",
",",
"expectedResult",
"*",
"sqltypes",
... | // AddQuery adds a query and expected result. | [
"AddQuery",
"adds",
"a",
"query",
"and",
"expected",
"result",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L104-L117 |
135,476 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | AddShardQuery | func (conn *FakeVTGateConn) AddShardQuery(
sql string,
bindVariables map[string]*querypb.BindVariable,
keyspace string,
shards []string,
tabletType topodatapb.TabletType,
session *vtgatepb.Session,
notInTransaction bool,
expectedResult *sqltypes.Result) {
conn.execMap[getShardQueryKey(sql, shards)] = &queryRes... | go | func (conn *FakeVTGateConn) AddShardQuery(
sql string,
bindVariables map[string]*querypb.BindVariable,
keyspace string,
shards []string,
tabletType topodatapb.TabletType,
session *vtgatepb.Session,
notInTransaction bool,
expectedResult *sqltypes.Result) {
conn.execMap[getShardQueryKey(sql, shards)] = &queryRes... | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"AddShardQuery",
"(",
"sql",
"string",
",",
"bindVariables",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
",",
"keyspace",
"string",
",",
"shards",
"[",
"]",
"string",
",",
"tabletType",
"... | // AddShardQuery adds a shard query and expected result. | [
"AddShardQuery",
"adds",
"a",
"shard",
"query",
"and",
"expected",
"result",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L120-L141 |
135,477 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | AddSplitQuery | func (conn *FakeVTGateConn) AddSplitQuery(
keyspace string,
sql string,
bindVariables map[string]*querypb.BindVariable,
splitColumns []string,
splitCount int64,
numRowsPerQueryPart int64,
algorithm querypb.SplitQueryRequest_Algorithm,
expectedResult []*vtgatepb.SplitQueryResponse_Part) {
reply := make([]*vtga... | go | func (conn *FakeVTGateConn) AddSplitQuery(
keyspace string,
sql string,
bindVariables map[string]*querypb.BindVariable,
splitColumns []string,
splitCount int64,
numRowsPerQueryPart int64,
algorithm querypb.SplitQueryRequest_Algorithm,
expectedResult []*vtgatepb.SplitQueryResponse_Part) {
reply := make([]*vtga... | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"AddSplitQuery",
"(",
"keyspace",
"string",
",",
"sql",
"string",
",",
"bindVariables",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
",",
"splitColumns",
"[",
"]",
"string",
",",
"splitCount... | // AddSplitQuery adds a split query and expected result. | [
"AddSplitQuery",
"adds",
"a",
"split",
"query",
"and",
"expected",
"result",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L144-L170 |
135,478 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | Execute | func (conn *FakeVTGateConn) Execute(ctx context.Context, session *vtgatepb.Session, sql string, bindVars map[string]*querypb.BindVariable) (*vtgatepb.Session, *sqltypes.Result, error) {
response, ok := conn.execMap[sql]
if !ok {
return nil, nil, fmt.Errorf("no match for: %s", sql)
}
query := &queryExecute{
SQL:... | go | func (conn *FakeVTGateConn) Execute(ctx context.Context, session *vtgatepb.Session, sql string, bindVars map[string]*querypb.BindVariable) (*vtgatepb.Session, *sqltypes.Result, error) {
response, ok := conn.execMap[sql]
if !ok {
return nil, nil, fmt.Errorf("no match for: %s", sql)
}
query := &queryExecute{
SQL:... | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"Execute",
"(",
"ctx",
"context",
".",
"Context",
",",
"session",
"*",
"vtgatepb",
".",
"Session",
",",
"sql",
"string",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
")"... | // Execute please see vtgateconn.Impl.Execute | [
"Execute",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"Execute"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L173-L190 |
135,479 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | ExecuteBatch | func (conn *FakeVTGateConn) ExecuteBatch(ctx context.Context, session *vtgatepb.Session, sqlList []string, bindVarsList []map[string]*querypb.BindVariable) (*vtgatepb.Session, []sqltypes.QueryResponse, error) {
panic("not implemented")
} | go | func (conn *FakeVTGateConn) ExecuteBatch(ctx context.Context, session *vtgatepb.Session, sqlList []string, bindVarsList []map[string]*querypb.BindVariable) (*vtgatepb.Session, []sqltypes.QueryResponse, error) {
panic("not implemented")
} | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"ExecuteBatch",
"(",
"ctx",
"context",
".",
"Context",
",",
"session",
"*",
"vtgatepb",
".",
"Session",
",",
"sqlList",
"[",
"]",
"string",
",",
"bindVarsList",
"[",
"]",
"map",
"[",
"string",
"]",
"*",
... | // ExecuteBatch please see vtgateconn.Impl.ExecuteBatch | [
"ExecuteBatch",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"ExecuteBatch"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L193-L195 |
135,480 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | StreamExecute | func (conn *FakeVTGateConn) StreamExecute(ctx context.Context, session *vtgatepb.Session, sql string, bindVars map[string]*querypb.BindVariable) (sqltypes.ResultStream, error) {
response, ok := conn.execMap[sql]
if !ok {
return nil, fmt.Errorf("no match for: %s", sql)
}
query := &queryExecute{
SQL: sq... | go | func (conn *FakeVTGateConn) StreamExecute(ctx context.Context, session *vtgatepb.Session, sql string, bindVars map[string]*querypb.BindVariable) (sqltypes.ResultStream, error) {
response, ok := conn.execMap[sql]
if !ok {
return nil, fmt.Errorf("no match for: %s", sql)
}
query := &queryExecute{
SQL: sq... | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"StreamExecute",
"(",
"ctx",
"context",
".",
"Context",
",",
"session",
"*",
"vtgatepb",
".",
"Session",
",",
"sql",
"string",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",... | // StreamExecute please see vtgateconn.Impl.StreamExecute | [
"StreamExecute",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"StreamExecute"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L198-L232 |
135,481 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | ExecuteShards | func (conn *FakeVTGateConn) ExecuteShards(ctx context.Context, sql string, keyspace string, shards []string, bindVars map[string]*querypb.BindVariable, tabletType topodatapb.TabletType, session *vtgatepb.Session, options *querypb.ExecuteOptions) (*vtgatepb.Session, *sqltypes.Result, error) {
var s *vtgatepb.Session
i... | go | func (conn *FakeVTGateConn) ExecuteShards(ctx context.Context, sql string, keyspace string, shards []string, bindVars map[string]*querypb.BindVariable, tabletType topodatapb.TabletType, session *vtgatepb.Session, options *querypb.ExecuteOptions) (*vtgatepb.Session, *sqltypes.Result, error) {
var s *vtgatepb.Session
i... | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"ExecuteShards",
"(",
"ctx",
"context",
".",
"Context",
",",
"sql",
"string",
",",
"keyspace",
"string",
",",
"shards",
"[",
"]",
"string",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
... | // ExecuteShards please see vtgateconn.Impl.ExecuteShard | [
"ExecuteShards",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"ExecuteShard"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L235-L261 |
135,482 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | ExecuteKeyspaceIds | func (conn *FakeVTGateConn) ExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]*querypb.BindVariable, tabletType topodatapb.TabletType, session *vtgatepb.Session, options *querypb.ExecuteOptions) (*vtgatepb.Session, *sqltypes.Result, error) {
panic("not imp... | go | func (conn *FakeVTGateConn) ExecuteKeyspaceIds(ctx context.Context, query string, keyspace string, keyspaceIds [][]byte, bindVars map[string]*querypb.BindVariable, tabletType topodatapb.TabletType, session *vtgatepb.Session, options *querypb.ExecuteOptions) (*vtgatepb.Session, *sqltypes.Result, error) {
panic("not imp... | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"ExecuteKeyspaceIds",
"(",
"ctx",
"context",
".",
"Context",
",",
"query",
"string",
",",
"keyspace",
"string",
",",
"keyspaceIds",
"[",
"]",
"[",
"]",
"byte",
",",
"bindVars",
"map",
"[",
"string",
"]",
"... | // ExecuteKeyspaceIds please see vtgateconn.Impl.ExecuteKeyspaceIds | [
"ExecuteKeyspaceIds",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"ExecuteKeyspaceIds"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L264-L266 |
135,483 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | ExecuteKeyRanges | func (conn *FakeVTGateConn) ExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]*querypb.BindVariable, tabletType topodatapb.TabletType, session *vtgatepb.Session, options *querypb.ExecuteOptions) (*vtgatepb.Session, *sqltypes.Result, error) {
pani... | go | func (conn *FakeVTGateConn) ExecuteKeyRanges(ctx context.Context, query string, keyspace string, keyRanges []*topodatapb.KeyRange, bindVars map[string]*querypb.BindVariable, tabletType topodatapb.TabletType, session *vtgatepb.Session, options *querypb.ExecuteOptions) (*vtgatepb.Session, *sqltypes.Result, error) {
pani... | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"ExecuteKeyRanges",
"(",
"ctx",
"context",
".",
"Context",
",",
"query",
"string",
",",
"keyspace",
"string",
",",
"keyRanges",
"[",
"]",
"*",
"topodatapb",
".",
"KeyRange",
",",
"bindVars",
"map",
"[",
"str... | // ExecuteKeyRanges please see vtgateconn.Impl.ExecuteKeyRanges | [
"ExecuteKeyRanges",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"ExecuteKeyRanges"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L269-L271 |
135,484 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | ExecuteEntityIds | func (conn *FakeVTGateConn) ExecuteEntityIds(ctx context.Context, query string, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, bindVars map[string]*querypb.BindVariable, tabletType topodatapb.TabletType, session *vtgatepb.Session, options *querypb.ExecuteOption... | go | func (conn *FakeVTGateConn) ExecuteEntityIds(ctx context.Context, query string, keyspace string, entityColumnName string, entityKeyspaceIDs []*vtgatepb.ExecuteEntityIdsRequest_EntityId, bindVars map[string]*querypb.BindVariable, tabletType topodatapb.TabletType, session *vtgatepb.Session, options *querypb.ExecuteOption... | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"ExecuteEntityIds",
"(",
"ctx",
"context",
".",
"Context",
",",
"query",
"string",
",",
"keyspace",
"string",
",",
"entityColumnName",
"string",
",",
"entityKeyspaceIDs",
"[",
"]",
"*",
"vtgatepb",
".",
"Execute... | // ExecuteEntityIds please see vtgateconn.Impl.ExecuteEntityIds | [
"ExecuteEntityIds",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"ExecuteEntityIds"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L274-L276 |
135,485 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | ExecuteBatchShards | func (conn *FakeVTGateConn) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) (*vtgatepb.Session, []sqltypes.Result, error) {
panic("not implemented")
} | go | func (conn *FakeVTGateConn) ExecuteBatchShards(ctx context.Context, queries []*vtgatepb.BoundShardQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, options *querypb.ExecuteOptions) (*vtgatepb.Session, []sqltypes.Result, error) {
panic("not implemented")
} | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"ExecuteBatchShards",
"(",
"ctx",
"context",
".",
"Context",
",",
"queries",
"[",
"]",
"*",
"vtgatepb",
".",
"BoundShardQuery",
",",
"tabletType",
"topodatapb",
".",
"TabletType",
",",
"asTransaction",
"bool",
"... | // ExecuteBatchShards please see vtgateconn.Impl.ExecuteBatchShards | [
"ExecuteBatchShards",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"ExecuteBatchShards"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L279-L281 |
135,486 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | StreamExecuteShards | func (conn *FakeVTGateConn) StreamExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]*querypb.BindVariable, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
panic("not implemented")
} | go | func (conn *FakeVTGateConn) StreamExecuteShards(ctx context.Context, query string, keyspace string, shards []string, bindVars map[string]*querypb.BindVariable, tabletType topodatapb.TabletType, options *querypb.ExecuteOptions) (sqltypes.ResultStream, error) {
panic("not implemented")
} | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"StreamExecuteShards",
"(",
"ctx",
"context",
".",
"Context",
",",
"query",
"string",
",",
"keyspace",
"string",
",",
"shards",
"[",
"]",
"string",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",... | // StreamExecuteShards please see vtgateconn.Impl.StreamExecuteShards | [
"StreamExecuteShards",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"StreamExecuteShards"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L301-L303 |
135,487 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | Begin | func (conn *FakeVTGateConn) Begin(ctx context.Context, singledb bool) (*vtgatepb.Session, error) {
return &vtgatepb.Session{
InTransaction: true,
SingleDb: singledb,
}, nil
} | go | func (conn *FakeVTGateConn) Begin(ctx context.Context, singledb bool) (*vtgatepb.Session, error) {
return &vtgatepb.Session{
InTransaction: true,
SingleDb: singledb,
}, nil
} | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"Begin",
"(",
"ctx",
"context",
".",
"Context",
",",
"singledb",
"bool",
")",
"(",
"*",
"vtgatepb",
".",
"Session",
",",
"error",
")",
"{",
"return",
"&",
"vtgatepb",
".",
"Session",
"{",
"InTransaction",
... | // Begin please see vtgateconn.Impl.Begin | [
"Begin",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"Begin"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L316-L321 |
135,488 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | Commit | func (conn *FakeVTGateConn) Commit(ctx context.Context, session *vtgatepb.Session, twopc bool) error {
if session == nil {
return errors.New("commit: not in transaction")
}
return nil
} | go | func (conn *FakeVTGateConn) Commit(ctx context.Context, session *vtgatepb.Session, twopc bool) error {
if session == nil {
return errors.New("commit: not in transaction")
}
return nil
} | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"Commit",
"(",
"ctx",
"context",
".",
"Context",
",",
"session",
"*",
"vtgatepb",
".",
"Session",
",",
"twopc",
"bool",
")",
"error",
"{",
"if",
"session",
"==",
"nil",
"{",
"return",
"errors",
".",
"New... | // Commit please see vtgateconn.Impl.Commit | [
"Commit",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"Commit"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L324-L329 |
135,489 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | Rollback | func (conn *FakeVTGateConn) Rollback(ctx context.Context, session *vtgatepb.Session) error {
return nil
} | go | func (conn *FakeVTGateConn) Rollback(ctx context.Context, session *vtgatepb.Session) error {
return nil
} | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"Rollback",
"(",
"ctx",
"context",
".",
"Context",
",",
"session",
"*",
"vtgatepb",
".",
"Session",
")",
"error",
"{",
"return",
"nil",
"\n",
"}"
] | // Rollback please see vtgateconn.Impl.Rollback | [
"Rollback",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"Rollback"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L332-L334 |
135,490 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | ResolveTransaction | func (conn *FakeVTGateConn) ResolveTransaction(ctx context.Context, dtid string) error {
return nil
} | go | func (conn *FakeVTGateConn) ResolveTransaction(ctx context.Context, dtid string) error {
return nil
} | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"ResolveTransaction",
"(",
"ctx",
"context",
".",
"Context",
",",
"dtid",
"string",
")",
"error",
"{",
"return",
"nil",
"\n",
"}"
] | // ResolveTransaction please see vtgateconn.Impl.ResolveTransaction | [
"ResolveTransaction",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"ResolveTransaction"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L337-L339 |
135,491 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | MessageStream | func (conn *FakeVTGateConn) MessageStream(ctx context.Context, keyspace string, shard string, keyRange *topodatapb.KeyRange, name string, callback func(*sqltypes.Result) error) error {
panic("not implemented")
} | go | func (conn *FakeVTGateConn) MessageStream(ctx context.Context, keyspace string, shard string, keyRange *topodatapb.KeyRange, name string, callback func(*sqltypes.Result) error) error {
panic("not implemented")
} | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"MessageStream",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
",",
"shard",
"string",
",",
"keyRange",
"*",
"topodatapb",
".",
"KeyRange",
",",
"name",
"string",
",",
"callback",
"func",
... | // MessageStream is part of the vtgate service API. | [
"MessageStream",
"is",
"part",
"of",
"the",
"vtgate",
"service",
"API",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L342-L344 |
135,492 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | MessageAck | func (conn *FakeVTGateConn) MessageAck(ctx context.Context, keyspace string, name string, ids []*querypb.Value) (int64, error) {
panic("not implemented")
} | go | func (conn *FakeVTGateConn) MessageAck(ctx context.Context, keyspace string, name string, ids []*querypb.Value) (int64, error) {
panic("not implemented")
} | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"MessageAck",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
",",
"name",
"string",
",",
"ids",
"[",
"]",
"*",
"querypb",
".",
"Value",
")",
"(",
"int64",
",",
"error",
")",
"{",
"pa... | // MessageAck is part of the vtgate service API. | [
"MessageAck",
"is",
"part",
"of",
"the",
"vtgate",
"service",
"API",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L347-L349 |
135,493 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | MessageAckKeyspaceIds | func (conn *FakeVTGateConn) MessageAckKeyspaceIds(ctx context.Context, keyspace string, name string, idKeyspaceIDs []*vtgatepb.IdKeyspaceId) (int64, error) {
panic("not implemented")
} | go | func (conn *FakeVTGateConn) MessageAckKeyspaceIds(ctx context.Context, keyspace string, name string, idKeyspaceIDs []*vtgatepb.IdKeyspaceId) (int64, error) {
panic("not implemented")
} | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"MessageAckKeyspaceIds",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
",",
"name",
"string",
",",
"idKeyspaceIDs",
"[",
"]",
"*",
"vtgatepb",
".",
"IdKeyspaceId",
")",
"(",
"int64",
",",
... | // MessageAckKeyspaceIds is part of the vtgate service API. | [
"MessageAckKeyspaceIds",
"is",
"part",
"of",
"the",
"vtgate",
"service",
"API",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L352-L354 |
135,494 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | SplitQuery | func (conn *FakeVTGateConn) SplitQuery(
ctx context.Context,
keyspace string,
query string,
bindVars map[string]*querypb.BindVariable,
splitColumns []string,
splitCount int64,
numRowsPerQueryPart int64,
algorithm querypb.SplitQueryRequest_Algorithm) ([]*vtgatepb.SplitQueryResponse_Part, error) {
response, ok ... | go | func (conn *FakeVTGateConn) SplitQuery(
ctx context.Context,
keyspace string,
query string,
bindVars map[string]*querypb.BindVariable,
splitColumns []string,
splitCount int64,
numRowsPerQueryPart int64,
algorithm querypb.SplitQueryRequest_Algorithm) ([]*vtgatepb.SplitQueryResponse_Part, error) {
response, ok ... | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"SplitQuery",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
",",
"query",
"string",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
",",
"splitColumns",
"... | // SplitQuery please see vtgateconn.Impl.SplitQuery | [
"SplitQuery",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"SplitQuery"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L357-L382 |
135,495 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | GetSrvKeyspace | func (conn *FakeVTGateConn) GetSrvKeyspace(ctx context.Context, keyspace string) (*topodatapb.SrvKeyspace, error) {
return nil, fmt.Errorf("NYI")
} | go | func (conn *FakeVTGateConn) GetSrvKeyspace(ctx context.Context, keyspace string) (*topodatapb.SrvKeyspace, error) {
return nil, fmt.Errorf("NYI")
} | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"GetSrvKeyspace",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
")",
"(",
"*",
"topodatapb",
".",
"SrvKeyspace",
",",
"error",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",... | // GetSrvKeyspace please see vtgateconn.Impl.GetSrvKeyspace | [
"GetSrvKeyspace",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"GetSrvKeyspace"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L385-L387 |
135,496 | vitessio/vitess | go/vt/vtgate/fakerpcvtgateconn/conn.go | UpdateStream | func (conn *FakeVTGateConn) UpdateStream(ctx context.Context, keyspace string, shard string, keyRange *topodatapb.KeyRange, tabletType topodatapb.TabletType, timestamp int64, event *querypb.EventToken) (vtgateconn.UpdateStreamReader, error) {
return nil, fmt.Errorf("NYI")
} | go | func (conn *FakeVTGateConn) UpdateStream(ctx context.Context, keyspace string, shard string, keyRange *topodatapb.KeyRange, tabletType topodatapb.TabletType, timestamp int64, event *querypb.EventToken) (vtgateconn.UpdateStreamReader, error) {
return nil, fmt.Errorf("NYI")
} | [
"func",
"(",
"conn",
"*",
"FakeVTGateConn",
")",
"UpdateStream",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
",",
"shard",
"string",
",",
"keyRange",
"*",
"topodatapb",
".",
"KeyRange",
",",
"tabletType",
"topodatapb",
".",
"TabletType",
... | // UpdateStream please see vtgateconn.Impl.UpdateStream | [
"UpdateStream",
"please",
"see",
"vtgateconn",
".",
"Impl",
".",
"UpdateStream"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/fakerpcvtgateconn/conn.go#L390-L392 |
135,497 | vitessio/vitess | go/vt/sqlparser/encodable.go | EncodeSQL | func (iv InsertValues) EncodeSQL(buf *strings.Builder) {
for i, rows := range iv {
if i != 0 {
buf.WriteString(", ")
}
buf.WriteByte('(')
for j, bv := range rows {
if j != 0 {
buf.WriteString(", ")
}
bv.EncodeSQL(buf)
}
buf.WriteByte(')')
}
} | go | func (iv InsertValues) EncodeSQL(buf *strings.Builder) {
for i, rows := range iv {
if i != 0 {
buf.WriteString(", ")
}
buf.WriteByte('(')
for j, bv := range rows {
if j != 0 {
buf.WriteString(", ")
}
bv.EncodeSQL(buf)
}
buf.WriteByte(')')
}
} | [
"func",
"(",
"iv",
"InsertValues",
")",
"EncodeSQL",
"(",
"buf",
"*",
"strings",
".",
"Builder",
")",
"{",
"for",
"i",
",",
"rows",
":=",
"range",
"iv",
"{",
"if",
"i",
"!=",
"0",
"{",
"buf",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"}",
... | // EncodeSQL performs the SQL encoding for InsertValues. | [
"EncodeSQL",
"performs",
"the",
"SQL",
"encoding",
"for",
"InsertValues",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/encodable.go#L38-L52 |
135,498 | vitessio/vitess | go/vt/sqlparser/encodable.go | EncodeSQL | func (tpl *TupleEqualityList) EncodeSQL(buf *strings.Builder) {
if len(tpl.Columns) == 1 {
tpl.encodeAsIn(buf)
return
}
tpl.encodeAsEquality(buf)
} | go | func (tpl *TupleEqualityList) EncodeSQL(buf *strings.Builder) {
if len(tpl.Columns) == 1 {
tpl.encodeAsIn(buf)
return
}
tpl.encodeAsEquality(buf)
} | [
"func",
"(",
"tpl",
"*",
"TupleEqualityList",
")",
"EncodeSQL",
"(",
"buf",
"*",
"strings",
".",
"Builder",
")",
"{",
"if",
"len",
"(",
"tpl",
".",
"Columns",
")",
"==",
"1",
"{",
"tpl",
".",
"encodeAsIn",
"(",
"buf",
")",
"\n",
"return",
"\n",
"}"... | // EncodeSQL generates the where clause constraints for the tuple
// equality. | [
"EncodeSQL",
"generates",
"the",
"where",
"clause",
"constraints",
"for",
"the",
"tuple",
"equality",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/encodable.go#L63-L69 |
135,499 | vitessio/vitess | go/vt/vttablet/tabletserver/txserializer/tx_serializer.go | New | func New(dryRun bool, maxQueueSize, maxGlobalQueueSize, concurrentTransactions int) *TxSerializer {
return &TxSerializer{
ConsolidatorCache: sync2.NewConsolidatorCache(1000),
dryRun: dryRun,
maxQueueSize: maxQueueSize,
maxGlobalQueueSize: maxGlobalQueu... | go | func New(dryRun bool, maxQueueSize, maxGlobalQueueSize, concurrentTransactions int) *TxSerializer {
return &TxSerializer{
ConsolidatorCache: sync2.NewConsolidatorCache(1000),
dryRun: dryRun,
maxQueueSize: maxQueueSize,
maxGlobalQueueSize: maxGlobalQueu... | [
"func",
"New",
"(",
"dryRun",
"bool",
",",
"maxQueueSize",
",",
"maxGlobalQueueSize",
",",
"concurrentTransactions",
"int",
")",
"*",
"TxSerializer",
"{",
"return",
"&",
"TxSerializer",
"{",
"ConsolidatorCache",
":",
"sync2",
".",
"NewConsolidatorCache",
"(",
"100... | // New returns a TxSerializer object. | [
"New",
"returns",
"a",
"TxSerializer",
"object",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/txserializer/tx_serializer.go#L113-L127 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.