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,300
vitessio/vitess
go/vt/logutil/logger.go
Errorf
func (cl *CallbackLogger) Errorf(format string, v ...interface{}) { cl.ErrorDepth(1, fmt.Sprintf(format, v...)) }
go
func (cl *CallbackLogger) Errorf(format string, v ...interface{}) { cl.ErrorDepth(1, fmt.Sprintf(format, v...)) }
[ "func", "(", "cl", "*", "CallbackLogger", ")", "Errorf", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "cl", ".", "ErrorDepth", "(", "1", ",", "fmt", ".", "Sprintf", "(", "format", ",", "v", "...", ")", ")", "\n", "}"...
// Errorf is part of the Logger interface.
[ "Errorf", "is", "part", "of", "the", "Logger", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L183-L185
135,301
vitessio/vitess
go/vt/logutil/logger.go
Printf
func (cl *CallbackLogger) Printf(format string, v ...interface{}) { file, line := fileAndLine(2) cl.f(&logutilpb.Event{ Time: TimeToProto(time.Now()), Level: logutilpb.Level_CONSOLE, File: file, Line: line, Value: fmt.Sprintf(format, v...), }) }
go
func (cl *CallbackLogger) Printf(format string, v ...interface{}) { file, line := fileAndLine(2) cl.f(&logutilpb.Event{ Time: TimeToProto(time.Now()), Level: logutilpb.Level_CONSOLE, File: file, Line: line, Value: fmt.Sprintf(format, v...), }) }
[ "func", "(", "cl", "*", "CallbackLogger", ")", "Printf", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "file", ",", "line", ":=", "fileAndLine", "(", "2", ")", "\n", "cl", ".", "f", "(", "&", "logutilpb", ".", "Event", ...
// Printf is part of the Logger interface.
[ "Printf", "is", "part", "of", "the", "Logger", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L198-L207
135,302
vitessio/vitess
go/vt/logutil/logger.go
NewChannelLogger
func NewChannelLogger(size int) *ChannelLogger { c := make(chan *logutilpb.Event, size) return &ChannelLogger{ CallbackLogger: CallbackLogger{ f: func(e *logutilpb.Event) { c <- e }, }, C: c, } }
go
func NewChannelLogger(size int) *ChannelLogger { c := make(chan *logutilpb.Event, size) return &ChannelLogger{ CallbackLogger: CallbackLogger{ f: func(e *logutilpb.Event) { c <- e }, }, C: c, } }
[ "func", "NewChannelLogger", "(", "size", "int", ")", "*", "ChannelLogger", "{", "c", ":=", "make", "(", "chan", "*", "logutilpb", ".", "Event", ",", "size", ")", "\n", "return", "&", "ChannelLogger", "{", "CallbackLogger", ":", "CallbackLogger", "{", "f", ...
// NewChannelLogger returns a CallbackLogger which will write the data // on a channel
[ "NewChannelLogger", "returns", "a", "CallbackLogger", "which", "will", "write", "the", "data", "on", "a", "channel" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L218-L228
135,303
vitessio/vitess
go/vt/logutil/logger.go
NewMemoryLogger
func NewMemoryLogger() *MemoryLogger { ml := &MemoryLogger{} ml.CallbackLogger.f = func(e *logutilpb.Event) { ml.mu.Lock() defer ml.mu.Unlock() ml.Events = append(ml.Events, e) } return ml }
go
func NewMemoryLogger() *MemoryLogger { ml := &MemoryLogger{} ml.CallbackLogger.f = func(e *logutilpb.Event) { ml.mu.Lock() defer ml.mu.Unlock() ml.Events = append(ml.Events, e) } return ml }
[ "func", "NewMemoryLogger", "(", ")", "*", "MemoryLogger", "{", "ml", ":=", "&", "MemoryLogger", "{", "}", "\n", "ml", ".", "CallbackLogger", ".", "f", "=", "func", "(", "e", "*", "logutilpb", ".", "Event", ")", "{", "ml", ".", "mu", ".", "Lock", "(...
// NewMemoryLogger returns a new MemoryLogger
[ "NewMemoryLogger", "returns", "a", "new", "MemoryLogger" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L241-L249
135,304
vitessio/vitess
go/vt/logutil/logger.go
String
func (ml *MemoryLogger) String() string { buf := new(bytes.Buffer) ml.mu.Lock() defer ml.mu.Unlock() for _, event := range ml.Events { EventToBuffer(event, buf) buf.WriteByte('\n') } return buf.String() }
go
func (ml *MemoryLogger) String() string { buf := new(bytes.Buffer) ml.mu.Lock() defer ml.mu.Unlock() for _, event := range ml.Events { EventToBuffer(event, buf) buf.WriteByte('\n') } return buf.String() }
[ "func", "(", "ml", "*", "MemoryLogger", ")", "String", "(", ")", "string", "{", "buf", ":=", "new", "(", "bytes", ".", "Buffer", ")", "\n", "ml", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "ml", ".", "mu", ".", "Unlock", "(", ")", "\n", ...
// String returns all the lines in one String, separated by '\n'
[ "String", "returns", "all", "the", "lines", "in", "one", "String", "separated", "by", "\\", "n" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L252-L261
135,305
vitessio/vitess
go/vt/logutil/logger.go
Clear
func (ml *MemoryLogger) Clear() { ml.mu.Lock() ml.Events = nil ml.mu.Unlock() }
go
func (ml *MemoryLogger) Clear() { ml.mu.Lock() ml.Events = nil ml.mu.Unlock() }
[ "func", "(", "ml", "*", "MemoryLogger", ")", "Clear", "(", ")", "{", "ml", ".", "mu", ".", "Lock", "(", ")", "\n", "ml", ".", "Events", "=", "nil", "\n", "ml", ".", "mu", ".", "Unlock", "(", ")", "\n", "}" ]
// Clear clears the logs.
[ "Clear", "clears", "the", "logs", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L264-L268
135,306
vitessio/vitess
go/vt/logutil/logger.go
NewTeeLogger
func NewTeeLogger(one, two Logger) *TeeLogger { return &TeeLogger{ One: one, Two: two, } }
go
func NewTeeLogger(one, two Logger) *TeeLogger { return &TeeLogger{ One: one, Two: two, } }
[ "func", "NewTeeLogger", "(", "one", ",", "two", "Logger", ")", "*", "TeeLogger", "{", "return", "&", "TeeLogger", "{", "One", ":", "one", ",", "Two", ":", "two", ",", "}", "\n", "}" ]
// NewTeeLogger returns a logger that sends its logs to both loggers
[ "NewTeeLogger", "returns", "a", "logger", "that", "sends", "its", "logs", "to", "both", "loggers" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L297-L302
135,307
vitessio/vitess
go/vt/logutil/logger.go
InfoDepth
func (tl *TeeLogger) InfoDepth(depth int, s string) { tl.One.InfoDepth(1+depth, s) tl.Two.InfoDepth(1+depth, s) }
go
func (tl *TeeLogger) InfoDepth(depth int, s string) { tl.One.InfoDepth(1+depth, s) tl.Two.InfoDepth(1+depth, s) }
[ "func", "(", "tl", "*", "TeeLogger", ")", "InfoDepth", "(", "depth", "int", ",", "s", "string", ")", "{", "tl", ".", "One", ".", "InfoDepth", "(", "1", "+", "depth", ",", "s", ")", "\n", "tl", ".", "Two", ".", "InfoDepth", "(", "1", "+", "depth...
// InfoDepth is part of the Logger interface
[ "InfoDepth", "is", "part", "of", "the", "Logger", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L305-L308
135,308
vitessio/vitess
go/vt/logutil/logger.go
Warningf
func (tl *TeeLogger) Warningf(format string, v ...interface{}) { tl.WarningDepth(1, fmt.Sprintf(format, v...)) }
go
func (tl *TeeLogger) Warningf(format string, v ...interface{}) { tl.WarningDepth(1, fmt.Sprintf(format, v...)) }
[ "func", "(", "tl", "*", "TeeLogger", ")", "Warningf", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "tl", ".", "WarningDepth", "(", "1", ",", "fmt", ".", "Sprintf", "(", "format", ",", "v", "...", ")", ")", "\n", "}" ...
// Warningf is part of the Logger interface
[ "Warningf", "is", "part", "of", "the", "Logger", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L328-L330
135,309
vitessio/vitess
go/vt/logutil/logger.go
Errorf
func (tl *TeeLogger) Errorf(format string, v ...interface{}) { tl.ErrorDepth(1, fmt.Sprintf(format, v...)) }
go
func (tl *TeeLogger) Errorf(format string, v ...interface{}) { tl.ErrorDepth(1, fmt.Sprintf(format, v...)) }
[ "func", "(", "tl", "*", "TeeLogger", ")", "Errorf", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "tl", ".", "ErrorDepth", "(", "1", ",", "fmt", ".", "Sprintf", "(", "format", ",", "v", "...", ")", ")", "\n", "}" ]
// Errorf is part of the Logger interface
[ "Errorf", "is", "part", "of", "the", "Logger", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L333-L335
135,310
vitessio/vitess
go/vt/logutil/logger.go
twoDigits
func twoDigits(buf *bytes.Buffer, value int) { buf.WriteByte(digits[value/10]) buf.WriteByte(digits[value%10]) }
go
func twoDigits(buf *bytes.Buffer, value int) { buf.WriteByte(digits[value/10]) buf.WriteByte(digits[value%10]) }
[ "func", "twoDigits", "(", "buf", "*", "bytes", ".", "Buffer", ",", "value", "int", ")", "{", "buf", ".", "WriteByte", "(", "digits", "[", "value", "/", "10", "]", ")", "\n", "buf", ".", "WriteByte", "(", "digits", "[", "value", "%", "10", "]", ")...
// twoDigits adds a zero-prefixed two-digit integer to buf
[ "twoDigits", "adds", "a", "zero", "-", "prefixed", "two", "-", "digit", "integer", "to", "buf" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L357-L360
135,311
vitessio/vitess
go/vt/logutil/logger.go
nDigits
func nDigits(buf *bytes.Buffer, n, d int, pad byte) { tmp := make([]byte, n) j := n - 1 for ; j >= 0 && d > 0; j-- { tmp[j] = digits[d%10] d /= 10 } for ; j >= 0; j-- { tmp[j] = pad } buf.Write(tmp) }
go
func nDigits(buf *bytes.Buffer, n, d int, pad byte) { tmp := make([]byte, n) j := n - 1 for ; j >= 0 && d > 0; j-- { tmp[j] = digits[d%10] d /= 10 } for ; j >= 0; j-- { tmp[j] = pad } buf.Write(tmp) }
[ "func", "nDigits", "(", "buf", "*", "bytes", ".", "Buffer", ",", "n", ",", "d", "int", ",", "pad", "byte", ")", "{", "tmp", ":=", "make", "(", "[", "]", "byte", ",", "n", ")", "\n", "j", ":=", "n", "-", "1", "\n", "for", ";", "j", ">=", "...
// nDigits adds an n-digit integer d to buf // padding with pad on the left. // It assumes d >= 0.
[ "nDigits", "adds", "an", "n", "-", "digit", "integer", "d", "to", "buf", "padding", "with", "pad", "on", "the", "left", ".", "It", "assumes", "d", ">", "=", "0", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L365-L376
135,312
vitessio/vitess
go/vt/logutil/logger.go
someDigits
func someDigits(buf *bytes.Buffer, d int64) { // Print into the top, then copy down. tmp := make([]byte, 10) j := 10 for { j-- tmp[j] = digits[d%10] d /= 10 if d == 0 { break } } buf.Write(tmp[j:]) }
go
func someDigits(buf *bytes.Buffer, d int64) { // Print into the top, then copy down. tmp := make([]byte, 10) j := 10 for { j-- tmp[j] = digits[d%10] d /= 10 if d == 0 { break } } buf.Write(tmp[j:]) }
[ "func", "someDigits", "(", "buf", "*", "bytes", ".", "Buffer", ",", "d", "int64", ")", "{", "// Print into the top, then copy down.", "tmp", ":=", "make", "(", "[", "]", "byte", ",", "10", ")", "\n", "j", ":=", "10", "\n", "for", "{", "j", "--", "\n"...
// someDigits adds a zero-prefixed variable-width integer to buf
[ "someDigits", "adds", "a", "zero", "-", "prefixed", "variable", "-", "width", "integer", "to", "buf" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L379-L392
135,313
vitessio/vitess
go/vt/logutil/logger.go
fileAndLine
func fileAndLine(depth int) (string, int64) { _, file, line, ok := runtime.Caller(depth) if !ok { return "???", 1 } slash := strings.LastIndex(file, "/") if slash >= 0 { file = file[slash+1:] } return file, int64(line) }
go
func fileAndLine(depth int) (string, int64) { _, file, line, ok := runtime.Caller(depth) if !ok { return "???", 1 } slash := strings.LastIndex(file, "/") if slash >= 0 { file = file[slash+1:] } return file, int64(line) }
[ "func", "fileAndLine", "(", "depth", "int", ")", "(", "string", ",", "int64", ")", "{", "_", ",", "file", ",", "line", ",", "ok", ":=", "runtime", ".", "Caller", "(", "depth", ")", "\n", "if", "!", "ok", "{", "return", "\"", "\"", ",", "1", "\n...
// fileAndLine returns the caller's file and line 2 levels above
[ "fileAndLine", "returns", "the", "caller", "s", "file", "and", "line", "2", "levels", "above" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L395-L406
135,314
vitessio/vitess
go/vt/discovery/replicationlag.go
IsReplicationLagHigh
func IsReplicationLagHigh(tabletStats *TabletStats) bool { return float64(tabletStats.Stats.SecondsBehindMaster) > lowReplicationLag.Seconds() }
go
func IsReplicationLagHigh(tabletStats *TabletStats) bool { return float64(tabletStats.Stats.SecondsBehindMaster) > lowReplicationLag.Seconds() }
[ "func", "IsReplicationLagHigh", "(", "tabletStats", "*", "TabletStats", ")", "bool", "{", "return", "float64", "(", "tabletStats", ".", "Stats", ".", "SecondsBehindMaster", ")", ">", "lowReplicationLag", ".", "Seconds", "(", ")", "\n", "}" ]
// IsReplicationLagHigh verifies that the given TabletStats refers to a tablet with high // replication lag, i.e. higher than the configured discovery_low_replication_lag flag.
[ "IsReplicationLagHigh", "verifies", "that", "the", "given", "TabletStats", "refers", "to", "a", "tablet", "with", "high", "replication", "lag", "i", ".", "e", ".", "higher", "than", "the", "configured", "discovery_low_replication_lag", "flag", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/replicationlag.go#L35-L37
135,315
vitessio/vitess
go/vt/discovery/replicationlag.go
IsReplicationLagVeryHigh
func IsReplicationLagVeryHigh(tabletStats *TabletStats) bool { return float64(tabletStats.Stats.SecondsBehindMaster) > highReplicationLagMinServing.Seconds() }
go
func IsReplicationLagVeryHigh(tabletStats *TabletStats) bool { return float64(tabletStats.Stats.SecondsBehindMaster) > highReplicationLagMinServing.Seconds() }
[ "func", "IsReplicationLagVeryHigh", "(", "tabletStats", "*", "TabletStats", ")", "bool", "{", "return", "float64", "(", "tabletStats", ".", "Stats", ".", "SecondsBehindMaster", ")", ">", "highReplicationLagMinServing", ".", "Seconds", "(", ")", "\n", "}" ]
// IsReplicationLagVeryHigh verifies that the given TabletStats refers to a tablet with very high // replication lag, i.e. higher than the configured discovery_high_replication_lag_minimum_serving flag.
[ "IsReplicationLagVeryHigh", "verifies", "that", "the", "given", "TabletStats", "refers", "to", "a", "tablet", "with", "very", "high", "replication", "lag", "i", ".", "e", ".", "higher", "than", "the", "configured", "discovery_high_replication_lag_minimum_serving", "fl...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/replicationlag.go#L41-L43
135,316
vitessio/vitess
go/vt/discovery/replicationlag.go
mean
func mean(tabletStatsList []*TabletStats, idxExclude int) (uint64, error) { var sum uint64 var count uint64 for i, ts := range tabletStatsList { if i == idxExclude { continue } sum = sum + uint64(ts.Stats.SecondsBehindMaster) count++ } if count == 0 { return 0, fmt.Errorf("empty list") } return sum ...
go
func mean(tabletStatsList []*TabletStats, idxExclude int) (uint64, error) { var sum uint64 var count uint64 for i, ts := range tabletStatsList { if i == idxExclude { continue } sum = sum + uint64(ts.Stats.SecondsBehindMaster) count++ } if count == 0 { return 0, fmt.Errorf("empty list") } return sum ...
[ "func", "mean", "(", "tabletStatsList", "[", "]", "*", "TabletStats", ",", "idxExclude", "int", ")", "(", "uint64", ",", "error", ")", "{", "var", "sum", "uint64", "\n", "var", "count", "uint64", "\n", "for", "i", ",", "ts", ":=", "range", "tabletStats...
// mean calculates the mean value over the given list, // while excluding the item with the specified index.
[ "mean", "calculates", "the", "mean", "value", "over", "the", "given", "list", "while", "excluding", "the", "item", "with", "the", "specified", "index", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/replicationlag.go#L163-L177
135,317
vitessio/vitess
go/vt/discovery/replicationlag.go
TrivialStatsUpdate
func TrivialStatsUpdate(o, n *TabletStats) bool { // Skip replag filter when replag remains in the low rep lag range, // which should be the case majority of the time. lowRepLag := lowReplicationLag.Seconds() oldRepLag := float64(o.Stats.SecondsBehindMaster) newRepLag := float64(n.Stats.SecondsBehindMaster) if ol...
go
func TrivialStatsUpdate(o, n *TabletStats) bool { // Skip replag filter when replag remains in the low rep lag range, // which should be the case majority of the time. lowRepLag := lowReplicationLag.Seconds() oldRepLag := float64(o.Stats.SecondsBehindMaster) newRepLag := float64(n.Stats.SecondsBehindMaster) if ol...
[ "func", "TrivialStatsUpdate", "(", "o", ",", "n", "*", "TabletStats", ")", "bool", "{", "// Skip replag filter when replag remains in the low rep lag range,", "// which should be the case majority of the time.", "lowRepLag", ":=", "lowReplicationLag", ".", "Seconds", "(", ")", ...
// TrivialStatsUpdate returns true iff the old and new TabletStats // haven't changed enough to warrant re-calling FilterByReplicationLag.
[ "TrivialStatsUpdate", "returns", "true", "iff", "the", "old", "and", "new", "TabletStats", "haven", "t", "changed", "enough", "to", "warrant", "re", "-", "calling", "FilterByReplicationLag", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/replicationlag.go#L181-L202
135,318
vitessio/vitess
go/vt/logutil/throttled.go
NewThrottledLogger
func NewThrottledLogger(name string, maxInterval time.Duration) *ThrottledLogger { return &ThrottledLogger{ name: name, maxInterval: maxInterval, } }
go
func NewThrottledLogger(name string, maxInterval time.Duration) *ThrottledLogger { return &ThrottledLogger{ name: name, maxInterval: maxInterval, } }
[ "func", "NewThrottledLogger", "(", "name", "string", ",", "maxInterval", "time", ".", "Duration", ")", "*", "ThrottledLogger", "{", "return", "&", "ThrottledLogger", "{", "name", ":", "name", ",", "maxInterval", ":", "maxInterval", ",", "}", "\n", "}" ]
// NewThrottledLogger will create a ThrottledLogger with the given // name and throttling interval.
[ "NewThrottledLogger", "will", "create", "a", "ThrottledLogger", "with", "the", "given", "name", "and", "throttling", "interval", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/throttled.go#L42-L47
135,319
vitessio/vitess
go/vt/logutil/throttled.go
Infof
func (tl *ThrottledLogger) Infof(format string, v ...interface{}) { tl.log(infoDepth, format, v...) }
go
func (tl *ThrottledLogger) Infof(format string, v ...interface{}) { tl.log(infoDepth, format, v...) }
[ "func", "(", "tl", "*", "ThrottledLogger", ")", "Infof", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "tl", ".", "log", "(", "infoDepth", ",", "format", ",", "v", "...", ")", "\n", "}" ]
// Infof logs an info if not throttled.
[ "Infof", "logs", "an", "info", "if", "not", "throttled", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/throttled.go#L85-L87
135,320
vitessio/vitess
go/vt/logutil/throttled.go
Warningf
func (tl *ThrottledLogger) Warningf(format string, v ...interface{}) { tl.log(warningDepth, format, v...) }
go
func (tl *ThrottledLogger) Warningf(format string, v ...interface{}) { tl.log(warningDepth, format, v...) }
[ "func", "(", "tl", "*", "ThrottledLogger", ")", "Warningf", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "tl", ".", "log", "(", "warningDepth", ",", "format", ",", "v", "...", ")", "\n", "}" ]
// Warningf logs a warning if not throttled.
[ "Warningf", "logs", "a", "warning", "if", "not", "throttled", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/throttled.go#L90-L92
135,321
vitessio/vitess
go/vt/logutil/throttled.go
Errorf
func (tl *ThrottledLogger) Errorf(format string, v ...interface{}) { tl.log(errorDepth, format, v...) }
go
func (tl *ThrottledLogger) Errorf(format string, v ...interface{}) { tl.log(errorDepth, format, v...) }
[ "func", "(", "tl", "*", "ThrottledLogger", ")", "Errorf", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "tl", ".", "log", "(", "errorDepth", ",", "format", ",", "v", "...", ")", "\n", "}" ]
// Errorf logs an error if not throttled.
[ "Errorf", "logs", "an", "error", "if", "not", "throttled", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/throttled.go#L95-L97
135,322
vitessio/vitess
go/vt/vtgate/vschema_manager.go
GetCurrentSrvVschema
func (vm *VSchemaManager) GetCurrentSrvVschema() *vschemapb.SrvVSchema { vm.mu.Lock() defer vm.mu.Unlock() return proto.Clone(vm.currentSrvVschema).(*vschemapb.SrvVSchema) }
go
func (vm *VSchemaManager) GetCurrentSrvVschema() *vschemapb.SrvVSchema { vm.mu.Lock() defer vm.mu.Unlock() return proto.Clone(vm.currentSrvVschema).(*vschemapb.SrvVSchema) }
[ "func", "(", "vm", "*", "VSchemaManager", ")", "GetCurrentSrvVschema", "(", ")", "*", "vschemapb", ".", "SrvVSchema", "{", "vm", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "vm", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "proto", ".", ...
// GetCurrentSrvVschema returns a copy of the latest SrvVschema from the // topo watch
[ "GetCurrentSrvVschema", "returns", "a", "copy", "of", "the", "latest", "SrvVschema", "from", "the", "topo", "watch" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vschema_manager.go#L43-L47
135,323
vitessio/vitess
go/vt/vtgate/vschema_manager.go
watchSrvVSchema
func (vm *VSchemaManager) watchSrvVSchema(ctx context.Context, cell string) { vm.e.serv.WatchSrvVSchema(ctx, cell, func(v *vschemapb.SrvVSchema, err error) { // Create a closure to save the vschema. If the value // passed is nil, it means we encountered an error and // we don't know the real value. In this case,...
go
func (vm *VSchemaManager) watchSrvVSchema(ctx context.Context, cell string) { vm.e.serv.WatchSrvVSchema(ctx, cell, func(v *vschemapb.SrvVSchema, err error) { // Create a closure to save the vschema. If the value // passed is nil, it means we encountered an error and // we don't know the real value. In this case,...
[ "func", "(", "vm", "*", "VSchemaManager", ")", "watchSrvVSchema", "(", "ctx", "context", ".", "Context", ",", "cell", "string", ")", "{", "vm", ".", "e", ".", "serv", ".", "WatchSrvVSchema", "(", "ctx", ",", "cell", ",", "func", "(", "v", "*", "vsche...
// watchSrvVSchema watches the SrvVSchema from the topo. The function does // not return an error. It instead logs warnings on failure. // The SrvVSchema object is roll-up of all the Keyspace information, // so when a keyspace is added or removed, it will be properly updated. // // This function will wait until the fir...
[ "watchSrvVSchema", "watches", "the", "SrvVSchema", "from", "the", "topo", ".", "The", "function", "does", "not", "return", "an", "error", ".", "It", "instead", "logs", "warnings", "on", "failure", ".", "The", "SrvVSchema", "object", "is", "roll", "-", "up", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vschema_manager.go#L56-L119
135,324
vitessio/vitess
go/vt/vtgate/vschema_manager.go
UpdateVSchema
func (vm *VSchemaManager) UpdateVSchema(ctx context.Context, ksName string, vschema *vschemapb.SrvVSchema) error { topoServer, err := vm.e.serv.GetTopoServer() if err != nil { return err } ks := vschema.Keyspaces[ksName] err = topoServer.SaveVSchema(ctx, ksName, ks) if err != nil { return err } cells, err...
go
func (vm *VSchemaManager) UpdateVSchema(ctx context.Context, ksName string, vschema *vschemapb.SrvVSchema) error { topoServer, err := vm.e.serv.GetTopoServer() if err != nil { return err } ks := vschema.Keyspaces[ksName] err = topoServer.SaveVSchema(ctx, ksName, ks) if err != nil { return err } cells, err...
[ "func", "(", "vm", "*", "VSchemaManager", ")", "UpdateVSchema", "(", "ctx", "context", ".", "Context", ",", "ksName", "string", ",", "vschema", "*", "vschemapb", ".", "SrvVSchema", ")", "error", "{", "topoServer", ",", "err", ":=", "vm", ".", "e", ".", ...
// UpdateVSchema propagates the updated vschema to the topo. The entry for // the given keyspace is updated in the global topo, and the full SrvVSchema // is updated in all known cells.
[ "UpdateVSchema", "propagates", "the", "updated", "vschema", "to", "the", "topo", ".", "The", "entry", "for", "the", "given", "keyspace", "is", "updated", "in", "the", "global", "topo", "and", "the", "full", "SrvVSchema", "is", "updated", "in", "all", "known"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vschema_manager.go#L124-L151
135,325
vitessio/vitess
go/mysql/flavor.go
MasterPosition
func (c *Conn) MasterPosition() (Position, error) { gtidSet, err := c.flavor.masterGTIDSet(c) if err != nil { return Position{}, err } return Position{ GTIDSet: gtidSet, }, nil }
go
func (c *Conn) MasterPosition() (Position, error) { gtidSet, err := c.flavor.masterGTIDSet(c) if err != nil { return Position{}, err } return Position{ GTIDSet: gtidSet, }, nil }
[ "func", "(", "c", "*", "Conn", ")", "MasterPosition", "(", ")", "(", "Position", ",", "error", ")", "{", "gtidSet", ",", "err", ":=", "c", ".", "flavor", ".", "masterGTIDSet", "(", "c", ")", "\n", "if", "err", "!=", "nil", "{", "return", "Position"...
// MasterPosition returns the current master replication position.
[ "MasterPosition", "returns", "the", "current", "master", "replication", "position", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/flavor.go#L141-L149
135,326
vitessio/vitess
go/mysql/flavor.go
StartSlaveUntilAfterCommand
func (c *Conn) StartSlaveUntilAfterCommand(pos Position) string { return c.flavor.startSlaveUntilAfter(pos) }
go
func (c *Conn) StartSlaveUntilAfterCommand(pos Position) string { return c.flavor.startSlaveUntilAfter(pos) }
[ "func", "(", "c", "*", "Conn", ")", "StartSlaveUntilAfterCommand", "(", "pos", "Position", ")", "string", "{", "return", "c", ".", "flavor", ".", "startSlaveUntilAfter", "(", "pos", ")", "\n", "}" ]
// StartSlaveUntilAfterCommand returns the command to start the slave.
[ "StartSlaveUntilAfterCommand", "returns", "the", "command", "to", "start", "the", "slave", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/flavor.go#L157-L159
135,327
vitessio/vitess
go/mysql/flavor.go
SendBinlogDumpCommand
func (c *Conn) SendBinlogDumpCommand(slaveID uint32, startPos Position) error { return c.flavor.sendBinlogDumpCommand(c, slaveID, startPos) }
go
func (c *Conn) SendBinlogDumpCommand(slaveID uint32, startPos Position) error { return c.flavor.sendBinlogDumpCommand(c, slaveID, startPos) }
[ "func", "(", "c", "*", "Conn", ")", "SendBinlogDumpCommand", "(", "slaveID", "uint32", ",", "startPos", "Position", ")", "error", "{", "return", "c", ".", "flavor", ".", "sendBinlogDumpCommand", "(", "c", ",", "slaveID", ",", "startPos", ")", "\n", "}" ]
// SendBinlogDumpCommand sends the flavor-specific version of // the COM_BINLOG_DUMP command to start dumping raw binlog // events over a slave connection, starting at a given GTID.
[ "SendBinlogDumpCommand", "sends", "the", "flavor", "-", "specific", "version", "of", "the", "COM_BINLOG_DUMP", "command", "to", "start", "dumping", "raw", "binlog", "events", "over", "a", "slave", "connection", "starting", "at", "a", "given", "GTID", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/flavor.go#L169-L171
135,328
vitessio/vitess
go/mysql/flavor.go
SetSlavePositionCommands
func (c *Conn) SetSlavePositionCommands(pos Position) []string { return c.flavor.setSlavePositionCommands(pos) }
go
func (c *Conn) SetSlavePositionCommands(pos Position) []string { return c.flavor.setSlavePositionCommands(pos) }
[ "func", "(", "c", "*", "Conn", ")", "SetSlavePositionCommands", "(", "pos", "Position", ")", "[", "]", "string", "{", "return", "c", ".", "flavor", ".", "setSlavePositionCommands", "(", "pos", ")", "\n", "}" ]
// SetSlavePositionCommands returns the commands to set the // replication position at which the slave will resume // when it is later reparented with SetMasterCommands.
[ "SetSlavePositionCommands", "returns", "the", "commands", "to", "set", "the", "replication", "position", "at", "which", "the", "slave", "will", "resume", "when", "it", "is", "later", "reparented", "with", "SetMasterCommands", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/flavor.go#L188-L190
135,329
vitessio/vitess
go/mysql/flavor.go
resultToMap
func resultToMap(qr *sqltypes.Result) (map[string]string, error) { if len(qr.Rows) == 0 { // The query succeeded, but there is no data. return nil, nil } if len(qr.Rows) > 1 { return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "query returned %d rows, expected 1", len(qr.Rows)) } if len(qr.Fields) != len(qr.Ro...
go
func resultToMap(qr *sqltypes.Result) (map[string]string, error) { if len(qr.Rows) == 0 { // The query succeeded, but there is no data. return nil, nil } if len(qr.Rows) > 1 { return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "query returned %d rows, expected 1", len(qr.Rows)) } if len(qr.Fields) != len(qr.Ro...
[ "func", "resultToMap", "(", "qr", "*", "sqltypes", ".", "Result", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "if", "len", "(", "qr", ".", "Rows", ")", "==", "0", "{", "// The query succeeded, but there is no data.", "return", ...
// resultToMap is a helper function used by ShowSlaveStatus.
[ "resultToMap", "is", "a", "helper", "function", "used", "by", "ShowSlaveStatus", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/flavor.go#L224-L241
135,330
vitessio/vitess
go/mysql/flavor.go
parseSlaveStatus
func parseSlaveStatus(fields map[string]string) SlaveStatus { status := SlaveStatus{ MasterHost: fields["Master_Host"], SlaveIORunning: fields["Slave_IO_Running"] == "Yes", SlaveSQLRunning: fields["Slave_SQL_Running"] == "Yes", } parseInt, _ := strconv.ParseInt(fields["Master_Port"], 10, 0) status.Maste...
go
func parseSlaveStatus(fields map[string]string) SlaveStatus { status := SlaveStatus{ MasterHost: fields["Master_Host"], SlaveIORunning: fields["Slave_IO_Running"] == "Yes", SlaveSQLRunning: fields["Slave_SQL_Running"] == "Yes", } parseInt, _ := strconv.ParseInt(fields["Master_Port"], 10, 0) status.Maste...
[ "func", "parseSlaveStatus", "(", "fields", "map", "[", "string", "]", "string", ")", "SlaveStatus", "{", "status", ":=", "SlaveStatus", "{", "MasterHost", ":", "fields", "[", "\"", "\"", "]", ",", "SlaveIORunning", ":", "fields", "[", "\"", "\"", "]", "=...
// parseSlaveStatus parses the common fields of SHOW SLAVE STATUS.
[ "parseSlaveStatus", "parses", "the", "common", "fields", "of", "SHOW", "SLAVE", "STATUS", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/flavor.go#L244-L257
135,331
vitessio/vitess
go/mysql/flavor.go
WaitUntilPositionCommand
func (c *Conn) WaitUntilPositionCommand(ctx context.Context, pos Position) (string, error) { return c.flavor.waitUntilPositionCommand(ctx, pos) }
go
func (c *Conn) WaitUntilPositionCommand(ctx context.Context, pos Position) (string, error) { return c.flavor.waitUntilPositionCommand(ctx, pos) }
[ "func", "(", "c", "*", "Conn", ")", "WaitUntilPositionCommand", "(", "ctx", "context", ".", "Context", ",", "pos", "Position", ")", "(", "string", ",", "error", ")", "{", "return", "c", ".", "flavor", ".", "waitUntilPositionCommand", "(", "ctx", ",", "po...
// WaitUntilPositionCommand returns the SQL command to issue // to wait until the given position, until the context // expires. The command returns -1 if it times out. It // returns NULL if GTIDs are not enabled.
[ "WaitUntilPositionCommand", "returns", "the", "SQL", "command", "to", "issue", "to", "wait", "until", "the", "given", "position", "until", "the", "context", "expires", ".", "The", "command", "returns", "-", "1", "if", "it", "times", "out", ".", "It", "return...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/flavor.go#L269-L271
135,332
vitessio/vitess
go/vt/topotools/events/migrate_syslog.go
Syslog
func (ev *MigrateServedFrom) Syslog() (syslog.Priority, string) { var format string if ev.Reverse { format = "%s [migrate served-from %s/%s <- %s/%s] %s" } else { format = "%s [migrate served-from %s/%s -> %s/%s] %s" } return syslog.LOG_INFO, fmt.Sprintf(format, ev.KeyspaceName, ev.SourceShard.Keyspace(), ...
go
func (ev *MigrateServedFrom) Syslog() (syslog.Priority, string) { var format string if ev.Reverse { format = "%s [migrate served-from %s/%s <- %s/%s] %s" } else { format = "%s [migrate served-from %s/%s -> %s/%s] %s" } return syslog.LOG_INFO, fmt.Sprintf(format, ev.KeyspaceName, ev.SourceShard.Keyspace(), ...
[ "func", "(", "ev", "*", "MigrateServedFrom", ")", "Syslog", "(", ")", "(", "syslog", ".", "Priority", ",", "string", ")", "{", "var", "format", "string", "\n", "if", "ev", ".", "Reverse", "{", "format", "=", "\"", "\"", "\n", "}", "else", "{", "for...
// Syslog writes a MigrateServedFrom event to syslog.
[ "Syslog", "writes", "a", "MigrateServedFrom", "event", "to", "syslog", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/events/migrate_syslog.go#L28-L40
135,333
vitessio/vitess
go/vt/topotools/events/migrate_syslog.go
Syslog
func (ev *MigrateServedTypes) Syslog() (syslog.Priority, string) { var format string if ev.Reverse { format = "%s [migrate served-types {%v} <- {%v}] %s" } else { format = "%s [migrate served-types {%v} -> {%v}] %s" } sourceShards := make([]string, len(ev.SourceShards)) for i, shard := range ev.SourceShards ...
go
func (ev *MigrateServedTypes) Syslog() (syslog.Priority, string) { var format string if ev.Reverse { format = "%s [migrate served-types {%v} <- {%v}] %s" } else { format = "%s [migrate served-types {%v} -> {%v}] %s" } sourceShards := make([]string, len(ev.SourceShards)) for i, shard := range ev.SourceShards ...
[ "func", "(", "ev", "*", "MigrateServedTypes", ")", "Syslog", "(", ")", "(", "syslog", ".", "Priority", ",", "string", ")", "{", "var", "format", "string", "\n", "if", "ev", ".", "Reverse", "{", "format", "=", "\"", "\"", "\n", "}", "else", "{", "fo...
// Syslog writes a MigrateServedTypes event to syslog.
[ "Syslog", "writes", "a", "MigrateServedTypes", "event", "to", "syslog", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/events/migrate_syslog.go#L45-L71
135,334
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_server.go
HandleRPCPanic
func (agent *ActionAgent) HandleRPCPanic(ctx context.Context, name string, args, reply interface{}, verbose bool, err *error) { // panic handling if x := recover(); x != nil { log.Errorf("TabletManager.%v(%v) on %v panic: %v\n%s", name, args, topoproto.TabletAliasString(agent.TabletAlias), x, tb.Stack(4)) *err = ...
go
func (agent *ActionAgent) HandleRPCPanic(ctx context.Context, name string, args, reply interface{}, verbose bool, err *error) { // panic handling if x := recover(); x != nil { log.Errorf("TabletManager.%v(%v) on %v panic: %v\n%s", name, args, topoproto.TabletAliasString(agent.TabletAlias), x, tb.Stack(4)) *err = ...
[ "func", "(", "agent", "*", "ActionAgent", ")", "HandleRPCPanic", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "args", ",", "reply", "interface", "{", "}", ",", "verbose", "bool", ",", "err", "*", "error", ")", "{", "// panic handlin...
// HandleRPCPanic is part of the RPCAgent interface.
[ "HandleRPCPanic", "is", "part", "of", "the", "RPCAgent", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_server.go#L69-L97
135,335
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
NewTabletStatsCache
func NewTabletStatsCache(hc HealthCheck, ts *topo.Server, cell string) *TabletStatsCache { return newTabletStatsCache(hc, ts, cell, true /* setListener */) }
go
func NewTabletStatsCache(hc HealthCheck, ts *topo.Server, cell string) *TabletStatsCache { return newTabletStatsCache(hc, ts, cell, true /* setListener */) }
[ "func", "NewTabletStatsCache", "(", "hc", "HealthCheck", ",", "ts", "*", "topo", ".", "Server", ",", "cell", "string", ")", "*", "TabletStatsCache", "{", "return", "newTabletStatsCache", "(", "hc", ",", "ts", ",", "cell", ",", "true", "/* setListener */", ")...
// NewTabletStatsCache creates a TabletStatsCache, and registers // it as HealthCheckStatsListener of the provided healthcheck. // Note we do the registration in this code to guarantee we call // SetListener with sendDownEvents=true, as we need these events // to maintain the integrity of our cache.
[ "NewTabletStatsCache", "creates", "a", "TabletStatsCache", "and", "registers", "it", "as", "HealthCheckStatsListener", "of", "the", "provided", "healthcheck", ".", "Note", "we", "do", "the", "registration", "in", "this", "code", "to", "guarantee", "we", "call", "S...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L117-L119
135,336
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
getEntry
func (tc *TabletStatsCache) getEntry(keyspace, shard string, tabletType topodatapb.TabletType) *tabletStatsCacheEntry { tc.mu.RLock() defer tc.mu.RUnlock() if s, ok := tc.entries[keyspace]; ok { if t, ok := s[shard]; ok { if e, ok := t[tabletType]; ok { return e } } } return nil }
go
func (tc *TabletStatsCache) getEntry(keyspace, shard string, tabletType topodatapb.TabletType) *tabletStatsCacheEntry { tc.mu.RLock() defer tc.mu.RUnlock() if s, ok := tc.entries[keyspace]; ok { if t, ok := s[shard]; ok { if e, ok := t[tabletType]; ok { return e } } } return nil }
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "getEntry", "(", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ")", "*", "tabletStatsCacheEntry", "{", "tc", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "tc", ...
// getEntry returns an existing tabletStatsCacheEntry in the cache, or nil // if the entry does not exist. It only takes a Read lock on mu.
[ "getEntry", "returns", "an", "existing", "tabletStatsCacheEntry", "in", "the", "cache", "or", "nil", "if", "the", "entry", "does", "not", "exist", ".", "It", "only", "takes", "a", "Read", "lock", "on", "mu", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L152-L164
135,337
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
getOrCreateEntry
func (tc *TabletStatsCache) getOrCreateEntry(target *querypb.Target) *tabletStatsCacheEntry { // Fast path (most common path too): Read-lock, return the entry. if e := tc.getEntry(target.Keyspace, target.Shard, target.TabletType); e != nil { return e } // Slow path: Lock, will probably have to add the entry at s...
go
func (tc *TabletStatsCache) getOrCreateEntry(target *querypb.Target) *tabletStatsCacheEntry { // Fast path (most common path too): Read-lock, return the entry. if e := tc.getEntry(target.Keyspace, target.Shard, target.TabletType); e != nil { return e } // Slow path: Lock, will probably have to add the entry at s...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "getOrCreateEntry", "(", "target", "*", "querypb", ".", "Target", ")", "*", "tabletStatsCacheEntry", "{", "// Fast path (most common path too): Read-lock, return the entry.", "if", "e", ":=", "tc", ".", "getEntry", "(",...
// getOrCreateEntry returns an existing tabletStatsCacheEntry from the cache, // or creates it if it doesn't exist.
[ "getOrCreateEntry", "returns", "an", "existing", "tabletStatsCacheEntry", "from", "the", "cache", "or", "creates", "it", "if", "it", "doesn", "t", "exist", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L168-L197
135,338
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
makeAggregateMap
func (tc *TabletStatsCache) makeAggregateMap(stats []*TabletStats) map[string]*querypb.AggregateStats { result := make(map[string]*querypb.AggregateStats) for _, ts := range stats { alias := tc.getAliasByCell(ts.Tablet.Alias.Cell) agg, ok := result[alias] if !ok { agg = &querypb.AggregateStats{ SecondsBe...
go
func (tc *TabletStatsCache) makeAggregateMap(stats []*TabletStats) map[string]*querypb.AggregateStats { result := make(map[string]*querypb.AggregateStats) for _, ts := range stats { alias := tc.getAliasByCell(ts.Tablet.Alias.Cell) agg, ok := result[alias] if !ok { agg = &querypb.AggregateStats{ SecondsBe...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "makeAggregateMap", "(", "stats", "[", "]", "*", "TabletStats", ")", "map", "[", "string", "]", "*", "querypb", ".", "AggregateStats", "{", "result", ":=", "make", "(", "map", "[", "string", "]", "*", "q...
// makeAggregateMap takes a list of TabletStats and builds a per-alias // AggregateStats map.
[ "makeAggregateMap", "takes", "a", "list", "of", "TabletStats", "and", "builds", "a", "per", "-", "alias", "AggregateStats", "map", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L285-L310
135,339
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
updateAggregateMap
func (tc *TabletStatsCache) updateAggregateMap(keyspace, shard string, tabletType topodatapb.TabletType, e *tabletStatsCacheEntry, stats []*TabletStats) { // Save the new value e.aggregates = tc.makeAggregateMap(stats) }
go
func (tc *TabletStatsCache) updateAggregateMap(keyspace, shard string, tabletType topodatapb.TabletType, e *tabletStatsCacheEntry, stats []*TabletStats) { // Save the new value e.aggregates = tc.makeAggregateMap(stats) }
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "updateAggregateMap", "(", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "e", "*", "tabletStatsCacheEntry", ",", "stats", "[", "]", "*", "TabletStats", ")", "{", ...
// updateAggregateMap will update the aggregate map for the // tabletStatsCacheEntry. It may broadcast the changes too if we have listeners. // e.mu needs to be locked.
[ "updateAggregateMap", "will", "update", "the", "aggregate", "map", "for", "the", "tabletStatsCacheEntry", ".", "It", "may", "broadcast", "the", "changes", "too", "if", "we", "have", "listeners", ".", "e", ".", "mu", "needs", "to", "be", "locked", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L315-L318
135,340
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
GetTabletStats
func (tc *TabletStatsCache) GetTabletStats(keyspace, shard string, tabletType topodatapb.TabletType) []TabletStats { e := tc.getEntry(keyspace, shard, tabletType) if e == nil { return nil } e.mu.RLock() defer e.mu.RUnlock() result := make([]TabletStats, 0, len(e.all)) for _, s := range e.all { result = appe...
go
func (tc *TabletStatsCache) GetTabletStats(keyspace, shard string, tabletType topodatapb.TabletType) []TabletStats { e := tc.getEntry(keyspace, shard, tabletType) if e == nil { return nil } e.mu.RLock() defer e.mu.RUnlock() result := make([]TabletStats, 0, len(e.all)) for _, s := range e.all { result = appe...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "GetTabletStats", "(", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ")", "[", "]", "TabletStats", "{", "e", ":=", "tc", ".", "getEntry", "(", "keyspace", ",", "shar...
// GetTabletStats returns the full list of available targets. // The returned array is owned by the caller.
[ "GetTabletStats", "returns", "the", "full", "list", "of", "available", "targets", ".", "The", "returned", "array", "is", "owned", "by", "the", "caller", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L322-L335
135,341
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
GetHealthyTabletStats
func (tc *TabletStatsCache) GetHealthyTabletStats(keyspace, shard string, tabletType topodatapb.TabletType) []TabletStats { e := tc.getEntry(keyspace, shard, tabletType) if e == nil { return nil } e.mu.RLock() defer e.mu.RUnlock() result := make([]TabletStats, len(e.healthy)) for i, ts := range e.healthy { ...
go
func (tc *TabletStatsCache) GetHealthyTabletStats(keyspace, shard string, tabletType topodatapb.TabletType) []TabletStats { e := tc.getEntry(keyspace, shard, tabletType) if e == nil { return nil } e.mu.RLock() defer e.mu.RUnlock() result := make([]TabletStats, len(e.healthy)) for i, ts := range e.healthy { ...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "GetHealthyTabletStats", "(", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ")", "[", "]", "TabletStats", "{", "e", ":=", "tc", ".", "getEntry", "(", "keyspace", ",", ...
// GetHealthyTabletStats returns only the healthy targets. // The returned array is owned by the caller. // For TabletType_MASTER, this will only return at most one entry, // the most recent tablet of type master.
[ "GetHealthyTabletStats", "returns", "only", "the", "healthy", "targets", ".", "The", "returned", "array", "is", "owned", "by", "the", "caller", ".", "For", "TabletType_MASTER", "this", "will", "only", "return", "at", "most", "one", "entry", "the", "most", "rec...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L341-L354
135,342
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
GetAggregateStats
func (tc *TabletStatsCache) GetAggregateStats(target *querypb.Target) (*querypb.AggregateStats, error) { e := tc.getEntry(target.Keyspace, target.Shard, target.TabletType) if e == nil { return nil, topo.NewError(topo.NoNode, topotools.TargetIdent(target)) } e.mu.RLock() defer e.mu.RUnlock() if target.TabletTyp...
go
func (tc *TabletStatsCache) GetAggregateStats(target *querypb.Target) (*querypb.AggregateStats, error) { e := tc.getEntry(target.Keyspace, target.Shard, target.TabletType) if e == nil { return nil, topo.NewError(topo.NoNode, topotools.TargetIdent(target)) } e.mu.RLock() defer e.mu.RUnlock() if target.TabletTyp...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "GetAggregateStats", "(", "target", "*", "querypb", ".", "Target", ")", "(", "*", "querypb", ".", "AggregateStats", ",", "error", ")", "{", "e", ":=", "tc", ".", "getEntry", "(", "target", ".", "Keyspace",...
// GetAggregateStats is part of the TargetStatsListener interface.
[ "GetAggregateStats", "is", "part", "of", "the", "TargetStatsListener", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L365-L387
135,343
vitessio/vitess
go/vt/discovery/tablet_stats_cache.go
GetMasterCell
func (tc *TabletStatsCache) GetMasterCell(keyspace, shard string) (cell string, err error) { e := tc.getEntry(keyspace, shard, topodatapb.TabletType_MASTER) if e == nil { return "", topo.NewError(topo.NoNode, topotools.TargetIdent(&querypb.Target{ Keyspace: keyspace, Shard: shard, TabletType: topoda...
go
func (tc *TabletStatsCache) GetMasterCell(keyspace, shard string) (cell string, err error) { e := tc.getEntry(keyspace, shard, topodatapb.TabletType_MASTER) if e == nil { return "", topo.NewError(topo.NoNode, topotools.TargetIdent(&querypb.Target{ Keyspace: keyspace, Shard: shard, TabletType: topoda...
[ "func", "(", "tc", "*", "TabletStatsCache", ")", "GetMasterCell", "(", "keyspace", ",", "shard", "string", ")", "(", "cell", "string", ",", "err", "error", ")", "{", "e", ":=", "tc", ".", "getEntry", "(", "keyspace", ",", "shard", ",", "topodatapb", "....
// GetMasterCell is part of the TargetStatsListener interface.
[ "GetMasterCell", "is", "part", "of", "the", "TargetStatsListener", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/tablet_stats_cache.go#L390-L410
135,344
vitessio/vitess
go/vt/key/destination.go
DestinationsString
func DestinationsString(destinations []Destination) string { var buffer bytes.Buffer buffer.WriteString("Destinations:") for i, d := range destinations { if i > 0 { buffer.WriteByte(',') } buffer.WriteString(d.String()) } return buffer.String() }
go
func DestinationsString(destinations []Destination) string { var buffer bytes.Buffer buffer.WriteString("Destinations:") for i, d := range destinations { if i > 0 { buffer.WriteByte(',') } buffer.WriteString(d.String()) } return buffer.String() }
[ "func", "DestinationsString", "(", "destinations", "[", "]", "Destination", ")", "string", "{", "var", "buffer", "bytes", ".", "Buffer", "\n", "buffer", ".", "WriteString", "(", "\"", "\"", ")", "\n", "for", "i", ",", "d", ":=", "range", "destinations", ...
// DestinationsString returns a printed version of the destination array.
[ "DestinationsString", "returns", "a", "printed", "version", "of", "the", "destination", "array", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/key/destination.go#L57-L67
135,345
vitessio/vitess
go/vt/key/destination.go
GetShardForKeyspaceID
func GetShardForKeyspaceID(allShards []*topodatapb.ShardReference, keyspaceID []byte) (string, error) { if len(allShards) == 0 { return "", vterrors.Errorf(vtrpcpb.Code_UNAVAILABLE, "no shard in keyspace") } for _, shardReference := range allShards { if KeyRangeContains(shardReference.KeyRange, keyspaceID) { ...
go
func GetShardForKeyspaceID(allShards []*topodatapb.ShardReference, keyspaceID []byte) (string, error) { if len(allShards) == 0 { return "", vterrors.Errorf(vtrpcpb.Code_UNAVAILABLE, "no shard in keyspace") } for _, shardReference := range allShards { if KeyRangeContains(shardReference.KeyRange, keyspaceID) { ...
[ "func", "GetShardForKeyspaceID", "(", "allShards", "[", "]", "*", "topodatapb", ".", "ShardReference", ",", "keyspaceID", "[", "]", "byte", ")", "(", "string", ",", "error", ")", "{", "if", "len", "(", "allShards", ")", "==", "0", "{", "return", "\"", ...
// GetShardForKeyspaceID finds the right shard for a keyspace id.
[ "GetShardForKeyspaceID", "finds", "the", "right", "shard", "for", "a", "keyspace", "id", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/key/destination.go#L322-L333
135,346
vitessio/vitess
go/memcache/memcache.go
Connect
func Connect(address string, timeout time.Duration) (conn *Connection, err error) { var network string if strings.Contains(address, "/") { network = "unix" } else { network = "tcp" } var nc net.Conn nc, err = net.DialTimeout(network, address, timeout) if err != nil { return nil, err } return &Connection{...
go
func Connect(address string, timeout time.Duration) (conn *Connection, err error) { var network string if strings.Contains(address, "/") { network = "unix" } else { network = "tcp" } var nc net.Conn nc, err = net.DialTimeout(network, address, timeout) if err != nil { return nil, err } return &Connection{...
[ "func", "Connect", "(", "address", "string", ",", "timeout", "time", ".", "Duration", ")", "(", "conn", "*", "Connection", ",", "err", "error", ")", "{", "var", "network", "string", "\n", "if", "strings", ".", "Contains", "(", "address", ",", "\"", "\"...
// Connect connects a memcache process.
[ "Connect", "connects", "a", "memcache", "process", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/memcache/memcache.go#L40-L60
135,347
vitessio/vitess
go/memcache/memcache.go
Get
func (mc *Connection) Get(keys ...string) (results []cacheservice.Result, err error) { defer handleError(&err) results = mc.get("get", keys) return }
go
func (mc *Connection) Get(keys ...string) (results []cacheservice.Result, err error) { defer handleError(&err) results = mc.get("get", keys) return }
[ "func", "(", "mc", "*", "Connection", ")", "Get", "(", "keys", "...", "string", ")", "(", "results", "[", "]", "cacheservice", ".", "Result", ",", "err", "error", ")", "{", "defer", "handleError", "(", "&", "err", ")", "\n", "results", "=", "mc", "...
// Get returns cached data for given keys.
[ "Get", "returns", "cached", "data", "for", "given", "keys", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/memcache/memcache.go#L68-L72
135,348
vitessio/vitess
go/memcache/memcache.go
Set
func (mc *Connection) Set(key string, flags uint16, timeout uint64, value []byte) (stored bool, err error) { defer handleError(&err) return mc.store("set", key, flags, timeout, value, 0), nil }
go
func (mc *Connection) Set(key string, flags uint16, timeout uint64, value []byte) (stored bool, err error) { defer handleError(&err) return mc.store("set", key, flags, timeout, value, 0), nil }
[ "func", "(", "mc", "*", "Connection", ")", "Set", "(", "key", "string", ",", "flags", "uint16", ",", "timeout", "uint64", ",", "value", "[", "]", "byte", ")", "(", "stored", "bool", ",", "err", "error", ")", "{", "defer", "handleError", "(", "&", "...
// Set sets the value with specified cache key.
[ "Set", "sets", "the", "value", "with", "specified", "cache", "key", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/memcache/memcache.go#L84-L87
135,349
vitessio/vitess
go/memcache/memcache.go
Delete
func (mc *Connection) Delete(key string) (deleted bool, err error) { defer handleError(&err) mc.setDeadline() // delete <key> [<time>] [noreply]\r\n mc.writestrings("delete ", key, "\r\n") reply := mc.readline() if strings.Contains(reply, "ERROR") { panic(NewError("Server error")) } return strings.HasPrefix(r...
go
func (mc *Connection) Delete(key string) (deleted bool, err error) { defer handleError(&err) mc.setDeadline() // delete <key> [<time>] [noreply]\r\n mc.writestrings("delete ", key, "\r\n") reply := mc.readline() if strings.Contains(reply, "ERROR") { panic(NewError("Server error")) } return strings.HasPrefix(r...
[ "func", "(", "mc", "*", "Connection", ")", "Delete", "(", "key", "string", ")", "(", "deleted", "bool", ",", "err", "error", ")", "{", "defer", "handleError", "(", "&", "err", ")", "\n", "mc", ".", "setDeadline", "(", ")", "\n", "// delete <key> [<time...
// Delete deletes the value for the specified cache key.
[ "Delete", "deletes", "the", "value", "for", "the", "specified", "cache", "key", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/memcache/memcache.go#L121-L131
135,350
vitessio/vitess
go/memcache/memcache.go
FlushAll
func (mc *Connection) FlushAll() (err error) { defer handleError(&err) mc.setDeadline() // flush_all [delay] [noreply]\r\n mc.writestrings("flush_all\r\n") response := mc.readline() if !strings.Contains(response, "OK") { panic(NewError(fmt.Sprintf("Error in FlushAll %v", response))) } return nil }
go
func (mc *Connection) FlushAll() (err error) { defer handleError(&err) mc.setDeadline() // flush_all [delay] [noreply]\r\n mc.writestrings("flush_all\r\n") response := mc.readline() if !strings.Contains(response, "OK") { panic(NewError(fmt.Sprintf("Error in FlushAll %v", response))) } return nil }
[ "func", "(", "mc", "*", "Connection", ")", "FlushAll", "(", ")", "(", "err", "error", ")", "{", "defer", "handleError", "(", "&", "err", ")", "\n", "mc", ".", "setDeadline", "(", ")", "\n", "// flush_all [delay] [noreply]\\r\\n", "mc", ".", "writestrings",...
// FlushAll purges the entire cache.
[ "FlushAll", "purges", "the", "entire", "cache", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/memcache/memcache.go#L134-L144
135,351
vitessio/vitess
go/memcache/memcache.go
Stats
func (mc *Connection) Stats(argument string) (result []byte, err error) { defer handleError(&err) mc.setDeadline() if argument == "" { mc.writestrings("stats\r\n") } else { mc.writestrings("stats ", argument, "\r\n") } mc.flush() for { l := mc.readline() if strings.HasPrefix(l, "END") { break } if...
go
func (mc *Connection) Stats(argument string) (result []byte, err error) { defer handleError(&err) mc.setDeadline() if argument == "" { mc.writestrings("stats\r\n") } else { mc.writestrings("stats ", argument, "\r\n") } mc.flush() for { l := mc.readline() if strings.HasPrefix(l, "END") { break } if...
[ "func", "(", "mc", "*", "Connection", ")", "Stats", "(", "argument", "string", ")", "(", "result", "[", "]", "byte", ",", "err", "error", ")", "{", "defer", "handleError", "(", "&", "err", ")", "\n", "mc", ".", "setDeadline", "(", ")", "\n", "if", ...
// Stats returns a list of basic stats.
[ "Stats", "returns", "a", "list", "of", "basic", "stats", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/memcache/memcache.go#L147-L168
135,352
vitessio/vitess
go/vt/topo/etcd2topo/lock.go
newUniqueEphemeralKV
func (s *Server) newUniqueEphemeralKV(ctx context.Context, cli *clientv3.Client, leaseID clientv3.LeaseID, nodePath string, contents string) (string, int64, error) { // Use the lease ID as the file name, so it's guaranteed unique. newKey := fmt.Sprintf("%v/%v", nodePath, leaseID) // Only create a new file if it doe...
go
func (s *Server) newUniqueEphemeralKV(ctx context.Context, cli *clientv3.Client, leaseID clientv3.LeaseID, nodePath string, contents string) (string, int64, error) { // Use the lease ID as the file name, so it's guaranteed unique. newKey := fmt.Sprintf("%v/%v", nodePath, leaseID) // Only create a new file if it doe...
[ "func", "(", "s", "*", "Server", ")", "newUniqueEphemeralKV", "(", "ctx", "context", ".", "Context", ",", "cli", "*", "clientv3", ".", "Client", ",", "leaseID", "clientv3", ".", "LeaseID", ",", "nodePath", "string", ",", "contents", "string", ")", "(", "...
// newUniqueEphemeralKV creates a new file in the provided directory. // It is linked to the Lease. // Errors returned are converted to topo errors.
[ "newUniqueEphemeralKV", "creates", "a", "new", "file", "in", "the", "provided", "directory", ".", "It", "is", "linked", "to", "the", "Lease", ".", "Errors", "returned", "are", "converted", "to", "topo", "errors", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/etcd2topo/lock.go#L41-L69
135,353
vitessio/vitess
go/vt/topo/etcd2topo/lock.go
waitOnLastRev
func (s *Server) waitOnLastRev(ctx context.Context, cli *clientv3.Client, nodePath string, revision int64) (bool, error) { // Get the keys that are blocking us, if any. opts := append(clientv3.WithLastRev(), clientv3.WithMaxModRev(revision-1)) lastKey, err := cli.Get(ctx, nodePath+"/", opts...) if err != nil { re...
go
func (s *Server) waitOnLastRev(ctx context.Context, cli *clientv3.Client, nodePath string, revision int64) (bool, error) { // Get the keys that are blocking us, if any. opts := append(clientv3.WithLastRev(), clientv3.WithMaxModRev(revision-1)) lastKey, err := cli.Get(ctx, nodePath+"/", opts...) if err != nil { re...
[ "func", "(", "s", "*", "Server", ")", "waitOnLastRev", "(", "ctx", "context", ".", "Context", ",", "cli", "*", "clientv3", ".", "Client", ",", "nodePath", "string", ",", "revision", "int64", ")", "(", "bool", ",", "error", ")", "{", "// Get the keys that...
// waitOnLastRev waits on all revisions of the files in the provided // directory that have revisions smaller than the provided revision. // It returns true only if there is no more other older files.
[ "waitOnLastRev", "waits", "on", "all", "revisions", "of", "the", "files", "in", "the", "provided", "directory", "that", "have", "revisions", "smaller", "than", "the", "provided", "revision", ".", "It", "returns", "true", "only", "if", "there", "is", "no", "m...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/etcd2topo/lock.go#L74-L111
135,354
vitessio/vitess
go/vt/topo/etcd2topo/lock.go
Check
func (ld *etcdLockDescriptor) Check(ctx context.Context) error { _, err := ld.s.cli.KeepAliveOnce(ctx, ld.leaseID) if err != nil { return convertError(err, "lease") } return nil }
go
func (ld *etcdLockDescriptor) Check(ctx context.Context) error { _, err := ld.s.cli.KeepAliveOnce(ctx, ld.leaseID) if err != nil { return convertError(err, "lease") } return nil }
[ "func", "(", "ld", "*", "etcdLockDescriptor", ")", "Check", "(", "ctx", "context", ".", "Context", ")", "error", "{", "_", ",", "err", ":=", "ld", ".", "s", ".", "cli", ".", "KeepAliveOnce", "(", "ctx", ",", "ld", ".", "leaseID", ")", "\n", "if", ...
// Check is part of the topo.LockDescriptor interface. // We use KeepAliveOnce to make sure the lease is still active and well.
[ "Check", "is", "part", "of", "the", "topo", ".", "LockDescriptor", "interface", ".", "We", "use", "KeepAliveOnce", "to", "make", "sure", "the", "lease", "is", "still", "active", "and", "well", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/etcd2topo/lock.go#L183-L189
135,355
vitessio/vitess
go/vt/grpcclient/client_auth_static.go
GetRequestMetadata
func (c *StaticAuthClientCreds) GetRequestMetadata(context.Context, ...string) (map[string]string, error) { return map[string]string{ "username": c.Username, "password": c.Password, }, nil }
go
func (c *StaticAuthClientCreds) GetRequestMetadata(context.Context, ...string) (map[string]string, error) { return map[string]string{ "username": c.Username, "password": c.Password, }, nil }
[ "func", "(", "c", "*", "StaticAuthClientCreds", ")", "GetRequestMetadata", "(", "context", ".", "Context", ",", "...", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "return", "map", "[", "string", "]", "string", "{", ...
// GetRequestMetadata gets the request metadata as a map from StaticAuthClientCreds
[ "GetRequestMetadata", "gets", "the", "request", "metadata", "as", "a", "map", "from", "StaticAuthClientCreds" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/grpcclient/client_auth_static.go#L43-L48
135,356
vitessio/vitess
go/vt/grpcclient/client_auth_static.go
AppendStaticAuth
func AppendStaticAuth(opts []grpc.DialOption) ([]grpc.DialOption, error) { if *credsFile == "" { return opts, nil } data, err := ioutil.ReadFile(*credsFile) if err != nil { return nil, err } clientCreds := &StaticAuthClientCreds{} err = json.Unmarshal(data, clientCreds) if err != nil { return nil, err } ...
go
func AppendStaticAuth(opts []grpc.DialOption) ([]grpc.DialOption, error) { if *credsFile == "" { return opts, nil } data, err := ioutil.ReadFile(*credsFile) if err != nil { return nil, err } clientCreds := &StaticAuthClientCreds{} err = json.Unmarshal(data, clientCreds) if err != nil { return nil, err } ...
[ "func", "AppendStaticAuth", "(", "opts", "[", "]", "grpc", ".", "DialOption", ")", "(", "[", "]", "grpc", ".", "DialOption", ",", "error", ")", "{", "if", "*", "credsFile", "==", "\"", "\"", "{", "return", "opts", ",", "nil", "\n", "}", "\n", "data...
// AppendStaticAuth optionally appends static auth credentials if provided.
[ "AppendStaticAuth", "optionally", "appends", "static", "auth", "credentials", "if", "provided", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/grpcclient/client_auth_static.go#L58-L74
135,357
vitessio/vitess
go/vt/throttler/aggregated_interval_history.go
average
func (h *aggregatedIntervalHistory) average(from, to time.Time) float64 { sum := 0.0 for i := 0; i < h.threadCount; i++ { sum += h.historyPerThread[i].average(from, to) } return sum }
go
func (h *aggregatedIntervalHistory) average(from, to time.Time) float64 { sum := 0.0 for i := 0; i < h.threadCount; i++ { sum += h.historyPerThread[i].average(from, to) } return sum }
[ "func", "(", "h", "*", "aggregatedIntervalHistory", ")", "average", "(", "from", ",", "to", "time", ".", "Time", ")", "float64", "{", "sum", ":=", "0.0", "\n", "for", "i", ":=", "0", ";", "i", "<", "h", ".", "threadCount", ";", "i", "++", "{", "s...
// average aggregates the average of all intervalHistory instances.
[ "average", "aggregates", "the", "average", "of", "all", "intervalHistory", "instances", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/aggregated_interval_history.go#L47-L53
135,358
vitessio/vitess
go/vt/wrangler/shard.go
updateShardMaster
func (wr *Wrangler) updateShardMaster(ctx context.Context, si *topo.ShardInfo, tabletAlias *topodatapb.TabletAlias, tabletType topodatapb.TabletType, allowMasterOverride bool) error { // See if we need to update the Shard: // - add the tablet's cell to the shard's Cells if needed // - change the master if needed sh...
go
func (wr *Wrangler) updateShardMaster(ctx context.Context, si *topo.ShardInfo, tabletAlias *topodatapb.TabletAlias, tabletType topodatapb.TabletType, allowMasterOverride bool) error { // See if we need to update the Shard: // - add the tablet's cell to the shard's Cells if needed // - change the master if needed sh...
[ "func", "(", "wr", "*", "Wrangler", ")", "updateShardMaster", "(", "ctx", "context", ".", "Context", ",", "si", "*", "topo", ".", "ShardInfo", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ",", "tabletType", "topodatapb", ".", "TabletType", ",",...
// shard related methods for Wrangler // updateShardCellsAndMaster will update the 'Cells' and possibly // MasterAlias records for the shard, if needed.
[ "shard", "related", "methods", "for", "Wrangler", "updateShardCellsAndMaster", "will", "update", "the", "Cells", "and", "possibly", "MasterAlias", "records", "for", "the", "shard", "if", "needed", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/shard.go#L33-L63
135,359
vitessio/vitess
go/vt/wrangler/shard.go
SetShardIsMasterServing
func (wr *Wrangler) SetShardIsMasterServing(ctx context.Context, keyspace, shard string, isMasterServing bool) (err error) { // lock the keyspace to not conflict with resharding operations ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, fmt.Sprintf("SetShardIsMasterServing(%v,%v,%v)", keyspace, shard, isMas...
go
func (wr *Wrangler) SetShardIsMasterServing(ctx context.Context, keyspace, shard string, isMasterServing bool) (err error) { // lock the keyspace to not conflict with resharding operations ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, fmt.Sprintf("SetShardIsMasterServing(%v,%v,%v)", keyspace, shard, isMas...
[ "func", "(", "wr", "*", "Wrangler", ")", "SetShardIsMasterServing", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "isMasterServing", "bool", ")", "(", "err", "error", ")", "{", "// lock the keyspace to not conflict with resha...
// SetShardIsMasterServing changes the IsMasterServing parameter of a shard. // It does not rebuild any serving graph or do any consistency check. // This is an emergency manual operation.
[ "SetShardIsMasterServing", "changes", "the", "IsMasterServing", "parameter", "of", "a", "shard", ".", "It", "does", "not", "rebuild", "any", "serving", "graph", "or", "do", "any", "consistency", "check", ".", "This", "is", "an", "emergency", "manual", "operation...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/shard.go#L68-L82
135,360
vitessio/vitess
go/vt/wrangler/shard.go
SetShardTabletControl
func (wr *Wrangler) SetShardTabletControl(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, cells []string, remove bool, blacklistedTables []string) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, "SetShardTabletControl") if lockErr != nil { ...
go
func (wr *Wrangler) SetShardTabletControl(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, cells []string, remove bool, blacklistedTables []string) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, "SetShardTabletControl") if lockErr != nil { ...
[ "func", "(", "wr", "*", "Wrangler", ")", "SetShardTabletControl", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "cells", "[", "]", "string", ",", "remove", "bool", "...
// SetShardTabletControl changes the TabletControl records // for a shard. It does not rebuild any serving graph or do // cross-shard consistency check. // - sets black listed tables in tablet control record // // This takes the keyspace lock as to not interfere with resharding operations.
[ "SetShardTabletControl", "changes", "the", "TabletControl", "records", "for", "a", "shard", ".", "It", "does", "not", "rebuild", "any", "serving", "graph", "or", "do", "cross", "-", "shard", "consistency", "check", ".", "-", "sets", "black", "listed", "tables"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/shard.go#L90-L104
135,361
vitessio/vitess
go/vt/wrangler/shard.go
UpdateSrvKeyspacePartitions
func (wr *Wrangler) UpdateSrvKeyspacePartitions(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, cells []string, remove bool) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, "UpdateSrvKeyspacePartitions") if lockErr != nil { return lockErr ...
go
func (wr *Wrangler) UpdateSrvKeyspacePartitions(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, cells []string, remove bool) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, "UpdateSrvKeyspacePartitions") if lockErr != nil { return lockErr ...
[ "func", "(", "wr", "*", "Wrangler", ")", "UpdateSrvKeyspacePartitions", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "cells", "[", "]", "string", ",", "remove", "bool...
// UpdateSrvKeyspacePartitions changes the SrvKeyspaceGraph // for a shard. It updates serving graph // // This takes the keyspace lock as to not interfere with resharding operations.
[ "UpdateSrvKeyspacePartitions", "changes", "the", "SrvKeyspaceGraph", "for", "a", "shard", ".", "It", "updates", "serving", "graph", "This", "takes", "the", "keyspace", "lock", "as", "to", "not", "interfere", "with", "resharding", "operations", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/shard.go#L130-L147
135,362
vitessio/vitess
go/vt/wrangler/shard.go
SourceShardDelete
func (wr *Wrangler) SourceShardDelete(ctx context.Context, keyspace, shard string, uid uint32) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, fmt.Sprintf("SourceShardDelete(%v)", uid)) if lockErr != nil { return lockErr } defer unlock(&err) // remove the source sha...
go
func (wr *Wrangler) SourceShardDelete(ctx context.Context, keyspace, shard string, uid uint32) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, fmt.Sprintf("SourceShardDelete(%v)", uid)) if lockErr != nil { return lockErr } defer unlock(&err) // remove the source sha...
[ "func", "(", "wr", "*", "Wrangler", ")", "SourceShardDelete", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "uid", "uint32", ")", "(", "err", "error", ")", "{", "// lock the keyspace", "ctx", ",", "unlock", ",", "lo...
// SourceShardDelete will delete a SourceShard inside a shard, by index. // // This takes the keyspace lock as not to interfere with resharding operations.
[ "SourceShardDelete", "will", "delete", "a", "SourceShard", "inside", "a", "shard", "by", "index", ".", "This", "takes", "the", "keyspace", "lock", "as", "not", "to", "interfere", "with", "resharding", "operations", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/shard.go#L346-L369
135,363
vitessio/vitess
go/vt/wrangler/shard.go
SourceShardAdd
func (wr *Wrangler) SourceShardAdd(ctx context.Context, keyspace, shard string, uid uint32, skeyspace, sshard string, keyRange *topodatapb.KeyRange, tables []string) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, fmt.Sprintf("SourceShardAdd(%v)", uid)) if lockErr != nil ...
go
func (wr *Wrangler) SourceShardAdd(ctx context.Context, keyspace, shard string, uid uint32, skeyspace, sshard string, keyRange *topodatapb.KeyRange, tables []string) (err error) { // lock the keyspace ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, fmt.Sprintf("SourceShardAdd(%v)", uid)) if lockErr != nil ...
[ "func", "(", "wr", "*", "Wrangler", ")", "SourceShardAdd", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "uid", "uint32", ",", "skeyspace", ",", "sshard", "string", ",", "keyRange", "*", "topodatapb", ".", "KeyRange",...
// SourceShardAdd will add a new SourceShard inside a shard.
[ "SourceShardAdd", "will", "add", "a", "new", "SourceShard", "inside", "a", "shard", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/shard.go#L372-L399
135,364
vitessio/vitess
go/vt/schemamanager/schemamanager.go
Run
func Run(ctx context.Context, controller Controller, executor Executor) error { if err := controller.Open(ctx); err != nil { log.Errorf("failed to open data sourcer: %v", err) return err } defer controller.Close() sqls, err := controller.Read(ctx) if err != nil { log.Errorf("failed to read data from data sou...
go
func Run(ctx context.Context, controller Controller, executor Executor) error { if err := controller.Open(ctx); err != nil { log.Errorf("failed to open data sourcer: %v", err) return err } defer controller.Close() sqls, err := controller.Read(ctx) if err != nil { log.Errorf("failed to read data from data sou...
[ "func", "Run", "(", "ctx", "context", ".", "Context", ",", "controller", "Controller", ",", "executor", "Executor", ")", "error", "{", "if", "err", ":=", "controller", ".", "Open", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "log", ".", "Errorf", ...
// Run applies schema changes on Vitess through VtGate.
[ "Run", "applies", "schema", "changes", "on", "Vitess", "through", "VtGate", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemamanager.go#L96-L138
135,365
vitessio/vitess
go/vt/schemamanager/schemamanager.go
RegisterControllerFactory
func RegisterControllerFactory(name string, factory ControllerFactory) { if _, ok := controllerFactories[name]; ok { panic(fmt.Sprintf("register a registered key: %s", name)) } controllerFactories[name] = factory }
go
func RegisterControllerFactory(name string, factory ControllerFactory) { if _, ok := controllerFactories[name]; ok { panic(fmt.Sprintf("register a registered key: %s", name)) } controllerFactories[name] = factory }
[ "func", "RegisterControllerFactory", "(", "name", "string", ",", "factory", "ControllerFactory", ")", "{", "if", "_", ",", "ok", ":=", "controllerFactories", "[", "name", "]", ";", "ok", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "na...
// RegisterControllerFactory register a control factory.
[ "RegisterControllerFactory", "register", "a", "control", "factory", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemamanager.go#L141-L146
135,366
vitessio/vitess
go/vt/schemamanager/schemamanager.go
GetControllerFactory
func GetControllerFactory(name string) (ControllerFactory, error) { factory, ok := controllerFactories[name] if !ok { return nil, fmt.Errorf("there is no data sourcer factory with name: %s", name) } return factory, nil }
go
func GetControllerFactory(name string) (ControllerFactory, error) { factory, ok := controllerFactories[name] if !ok { return nil, fmt.Errorf("there is no data sourcer factory with name: %s", name) } return factory, nil }
[ "func", "GetControllerFactory", "(", "name", "string", ")", "(", "ControllerFactory", ",", "error", ")", "{", "factory", ",", "ok", ":=", "controllerFactories", "[", "name", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "("...
// GetControllerFactory gets a ControllerFactory.
[ "GetControllerFactory", "gets", "a", "ControllerFactory", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/schemamanager.go#L149-L155
135,367
vitessio/vitess
go/vt/vttablet/queryservice/wrapped.go
canRetry
func canRetry(ctx context.Context, err error) bool { if err == nil { return false } select { case <-ctx.Done(): return false default: } switch vterrors.Code(err) { case vtrpcpb.Code_UNAVAILABLE, vtrpcpb.Code_FAILED_PRECONDITION: return true } return false }
go
func canRetry(ctx context.Context, err error) bool { if err == nil { return false } select { case <-ctx.Done(): return false default: } switch vterrors.Code(err) { case vtrpcpb.Code_UNAVAILABLE, vtrpcpb.Code_FAILED_PRECONDITION: return true } return false }
[ "func", "canRetry", "(", "ctx", "context", ".", "Context", ",", "err", "error", ")", "bool", "{", "if", "err", "==", "nil", "{", "return", "false", "\n", "}", "\n\n", "select", "{", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "false"...
// canRetry returns true if the error is retryable on a different vttablet. // Nil error or a canceled context make it return // false. Otherwise, the error code determines the outcome.
[ "canRetry", "returns", "true", "if", "the", "error", "is", "retryable", "on", "a", "different", "vttablet", ".", "Nil", "error", "or", "a", "canceled", "context", "make", "it", "return", "false", ".", "Otherwise", "the", "error", "code", "determines", "the",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/queryservice/wrapped.go#L61-L77
135,368
vitessio/vitess
go/vt/vtgate/resolver.go
StreamExecute
func (res *Resolver) StreamExecute( ctx context.Context, sql string, bindVars map[string]*querypb.BindVariable, keyspace string, tabletType topodatapb.TabletType, destination key.Destination, options *querypb.ExecuteOptions, callback func(*sqltypes.Result) error, ) error { rss, err := res.resolver.ResolveDesti...
go
func (res *Resolver) StreamExecute( ctx context.Context, sql string, bindVars map[string]*querypb.BindVariable, keyspace string, tabletType topodatapb.TabletType, destination key.Destination, options *querypb.ExecuteOptions, callback func(*sqltypes.Result) error, ) error { rss, err := res.resolver.ResolveDesti...
[ "func", "(", "res", "*", "Resolver", ")", "StreamExecute", "(", "ctx", "context", ".", "Context", ",", "sql", "string", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "keyspace", "string", ",", "tabletType", "topodata...
// StreamExecute executes a streaming query on shards resolved by given func. // This function currently temporarily enforces the restriction of executing on // one shard since it cannot merge-sort the results to guarantee ordering of // response which is needed for checkpointing. // Note we guarantee the callback will...
[ "StreamExecute", "executes", "a", "streaming", "query", "on", "shards", "resolved", "by", "given", "func", ".", "This", "function", "currently", "temporarily", "enforces", "the", "restriction", "of", "executing", "on", "one", "shard", "since", "it", "cannot", "m...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/resolver.go#L241-L264
135,369
vitessio/vitess
go/vt/vtgate/resolver.go
MessageAckKeyspaceIds
func (res *Resolver) MessageAckKeyspaceIds(ctx context.Context, keyspace, name string, idKeyspaceIDs []*vtgatepb.IdKeyspaceId) (int64, error) { ids := make([]*querypb.Value, len(idKeyspaceIDs)) ksids := make([]key.Destination, len(idKeyspaceIDs)) for i, iki := range idKeyspaceIDs { ids[i] = iki.Id ksids[i] = key...
go
func (res *Resolver) MessageAckKeyspaceIds(ctx context.Context, keyspace, name string, idKeyspaceIDs []*vtgatepb.IdKeyspaceId) (int64, error) { ids := make([]*querypb.Value, len(idKeyspaceIDs)) ksids := make([]key.Destination, len(idKeyspaceIDs)) for i, iki := range idKeyspaceIDs { ids[i] = iki.Id ksids[i] = key...
[ "func", "(", "res", "*", "Resolver", ")", "MessageAckKeyspaceIds", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "name", "string", ",", "idKeyspaceIDs", "[", "]", "*", "vtgatepb", ".", "IdKeyspaceId", ")", "(", "int64", ",", "error", ")", ...
// MessageAckKeyspaceIds routes message acks based on the associated keyspace ids.
[ "MessageAckKeyspaceIds", "routes", "message", "acks", "based", "on", "the", "associated", "keyspace", "ids", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/resolver.go#L287-L301
135,370
vitessio/vitess
go/vt/vtgate/resolver.go
StrsEquals
func StrsEquals(a, b []string) bool { if len(a) != len(b) { return false } sort.Strings(a) sort.Strings(b) for i, v := range a { if v != b[i] { return false } } return true }
go
func StrsEquals(a, b []string) bool { if len(a) != len(b) { return false } sort.Strings(a) sort.Strings(b) for i, v := range a { if v != b[i] { return false } } return true }
[ "func", "StrsEquals", "(", "a", ",", "b", "[", "]", "string", ")", "bool", "{", "if", "len", "(", "a", ")", "!=", "len", "(", "b", ")", "{", "return", "false", "\n", "}", "\n", "sort", ".", "Strings", "(", "a", ")", "\n", "sort", ".", "String...
// StrsEquals compares contents of two string slices.
[ "StrsEquals", "compares", "contents", "of", "two", "string", "slices", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/resolver.go#L348-L360
135,371
vitessio/vitess
go/vt/vtgate/resolver.go
buildEntityIds
func buildEntityIds(values [][]*querypb.Value, qSQL, entityColName string, qBindVars map[string]*querypb.BindVariable) ([]string, []map[string]*querypb.BindVariable) { sqls := make([]string, len(values)) bindVars := make([]map[string]*querypb.BindVariable, len(values)) for i, val := range values { var b bytes.Buff...
go
func buildEntityIds(values [][]*querypb.Value, qSQL, entityColName string, qBindVars map[string]*querypb.BindVariable) ([]string, []map[string]*querypb.BindVariable) { sqls := make([]string, len(values)) bindVars := make([]map[string]*querypb.BindVariable, len(values)) for i, val := range values { var b bytes.Buff...
[ "func", "buildEntityIds", "(", "values", "[", "]", "[", "]", "*", "querypb", ".", "Value", ",", "qSQL", ",", "entityColName", "string", ",", "qBindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ")", "(", "[", "]", "string", ",",...
// buildEntityIds populates SQL and BindVariables.
[ "buildEntityIds", "populates", "SQL", "and", "BindVariables", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/resolver.go#L363-L385
135,372
vitessio/vitess
go/vt/vtgate/vindexes/lookup_internal.go
Lookup
func (lkp *lookupInternal) Lookup(vcursor VCursor, ids []sqltypes.Value) ([]*sqltypes.Result, error) { results := make([]*sqltypes.Result, 0, len(ids)) for _, id := range ids { bindVars := map[string]*querypb.BindVariable{ lkp.FromColumns[0]: sqltypes.ValueBindVariable(id), } var err error var result *sqlt...
go
func (lkp *lookupInternal) Lookup(vcursor VCursor, ids []sqltypes.Value) ([]*sqltypes.Result, error) { results := make([]*sqltypes.Result, 0, len(ids)) for _, id := range ids { bindVars := map[string]*querypb.BindVariable{ lkp.FromColumns[0]: sqltypes.ValueBindVariable(id), } var err error var result *sqlt...
[ "func", "(", "lkp", "*", "lookupInternal", ")", "Lookup", "(", "vcursor", "VCursor", ",", "ids", "[", "]", "sqltypes", ".", "Value", ")", "(", "[", "]", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "results", ":=", "make", "(", "[", "]",...
// Lookup performs a lookup for the ids.
[ "Lookup", "performs", "a", "lookup", "for", "the", "ids", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/lookup_internal.go#L62-L81
135,373
vitessio/vitess
go/vt/vtgate/vindexes/lookup_internal.go
Verify
func (lkp *lookupInternal) Verify(vcursor VCursor, ids, values []sqltypes.Value) ([]bool, error) { out := make([]bool, len(ids)) for i, id := range ids { bindVars := map[string]*querypb.BindVariable{ lkp.FromColumns[0]: sqltypes.ValueBindVariable(id), lkp.To: sqltypes.ValueBindVariable(values[i]),...
go
func (lkp *lookupInternal) Verify(vcursor VCursor, ids, values []sqltypes.Value) ([]bool, error) { out := make([]bool, len(ids)) for i, id := range ids { bindVars := map[string]*querypb.BindVariable{ lkp.FromColumns[0]: sqltypes.ValueBindVariable(id), lkp.To: sqltypes.ValueBindVariable(values[i]),...
[ "func", "(", "lkp", "*", "lookupInternal", ")", "Verify", "(", "vcursor", "VCursor", ",", "ids", ",", "values", "[", "]", "sqltypes", ".", "Value", ")", "(", "[", "]", "bool", ",", "error", ")", "{", "out", ":=", "make", "(", "[", "]", "bool", ",...
// Verify returns true if ids map to values.
[ "Verify", "returns", "true", "if", "ids", "map", "to", "values", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/lookup_internal.go#L84-L104
135,374
vitessio/vitess
go/vt/vtgate/vindexes/lookup_internal.go
Update
func (lkp *lookupInternal) Update(vcursor VCursor, oldValues []sqltypes.Value, ksid sqltypes.Value, newValues []sqltypes.Value) error { if err := lkp.Delete(vcursor, [][]sqltypes.Value{oldValues}, ksid); err != nil { return err } return lkp.Create(vcursor, [][]sqltypes.Value{newValues}, []sqltypes.Value{ksid}, fal...
go
func (lkp *lookupInternal) Update(vcursor VCursor, oldValues []sqltypes.Value, ksid sqltypes.Value, newValues []sqltypes.Value) error { if err := lkp.Delete(vcursor, [][]sqltypes.Value{oldValues}, ksid); err != nil { return err } return lkp.Create(vcursor, [][]sqltypes.Value{newValues}, []sqltypes.Value{ksid}, fal...
[ "func", "(", "lkp", "*", "lookupInternal", ")", "Update", "(", "vcursor", "VCursor", ",", "oldValues", "[", "]", "sqltypes", ".", "Value", ",", "ksid", "sqltypes", ".", "Value", ",", "newValues", "[", "]", "sqltypes", ".", "Value", ")", "error", "{", "...
// Update implements the update functionality.
[ "Update", "implements", "the", "update", "functionality", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/lookup_internal.go#L217-L222
135,375
vitessio/vitess
go/vt/health/health.go
Report
func (fc FunctionReporter) Report(isSlaveType, shouldQueryServiceBeRunning bool) (time.Duration, error) { return fc(isSlaveType, shouldQueryServiceBeRunning) }
go
func (fc FunctionReporter) Report(isSlaveType, shouldQueryServiceBeRunning bool) (time.Duration, error) { return fc(isSlaveType, shouldQueryServiceBeRunning) }
[ "func", "(", "fc", "FunctionReporter", ")", "Report", "(", "isSlaveType", ",", "shouldQueryServiceBeRunning", "bool", ")", "(", "time", ".", "Duration", ",", "error", ")", "{", "return", "fc", "(", "isSlaveType", ",", "shouldQueryServiceBeRunning", ")", "\n", ...
// Report implements Reporter.Report
[ "Report", "implements", "Reporter", ".", "Report" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/health/health.go#L64-L66
135,376
vitessio/vitess
go/vt/health/health.go
Register
func (ag *Aggregator) Register(name string, rep Reporter) { ag.mu.Lock() defer ag.mu.Unlock() if _, ok := ag.reporters[name]; ok { panic("reporter named " + name + " is already registered") } ag.reporters[name] = rep }
go
func (ag *Aggregator) Register(name string, rep Reporter) { ag.mu.Lock() defer ag.mu.Unlock() if _, ok := ag.reporters[name]; ok { panic("reporter named " + name + " is already registered") } ag.reporters[name] = rep }
[ "func", "(", "ag", "*", "Aggregator", ")", "Register", "(", "name", "string", ",", "rep", "Reporter", ")", "{", "ag", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "ag", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "_", ",", "ok", ":=", ...
// Register registers rep with ag.
[ "Register", "registers", "rep", "with", "ag", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/health/health.go#L138-L145
135,377
vitessio/vitess
go/vt/health/health.go
RegisterSimpleCheck
func (ag *Aggregator) RegisterSimpleCheck(name string, check func() error) { ag.Register(name, simpleReporter{html: template.HTML(name), check: check}) }
go
func (ag *Aggregator) RegisterSimpleCheck(name string, check func() error) { ag.Register(name, simpleReporter{html: template.HTML(name), check: check}) }
[ "func", "(", "ag", "*", "Aggregator", ")", "RegisterSimpleCheck", "(", "name", "string", ",", "check", "func", "(", ")", "error", ")", "{", "ag", ".", "Register", "(", "name", ",", "simpleReporter", "{", "html", ":", "template", ".", "HTML", "(", "name...
// RegisterSimpleCheck registers a simple health check function.
[ "RegisterSimpleCheck", "registers", "a", "simple", "health", "check", "function", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/health/health.go#L148-L150
135,378
vitessio/vitess
go/vt/health/health.go
HTMLName
func (ag *Aggregator) HTMLName() template.HTML { ag.mu.Lock() defer ag.mu.Unlock() result := make([]string, 0, len(ag.reporters)) for _, rep := range ag.reporters { result = append(result, string(rep.HTMLName())) } sort.Strings(result) return template.HTML(strings.Join(result, "&nbsp; + &nbsp;")) }
go
func (ag *Aggregator) HTMLName() template.HTML { ag.mu.Lock() defer ag.mu.Unlock() result := make([]string, 0, len(ag.reporters)) for _, rep := range ag.reporters { result = append(result, string(rep.HTMLName())) } sort.Strings(result) return template.HTML(strings.Join(result, "&nbsp; + &nbsp;")) }
[ "func", "(", "ag", "*", "Aggregator", ")", "HTMLName", "(", ")", "template", ".", "HTML", "{", "ag", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "ag", ".", "mu", ".", "Unlock", "(", ")", "\n", "result", ":=", "make", "(", "[", "]", "string...
// HTMLName returns an aggregate name for all the reporters
[ "HTMLName", "returns", "an", "aggregate", "name", "for", "all", "the", "reporters" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/health/health.go#L153-L162
135,379
vitessio/vitess
go/vt/schemamanager/local_controller.go
Open
func (controller *LocalController) Open(ctx context.Context) error { // find all keyspace directories. fileInfos, err := ioutil.ReadDir(controller.schemaChangeDir) if err != nil { return err } for _, fileinfo := range fileInfos { if !fileinfo.IsDir() { continue } dirpath := path.Join(controller.schemaCh...
go
func (controller *LocalController) Open(ctx context.Context) error { // find all keyspace directories. fileInfos, err := ioutil.ReadDir(controller.schemaChangeDir) if err != nil { return err } for _, fileinfo := range fileInfos { if !fileinfo.IsDir() { continue } dirpath := path.Join(controller.schemaCh...
[ "func", "(", "controller", "*", "LocalController", ")", "Open", "(", "ctx", "context", ".", "Context", ")", "error", "{", "// find all keyspace directories.", "fileInfos", ",", "err", ":=", "ioutil", ".", "ReadDir", "(", "controller", ".", "schemaChangeDir", ")"...
// Open goes through the schema change dir and find a keyspace with a pending // schema change.
[ "Open", "goes", "through", "the", "schema", "change", "dir", "and", "find", "a", "keyspace", "with", "a", "pending", "schema", "change", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/local_controller.go#L77-L114
135,380
vitessio/vitess
go/vt/schemamanager/local_controller.go
Read
func (controller *LocalController) Read(ctx context.Context) ([]string, error) { if controller.keyspace == "" || controller.sqlPath == "" { return []string{}, nil } data, err := ioutil.ReadFile(controller.sqlPath) if err != nil { return nil, err } return strings.Split(string(data), ";"), nil }
go
func (controller *LocalController) Read(ctx context.Context) ([]string, error) { if controller.keyspace == "" || controller.sqlPath == "" { return []string{}, nil } data, err := ioutil.ReadFile(controller.sqlPath) if err != nil { return nil, err } return strings.Split(string(data), ";"), nil }
[ "func", "(", "controller", "*", "LocalController", ")", "Read", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "string", ",", "error", ")", "{", "if", "controller", ".", "keyspace", "==", "\"", "\"", "||", "controller", ".", "sqlPath", "=="...
// Read reads schema changes.
[ "Read", "reads", "schema", "changes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/local_controller.go#L117-L126
135,381
vitessio/vitess
go/vt/schemamanager/local_controller.go
Close
func (controller *LocalController) Close() { controller.keyspace = "" controller.sqlPath = "" controller.sqlFilename = "" controller.errorDir = "" controller.logDir = "" controller.completeDir = "" }
go
func (controller *LocalController) Close() { controller.keyspace = "" controller.sqlPath = "" controller.sqlFilename = "" controller.errorDir = "" controller.logDir = "" controller.completeDir = "" }
[ "func", "(", "controller", "*", "LocalController", ")", "Close", "(", ")", "{", "controller", ".", "keyspace", "=", "\"", "\"", "\n", "controller", ".", "sqlPath", "=", "\"", "\"", "\n", "controller", ".", "sqlFilename", "=", "\"", "\"", "\n", "controlle...
// Close reset keyspace, sqlPath, errorDir, logDir and completeDir.
[ "Close", "reset", "keyspace", "sqlPath", "errorDir", "logDir", "and", "completeDir", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/local_controller.go#L134-L141
135,382
vitessio/vitess
go/vt/schemamanager/local_controller.go
OnValidationFail
func (controller *LocalController) OnValidationFail(ctx context.Context, err error) error { return controller.moveToErrorDir(ctx) }
go
func (controller *LocalController) OnValidationFail(ctx context.Context, err error) error { return controller.moveToErrorDir(ctx) }
[ "func", "(", "controller", "*", "LocalController", ")", "OnValidationFail", "(", "ctx", "context", ".", "Context", ",", "err", "error", ")", "error", "{", "return", "controller", ".", "moveToErrorDir", "(", "ctx", ")", "\n", "}" ]
// OnValidationFail is no-op
[ "OnValidationFail", "is", "no", "-", "op" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/local_controller.go#L160-L162
135,383
vitessio/vitess
go/vt/topo/topoproto/flag.go
TabletTypeVar
func TabletTypeVar(p *topodatapb.TabletType, name string, defaultValue topodatapb.TabletType, usage string) { *p = defaultValue flag.Var((*TabletTypeFlag)(p), name, usage) }
go
func TabletTypeVar(p *topodatapb.TabletType, name string, defaultValue topodatapb.TabletType, usage string) { *p = defaultValue flag.Var((*TabletTypeFlag)(p), name, usage) }
[ "func", "TabletTypeVar", "(", "p", "*", "topodatapb", ".", "TabletType", ",", "name", "string", ",", "defaultValue", "topodatapb", ".", "TabletType", ",", "usage", "string", ")", "{", "*", "p", "=", "defaultValue", "\n", "flag", ".", "Var", "(", "(", "*"...
// TabletTypeVar defines a TabletType flag with the specified name, default value and usage // string. The argument 'p' points to a tabletType in which to store the value of the flag.
[ "TabletTypeVar", "defines", "a", "TabletType", "flag", "with", "the", "specified", "name", "default", "value", "and", "usage", "string", ".", "The", "argument", "p", "points", "to", "a", "tabletType", "in", "which", "to", "store", "the", "value", "of", "the"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/flag.go#L18-L21
135,384
vitessio/vitess
go/vt/topo/topoproto/tablet.go
TabletAliasIsZero
func TabletAliasIsZero(ta *topodatapb.TabletAlias) bool { return ta == nil || (ta.Cell == "" && ta.Uid == 0) }
go
func TabletAliasIsZero(ta *topodatapb.TabletAlias) bool { return ta == nil || (ta.Cell == "" && ta.Uid == 0) }
[ "func", "TabletAliasIsZero", "(", "ta", "*", "topodatapb", ".", "TabletAlias", ")", "bool", "{", "return", "ta", "==", "nil", "||", "(", "ta", ".", "Cell", "==", "\"", "\"", "&&", "ta", ".", "Uid", "==", "0", ")", "\n", "}" ]
// TabletAliasIsZero returns true iff cell and uid are empty
[ "TabletAliasIsZero", "returns", "true", "iff", "cell", "and", "uid", "are", "empty" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L52-L54
135,385
vitessio/vitess
go/vt/topo/topoproto/tablet.go
TabletAliasEqual
func TabletAliasEqual(left, right *topodatapb.TabletAlias) bool { return proto.Equal(left, right) }
go
func TabletAliasEqual(left, right *topodatapb.TabletAlias) bool { return proto.Equal(left, right) }
[ "func", "TabletAliasEqual", "(", "left", ",", "right", "*", "topodatapb", ".", "TabletAlias", ")", "bool", "{", "return", "proto", ".", "Equal", "(", "left", ",", "right", ")", "\n", "}" ]
// TabletAliasEqual returns true if two TabletAlias match
[ "TabletAliasEqual", "returns", "true", "if", "two", "TabletAlias", "match" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L57-L59
135,386
vitessio/vitess
go/vt/topo/topoproto/tablet.go
TabletAliasString
func TabletAliasString(ta *topodatapb.TabletAlias) string { if ta == nil { return "<nil>" } return fmt.Sprintf("%v-%010d", ta.Cell, ta.Uid) }
go
func TabletAliasString(ta *topodatapb.TabletAlias) string { if ta == nil { return "<nil>" } return fmt.Sprintf("%v-%010d", ta.Cell, ta.Uid) }
[ "func", "TabletAliasString", "(", "ta", "*", "topodatapb", ".", "TabletAlias", ")", "string", "{", "if", "ta", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ta", ".", "Cell", ",", "...
// TabletAliasString formats a TabletAlias
[ "TabletAliasString", "formats", "a", "TabletAlias" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L62-L67
135,387
vitessio/vitess
go/vt/topo/topoproto/tablet.go
ParseTabletType
func ParseTabletType(param string) (topodatapb.TabletType, error) { value, ok := topodatapb.TabletType_value[strings.ToUpper(param)] if !ok { return topodatapb.TabletType_UNKNOWN, fmt.Errorf("unknown TabletType %v", param) } return topodatapb.TabletType(value), nil }
go
func ParseTabletType(param string) (topodatapb.TabletType, error) { value, ok := topodatapb.TabletType_value[strings.ToUpper(param)] if !ok { return topodatapb.TabletType_UNKNOWN, fmt.Errorf("unknown TabletType %v", param) } return topodatapb.TabletType(value), nil }
[ "func", "ParseTabletType", "(", "param", "string", ")", "(", "topodatapb", ".", "TabletType", ",", "error", ")", "{", "value", ",", "ok", ":=", "topodatapb", ".", "TabletType_value", "[", "strings", ".", "ToUpper", "(", "param", ")", "]", "\n", "if", "!"...
// ParseTabletType parses the tablet type into the enum.
[ "ParseTabletType", "parses", "the", "tablet", "type", "into", "the", "enum", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L150-L156
135,388
vitessio/vitess
go/vt/topo/topoproto/tablet.go
ParseTabletTypes
func ParseTabletTypes(param string) ([]topodatapb.TabletType, error) { var tabletTypes []topodatapb.TabletType for _, typeStr := range strings.Split(param, ",") { t, err := ParseTabletType(typeStr) if err != nil { return nil, err } tabletTypes = append(tabletTypes, t) } return tabletTypes, nil }
go
func ParseTabletTypes(param string) ([]topodatapb.TabletType, error) { var tabletTypes []topodatapb.TabletType for _, typeStr := range strings.Split(param, ",") { t, err := ParseTabletType(typeStr) if err != nil { return nil, err } tabletTypes = append(tabletTypes, t) } return tabletTypes, nil }
[ "func", "ParseTabletTypes", "(", "param", "string", ")", "(", "[", "]", "topodatapb", ".", "TabletType", ",", "error", ")", "{", "var", "tabletTypes", "[", "]", "topodatapb", ".", "TabletType", "\n", "for", "_", ",", "typeStr", ":=", "range", "strings", ...
// ParseTabletTypes parses a comma separated list of tablet types and returns a slice with the respective enums.
[ "ParseTabletTypes", "parses", "a", "comma", "separated", "list", "of", "tablet", "types", "and", "returns", "a", "slice", "with", "the", "respective", "enums", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L159-L169
135,389
vitessio/vitess
go/vt/topo/topoproto/tablet.go
TabletTypeLString
func TabletTypeLString(tabletType topodatapb.TabletType) string { value, ok := tabletTypeLowerName[int32(tabletType)] if !ok { return "unknown" } return value }
go
func TabletTypeLString(tabletType topodatapb.TabletType) string { value, ok := tabletTypeLowerName[int32(tabletType)] if !ok { return "unknown" } return value }
[ "func", "TabletTypeLString", "(", "tabletType", "topodatapb", ".", "TabletType", ")", "string", "{", "value", ",", "ok", ":=", "tabletTypeLowerName", "[", "int32", "(", "tabletType", ")", "]", "\n", "if", "!", "ok", "{", "return", "\"", "\"", "\n", "}", ...
// TabletTypeLString returns a lower case version of the tablet type, // or "unknown" if not known.
[ "TabletTypeLString", "returns", "a", "lower", "case", "version", "of", "the", "tablet", "type", "or", "unknown", "if", "not", "known", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L173-L179
135,390
vitessio/vitess
go/vt/topo/topoproto/tablet.go
IsTypeInList
func IsTypeInList(tabletType topodatapb.TabletType, types []topodatapb.TabletType) bool { for _, t := range types { if tabletType == t { return true } } return false }
go
func IsTypeInList(tabletType topodatapb.TabletType, types []topodatapb.TabletType) bool { for _, t := range types { if tabletType == t { return true } } return false }
[ "func", "IsTypeInList", "(", "tabletType", "topodatapb", ".", "TabletType", ",", "types", "[", "]", "topodatapb", ".", "TabletType", ")", "bool", "{", "for", "_", ",", "t", ":=", "range", "types", "{", "if", "tabletType", "==", "t", "{", "return", "true"...
// IsTypeInList returns true if the given type is in the list. // Use it with AllTabletType and SlaveTabletType for instance.
[ "IsTypeInList", "returns", "true", "if", "the", "given", "type", "is", "in", "the", "list", ".", "Use", "it", "with", "AllTabletType", "and", "SlaveTabletType", "for", "instance", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L183-L190
135,391
vitessio/vitess
go/vt/topo/topoproto/tablet.go
MakeStringTypeList
func MakeStringTypeList(types []topodatapb.TabletType) []string { strs := make([]string, len(types)) for i, t := range types { strs[i] = strings.ToLower(t.String()) } sort.Strings(strs) return strs }
go
func MakeStringTypeList(types []topodatapb.TabletType) []string { strs := make([]string, len(types)) for i, t := range types { strs[i] = strings.ToLower(t.String()) } sort.Strings(strs) return strs }
[ "func", "MakeStringTypeList", "(", "types", "[", "]", "topodatapb", ".", "TabletType", ")", "[", "]", "string", "{", "strs", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "types", ")", ")", "\n", "for", "i", ",", "t", ":=", "range", "type...
// MakeStringTypeList returns a list of strings that match the input list.
[ "MakeStringTypeList", "returns", "a", "list", "of", "strings", "that", "match", "the", "input", "list", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L193-L200
135,392
vitessio/vitess
go/vt/topo/topoproto/tablet.go
MySQLIP
func MySQLIP(tablet *topodatapb.Tablet) (string, error) { ipAddrs, err := net.LookupHost(MysqlHostname(tablet)) if err != nil { return "", err } return ipAddrs[0], nil }
go
func MySQLIP(tablet *topodatapb.Tablet) (string, error) { ipAddrs, err := net.LookupHost(MysqlHostname(tablet)) if err != nil { return "", err } return ipAddrs[0], nil }
[ "func", "MySQLIP", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "(", "string", ",", "error", ")", "{", "ipAddrs", ",", "err", ":=", "net", ".", "LookupHost", "(", "MysqlHostname", "(", "tablet", ")", ")", "\n", "if", "err", "!=", "nil", "{",...
// MySQLIP returns the MySQL server's IP by resolvign the host name.
[ "MySQLIP", "returns", "the", "MySQL", "server", "s", "IP", "by", "resolvign", "the", "host", "name", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L244-L250
135,393
vitessio/vitess
go/vt/topo/topoproto/tablet.go
TabletDbName
func TabletDbName(tablet *topodatapb.Tablet) string { if tablet.DbNameOverride != "" { return tablet.DbNameOverride } if tablet.Keyspace == "" { return "" } return vtDbPrefix + tablet.Keyspace }
go
func TabletDbName(tablet *topodatapb.Tablet) string { if tablet.DbNameOverride != "" { return tablet.DbNameOverride } if tablet.Keyspace == "" { return "" } return vtDbPrefix + tablet.Keyspace }
[ "func", "TabletDbName", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "string", "{", "if", "tablet", ".", "DbNameOverride", "!=", "\"", "\"", "{", "return", "tablet", ".", "DbNameOverride", "\n", "}", "\n", "if", "tablet", ".", "Keyspace", "==", ...
// TabletDbName is usually implied by keyspace. Having the shard // information in the database name complicates mysql replication.
[ "TabletDbName", "is", "usually", "implied", "by", "keyspace", ".", "Having", "the", "shard", "information", "in", "the", "database", "name", "complicates", "mysql", "replication", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L254-L262
135,394
vitessio/vitess
go/vt/topo/topoproto/tablet.go
TabletIsAssigned
func TabletIsAssigned(tablet *topodatapb.Tablet) bool { return tablet != nil && tablet.Keyspace != "" && tablet.Shard != "" }
go
func TabletIsAssigned(tablet *topodatapb.Tablet) bool { return tablet != nil && tablet.Keyspace != "" && tablet.Shard != "" }
[ "func", "TabletIsAssigned", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "bool", "{", "return", "tablet", "!=", "nil", "&&", "tablet", ".", "Keyspace", "!=", "\"", "\"", "&&", "tablet", ".", "Shard", "!=", "\"", "\"", "\n", "}" ]
// TabletIsAssigned returns if this tablet is assigned to a keyspace and shard. // A "scrap" node will show up as assigned even though its data cannot be used // for serving.
[ "TabletIsAssigned", "returns", "if", "this", "tablet", "is", "assigned", "to", "a", "keyspace", "and", "shard", ".", "A", "scrap", "node", "will", "show", "up", "as", "assigned", "even", "though", "its", "data", "cannot", "be", "used", "for", "serving", "....
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/topoproto/tablet.go#L267-L269
135,395
vitessio/vitess
go/mysql/binlog_event_rbr.go
metadataLength
func metadataLength(typ byte) int { switch typ { case TypeDecimal, TypeTiny, TypeShort, TypeLong, TypeNull, TypeTimestamp, TypeLongLong, TypeInt24, TypeDate, TypeTime, TypeDateTime, TypeYear, TypeNewDate: // No data here. return 0 case TypeFloat, TypeDouble, TypeTimestamp2, TypeDateTime2, TypeTime2, TypeJSON, T...
go
func metadataLength(typ byte) int { switch typ { case TypeDecimal, TypeTiny, TypeShort, TypeLong, TypeNull, TypeTimestamp, TypeLongLong, TypeInt24, TypeDate, TypeTime, TypeDateTime, TypeYear, TypeNewDate: // No data here. return 0 case TypeFloat, TypeDouble, TypeTimestamp2, TypeDateTime2, TypeTime2, TypeJSON, T...
[ "func", "metadataLength", "(", "typ", "byte", ")", "int", "{", "switch", "typ", "{", "case", "TypeDecimal", ",", "TypeTiny", ",", "TypeShort", ",", "TypeLong", ",", "TypeNull", ",", "TypeTimestamp", ",", "TypeLongLong", ",", "TypeInt24", ",", "TypeDate", ","...
// metadataLength returns how many bytes are used for metadata, based on a type.
[ "metadataLength", "returns", "how", "many", "bytes", "are", "used", "for", "metadata", "based", "on", "a", "type", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_rbr.go#L104-L126
135,396
vitessio/vitess
go/mysql/binlog_event_rbr.go
metadataTotalLength
func metadataTotalLength(types []byte) int { sum := 0 for _, t := range types { sum += metadataLength(t) } return sum }
go
func metadataTotalLength(types []byte) int { sum := 0 for _, t := range types { sum += metadataLength(t) } return sum }
[ "func", "metadataTotalLength", "(", "types", "[", "]", "byte", ")", "int", "{", "sum", ":=", "0", "\n", "for", "_", ",", "t", ":=", "range", "types", "{", "sum", "+=", "metadataLength", "(", "t", ")", "\n", "}", "\n", "return", "sum", "\n", "}" ]
// metadataTotalLength returns the total size of the metadata for an // array of types.
[ "metadataTotalLength", "returns", "the", "total", "size", "of", "the", "metadata", "for", "an", "array", "of", "types", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_rbr.go#L130-L136
135,397
vitessio/vitess
go/mysql/binlog_event_rbr.go
metadataRead
func metadataRead(data []byte, pos int, typ byte) (uint16, int, error) { switch typ { case TypeDecimal, TypeTiny, TypeShort, TypeLong, TypeNull, TypeTimestamp, TypeLongLong, TypeInt24, TypeDate, TypeTime, TypeDateTime, TypeYear, TypeNewDate: // No data here. return 0, pos, nil case TypeFloat, TypeDouble, TypeT...
go
func metadataRead(data []byte, pos int, typ byte) (uint16, int, error) { switch typ { case TypeDecimal, TypeTiny, TypeShort, TypeLong, TypeNull, TypeTimestamp, TypeLongLong, TypeInt24, TypeDate, TypeTime, TypeDateTime, TypeYear, TypeNewDate: // No data here. return 0, pos, nil case TypeFloat, TypeDouble, TypeT...
[ "func", "metadataRead", "(", "data", "[", "]", "byte", ",", "pos", "int", ",", "typ", "byte", ")", "(", "uint16", ",", "int", ",", "error", ")", "{", "switch", "typ", "{", "case", "TypeDecimal", ",", "TypeTiny", ",", "TypeShort", ",", "TypeLong", ","...
// metadataRead reads a single value from the metadata string.
[ "metadataRead", "reads", "a", "single", "value", "from", "the", "metadata", "string", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_rbr.go#L139-L162
135,398
vitessio/vitess
go/mysql/binlog_event_rbr.go
printTimestamp
func printTimestamp(v uint32) *bytes.Buffer { if v == 0 { return bytes.NewBuffer(ZeroTimestamp) } t := time.Unix(int64(v), 0).UTC() year, month, day := t.Date() hour, minute, second := t.Clock() result := &bytes.Buffer{} fmt.Fprintf(result, "%04d-%02d-%02d %02d:%02d:%02d", year, int(month), day, hour, minute...
go
func printTimestamp(v uint32) *bytes.Buffer { if v == 0 { return bytes.NewBuffer(ZeroTimestamp) } t := time.Unix(int64(v), 0).UTC() year, month, day := t.Date() hour, minute, second := t.Clock() result := &bytes.Buffer{} fmt.Fprintf(result, "%04d-%02d-%02d %02d:%02d:%02d", year, int(month), day, hour, minute...
[ "func", "printTimestamp", "(", "v", "uint32", ")", "*", "bytes", ".", "Buffer", "{", "if", "v", "==", "0", "{", "return", "bytes", ".", "NewBuffer", "(", "ZeroTimestamp", ")", "\n", "}", "\n\n", "t", ":=", "time", ".", "Unix", "(", "int64", "(", "v...
// printTimestamp is a helper method to append a timestamp into a bytes.Buffer, // and return the Buffer.
[ "printTimestamp", "is", "a", "helper", "method", "to", "append", "a", "timestamp", "into", "a", "bytes", ".", "Buffer", "and", "return", "the", "Buffer", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_rbr.go#L318-L330
135,399
vitessio/vitess
go/vt/vttablet/tabletserver/vstreamer/vstreamer.go
SetKSchema
func (vs *vstreamer) SetKSchema(kschema *vindexes.KeyspaceSchema) { // Since vs.Stream is a single-threaded loop. We just send an event to // that thread, which helps us avoid mutexes to update the plans. select { case vs.kevents <- kschema: case <-vs.ctx.Done(): } }
go
func (vs *vstreamer) SetKSchema(kschema *vindexes.KeyspaceSchema) { // Since vs.Stream is a single-threaded loop. We just send an event to // that thread, which helps us avoid mutexes to update the plans. select { case vs.kevents <- kschema: case <-vs.ctx.Done(): } }
[ "func", "(", "vs", "*", "vstreamer", ")", "SetKSchema", "(", "kschema", "*", "vindexes", ".", "KeyspaceSchema", ")", "{", "// Since vs.Stream is a single-threaded loop. We just send an event to", "// that thread, which helps us avoid mutexes to update the plans.", "select", "{", ...
// SetKSchema updates all existing against the new kschema.
[ "SetKSchema", "updates", "all", "existing", "against", "the", "new", "kschema", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go#L88-L95