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,200
vitessio/vitess
go/vt/servenv/grpc_auth.go
GetAuthenticator
func GetAuthenticator(name string) func() (Authenticator, error) { authPlugin, ok := authPlugins[name] if !ok { log.Fatalf("no AuthPlugin name %v registered", name) } return authPlugin }
go
func GetAuthenticator(name string) func() (Authenticator, error) { authPlugin, ok := authPlugins[name] if !ok { log.Fatalf("no AuthPlugin name %v registered", name) } return authPlugin }
[ "func", "GetAuthenticator", "(", "name", "string", ")", "func", "(", ")", "(", "Authenticator", ",", "error", ")", "{", "authPlugin", ",", "ok", ":=", "authPlugins", "[", "name", "]", "\n", "if", "!", "ok", "{", "log", ".", "Fatalf", "(", "\"", "\"",...
// GetAuthenticator returns an AuthPlugin by name, or log.Fatalf.
[ "GetAuthenticator", "returns", "an", "AuthPlugin", "by", "name", "or", "log", ".", "Fatalf", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/grpc_auth.go#L48-L54
135,201
vitessio/vitess
go/vt/servenv/grpc_auth.go
FakeAuthStreamInterceptor
func FakeAuthStreamInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { if fakeDummyAuthenticate(stream.Context()) { return handler(srv, stream) } return status.Errorf(codes.Unauthenticated, "username and password must be provided") }
go
func FakeAuthStreamInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { if fakeDummyAuthenticate(stream.Context()) { return handler(srv, stream) } return status.Errorf(codes.Unauthenticated, "username and password must be provided") }
[ "func", "FakeAuthStreamInterceptor", "(", "srv", "interface", "{", "}", ",", "stream", "grpc", ".", "ServerStream", ",", "info", "*", "grpc", ".", "StreamServerInfo", ",", "handler", "grpc", ".", "StreamHandler", ")", "error", "{", "if", "fakeDummyAuthenticate",...
// FakeAuthStreamInterceptor fake interceptor to test plugin
[ "FakeAuthStreamInterceptor", "fake", "interceptor", "to", "test", "plugin" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/grpc_auth.go#L57-L62
135,202
vitessio/vitess
go/vt/servenv/grpc_auth.go
FakeAuthUnaryInterceptor
func FakeAuthUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { if fakeDummyAuthenticate(ctx) { return handler(ctx, req) } return nil, status.Errorf(codes.Unauthenticated, "username and password must be provided") }
go
func FakeAuthUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { if fakeDummyAuthenticate(ctx) { return handler(ctx, req) } return nil, status.Errorf(codes.Unauthenticated, "username and password must be provided") }
[ "func", "FakeAuthUnaryInterceptor", "(", "ctx", "context", ".", "Context", ",", "req", "interface", "{", "}", ",", "info", "*", "grpc", ".", "UnaryServerInfo", ",", "handler", "grpc", ".", "UnaryHandler", ")", "(", "interface", "{", "}", ",", "error", ")",...
// FakeAuthUnaryInterceptor fake interceptor to test plugin
[ "FakeAuthUnaryInterceptor", "fake", "interceptor", "to", "test", "plugin" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/grpc_auth.go#L65-L70
135,203
vitessio/vitess
go/vt/throttler/demo/throttler_demo.go
execute
func (m *master) execute(msg time.Time) { m.replica.replicate(msg) }
go
func (m *master) execute(msg time.Time) { m.replica.replicate(msg) }
[ "func", "(", "m", "*", "master", ")", "execute", "(", "msg", "time", ".", "Time", ")", "{", "m", ".", "replica", ".", "replicate", "(", "msg", ")", "\n", "}" ]
// execute is the simulated RPC which is called by the client.
[ "execute", "is", "the", "simulated", "RPC", "which", "is", "called", "by", "the", "client", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/demo/throttler_demo.go#L77-L79
135,204
vitessio/vitess
go/vt/throttler/demo/throttler_demo.go
StatsUpdate
func (c *client) StatsUpdate(ts *discovery.TabletStats) { // Ignore unless REPLICA or RDONLY. if ts.Target.TabletType != topodatapb.TabletType_REPLICA && ts.Target.TabletType != topodatapb.TabletType_RDONLY { return } c.throttler.RecordReplicationLag(time.Now(), ts) }
go
func (c *client) StatsUpdate(ts *discovery.TabletStats) { // Ignore unless REPLICA or RDONLY. if ts.Target.TabletType != topodatapb.TabletType_REPLICA && ts.Target.TabletType != topodatapb.TabletType_RDONLY { return } c.throttler.RecordReplicationLag(time.Now(), ts) }
[ "func", "(", "c", "*", "client", ")", "StatsUpdate", "(", "ts", "*", "discovery", ".", "TabletStats", ")", "{", "// Ignore unless REPLICA or RDONLY.", "if", "ts", ".", "Target", ".", "TabletType", "!=", "topodatapb", ".", "TabletType_REPLICA", "&&", "ts", ".",...
// StatsUpdate implements discovery.HealthCheckStatsListener. // It gets called by the healthCheck instance every time a tablet broadcasts // a health update.
[ "StatsUpdate", "implements", "discovery", ".", "HealthCheckStatsListener", ".", "It", "gets", "called", "by", "the", "healthCheck", "instance", "every", "time", "a", "tablet", "broadcasts", "a", "health", "update", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/demo/throttler_demo.go#L279-L286
135,205
vitessio/vitess
go/vt/worker/vertical_split_diff.go
NewVerticalSplitDiffWorker
func NewVerticalSplitDiffWorker(wr *wrangler.Wrangler, cell, keyspace, shard string, minHealthyRdonlyTablets, parallelDiffsCount int, destintationTabletType topodatapb.TabletType) Worker { return &VerticalSplitDiffWorker{ StatusWorker: NewStatusWorker(), wr: wr, cell: ...
go
func NewVerticalSplitDiffWorker(wr *wrangler.Wrangler, cell, keyspace, shard string, minHealthyRdonlyTablets, parallelDiffsCount int, destintationTabletType topodatapb.TabletType) Worker { return &VerticalSplitDiffWorker{ StatusWorker: NewStatusWorker(), wr: wr, cell: ...
[ "func", "NewVerticalSplitDiffWorker", "(", "wr", "*", "wrangler", ".", "Wrangler", ",", "cell", ",", "keyspace", ",", "shard", "string", ",", "minHealthyRdonlyTablets", ",", "parallelDiffsCount", "int", ",", "destintationTabletType", "topodatapb", ".", "TabletType", ...
// NewVerticalSplitDiffWorker returns a new VerticalSplitDiffWorker object.
[ "NewVerticalSplitDiffWorker", "returns", "a", "new", "VerticalSplitDiffWorker", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/vertical_split_diff.go#L69-L81
135,206
vitessio/vitess
go/vt/sqlparser/redact_query.go
RedactSQLQuery
func RedactSQLQuery(sql string) (string, error) { bv := map[string]*querypb.BindVariable{} sqlStripped, comments := SplitMarginComments(sql) stmt, err := Parse(sqlStripped) if err != nil { return "", err } prefix := "redacted" Normalize(stmt, bv, prefix) return comments.Leading + String(stmt) + comments.Tr...
go
func RedactSQLQuery(sql string) (string, error) { bv := map[string]*querypb.BindVariable{} sqlStripped, comments := SplitMarginComments(sql) stmt, err := Parse(sqlStripped) if err != nil { return "", err } prefix := "redacted" Normalize(stmt, bv, prefix) return comments.Leading + String(stmt) + comments.Tr...
[ "func", "RedactSQLQuery", "(", "sql", "string", ")", "(", "string", ",", "error", ")", "{", "bv", ":=", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", "{", "}", "\n", "sqlStripped", ",", "comments", ":=", "SplitMarginComments", "(", "sql...
// RedactSQLQuery returns a sql string with the params stripped out for display
[ "RedactSQLQuery", "returns", "a", "sql", "string", "with", "the", "params", "stripped", "out", "for", "display" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/redact_query.go#L6-L19
135,207
vitessio/vitess
go/vt/vtctl/fakevtctlclient/fake_loggerevent_streamingclient.go
RegisterResultForAddr
func (f *FakeLoggerEventStreamingClient) RegisterResultForAddr(addr string, args []string, output string, err error) error { f.mu.Lock() defer f.mu.Unlock() k := generateKey(args) v := result{output, err, 1, addr} if result, ok := f.results[k]; ok { if result.Equals(v) { result.count++ return nil } re...
go
func (f *FakeLoggerEventStreamingClient) RegisterResultForAddr(addr string, args []string, output string, err error) error { f.mu.Lock() defer f.mu.Unlock() k := generateKey(args) v := result{output, err, 1, addr} if result, ok := f.results[k]; ok { if result.Equals(v) { result.count++ return nil } re...
[ "func", "(", "f", "*", "FakeLoggerEventStreamingClient", ")", "RegisterResultForAddr", "(", "addr", "string", ",", "args", "[", "]", "string", ",", "output", "string", ",", "err", "error", ")", "error", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", ...
// RegisterResultForAddr is identical to RegisterResult but also expects that // the client did dial "addr" as server address.
[ "RegisterResultForAddr", "is", "identical", "to", "RegisterResult", "but", "also", "expects", "that", "the", "client", "did", "dial", "addr", "as", "server", "address", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctl/fakevtctlclient/fake_loggerevent_streamingclient.go#L75-L90
135,208
vitessio/vitess
go/vt/vtctl/fakevtctlclient/fake_loggerevent_streamingclient.go
RegisteredCommands
func (f *FakeLoggerEventStreamingClient) RegisteredCommands() []string { f.mu.Lock() defer f.mu.Unlock() var commands []string for k := range f.results { commands = append(commands, k) } return commands }
go
func (f *FakeLoggerEventStreamingClient) RegisteredCommands() []string { f.mu.Lock() defer f.mu.Unlock() var commands []string for k := range f.results { commands = append(commands, k) } return commands }
[ "func", "(", "f", "*", "FakeLoggerEventStreamingClient", ")", "RegisteredCommands", "(", ")", "[", "]", "string", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "var", "commands", "[", "]",...
// RegisteredCommands returns a list of commands which are currently registered. // This is useful to check that all registered results have been consumed.
[ "RegisteredCommands", "returns", "a", "list", "of", "commands", "which", "are", "currently", "registered", ".", "This", "is", "useful", "to", "check", "that", "all", "registered", "results", "have", "been", "consumed", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctl/fakevtctlclient/fake_loggerevent_streamingclient.go#L94-L103
135,209
vitessio/vitess
go/vt/vtctl/fakevtctlclient/fake_loggerevent_streamingclient.go
StreamResult
func (f *FakeLoggerEventStreamingClient) StreamResult(addr string, args []string) (logutil.EventStream, error) { f.mu.Lock() defer f.mu.Unlock() k := generateKey(args) result, ok := f.results[k] if !ok { return nil, fmt.Errorf("no response was registered for args: %v", args) } if result.addr != "" && addr != ...
go
func (f *FakeLoggerEventStreamingClient) StreamResult(addr string, args []string) (logutil.EventStream, error) { f.mu.Lock() defer f.mu.Unlock() k := generateKey(args) result, ok := f.results[k] if !ok { return nil, fmt.Errorf("no response was registered for args: %v", args) } if result.addr != "" && addr != ...
[ "func", "(", "f", "*", "FakeLoggerEventStreamingClient", ")", "StreamResult", "(", "addr", "string", ",", "args", "[", "]", "string", ")", "(", "logutil", ".", "EventStream", ",", "error", ")", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer",...
// StreamResult returns an EventStream which streams back a registered result as logging events. // "addr" is the server address which the client dialed and may be empty.
[ "StreamResult", "returns", "an", "EventStream", "which", "streams", "back", "a", "registered", "result", "as", "logging", "events", ".", "addr", "is", "the", "server", "address", "which", "the", "client", "dialed", "and", "may", "be", "empty", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctl/fakevtctlclient/fake_loggerevent_streamingclient.go#L131-L153
135,210
vitessio/vitess
go/vt/vttablet/tabletmanager/vreplication/stats.go
StatusSummary
func StatusSummary() (maxSecondsBehindMaster int64, binlogPlayersCount int32) { return globalStats.maxSecondsBehindMaster(), int32(globalStats.numControllers()) }
go
func StatusSummary() (maxSecondsBehindMaster int64, binlogPlayersCount int32) { return globalStats.maxSecondsBehindMaster(), int32(globalStats.numControllers()) }
[ "func", "StatusSummary", "(", ")", "(", "maxSecondsBehindMaster", "int64", ",", "binlogPlayersCount", "int32", ")", "{", "return", "globalStats", ".", "maxSecondsBehindMaster", "(", ")", ",", "int32", "(", "globalStats", ".", "numControllers", "(", ")", ")", "\n...
// StatusSummary returns the summary status of vreplication.
[ "StatusSummary", "returns", "the", "summary", "status", "of", "vreplication", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/stats.go#L37-L39
135,211
vitessio/vitess
go/vt/vtgate/buffer/shard_buffer.go
oldestEntry
func (sb *shardBuffer) oldestEntry() *entry { sb.mu.Lock() defer sb.mu.Unlock() if len(sb.queue) > 0 { return sb.queue[0] } return nil }
go
func (sb *shardBuffer) oldestEntry() *entry { sb.mu.Lock() defer sb.mu.Unlock() if len(sb.queue) > 0 { return sb.queue[0] } return nil }
[ "func", "(", "sb", "*", "shardBuffer", ")", "oldestEntry", "(", ")", "*", "entry", "{", "sb", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "sb", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "len", "(", "sb", ".", "queue", ")", ">", "...
// oldestEntry returns the head of the queue or nil if the queue is empty.
[ "oldestEntry", "returns", "the", "head", "of", "the", "queue", "or", "nil", "if", "the", "queue", "is", "empty", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/buffer/shard_buffer.go#L396-L404
135,212
vitessio/vitess
go/vt/vtgate/buffer/shard_buffer.go
evictOldestEntry
func (sb *shardBuffer) evictOldestEntry(e *entry) { sb.mu.Lock() defer sb.mu.Unlock() if len(sb.queue) == 0 || e != sb.queue[0] { // Entry is already removed e.g. by remove(). Ignore it. return } // Evict the entry. // // NOTE: We're not waiting for the request to finish in order to unblock the // timeout...
go
func (sb *shardBuffer) evictOldestEntry(e *entry) { sb.mu.Lock() defer sb.mu.Unlock() if len(sb.queue) == 0 || e != sb.queue[0] { // Entry is already removed e.g. by remove(). Ignore it. return } // Evict the entry. // // NOTE: We're not waiting for the request to finish in order to unblock the // timeout...
[ "func", "(", "sb", "*", "shardBuffer", ")", "evictOldestEntry", "(", "e", "*", "entry", ")", "{", "sb", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "sb", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "len", "(", "sb", ".", "queue", ")"...
// evictOldestEntry is used by timeoutThread to evict the head entry of the // queue if it exceeded its buffering window.
[ "evictOldestEntry", "is", "used", "by", "timeoutThread", "to", "evict", "the", "head", "entry", "of", "the", "queue", "if", "it", "exceeded", "its", "buffering", "window", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/buffer/shard_buffer.go#L408-L428
135,213
vitessio/vitess
go/vt/vtgate/buffer/shard_buffer.go
remove
func (sb *shardBuffer) remove(toRemove *entry) { sb.mu.Lock() defer sb.mu.Unlock() if sb.queue == nil { // Queue is cleared because we're already in the DRAIN phase. return } // If entry is still in the queue, delete it and cancel it internally. for i, e := range sb.queue { if e == toRemove { // Delete...
go
func (sb *shardBuffer) remove(toRemove *entry) { sb.mu.Lock() defer sb.mu.Unlock() if sb.queue == nil { // Queue is cleared because we're already in the DRAIN phase. return } // If entry is still in the queue, delete it and cancel it internally. for i, e := range sb.queue { if e == toRemove { // Delete...
[ "func", "(", "sb", "*", "shardBuffer", ")", "remove", "(", "toRemove", "*", "entry", ")", "{", "sb", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "sb", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "sb", ".", "queue", "==", "nil", "{", ...
// remove must be called when the request was canceled from outside and not // internally.
[ "remove", "must", "be", "called", "when", "the", "request", "was", "canceled", "from", "outside", "and", "not", "internally", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/buffer/shard_buffer.go#L432-L469
135,214
vitessio/vitess
go/mysql/auth_server_static.go
InitAuthServerStatic
func InitAuthServerStatic() { // Check parameters. if *mysqlAuthServerStaticFile == "" && *mysqlAuthServerStaticString == "" { // Not configured, nothing to do. log.Infof("Not configuring AuthServerStatic, as mysql_auth_server_static_file and mysql_auth_server_static_string are empty") return } if *mysqlAuthS...
go
func InitAuthServerStatic() { // Check parameters. if *mysqlAuthServerStaticFile == "" && *mysqlAuthServerStaticString == "" { // Not configured, nothing to do. log.Infof("Not configuring AuthServerStatic, as mysql_auth_server_static_file and mysql_auth_server_static_string are empty") return } if *mysqlAuthS...
[ "func", "InitAuthServerStatic", "(", ")", "{", "// Check parameters.", "if", "*", "mysqlAuthServerStaticFile", "==", "\"", "\"", "&&", "*", "mysqlAuthServerStaticString", "==", "\"", "\"", "{", "// Not configured, nothing to do.", "log", ".", "Infof", "(", "\"", "\"...
// InitAuthServerStatic Handles initializing the AuthServerStatic if necessary.
[ "InitAuthServerStatic", "Handles", "initializing", "the", "AuthServerStatic", "if", "necessary", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/auth_server_static.go#L82-L96
135,215
vitessio/vitess
go/mysql/auth_server_static.go
RegisterAuthServerStaticFromParams
func RegisterAuthServerStaticFromParams(file, str string) { authServerStatic := NewAuthServerStatic() authServerStatic.loadConfigFromParams(file, str) if len(authServerStatic.Entries) <= 0 { log.Exitf("Failed to populate entries from file: %v", file) } authServerStatic.installSignalHandlers() // And register...
go
func RegisterAuthServerStaticFromParams(file, str string) { authServerStatic := NewAuthServerStatic() authServerStatic.loadConfigFromParams(file, str) if len(authServerStatic.Entries) <= 0 { log.Exitf("Failed to populate entries from file: %v", file) } authServerStatic.installSignalHandlers() // And register...
[ "func", "RegisterAuthServerStaticFromParams", "(", "file", ",", "str", "string", ")", "{", "authServerStatic", ":=", "NewAuthServerStatic", "(", ")", "\n\n", "authServerStatic", ".", "loadConfigFromParams", "(", "file", ",", "str", ")", "\n\n", "if", "len", "(", ...
// RegisterAuthServerStaticFromParams creates and registers a new // AuthServerStatic, loaded for a JSON file or string. If file is set, // it uses file. Otherwise, load the string. It log.Exits out in case // of error.
[ "RegisterAuthServerStaticFromParams", "creates", "and", "registers", "a", "new", "AuthServerStatic", "loaded", "for", "a", "JSON", "file", "or", "string", ".", "If", "file", "is", "set", "it", "uses", "file", ".", "Otherwise", "load", "the", "string", ".", "It...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/auth_server_static.go#L110-L122
135,216
vitessio/vitess
go/mysql/auth_server_static.go
ValidateHash
func (a *AuthServerStatic) ValidateHash(salt []byte, user string, authResponse []byte, remoteAddr net.Addr) (Getter, error) { a.mu.Lock() entries, ok := a.Entries[user] a.mu.Unlock() if !ok { return &StaticUserData{}, NewSQLError(ERAccessDeniedError, SSAccessDeniedError, "Access denied for user '%v'", user) } ...
go
func (a *AuthServerStatic) ValidateHash(salt []byte, user string, authResponse []byte, remoteAddr net.Addr) (Getter, error) { a.mu.Lock() entries, ok := a.Entries[user] a.mu.Unlock() if !ok { return &StaticUserData{}, NewSQLError(ERAccessDeniedError, SSAccessDeniedError, "Access denied for user '%v'", user) } ...
[ "func", "(", "a", "*", "AuthServerStatic", ")", "ValidateHash", "(", "salt", "[", "]", "byte", ",", "user", "string", ",", "authResponse", "[", "]", "byte", ",", "remoteAddr", "net", ".", "Addr", ")", "(", "Getter", ",", "error", ")", "{", "a", ".", ...
// ValidateHash is part of the AuthServer interface.
[ "ValidateHash", "is", "part", "of", "the", "AuthServer", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/auth_server_static.go#L224-L248
135,217
vitessio/vitess
go/mysql/auth_server_static.go
Negotiate
func (a *AuthServerStatic) Negotiate(c *Conn, user string, remoteAddr net.Addr) (Getter, error) { // Finish the negotiation. password, err := AuthServerNegotiateClearOrDialog(c, a.Method) if err != nil { return nil, err } a.mu.Lock() entries, ok := a.Entries[user] a.mu.Unlock() if !ok { return &StaticUser...
go
func (a *AuthServerStatic) Negotiate(c *Conn, user string, remoteAddr net.Addr) (Getter, error) { // Finish the negotiation. password, err := AuthServerNegotiateClearOrDialog(c, a.Method) if err != nil { return nil, err } a.mu.Lock() entries, ok := a.Entries[user] a.mu.Unlock() if !ok { return &StaticUser...
[ "func", "(", "a", "*", "AuthServerStatic", ")", "Negotiate", "(", "c", "*", "Conn", ",", "user", "string", ",", "remoteAddr", "net", ".", "Addr", ")", "(", "Getter", ",", "error", ")", "{", "// Finish the negotiation.", "password", ",", "err", ":=", "Aut...
// Negotiate is part of the AuthServer interface. // It will be called if Method is anything else than MysqlNativePassword. // We only recognize MysqlClearPassword and MysqlDialog here.
[ "Negotiate", "is", "part", "of", "the", "AuthServer", "interface", ".", "It", "will", "be", "called", "if", "Method", "is", "anything", "else", "than", "MysqlNativePassword", ".", "We", "only", "recognize", "MysqlClearPassword", "and", "MysqlDialog", "here", "."...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/auth_server_static.go#L253-L274
135,218
vitessio/vitess
go/mysql/auth_server_static.go
Get
func (sud *StaticUserData) Get() *querypb.VTGateCallerID { return &querypb.VTGateCallerID{Username: sud.username, Groups: sud.groups} }
go
func (sud *StaticUserData) Get() *querypb.VTGateCallerID { return &querypb.VTGateCallerID{Username: sud.username, Groups: sud.groups} }
[ "func", "(", "sud", "*", "StaticUserData", ")", "Get", "(", ")", "*", "querypb", ".", "VTGateCallerID", "{", "return", "&", "querypb", ".", "VTGateCallerID", "{", "Username", ":", "sud", ".", "username", ",", "Groups", ":", "sud", ".", "groups", "}", "...
// Get returns the wrapped username and groups
[ "Get", "returns", "the", "wrapped", "username", "and", "groups" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/auth_server_static.go#L297-L299
135,219
vitessio/vitess
go/vt/vtctld/explorer.go
HandlePath
func (ex *backendExplorer) HandlePath(nodePath string, r *http.Request) *Result { ctx := context.Background() result := &Result{} // Handle toplevel display: global, then one line per cell. if nodePath == "/" { cells, err := ex.ts.GetKnownCells(ctx) if err != nil { result.Error = err.Error() return resul...
go
func (ex *backendExplorer) HandlePath(nodePath string, r *http.Request) *Result { ctx := context.Background() result := &Result{} // Handle toplevel display: global, then one line per cell. if nodePath == "/" { cells, err := ex.ts.GetKnownCells(ctx) if err != nil { result.Error = err.Error() return resul...
[ "func", "(", "ex", "*", "backendExplorer", ")", "HandlePath", "(", "nodePath", "string", ",", "r", "*", "http", ".", "Request", ")", "*", "Result", "{", "ctx", ":=", "context", ".", "Background", "(", ")", "\n", "result", ":=", "&", "Result", "{", "}...
// HandlePath is the main function for this class.
[ "HandlePath", "is", "the", "main", "function", "for", "this", "class", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/explorer.go#L56-L119
135,220
vitessio/vitess
go/vt/vtctld/explorer.go
handleExplorerRedirect
func handleExplorerRedirect(ctx context.Context, ts *topo.Server, r *http.Request) (string, error) { keyspace := r.FormValue("keyspace") shard := r.FormValue("shard") cell := r.FormValue("cell") switch r.FormValue("type") { case "keyspace": if keyspace == "" { return "", errors.New("keyspace is required for ...
go
func handleExplorerRedirect(ctx context.Context, ts *topo.Server, r *http.Request) (string, error) { keyspace := r.FormValue("keyspace") shard := r.FormValue("shard") cell := r.FormValue("cell") switch r.FormValue("type") { case "keyspace": if keyspace == "" { return "", errors.New("keyspace is required for ...
[ "func", "handleExplorerRedirect", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "topo", ".", "Server", ",", "r", "*", "http", ".", "Request", ")", "(", "string", ",", "error", ")", "{", "keyspace", ":=", "r", ".", "FormValue", "(", "\"", "\"...
// handleExplorerRedirect returns the redirect target URL.
[ "handleExplorerRedirect", "returns", "the", "redirect", "target", "URL", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/explorer.go#L122-L165
135,221
vitessio/vitess
go/vt/vtctld/explorer.go
initExplorer
func initExplorer(ts *topo.Server) { // Main backend explorer functions. be := newBackendExplorer(ts) handleCollection("topodata", func(r *http.Request) (interface{}, error) { return be.HandlePath(path.Clean("/"+getItemPath(r.URL.Path)), r), nil }) // Redirects for explorers. http.HandleFunc("/explorers/redire...
go
func initExplorer(ts *topo.Server) { // Main backend explorer functions. be := newBackendExplorer(ts) handleCollection("topodata", func(r *http.Request) (interface{}, error) { return be.HandlePath(path.Clean("/"+getItemPath(r.URL.Path)), r), nil }) // Redirects for explorers. http.HandleFunc("/explorers/redire...
[ "func", "initExplorer", "(", "ts", "*", "topo", ".", "Server", ")", "{", "// Main backend explorer functions.", "be", ":=", "newBackendExplorer", "(", "ts", ")", "\n", "handleCollection", "(", "\"", "\"", ",", "func", "(", "r", "*", "http", ".", "Request", ...
// initExplorer initializes the redirects for explorer
[ "initExplorer", "initializes", "the", "redirects", "for", "explorer" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/explorer.go#L168-L190
135,222
vitessio/vitess
go/vt/vttablet/tabletserver/planbuilder/dml.go
analyzeOnDupExpressions
func analyzeOnDupExpressions(ins *sqlparser.Insert, pkIndex *schema.Index) (pkValues []sqltypes.PlanValue, ok bool) { rowList := ins.Rows.(sqlparser.Values) for _, expr := range ins.OnDup { index := pkIndex.FindColumn(expr.Name.Name) if index == -1 { continue } if pkValues == nil { pkValues = make([]sq...
go
func analyzeOnDupExpressions(ins *sqlparser.Insert, pkIndex *schema.Index) (pkValues []sqltypes.PlanValue, ok bool) { rowList := ins.Rows.(sqlparser.Values) for _, expr := range ins.OnDup { index := pkIndex.FindColumn(expr.Name.Name) if index == -1 { continue } if pkValues == nil { pkValues = make([]sq...
[ "func", "analyzeOnDupExpressions", "(", "ins", "*", "sqlparser", ".", "Insert", ",", "pkIndex", "*", "schema", ".", "Index", ")", "(", "pkValues", "[", "]", "sqltypes", ".", "PlanValue", ",", "ok", "bool", ")", "{", "rowList", ":=", "ins", ".", "Rows", ...
// analyzeOnDupExpressions analyzes the OnDup and returns the list for any pk value changes.
[ "analyzeOnDupExpressions", "analyzes", "the", "OnDup", "and", "returns", "the", "list", "for", "any", "pk", "value", "changes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/planbuilder/dml.go#L611-L643
135,223
vitessio/vitess
go/vt/vttablet/tabletserver/planbuilder/dml.go
extractColumnValues
func extractColumnValues(rowList sqlparser.Values, colnum int) (sqltypes.PlanValue, bool) { pv := sqltypes.PlanValue{Values: make([]sqltypes.PlanValue, len(rowList))} for i := 0; i < len(rowList); i++ { var ok bool pv.Values[i], ok = extractSingleValue(rowList[i][colnum]) if !ok { return pv, false } } re...
go
func extractColumnValues(rowList sqlparser.Values, colnum int) (sqltypes.PlanValue, bool) { pv := sqltypes.PlanValue{Values: make([]sqltypes.PlanValue, len(rowList))} for i := 0; i < len(rowList); i++ { var ok bool pv.Values[i], ok = extractSingleValue(rowList[i][colnum]) if !ok { return pv, false } } re...
[ "func", "extractColumnValues", "(", "rowList", "sqlparser", ".", "Values", ",", "colnum", "int", ")", "(", "sqltypes", ".", "PlanValue", ",", "bool", ")", "{", "pv", ":=", "sqltypes", ".", "PlanValue", "{", "Values", ":", "make", "(", "[", "]", "sqltypes...
// extractColumnValues extracts the values of a column into a PlanValue.
[ "extractColumnValues", "extracts", "the", "values", "of", "a", "column", "into", "a", "PlanValue", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/planbuilder/dml.go#L646-L656
135,224
vitessio/vitess
go/vt/vtctl/query.go
printQueryResult
func printQueryResult(writer io.Writer, qr *sqltypes.Result) { table := tablewriter.NewWriter(writer) table.SetAutoFormatHeaders(false) // Make header. header := make([]string, 0, len(qr.Fields)) for _, field := range qr.Fields { header = append(header, field.Name) } table.SetHeader(header) // Add rows. fo...
go
func printQueryResult(writer io.Writer, qr *sqltypes.Result) { table := tablewriter.NewWriter(writer) table.SetAutoFormatHeaders(false) // Make header. header := make([]string, 0, len(qr.Fields)) for _, field := range qr.Fields { header = append(header, field.Name) } table.SetHeader(header) // Add rows. fo...
[ "func", "printQueryResult", "(", "writer", "io", ".", "Writer", ",", "qr", "*", "sqltypes", ".", "Result", ")", "{", "table", ":=", "tablewriter", ".", "NewWriter", "(", "writer", ")", "\n", "table", ".", "SetAutoFormatHeaders", "(", "false", ")", "\n\n", ...
// printQueryResult will pretty-print a QueryResult to the logger.
[ "printQueryResult", "will", "pretty", "-", "print", "a", "QueryResult", "to", "the", "logger", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctl/query.go#L708-L730
135,225
vitessio/vitess
go/vt/vtgate/gateway/status.go
registerAggregator
func registerAggregator(a *TabletStatusAggregator) { muAggr.Lock() defer muAggr.Unlock() aggregators = append(aggregators, a) }
go
func registerAggregator(a *TabletStatusAggregator) { muAggr.Lock() defer muAggr.Unlock() aggregators = append(aggregators, a) }
[ "func", "registerAggregator", "(", "a", "*", "TabletStatusAggregator", ")", "{", "muAggr", ".", "Lock", "(", ")", "\n", "defer", "muAggr", ".", "Unlock", "(", ")", "\n", "aggregators", "=", "append", "(", "aggregators", ",", "a", ")", "\n", "}" ]
// registerAggregator registers an aggregator to the global list.
[ "registerAggregator", "registers", "an", "aggregator", "to", "the", "global", "list", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/status.go#L99-L103
135,226
vitessio/vitess
go/vt/vtgate/gateway/status.go
resetAggregators
func resetAggregators() { ticker := time.NewTicker(time.Second) for range ticker.C { muAggr.Lock() for _, a := range aggregators { a.resetNextSlot() } muAggr.Unlock() } }
go
func resetAggregators() { ticker := time.NewTicker(time.Second) for range ticker.C { muAggr.Lock() for _, a := range aggregators { a.resetNextSlot() } muAggr.Unlock() } }
[ "func", "resetAggregators", "(", ")", "{", "ticker", ":=", "time", ".", "NewTicker", "(", "time", ".", "Second", ")", "\n", "for", "range", "ticker", ".", "C", "{", "muAggr", ".", "Lock", "(", ")", "\n", "for", "_", ",", "a", ":=", "range", "aggreg...
// resetAggregators resets the next stats slot for all aggregators every second.
[ "resetAggregators", "resets", "the", "next", "stats", "slot", "for", "all", "aggregators", "every", "second", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/status.go#L106-L115
135,227
vitessio/vitess
go/vt/vtgate/gateway/status.go
NewTabletStatusAggregator
func NewTabletStatusAggregator(keyspace, shard string, tabletType topodatapb.TabletType, name string) *TabletStatusAggregator { tsa := &TabletStatusAggregator{ Keyspace: keyspace, Shard: shard, TabletType: tabletType, Name: name, } registerAggregator(tsa) return tsa }
go
func NewTabletStatusAggregator(keyspace, shard string, tabletType topodatapb.TabletType, name string) *TabletStatusAggregator { tsa := &TabletStatusAggregator{ Keyspace: keyspace, Shard: shard, TabletType: tabletType, Name: name, } registerAggregator(tsa) return tsa }
[ "func", "NewTabletStatusAggregator", "(", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "name", "string", ")", "*", "TabletStatusAggregator", "{", "tsa", ":=", "&", "TabletStatusAggregator", "{", "Keyspace", ":", "key...
// NewTabletStatusAggregator creates a TabletStatusAggregator.
[ "NewTabletStatusAggregator", "creates", "a", "TabletStatusAggregator", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/status.go#L180-L189
135,228
vitessio/vitess
go/vt/vtgate/gateway/status.go
UpdateQueryInfo
func (tsa *TabletStatusAggregator) UpdateQueryInfo(addr string, tabletType topodatapb.TabletType, elapsed time.Duration, hasError bool) { qi := &queryInfo{ aggr: tsa, addr: addr, tabletType: tabletType, elapsed: elapsed, hasError: hasError, } select { case aggrChan <- qi: default: gate...
go
func (tsa *TabletStatusAggregator) UpdateQueryInfo(addr string, tabletType topodatapb.TabletType, elapsed time.Duration, hasError bool) { qi := &queryInfo{ aggr: tsa, addr: addr, tabletType: tabletType, elapsed: elapsed, hasError: hasError, } select { case aggrChan <- qi: default: gate...
[ "func", "(", "tsa", "*", "TabletStatusAggregator", ")", "UpdateQueryInfo", "(", "addr", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "elapsed", "time", ".", "Duration", ",", "hasError", "bool", ")", "{", "qi", ":=", "&", "queryInfo", "{...
// UpdateQueryInfo updates the aggregator with the given information about a query.
[ "UpdateQueryInfo", "updates", "the", "aggregator", "with", "the", "given", "information", "about", "a", "query", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/status.go#L192-L205
135,229
vitessio/vitess
go/vt/vtgate/gateway/status.go
GetCacheStatus
func (tsa *TabletStatusAggregator) GetCacheStatus() *TabletCacheStatus { status := &TabletCacheStatus{ Keyspace: tsa.Keyspace, Shard: tsa.Shard, Name: tsa.Name, } tsa.mu.RLock() defer tsa.mu.RUnlock() status.TabletType = tsa.TabletType status.Addr = tsa.Addr status.QueryCount = tsa.QueryCount statu...
go
func (tsa *TabletStatusAggregator) GetCacheStatus() *TabletCacheStatus { status := &TabletCacheStatus{ Keyspace: tsa.Keyspace, Shard: tsa.Shard, Name: tsa.Name, } tsa.mu.RLock() defer tsa.mu.RUnlock() status.TabletType = tsa.TabletType status.Addr = tsa.Addr status.QueryCount = tsa.QueryCount statu...
[ "func", "(", "tsa", "*", "TabletStatusAggregator", ")", "GetCacheStatus", "(", ")", "*", "TabletCacheStatus", "{", "status", ":=", "&", "TabletCacheStatus", "{", "Keyspace", ":", "tsa", ".", "Keyspace", ",", "Shard", ":", "tsa", ".", "Shard", ",", "Name", ...
// GetCacheStatus returns a TabletCacheStatus representing the current gateway status.
[ "GetCacheStatus", "returns", "a", "TabletCacheStatus", "representing", "the", "current", "gateway", "status", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/status.go#L234-L259
135,230
vitessio/vitess
go/vt/vtgate/gateway/status.go
resetNextSlot
func (tsa *TabletStatusAggregator) resetNextSlot() { tsa.mu.Lock() defer tsa.mu.Unlock() tsa.tick = (tsa.tick + 1) % 60 tsa.queryCountInMinute[tsa.tick] = 0 tsa.latencyInMinute[tsa.tick] = time.Duration(0) }
go
func (tsa *TabletStatusAggregator) resetNextSlot() { tsa.mu.Lock() defer tsa.mu.Unlock() tsa.tick = (tsa.tick + 1) % 60 tsa.queryCountInMinute[tsa.tick] = 0 tsa.latencyInMinute[tsa.tick] = time.Duration(0) }
[ "func", "(", "tsa", "*", "TabletStatusAggregator", ")", "resetNextSlot", "(", ")", "{", "tsa", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tsa", ".", "mu", ".", "Unlock", "(", ")", "\n", "tsa", ".", "tick", "=", "(", "tsa", ".", "tick", "+"...
// resetNextSlot resets the next tracking slot.
[ "resetNextSlot", "resets", "the", "next", "tracking", "slot", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/gateway/status.go#L262-L268
135,231
vitessio/vitess
go/vt/vttablet/endtoend/framework/streamqueryz.go
StreamTerminate
func StreamTerminate(connID int) error { response, err := http.Get(fmt.Sprintf("%s/streamqueryz/terminate?format=json&connID=%d", ServerAddress, connID)) if err != nil { return err } response.Body.Close() return nil }
go
func StreamTerminate(connID int) error { response, err := http.Get(fmt.Sprintf("%s/streamqueryz/terminate?format=json&connID=%d", ServerAddress, connID)) if err != nil { return err } response.Body.Close() return nil }
[ "func", "StreamTerminate", "(", "connID", "int", ")", "error", "{", "response", ",", "err", ":=", "http", ".", "Get", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ServerAddress", ",", "connID", ")", ")", "\n", "if", "err", "!=", "nil", "{", "...
// StreamTerminate terminates the specified streaming query.
[ "StreamTerminate", "terminates", "the", "specified", "streaming", "query", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/endtoend/framework/streamqueryz.go#L51-L58
135,232
vitessio/vitess
go/vt/key/key.go
ParseKeyspaceIDType
func ParseKeyspaceIDType(param string) (topodatapb.KeyspaceIdType, error) { if param == "" { return topodatapb.KeyspaceIdType_UNSET, nil } value, ok := topodatapb.KeyspaceIdType_value[strings.ToUpper(param)] if !ok { return topodatapb.KeyspaceIdType_UNSET, fmt.Errorf("unknown KeyspaceIdType %v", param) } retu...
go
func ParseKeyspaceIDType(param string) (topodatapb.KeyspaceIdType, error) { if param == "" { return topodatapb.KeyspaceIdType_UNSET, nil } value, ok := topodatapb.KeyspaceIdType_value[strings.ToUpper(param)] if !ok { return topodatapb.KeyspaceIdType_UNSET, fmt.Errorf("unknown KeyspaceIdType %v", param) } retu...
[ "func", "ParseKeyspaceIDType", "(", "param", "string", ")", "(", "topodatapb", ".", "KeyspaceIdType", ",", "error", ")", "{", "if", "param", "==", "\"", "\"", "{", "return", "topodatapb", ".", "KeyspaceIdType_UNSET", ",", "nil", "\n", "}", "\n", "value", "...
// // KeyspaceIdType helper methods // // ParseKeyspaceIDType parses the keyspace id type into the enum
[ "KeyspaceIdType", "helper", "methods", "ParseKeyspaceIDType", "parses", "the", "keyspace", "id", "type", "into", "the", "enum" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/key/key.go#L53-L62
135,233
vitessio/vitess
go/vt/key/key.go
KeyRangeContains
func KeyRangeContains(kr *topodatapb.KeyRange, id []byte) bool { if kr == nil { return true } return bytes.Compare(kr.Start, id) <= 0 && (len(kr.End) == 0 || bytes.Compare(id, kr.End) < 0) }
go
func KeyRangeContains(kr *topodatapb.KeyRange, id []byte) bool { if kr == nil { return true } return bytes.Compare(kr.Start, id) <= 0 && (len(kr.End) == 0 || bytes.Compare(id, kr.End) < 0) }
[ "func", "KeyRangeContains", "(", "kr", "*", "topodatapb", ".", "KeyRange", ",", "id", "[", "]", "byte", ")", "bool", "{", "if", "kr", "==", "nil", "{", "return", "true", "\n", "}", "\n", "return", "bytes", ".", "Compare", "(", "kr", ".", "Start", "...
// KeyRangeContains returns true if the provided id is in the keyrange.
[ "KeyRangeContains", "returns", "true", "if", "the", "provided", "id", "is", "in", "the", "keyrange", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/key/key.go#L123-L129
135,234
vitessio/vitess
go/vt/key/key.go
ParseKeyRangeParts
func ParseKeyRangeParts(start, end string) (*topodatapb.KeyRange, error) { s, err := hex.DecodeString(start) if err != nil { return nil, err } e, err := hex.DecodeString(end) if err != nil { return nil, err } return &topodatapb.KeyRange{Start: s, End: e}, nil }
go
func ParseKeyRangeParts(start, end string) (*topodatapb.KeyRange, error) { s, err := hex.DecodeString(start) if err != nil { return nil, err } e, err := hex.DecodeString(end) if err != nil { return nil, err } return &topodatapb.KeyRange{Start: s, End: e}, nil }
[ "func", "ParseKeyRangeParts", "(", "start", ",", "end", "string", ")", "(", "*", "topodatapb", ".", "KeyRange", ",", "error", ")", "{", "s", ",", "err", ":=", "hex", ".", "DecodeString", "(", "start", ")", "\n", "if", "err", "!=", "nil", "{", "return...
// ParseKeyRangeParts parses a start and end hex values and build a proto KeyRange
[ "ParseKeyRangeParts", "parses", "a", "start", "and", "end", "hex", "values", "and", "build", "a", "proto", "KeyRange" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/key/key.go#L132-L142
135,235
vitessio/vitess
go/vt/key/key.go
KeyRangeString
func KeyRangeString(k *topodatapb.KeyRange) string { if k == nil { return "-" } return hex.EncodeToString(k.Start) + "-" + hex.EncodeToString(k.End) }
go
func KeyRangeString(k *topodatapb.KeyRange) string { if k == nil { return "-" } return hex.EncodeToString(k.Start) + "-" + hex.EncodeToString(k.End) }
[ "func", "KeyRangeString", "(", "k", "*", "topodatapb", ".", "KeyRange", ")", "string", "{", "if", "k", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "hex", ".", "EncodeToString", "(", "k", ".", "Start", ")", "+", "\"", "\"", "+...
// KeyRangeString prints a topodatapb.KeyRange
[ "KeyRangeString", "prints", "a", "topodatapb", ".", "KeyRange" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/key/key.go#L145-L150
135,236
vitessio/vitess
go/vt/key/key.go
KeyRangeIsPartial
func KeyRangeIsPartial(kr *topodatapb.KeyRange) bool { if kr == nil { return false } return !(len(kr.Start) == 0 && len(kr.End) == 0) }
go
func KeyRangeIsPartial(kr *topodatapb.KeyRange) bool { if kr == nil { return false } return !(len(kr.Start) == 0 && len(kr.End) == 0) }
[ "func", "KeyRangeIsPartial", "(", "kr", "*", "topodatapb", ".", "KeyRange", ")", "bool", "{", "if", "kr", "==", "nil", "{", "return", "false", "\n", "}", "\n", "return", "!", "(", "len", "(", "kr", ".", "Start", ")", "==", "0", "&&", "len", "(", ...
// KeyRangeIsPartial returns true if the KeyRange does not cover the entire space.
[ "KeyRangeIsPartial", "returns", "true", "if", "the", "KeyRange", "does", "not", "cover", "the", "entire", "space", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/key/key.go#L153-L158
135,237
vitessio/vitess
go/vt/key/key.go
KeyRangeEqual
func KeyRangeEqual(left, right *topodatapb.KeyRange) bool { if left == nil { return right == nil || (len(right.Start) == 0 && len(right.End) == 0) } if right == nil { return len(left.Start) == 0 && len(left.End) == 0 } return bytes.Equal(left.Start, right.Start) && bytes.Equal(left.End, right.End) }
go
func KeyRangeEqual(left, right *topodatapb.KeyRange) bool { if left == nil { return right == nil || (len(right.Start) == 0 && len(right.End) == 0) } if right == nil { return len(left.Start) == 0 && len(left.End) == 0 } return bytes.Equal(left.Start, right.Start) && bytes.Equal(left.End, right.End) }
[ "func", "KeyRangeEqual", "(", "left", ",", "right", "*", "topodatapb", ".", "KeyRange", ")", "bool", "{", "if", "left", "==", "nil", "{", "return", "right", "==", "nil", "||", "(", "len", "(", "right", ".", "Start", ")", "==", "0", "&&", "len", "("...
// KeyRangeEqual returns true if both key ranges cover the same area
[ "KeyRangeEqual", "returns", "true", "if", "both", "key", "ranges", "cover", "the", "same", "area" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/key/key.go#L161-L170
135,238
vitessio/vitess
go/vt/key/key.go
KeyRangeStartEqual
func KeyRangeStartEqual(left, right *topodatapb.KeyRange) bool { if left == nil { return right == nil || len(right.Start) == 0 } if right == nil { return len(left.Start) == 0 } return bytes.Equal(left.Start, right.Start) }
go
func KeyRangeStartEqual(left, right *topodatapb.KeyRange) bool { if left == nil { return right == nil || len(right.Start) == 0 } if right == nil { return len(left.Start) == 0 } return bytes.Equal(left.Start, right.Start) }
[ "func", "KeyRangeStartEqual", "(", "left", ",", "right", "*", "topodatapb", ".", "KeyRange", ")", "bool", "{", "if", "left", "==", "nil", "{", "return", "right", "==", "nil", "||", "len", "(", "right", ".", "Start", ")", "==", "0", "\n", "}", "\n", ...
// KeyRangeStartEqual returns true if both key ranges have the same start
[ "KeyRangeStartEqual", "returns", "true", "if", "both", "key", "ranges", "have", "the", "same", "start" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/key/key.go#L173-L181
135,239
vitessio/vitess
go/vt/key/key.go
KeyRangeEndEqual
func KeyRangeEndEqual(left, right *topodatapb.KeyRange) bool { if left == nil { return right == nil || len(right.End) == 0 } if right == nil { return len(left.End) == 0 } return bytes.Equal(left.End, right.End) }
go
func KeyRangeEndEqual(left, right *topodatapb.KeyRange) bool { if left == nil { return right == nil || len(right.End) == 0 } if right == nil { return len(left.End) == 0 } return bytes.Equal(left.End, right.End) }
[ "func", "KeyRangeEndEqual", "(", "left", ",", "right", "*", "topodatapb", ".", "KeyRange", ")", "bool", "{", "if", "left", "==", "nil", "{", "return", "right", "==", "nil", "||", "len", "(", "right", ".", "End", ")", "==", "0", "\n", "}", "\n", "if...
// KeyRangeEndEqual returns true if both key ranges have the same end
[ "KeyRangeEndEqual", "returns", "true", "if", "both", "key", "ranges", "have", "the", "same", "end" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/key/key.go#L184-L192
135,240
vitessio/vitess
go/vt/key/key.go
KeyRangesOverlap
func KeyRangesOverlap(first, second *topodatapb.KeyRange) (*topodatapb.KeyRange, error) { if !KeyRangesIntersect(first, second) { return nil, fmt.Errorf("KeyRanges %v and %v don't overlap", first, second) } if first == nil { return second, nil } if second == nil { return first, nil } // compute max(c,a) an...
go
func KeyRangesOverlap(first, second *topodatapb.KeyRange) (*topodatapb.KeyRange, error) { if !KeyRangesIntersect(first, second) { return nil, fmt.Errorf("KeyRanges %v and %v don't overlap", first, second) } if first == nil { return second, nil } if second == nil { return first, nil } // compute max(c,a) an...
[ "func", "KeyRangesOverlap", "(", "first", ",", "second", "*", "topodatapb", ".", "KeyRange", ")", "(", "*", "topodatapb", ".", "KeyRange", ",", "error", ")", "{", "if", "!", "KeyRangesIntersect", "(", "first", ",", "second", ")", "{", "return", "nil", ",...
// KeyRangesOverlap returns the overlap between two KeyRanges. // They need to overlap, otherwise an error is returned.
[ "KeyRangesOverlap", "returns", "the", "overlap", "between", "two", "KeyRanges", ".", "They", "need", "to", "overlap", "otherwise", "an", "error", "is", "returned", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/key/key.go#L211-L236
135,241
vitessio/vitess
go/vt/key/key.go
KeyRangeIncludes
func KeyRangeIncludes(big, small *topodatapb.KeyRange) bool { if big == nil { // The outside one covers everything, we're good. return true } if small == nil { // The smaller one covers everything, better have the // bigger one also cover everything. return len(big.Start) == 0 && len(big.End) == 0 } // N...
go
func KeyRangeIncludes(big, small *topodatapb.KeyRange) bool { if big == nil { // The outside one covers everything, we're good. return true } if small == nil { // The smaller one covers everything, better have the // bigger one also cover everything. return len(big.Start) == 0 && len(big.End) == 0 } // N...
[ "func", "KeyRangeIncludes", "(", "big", ",", "small", "*", "topodatapb", ".", "KeyRange", ")", "bool", "{", "if", "big", "==", "nil", "{", "// The outside one covers everything, we're good.", "return", "true", "\n", "}", "\n", "if", "small", "==", "nil", "{", ...
// KeyRangeIncludes returns true if the first provided KeyRange, big, // contains the second KeyRange, small. If they intersect, but small // spills out, this returns false.
[ "KeyRangeIncludes", "returns", "true", "if", "the", "first", "provided", "KeyRange", "big", "contains", "the", "second", "KeyRange", "small", ".", "If", "they", "intersect", "but", "small", "spills", "out", "this", "returns", "false", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/key/key.go#L241-L259
135,242
vitessio/vitess
go/vt/automation/task_containers.go
NewTaskContainerWithSingleTask
func NewTaskContainerWithSingleTask(taskName string, parameters map[string]string) *automationpb.TaskContainer { return &automationpb.TaskContainer{ ParallelTasks: []*automationpb.Task{ NewTask(taskName, parameters), }, } }
go
func NewTaskContainerWithSingleTask(taskName string, parameters map[string]string) *automationpb.TaskContainer { return &automationpb.TaskContainer{ ParallelTasks: []*automationpb.Task{ NewTask(taskName, parameters), }, } }
[ "func", "NewTaskContainerWithSingleTask", "(", "taskName", "string", ",", "parameters", "map", "[", "string", "]", "string", ")", "*", "automationpb", ".", "TaskContainer", "{", "return", "&", "automationpb", ".", "TaskContainer", "{", "ParallelTasks", ":", "[", ...
// Helper functions for "TaskContainer" protobuf message. // NewTaskContainerWithSingleTask creates a new task container with exactly one task.
[ "Helper", "functions", "for", "TaskContainer", "protobuf", "message", ".", "NewTaskContainerWithSingleTask", "creates", "a", "new", "task", "container", "with", "exactly", "one", "task", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/automation/task_containers.go#L26-L32
135,243
vitessio/vitess
go/vt/automation/task_containers.go
AddTask
func AddTask(t *automationpb.TaskContainer, taskName string, parameters map[string]string) { t.ParallelTasks = append(t.ParallelTasks, NewTask(taskName, parameters)) }
go
func AddTask(t *automationpb.TaskContainer, taskName string, parameters map[string]string) { t.ParallelTasks = append(t.ParallelTasks, NewTask(taskName, parameters)) }
[ "func", "AddTask", "(", "t", "*", "automationpb", ".", "TaskContainer", ",", "taskName", "string", ",", "parameters", "map", "[", "string", "]", "string", ")", "{", "t", ".", "ParallelTasks", "=", "append", "(", "t", ".", "ParallelTasks", ",", "NewTask", ...
// AddTask adds a new task to an existing task container.
[ "AddTask", "adds", "a", "new", "task", "to", "an", "existing", "task", "container", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/automation/task_containers.go#L42-L44
135,244
vitessio/vitess
go/vt/automation/task_containers.go
AddMissingTaskID
func AddMissingTaskID(tc []*automationpb.TaskContainer, taskIDGenerator *IDGenerator) { for _, taskContainer := range tc { for _, task := range taskContainer.ParallelTasks { if task.Id == "" { task.Id = taskIDGenerator.GetNextID() } } } }
go
func AddMissingTaskID(tc []*automationpb.TaskContainer, taskIDGenerator *IDGenerator) { for _, taskContainer := range tc { for _, task := range taskContainer.ParallelTasks { if task.Id == "" { task.Id = taskIDGenerator.GetNextID() } } } }
[ "func", "AddMissingTaskID", "(", "tc", "[", "]", "*", "automationpb", ".", "TaskContainer", ",", "taskIDGenerator", "*", "IDGenerator", ")", "{", "for", "_", ",", "taskContainer", ":=", "range", "tc", "{", "for", "_", ",", "task", ":=", "range", "taskConta...
// AddMissingTaskID assigns a task id to each task in "tc".
[ "AddMissingTaskID", "assigns", "a", "task", "id", "to", "each", "task", "in", "tc", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/automation/task_containers.go#L47-L55
135,245
vitessio/vitess
go/vt/vtgate/vindexes/hash.go
NewHash
func NewHash(name string, m map[string]string) (Vindex, error) { return &Hash{name: name}, nil }
go
func NewHash(name string, m map[string]string) (Vindex, error) { return &Hash{name: name}, nil }
[ "func", "NewHash", "(", "name", "string", ",", "m", "map", "[", "string", "]", "string", ")", "(", "Vindex", ",", "error", ")", "{", "return", "&", "Hash", "{", "name", ":", "name", "}", ",", "nil", "\n", "}" ]
// NewHash creates a new Hash.
[ "NewHash", "creates", "a", "new", "Hash", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/hash.go#L46-L48
135,246
vitessio/vitess
go/vt/worker/restartable_result_reader.go
Next
func (r *RestartableResultReader) Next() (*sqltypes.Result, error) { result, err := r.output.Recv() if err != nil && err != io.EOF { // We start the retries only on the second attempt to avoid the cost // of starting a timer (for the retry timeout) for every Next() call // when no error occurs. alias := topop...
go
func (r *RestartableResultReader) Next() (*sqltypes.Result, error) { result, err := r.output.Recv() if err != nil && err != io.EOF { // We start the retries only on the second attempt to avoid the cost // of starting a timer (for the retry timeout) for every Next() call // when no error occurs. alias := topop...
[ "func", "(", "r", "*", "RestartableResultReader", ")", "Next", "(", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "result", ",", "err", ":=", "r", ".", "output", ".", "Recv", "(", ")", "\n", "if", "err", "!=", "nil", "&&", "er...
// Next returns the next result on the stream. It implements ResultReader.
[ "Next", "returns", "the", "next", "result", "on", "the", "stream", ".", "It", "implements", "ResultReader", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/restartable_result_reader.go#L209-L224
135,247
vitessio/vitess
go/proc/counting_listener.go
Published
func Published(l net.Listener, countTag, acceptTag string) net.Listener { return &CountingListener{ Listener: l, ConnCount: stats.NewGauge(countTag, "Active connections accepted by counting listener"), ConnAccept: stats.NewCounter(acceptTag, "Count of connections accepted by the counting listener"), } }
go
func Published(l net.Listener, countTag, acceptTag string) net.Listener { return &CountingListener{ Listener: l, ConnCount: stats.NewGauge(countTag, "Active connections accepted by counting listener"), ConnAccept: stats.NewCounter(acceptTag, "Count of connections accepted by the counting listener"), } }
[ "func", "Published", "(", "l", "net", ".", "Listener", ",", "countTag", ",", "acceptTag", "string", ")", "net", ".", "Listener", "{", "return", "&", "CountingListener", "{", "Listener", ":", "l", ",", "ConnCount", ":", "stats", ".", "NewGauge", "(", "cou...
// Published creates a wrapper for net.Listener that // publishes connection stats.
[ "Published", "creates", "a", "wrapper", "for", "net", ".", "Listener", "that", "publishes", "connection", "stats", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/proc/counting_listener.go#L38-L44
135,248
vitessio/vitess
go/proc/counting_listener.go
Accept
func (l *CountingListener) Accept() (c net.Conn, err error) { conn, err := l.Listener.Accept() if err != nil { return nil, err } l.ConnCount.Add(1) l.ConnAccept.Add(1) return &countingConnection{conn, l}, nil }
go
func (l *CountingListener) Accept() (c net.Conn, err error) { conn, err := l.Listener.Accept() if err != nil { return nil, err } l.ConnCount.Add(1) l.ConnAccept.Add(1) return &countingConnection{conn, l}, nil }
[ "func", "(", "l", "*", "CountingListener", ")", "Accept", "(", ")", "(", "c", "net", ".", "Conn", ",", "err", "error", ")", "{", "conn", ",", "err", ":=", "l", ".", "Listener", ".", "Accept", "(", ")", "\n", "if", "err", "!=", "nil", "{", "retu...
// Accept increments stats counters before returning // a connection.
[ "Accept", "increments", "stats", "counters", "before", "returning", "a", "connection", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/proc/counting_listener.go#L48-L56
135,249
vitessio/vitess
go/proc/counting_listener.go
Close
func (c *countingConnection) Close() error { if c.listener != nil { c.listener.ConnCount.Add(-1) c.listener = nil } return c.Conn.Close() }
go
func (c *countingConnection) Close() error { if c.listener != nil { c.listener.ConnCount.Add(-1) c.listener = nil } return c.Conn.Close() }
[ "func", "(", "c", "*", "countingConnection", ")", "Close", "(", ")", "error", "{", "if", "c", ".", "listener", "!=", "nil", "{", "c", ".", "listener", ".", "ConnCount", ".", "Add", "(", "-", "1", ")", "\n", "c", ".", "listener", "=", "nil", "\n",...
// Close decrements the stats counter and // closes the connection.
[ "Close", "decrements", "the", "stats", "counter", "and", "closes", "the", "connection", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/proc/counting_listener.go#L60-L66
135,250
vitessio/vitess
go/vt/throttler/throttlerclient/throttlerclient.go
New
func New(addr string) (Client, error) { factory, ok := factories[*protocol] if !ok { return nil, fmt.Errorf("unknown throttler client protocol: %v", *protocol) } return factory(addr) }
go
func New(addr string) (Client, error) { factory, ok := factories[*protocol] if !ok { return nil, fmt.Errorf("unknown throttler client protocol: %v", *protocol) } return factory(addr) }
[ "func", "New", "(", "addr", "string", ")", "(", "Client", ",", "error", ")", "{", "factory", ",", "ok", ":=", "factories", "[", "*", "protocol", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", ...
// New will return a client for the selected RPC implementation.
[ "New", "will", "return", "a", "client", "for", "the", "selected", "RPC", "implementation", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/throttlerclient/throttlerclient.go#L82-L88
135,251
vitessio/vitess
go/vt/vttablet/tabletserver/connpool/pool.go
New
func New( name string, capacity int, idleTimeout time.Duration, checker MySQLChecker) *Pool { cp := &Pool{ capacity: capacity, idleTimeout: idleTimeout, dbaPool: dbconnpool.NewConnectionPool("", 1, idleTimeout, 0), checker: checker, } if name == "" || usedNames[name] { return cp } usedName...
go
func New( name string, capacity int, idleTimeout time.Duration, checker MySQLChecker) *Pool { cp := &Pool{ capacity: capacity, idleTimeout: idleTimeout, dbaPool: dbconnpool.NewConnectionPool("", 1, idleTimeout, 0), checker: checker, } if name == "" || usedNames[name] { return cp } usedName...
[ "func", "New", "(", "name", "string", ",", "capacity", "int", ",", "idleTimeout", "time", ".", "Duration", ",", "checker", "MySQLChecker", ")", "*", "Pool", "{", "cp", ":=", "&", "Pool", "{", "capacity", ":", "capacity", ",", "idleTimeout", ":", "idleTim...
// New creates a new Pool. The name is used // to publish stats only.
[ "New", "creates", "a", "new", "Pool", ".", "The", "name", "is", "used", "to", "publish", "stats", "only", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/connpool/pool.go#L71-L96
135,252
vitessio/vitess
go/vt/vttablet/tabletserver/connpool/pool.go
Open
func (cp *Pool) Open(appParams, dbaParams, appDebugParams *mysql.ConnParams) { cp.mu.Lock() defer cp.mu.Unlock() f := func() (pools.Resource, error) { return NewDBConn(cp, appParams) } cp.connections = pools.NewResourcePool(f, cp.capacity, cp.capacity, cp.idleTimeout) cp.appDebugParams = appDebugParams cp.db...
go
func (cp *Pool) Open(appParams, dbaParams, appDebugParams *mysql.ConnParams) { cp.mu.Lock() defer cp.mu.Unlock() f := func() (pools.Resource, error) { return NewDBConn(cp, appParams) } cp.connections = pools.NewResourcePool(f, cp.capacity, cp.capacity, cp.idleTimeout) cp.appDebugParams = appDebugParams cp.db...
[ "func", "(", "cp", "*", "Pool", ")", "Open", "(", "appParams", ",", "dbaParams", ",", "appDebugParams", "*", "mysql", ".", "ConnParams", ")", "{", "cp", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "cp", ".", "mu", ".", "Unlock", "(", ")", "\...
// Open must be called before starting to use the pool.
[ "Open", "must", "be", "called", "before", "starting", "to", "use", "the", "pool", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/connpool/pool.go#L106-L117
135,253
vitessio/vitess
go/vt/vttablet/tabletserver/connpool/pool.go
Get
func (cp *Pool) Get(ctx context.Context) (*DBConn, error) { span, ctx := trace.NewSpan(ctx, "Pool.Get") defer span.Finish() if cp.isCallerIDAppDebug(ctx) { return NewDBConnNoPool(cp.appDebugParams, cp.dbaPool) } p := cp.pool() if p == nil { return nil, ErrConnPoolClosed } span.Annotate("capacity", p.Capaci...
go
func (cp *Pool) Get(ctx context.Context) (*DBConn, error) { span, ctx := trace.NewSpan(ctx, "Pool.Get") defer span.Finish() if cp.isCallerIDAppDebug(ctx) { return NewDBConnNoPool(cp.appDebugParams, cp.dbaPool) } p := cp.pool() if p == nil { return nil, ErrConnPoolClosed } span.Annotate("capacity", p.Capaci...
[ "func", "(", "cp", "*", "Pool", ")", "Get", "(", "ctx", "context", ".", "Context", ")", "(", "*", "DBConn", ",", "error", ")", "{", "span", ",", "ctx", ":=", "trace", ".", "NewSpan", "(", "ctx", ",", "\"", "\"", ")", "\n", "defer", "span", ".",...
// Get returns a connection. // You must call Recycle on DBConn once done.
[ "Get", "returns", "a", "connection", ".", "You", "must", "call", "Recycle", "on", "DBConn", "once", "done", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/connpool/pool.go#L137-L158
135,254
vitessio/vitess
go/vt/vttablet/tabletserver/connpool/pool.go
StatsJSON
func (cp *Pool) StatsJSON() string { p := cp.pool() if p == nil { return "{}" } return p.StatsJSON() }
go
func (cp *Pool) StatsJSON() string { p := cp.pool() if p == nil { return "{}" } return p.StatsJSON() }
[ "func", "(", "cp", "*", "Pool", ")", "StatsJSON", "(", ")", "string", "{", "p", ":=", "cp", ".", "pool", "(", ")", "\n", "if", "p", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "p", ".", "StatsJSON", "(", ")", "\n", "}" ...
// StatsJSON returns the pool stats as a JSON object.
[ "StatsJSON", "returns", "the", "pool", "stats", "as", "a", "JSON", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/connpool/pool.go#L199-L205
135,255
vitessio/vitess
go/json2/unmarshal.go
Unmarshal
func Unmarshal(data []byte, v interface{}) error { if pb, ok := v.(proto.Message); ok { return annotate(data, jsonpb.Unmarshal(bytes.NewBuffer(data), pb)) } return annotate(data, json.Unmarshal(data, v)) }
go
func Unmarshal(data []byte, v interface{}) error { if pb, ok := v.(proto.Message); ok { return annotate(data, jsonpb.Unmarshal(bytes.NewBuffer(data), pb)) } return annotate(data, json.Unmarshal(data, v)) }
[ "func", "Unmarshal", "(", "data", "[", "]", "byte", ",", "v", "interface", "{", "}", ")", "error", "{", "if", "pb", ",", "ok", ":=", "v", ".", "(", "proto", ".", "Message", ")", ";", "ok", "{", "return", "annotate", "(", "data", ",", "jsonpb", ...
// Unmarshal wraps json.Unmarshal, but returns errors that // also mention the line number. This function is not very // efficient and should not be used for high QPS operations.
[ "Unmarshal", "wraps", "json", ".", "Unmarshal", "but", "returns", "errors", "that", "also", "mention", "the", "line", "number", ".", "This", "function", "is", "not", "very", "efficient", "and", "should", "not", "be", "used", "for", "high", "QPS", "operations...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/json2/unmarshal.go#L34-L39
135,256
vitessio/vitess
go/sync2/batcher.go
NewBatcher
func NewBatcher(interval time.Duration) *Batcher { return &Batcher{ interval: interval, queue: make(chan int), waiters: NewAtomicInt32(0), nextID: NewAtomicInt32(0), after: time.After, } }
go
func NewBatcher(interval time.Duration) *Batcher { return &Batcher{ interval: interval, queue: make(chan int), waiters: NewAtomicInt32(0), nextID: NewAtomicInt32(0), after: time.After, } }
[ "func", "NewBatcher", "(", "interval", "time", ".", "Duration", ")", "*", "Batcher", "{", "return", "&", "Batcher", "{", "interval", ":", "interval", ",", "queue", ":", "make", "(", "chan", "int", ")", ",", "waiters", ":", "NewAtomicInt32", "(", "0", "...
// NewBatcher returns a new Batcher
[ "NewBatcher", "returns", "a", "new", "Batcher" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sync2/batcher.go#L39-L47
135,257
vitessio/vitess
go/sync2/batcher.go
Wait
func (b *Batcher) Wait() int { numWaiters := b.waiters.Add(1) if numWaiters == 1 { b.newBatch() } return <-b.queue }
go
func (b *Batcher) Wait() int { numWaiters := b.waiters.Add(1) if numWaiters == 1 { b.newBatch() } return <-b.queue }
[ "func", "(", "b", "*", "Batcher", ")", "Wait", "(", ")", "int", "{", "numWaiters", ":=", "b", ".", "waiters", ".", "Add", "(", "1", ")", "\n", "if", "numWaiters", "==", "1", "{", "b", ".", "newBatch", "(", ")", "\n", "}", "\n", "return", "<-", ...
// Wait adds a new waiter to the queue and blocks until the next batch
[ "Wait", "adds", "a", "new", "waiter", "to", "the", "queue", "and", "blocks", "until", "the", "next", "batch" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sync2/batcher.go#L62-L68
135,258
vitessio/vitess
go/sync2/batcher.go
newBatch
func (b *Batcher) newBatch() { go func() { <-b.after(b.interval) id := b.nextID.Add(1) // Make sure to atomically reset the number of waiters to make // sure that all incoming requests either make it into the // current batch or the next one. waiters := b.waiters.Get() for !b.waiters.CompareAndSwap(wai...
go
func (b *Batcher) newBatch() { go func() { <-b.after(b.interval) id := b.nextID.Add(1) // Make sure to atomically reset the number of waiters to make // sure that all incoming requests either make it into the // current batch or the next one. waiters := b.waiters.Get() for !b.waiters.CompareAndSwap(wai...
[ "func", "(", "b", "*", "Batcher", ")", "newBatch", "(", ")", "{", "go", "func", "(", ")", "{", "<-", "b", ".", "after", "(", "b", ".", "interval", ")", "\n\n", "id", ":=", "b", ".", "nextID", ".", "Add", "(", "1", ")", "\n\n", "// Make sure to ...
// newBatch starts a new batch
[ "newBatch", "starts", "a", "new", "batch" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sync2/batcher.go#L71-L89
135,259
vitessio/vitess
go/mysql/encoding.go
readBytesCopy
func readBytesCopy(data []byte, pos int, size int) ([]byte, int, bool) { if pos+size-1 >= len(data) { return nil, 0, false } result := make([]byte, size) copy(result, data[pos:pos+size]) return result, pos + size, true }
go
func readBytesCopy(data []byte, pos int, size int) ([]byte, int, bool) { if pos+size-1 >= len(data) { return nil, 0, false } result := make([]byte, size) copy(result, data[pos:pos+size]) return result, pos + size, true }
[ "func", "readBytesCopy", "(", "data", "[", "]", "byte", ",", "pos", "int", ",", "size", "int", ")", "(", "[", "]", "byte", ",", "int", ",", "bool", ")", "{", "if", "pos", "+", "size", "-", "1", ">=", "len", "(", "data", ")", "{", "return", "n...
// readBytesCopy returns a copy of the bytes in the packet. // Useful to remember contents of ephemeral packets.
[ "readBytesCopy", "returns", "a", "copy", "of", "the", "bytes", "in", "the", "packet", ".", "Useful", "to", "remember", "contents", "of", "ephemeral", "packets", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/encoding.go#L166-L173
135,260
vitessio/vitess
go/vt/vtgate/planbuilder/pullout_subquery.go
newPulloutSubquery
func newPulloutSubquery(opcode engine.PulloutOpcode, sqName, hasValues string, subquery builder) *pulloutSubquery { return &pulloutSubquery{ subquery: subquery, eSubquery: &engine.PulloutSubquery{ Opcode: opcode, SubqueryResult: sqName, HasValues: hasValues, }, } }
go
func newPulloutSubquery(opcode engine.PulloutOpcode, sqName, hasValues string, subquery builder) *pulloutSubquery { return &pulloutSubquery{ subquery: subquery, eSubquery: &engine.PulloutSubquery{ Opcode: opcode, SubqueryResult: sqName, HasValues: hasValues, }, } }
[ "func", "newPulloutSubquery", "(", "opcode", "engine", ".", "PulloutOpcode", ",", "sqName", ",", "hasValues", "string", ",", "subquery", "builder", ")", "*", "pulloutSubquery", "{", "return", "&", "pulloutSubquery", "{", "subquery", ":", "subquery", ",", "eSubqu...
// newPulloutSubquery builds a new pulloutSubquery.
[ "newPulloutSubquery", "builds", "a", "new", "pulloutSubquery", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/pullout_subquery.go#L37-L46
135,261
vitessio/vitess
go/vt/vtgate/planbuilder/pullout_subquery.go
setUnderlying
func (ps *pulloutSubquery) setUnderlying(underlying builder) { ps.underlying = underlying ps.underlying.Reorder(ps.subquery.Order()) ps.order = ps.underlying.Order() + 1 }
go
func (ps *pulloutSubquery) setUnderlying(underlying builder) { ps.underlying = underlying ps.underlying.Reorder(ps.subquery.Order()) ps.order = ps.underlying.Order() + 1 }
[ "func", "(", "ps", "*", "pulloutSubquery", ")", "setUnderlying", "(", "underlying", "builder", ")", "{", "ps", ".", "underlying", "=", "underlying", "\n", "ps", ".", "underlying", ".", "Reorder", "(", "ps", ".", "subquery", ".", "Order", "(", ")", ")", ...
// setUnderlying sets the underlying primitive.
[ "setUnderlying", "sets", "the", "underlying", "primitive", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/pullout_subquery.go#L49-L53
135,262
vitessio/vitess
go/vt/vtgate/planbuilder/pullout_subquery.go
SetUpperLimit
func (ps *pulloutSubquery) SetUpperLimit(count *sqlparser.SQLVal) { ps.underlying.SetUpperLimit(count) }
go
func (ps *pulloutSubquery) SetUpperLimit(count *sqlparser.SQLVal) { ps.underlying.SetUpperLimit(count) }
[ "func", "(", "ps", "*", "pulloutSubquery", ")", "SetUpperLimit", "(", "count", "*", "sqlparser", ".", "SQLVal", ")", "{", "ps", ".", "underlying", ".", "SetUpperLimit", "(", "count", ")", "\n", "}" ]
// SetUpperLimit satisfies the builder interface. // This is a no-op because we actually call SetLimit for this primitive. // In the future, we may have to honor this call for subqueries.
[ "SetUpperLimit", "satisfies", "the", "builder", "interface", ".", "This", "is", "a", "no", "-", "op", "because", "we", "actually", "call", "SetLimit", "for", "this", "primitive", ".", "In", "the", "future", "we", "may", "have", "to", "honor", "this", "call...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/pullout_subquery.go#L107-L109
135,263
vitessio/vitess
go/vt/mysqlctl/tmutils/schema.go
TableDefinitionGetColumn
func TableDefinitionGetColumn(td *tabletmanagerdatapb.TableDefinition, name string) (index int, ok bool) { lowered := strings.ToLower(name) for i, n := range td.Columns { if lowered == strings.ToLower(n) { return i, true } } return -1, false }
go
func TableDefinitionGetColumn(td *tabletmanagerdatapb.TableDefinition, name string) (index int, ok bool) { lowered := strings.ToLower(name) for i, n := range td.Columns { if lowered == strings.ToLower(n) { return i, true } } return -1, false }
[ "func", "TableDefinitionGetColumn", "(", "td", "*", "tabletmanagerdatapb", ".", "TableDefinition", ",", "name", "string", ")", "(", "index", "int", ",", "ok", "bool", ")", "{", "lowered", ":=", "strings", ".", "ToLower", "(", "name", ")", "\n", "for", "i",...
// TableDefinitionGetColumn returns the index of a column inside a // TableDefinition.
[ "TableDefinitionGetColumn", "returns", "the", "index", "of", "a", "column", "inside", "a", "TableDefinition", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/tmutils/schema.go#L43-L51
135,264
vitessio/vitess
go/vt/mysqlctl/tmutils/schema.go
Swap
func (tds TableDefinitions) Swap(i, j int) { tds[i], tds[j] = tds[j], tds[i] }
go
func (tds TableDefinitions) Swap(i, j int) { tds[i], tds[j] = tds[j], tds[i] }
[ "func", "(", "tds", "TableDefinitions", ")", "Swap", "(", "i", ",", "j", "int", ")", "{", "tds", "[", "i", "]", ",", "tds", "[", "j", "]", "=", "tds", "[", "j", "]", ",", "tds", "[", "i", "]", "\n", "}" ]
// Swap used for sorting TableDefinitions.
[ "Swap", "used", "for", "sorting", "TableDefinitions", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/tmutils/schema.go#L62-L64
135,265
vitessio/vitess
go/vt/mysqlctl/tmutils/schema.go
GenerateSchemaVersion
func GenerateSchemaVersion(sd *tabletmanagerdatapb.SchemaDefinition) { hasher := md5.New() for _, td := range sd.TableDefinitions { if _, err := hasher.Write([]byte(td.Schema)); err != nil { panic(err) // extremely unlikely } } sd.Version = hex.EncodeToString(hasher.Sum(nil)) }
go
func GenerateSchemaVersion(sd *tabletmanagerdatapb.SchemaDefinition) { hasher := md5.New() for _, td := range sd.TableDefinitions { if _, err := hasher.Write([]byte(td.Schema)); err != nil { panic(err) // extremely unlikely } } sd.Version = hex.EncodeToString(hasher.Sum(nil)) }
[ "func", "GenerateSchemaVersion", "(", "sd", "*", "tabletmanagerdatapb", ".", "SchemaDefinition", ")", "{", "hasher", ":=", "md5", ".", "New", "(", ")", "\n", "for", "_", ",", "td", ":=", "range", "sd", ".", "TableDefinitions", "{", "if", "_", ",", "err",...
// GenerateSchemaVersion return a unique schema version string based on // its TableDefinitions.
[ "GenerateSchemaVersion", "return", "a", "unique", "schema", "version", "string", "based", "on", "its", "TableDefinitions", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/tmutils/schema.go#L166-L174
135,266
vitessio/vitess
go/vt/mysqlctl/tmutils/schema.go
SchemaDefinitionGetTable
func SchemaDefinitionGetTable(sd *tabletmanagerdatapb.SchemaDefinition, table string) (td *tabletmanagerdatapb.TableDefinition, ok bool) { for _, td := range sd.TableDefinitions { if td.Name == table { return td, true } } return nil, false }
go
func SchemaDefinitionGetTable(sd *tabletmanagerdatapb.SchemaDefinition, table string) (td *tabletmanagerdatapb.TableDefinition, ok bool) { for _, td := range sd.TableDefinitions { if td.Name == table { return td, true } } return nil, false }
[ "func", "SchemaDefinitionGetTable", "(", "sd", "*", "tabletmanagerdatapb", ".", "SchemaDefinition", ",", "table", "string", ")", "(", "td", "*", "tabletmanagerdatapb", ".", "TableDefinition", ",", "ok", "bool", ")", "{", "for", "_", ",", "td", ":=", "range", ...
// SchemaDefinitionGetTable returns TableDefinition for a given table name.
[ "SchemaDefinitionGetTable", "returns", "TableDefinition", "for", "a", "given", "table", "name", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/tmutils/schema.go#L177-L184
135,267
vitessio/vitess
go/vt/mysqlctl/tmutils/schema.go
DiffSchema
func DiffSchema(leftName string, left *tabletmanagerdatapb.SchemaDefinition, rightName string, right *tabletmanagerdatapb.SchemaDefinition, er concurrency.ErrorRecorder) { if left == nil && right == nil { return } if left == nil || right == nil { er.RecordError(fmt.Errorf("schemas are different:\n%s: %v, %s: %v"...
go
func DiffSchema(leftName string, left *tabletmanagerdatapb.SchemaDefinition, rightName string, right *tabletmanagerdatapb.SchemaDefinition, er concurrency.ErrorRecorder) { if left == nil && right == nil { return } if left == nil || right == nil { er.RecordError(fmt.Errorf("schemas are different:\n%s: %v, %s: %v"...
[ "func", "DiffSchema", "(", "leftName", "string", ",", "left", "*", "tabletmanagerdatapb", ".", "SchemaDefinition", ",", "rightName", "string", ",", "right", "*", "tabletmanagerdatapb", ".", "SchemaDefinition", ",", "er", "concurrency", ".", "ErrorRecorder", ")", "...
// DiffSchema generates a report on what's different between two SchemaDefinitions // including views.
[ "DiffSchema", "generates", "a", "report", "on", "what", "s", "different", "between", "two", "SchemaDefinitions", "including", "views", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/tmutils/schema.go#L214-L274
135,268
vitessio/vitess
go/vt/mysqlctl/tmutils/schema.go
DiffSchemaToArray
func DiffSchemaToArray(leftName string, left *tabletmanagerdatapb.SchemaDefinition, rightName string, right *tabletmanagerdatapb.SchemaDefinition) (result []string) { er := concurrency.AllErrorRecorder{} DiffSchema(leftName, left, rightName, right, &er) if er.HasErrors() { return er.ErrorStrings() } return nil }
go
func DiffSchemaToArray(leftName string, left *tabletmanagerdatapb.SchemaDefinition, rightName string, right *tabletmanagerdatapb.SchemaDefinition) (result []string) { er := concurrency.AllErrorRecorder{} DiffSchema(leftName, left, rightName, right, &er) if er.HasErrors() { return er.ErrorStrings() } return nil }
[ "func", "DiffSchemaToArray", "(", "leftName", "string", ",", "left", "*", "tabletmanagerdatapb", ".", "SchemaDefinition", ",", "rightName", "string", ",", "right", "*", "tabletmanagerdatapb", ".", "SchemaDefinition", ")", "(", "result", "[", "]", "string", ")", ...
// DiffSchemaToArray diffs two schemas and return the schema diffs if there is any.
[ "DiffSchemaToArray", "diffs", "two", "schemas", "and", "return", "the", "schema", "diffs", "if", "there", "is", "any", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/tmutils/schema.go#L277-L284
135,269
vitessio/vitess
go/vt/mysqlctl/tmutils/schema.go
Equal
func (s *SchemaChange) Equal(s2 *SchemaChange) bool { return s.SQL == s2.SQL && s.Force == s2.Force && s.AllowReplication == s2.AllowReplication && proto.Equal(s.BeforeSchema, s2.BeforeSchema) && proto.Equal(s.AfterSchema, s2.AfterSchema) }
go
func (s *SchemaChange) Equal(s2 *SchemaChange) bool { return s.SQL == s2.SQL && s.Force == s2.Force && s.AllowReplication == s2.AllowReplication && proto.Equal(s.BeforeSchema, s2.BeforeSchema) && proto.Equal(s.AfterSchema, s2.AfterSchema) }
[ "func", "(", "s", "*", "SchemaChange", ")", "Equal", "(", "s2", "*", "SchemaChange", ")", "bool", "{", "return", "s", ".", "SQL", "==", "s2", ".", "SQL", "&&", "s", ".", "Force", "==", "s2", ".", "Force", "&&", "s", ".", "AllowReplication", "==", ...
// Equal compares two SchemaChange objects.
[ "Equal", "compares", "two", "SchemaChange", "objects", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/tmutils/schema.go#L297-L303
135,270
vitessio/vitess
go/vt/vttablet/tabletserver/splitquery/utils.go
populateNewBindVariable
func populateNewBindVariable( bindVariableName string, bindVariableValue *querypb.BindVariable, resultBindVariables map[string]*querypb.BindVariable) { _, alreadyInMap := resultBindVariables[bindVariableName] if alreadyInMap { panic(fmt.Sprintf( "bindVariable %v already exists in map: %v. bindVariableValue gi...
go
func populateNewBindVariable( bindVariableName string, bindVariableValue *querypb.BindVariable, resultBindVariables map[string]*querypb.BindVariable) { _, alreadyInMap := resultBindVariables[bindVariableName] if alreadyInMap { panic(fmt.Sprintf( "bindVariable %v already exists in map: %v. bindVariableValue gi...
[ "func", "populateNewBindVariable", "(", "bindVariableName", "string", ",", "bindVariableValue", "*", "querypb", ".", "BindVariable", ",", "resultBindVariables", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ")", "{", "_", ",", "alreadyInMap", ":=...
// populateNewBindVariable inserts 'bindVariableName' with 'bindVariableValue' to the // 'resultBindVariables' map. Panics if 'bindVariableName' already exists in the map.
[ "populateNewBindVariable", "inserts", "bindVariableName", "with", "bindVariableValue", "to", "the", "resultBindVariables", "map", ".", "Panics", "if", "bindVariableName", "already", "exists", "in", "the", "map", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/utils.go#L31-L44
135,271
vitessio/vitess
go/vt/vttablet/tabletserver/splitquery/utils.go
cloneBindVariables
func cloneBindVariables(bindVariables map[string]*querypb.BindVariable) map[string]*querypb.BindVariable { result := make(map[string]*querypb.BindVariable) for key, value := range bindVariables { result[key] = value } return result }
go
func cloneBindVariables(bindVariables map[string]*querypb.BindVariable) map[string]*querypb.BindVariable { result := make(map[string]*querypb.BindVariable) for key, value := range bindVariables { result[key] = value } return result }
[ "func", "cloneBindVariables", "(", "bindVariables", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ")", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", "{", "result", ":=", "make", "(", "map", "[", "string", "]", "*", "qu...
// cloneBindVariables returns a shallow-copy of the given bindVariables map.
[ "cloneBindVariables", "returns", "a", "shallow", "-", "copy", "of", "the", "given", "bindVariables", "map", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/utils.go#L47-L53
135,272
vitessio/vitess
go/vt/vttablet/tabletserver/tabletenv/logstats.go
ImmediateCaller
func (stats *LogStats) ImmediateCaller() string { return callerid.GetUsername(callerid.ImmediateCallerIDFromContext(stats.Ctx)) }
go
func (stats *LogStats) ImmediateCaller() string { return callerid.GetUsername(callerid.ImmediateCallerIDFromContext(stats.Ctx)) }
[ "func", "(", "stats", "*", "LogStats", ")", "ImmediateCaller", "(", ")", "string", "{", "return", "callerid", ".", "GetUsername", "(", "callerid", ".", "ImmediateCallerIDFromContext", "(", "stats", ".", "Ctx", ")", ")", "\n", "}" ]
// ImmediateCaller returns the immediate caller stored in LogStats.Ctx
[ "ImmediateCaller", "returns", "the", "immediate", "caller", "stored", "in", "LogStats", ".", "Ctx" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletenv/logstats.go#L87-L89
135,273
vitessio/vitess
go/vt/vttablet/tabletserver/tabletenv/logstats.go
EffectiveCaller
func (stats *LogStats) EffectiveCaller() string { return callerid.GetPrincipal(callerid.EffectiveCallerIDFromContext(stats.Ctx)) }
go
func (stats *LogStats) EffectiveCaller() string { return callerid.GetPrincipal(callerid.EffectiveCallerIDFromContext(stats.Ctx)) }
[ "func", "(", "stats", "*", "LogStats", ")", "EffectiveCaller", "(", ")", "string", "{", "return", "callerid", ".", "GetPrincipal", "(", "callerid", ".", "EffectiveCallerIDFromContext", "(", "stats", ".", "Ctx", ")", ")", "\n", "}" ]
// EffectiveCaller returns the effective caller stored in LogStats.Ctx
[ "EffectiveCaller", "returns", "the", "effective", "caller", "stored", "in", "LogStats", ".", "Ctx" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletenv/logstats.go#L92-L94
135,274
vitessio/vitess
go/vt/vttablet/tabletserver/tabletenv/logstats.go
AddRewrittenSQL
func (stats *LogStats) AddRewrittenSQL(sql string, start time.Time) { stats.QuerySources |= QuerySourceMySQL stats.NumberOfQueries++ stats.rewrittenSqls = append(stats.rewrittenSqls, sql) stats.MysqlResponseTime += time.Since(start) }
go
func (stats *LogStats) AddRewrittenSQL(sql string, start time.Time) { stats.QuerySources |= QuerySourceMySQL stats.NumberOfQueries++ stats.rewrittenSqls = append(stats.rewrittenSqls, sql) stats.MysqlResponseTime += time.Since(start) }
[ "func", "(", "stats", "*", "LogStats", ")", "AddRewrittenSQL", "(", "sql", "string", ",", "start", "time", ".", "Time", ")", "{", "stats", ".", "QuerySources", "|=", "QuerySourceMySQL", "\n", "stats", ".", "NumberOfQueries", "++", "\n", "stats", ".", "rewr...
// AddRewrittenSQL adds a single sql statement to the rewritten list
[ "AddRewrittenSQL", "adds", "a", "single", "sql", "statement", "to", "the", "rewritten", "list" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletenv/logstats.go#L102-L107
135,275
vitessio/vitess
go/vt/vttablet/tabletserver/tabletenv/logstats.go
TotalTime
func (stats *LogStats) TotalTime() time.Duration { return stats.EndTime.Sub(stats.StartTime) }
go
func (stats *LogStats) TotalTime() time.Duration { return stats.EndTime.Sub(stats.StartTime) }
[ "func", "(", "stats", "*", "LogStats", ")", "TotalTime", "(", ")", "time", ".", "Duration", "{", "return", "stats", ".", "EndTime", ".", "Sub", "(", "stats", ".", "StartTime", ")", "\n", "}" ]
// TotalTime returns how long this query has been running
[ "TotalTime", "returns", "how", "long", "this", "query", "has", "been", "running" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletenv/logstats.go#L110-L112
135,276
vitessio/vitess
go/vt/vttablet/tabletserver/tabletenv/logstats.go
FmtQuerySources
func (stats *LogStats) FmtQuerySources() string { if stats.QuerySources == 0 { return "none" } sources := make([]string, 2) n := 0 if stats.QuerySources&QuerySourceMySQL != 0 { sources[n] = "mysql" n++ } if stats.QuerySources&QuerySourceConsolidator != 0 { sources[n] = "consolidator" n++ } return str...
go
func (stats *LogStats) FmtQuerySources() string { if stats.QuerySources == 0 { return "none" } sources := make([]string, 2) n := 0 if stats.QuerySources&QuerySourceMySQL != 0 { sources[n] = "mysql" n++ } if stats.QuerySources&QuerySourceConsolidator != 0 { sources[n] = "consolidator" n++ } return str...
[ "func", "(", "stats", "*", "LogStats", ")", "FmtQuerySources", "(", ")", "string", "{", "if", "stats", ".", "QuerySources", "==", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "sources", ":=", "make", "(", "[", "]", "string", ",", "2", ")", "\n"...
// FmtQuerySources returns a comma separated list of query // sources. If there were no query sources, it returns the string // "none".
[ "FmtQuerySources", "returns", "a", "comma", "separated", "list", "of", "query", "sources", ".", "If", "there", "were", "no", "query", "sources", "it", "returns", "the", "string", "none", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletenv/logstats.go#L139-L154
135,277
vitessio/vitess
go/vt/vttablet/tabletserver/tabletenv/logstats.go
ErrorStr
func (stats *LogStats) ErrorStr() string { if stats.Error != nil { return stats.Error.Error() } return "" }
go
func (stats *LogStats) ErrorStr() string { if stats.Error != nil { return stats.Error.Error() } return "" }
[ "func", "(", "stats", "*", "LogStats", ")", "ErrorStr", "(", ")", "string", "{", "if", "stats", ".", "Error", "!=", "nil", "{", "return", "stats", ".", "Error", ".", "Error", "(", ")", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
// ErrorStr returns the error string or ""
[ "ErrorStr", "returns", "the", "error", "string", "or" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletenv/logstats.go#L164-L169
135,278
vitessio/vitess
go/vt/vttablet/tabletserver/tabletenv/logstats.go
CallInfo
func (stats *LogStats) CallInfo() (string, string) { ci, ok := callinfo.FromContext(stats.Ctx) if !ok { return "", "" } return ci.Text(), ci.Username() }
go
func (stats *LogStats) CallInfo() (string, string) { ci, ok := callinfo.FromContext(stats.Ctx) if !ok { return "", "" } return ci.Text(), ci.Username() }
[ "func", "(", "stats", "*", "LogStats", ")", "CallInfo", "(", ")", "(", "string", ",", "string", ")", "{", "ci", ",", "ok", ":=", "callinfo", ".", "FromContext", "(", "stats", ".", "Ctx", ")", "\n", "if", "!", "ok", "{", "return", "\"", "\"", ",",...
// CallInfo returns some parts of CallInfo if set
[ "CallInfo", "returns", "some", "parts", "of", "CallInfo", "if", "set" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tabletenv/logstats.go#L172-L178
135,279
vitessio/vitess
go/vtbench/vtbench.go
String
func (cp ClientProtocol) String() string { switch cp { case MySQL: return "mysql" case GRPCVtgate: return "grpc-vtgate" case GRPCVttablet: return "grpc-vttablet" default: return fmt.Sprintf("unknown-protocol-%d", cp) } }
go
func (cp ClientProtocol) String() string { switch cp { case MySQL: return "mysql" case GRPCVtgate: return "grpc-vtgate" case GRPCVttablet: return "grpc-vttablet" default: return fmt.Sprintf("unknown-protocol-%d", cp) } }
[ "func", "(", "cp", "ClientProtocol", ")", "String", "(", ")", "string", "{", "switch", "cp", "{", "case", "MySQL", ":", "return", "\"", "\"", "\n", "case", "GRPCVtgate", ":", "return", "\"", "\"", "\n", "case", "GRPCVttablet", ":", "return", "\"", "\""...
// ProtocolString returns a string representation of the protocol
[ "ProtocolString", "returns", "a", "string", "representation", "of", "the", "protocol" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vtbench/vtbench.go#L47-L58
135,280
vitessio/vitess
go/vtbench/vtbench.go
NewBench
func NewBench(threads, count int, cp ConnParams, query string) *Bench { bench := Bench{ Threads: threads, Count: count, ConnParams: cp, Query: query, Rows: stats.NewCounter("", ""), Timings: stats.NewTimings("", "", ""), } return &bench }
go
func NewBench(threads, count int, cp ConnParams, query string) *Bench { bench := Bench{ Threads: threads, Count: count, ConnParams: cp, Query: query, Rows: stats.NewCounter("", ""), Timings: stats.NewTimings("", "", ""), } return &bench }
[ "func", "NewBench", "(", "threads", ",", "count", "int", ",", "cp", "ConnParams", ",", "query", "string", ")", "*", "Bench", "{", "bench", ":=", "Bench", "{", "Threads", ":", "threads", ",", "Count", ":", "count", ",", "ConnParams", ":", "cp", ",", "...
// NewBench creates a new bench test
[ "NewBench", "creates", "a", "new", "bench", "test" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vtbench/vtbench.go#L102-L112
135,281
vitessio/vitess
go/vtbench/vtbench.go
Run
func (b *Bench) Run(ctx context.Context) error { err := b.createConns(ctx) if err != nil { return err } b.createThreads(ctx) b.runTest(ctx) return nil }
go
func (b *Bench) Run(ctx context.Context) error { err := b.createConns(ctx) if err != nil { return err } b.createThreads(ctx) b.runTest(ctx) return nil }
[ "func", "(", "b", "*", "Bench", ")", "Run", "(", "ctx", "context", ".", "Context", ")", "error", "{", "err", ":=", "b", ".", "createConns", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "b", ".", "cre...
// Run executes the test
[ "Run", "executes", "the", "test" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vtbench/vtbench.go#L115-L124
135,282
vitessio/vitess
go/history/history.go
Add
func (history *History) Add(record interface{}) { history.mu.Lock() defer history.mu.Unlock() history.latest = record if equiv, ok := record.(Deduplicable); ok && history.length > 0 { if equiv.IsDuplicate(history.lastAdded) { return } } history.records[history.next] = record history.lastAdded = record ...
go
func (history *History) Add(record interface{}) { history.mu.Lock() defer history.mu.Unlock() history.latest = record if equiv, ok := record.(Deduplicable); ok && history.length > 0 { if equiv.IsDuplicate(history.lastAdded) { return } } history.records[history.next] = record history.lastAdded = record ...
[ "func", "(", "history", "*", "History", ")", "Add", "(", "record", "interface", "{", "}", ")", "{", "history", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "history", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "history", ".", "latest", "=", ...
// Add a new record in a threadsafe manner. If record implements // Deduplicable, and IsDuplicate returns true when called on the last // previously added record, it will not be added.
[ "Add", "a", "new", "record", "in", "a", "threadsafe", "manner", ".", "If", "record", "implements", "Deduplicable", "and", "IsDuplicate", "returns", "true", "when", "called", "on", "the", "last", "previously", "added", "record", "it", "will", "not", "be", "ad...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/history/history.go#L52-L72
135,283
vitessio/vitess
go/history/history.go
Records
func (history *History) Records() []interface{} { history.mu.Lock() defer history.mu.Unlock() records := make([]interface{}, 0, history.length) records = append(records, history.records[history.next:history.length]...) records = append(records, history.records[:history.next]...) // In place reverse. for i := 0...
go
func (history *History) Records() []interface{} { history.mu.Lock() defer history.mu.Unlock() records := make([]interface{}, 0, history.length) records = append(records, history.records[history.next:history.length]...) records = append(records, history.records[:history.next]...) // In place reverse. for i := 0...
[ "func", "(", "history", "*", "History", ")", "Records", "(", ")", "[", "]", "interface", "{", "}", "{", "history", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "history", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "records", ":=", "make", "(...
// Records returns the kept records in reverse chronological order in a // threadsafe manner.
[ "Records", "returns", "the", "kept", "records", "in", "reverse", "chronological", "order", "in", "a", "threadsafe", "manner", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/history/history.go#L76-L90
135,284
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_external_reparent.go
TabletExternallyReparented
func (agent *ActionAgent) TabletExternallyReparented(ctx context.Context, externalID string) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() startTime := time.Now() // If there is a finalize step running, wait for it to finish or time out // before checking the global shard r...
go
func (agent *ActionAgent) TabletExternallyReparented(ctx context.Context, externalID string) error { if err := agent.lock(ctx); err != nil { return err } defer agent.unlock() startTime := time.Now() // If there is a finalize step running, wait for it to finish or time out // before checking the global shard r...
[ "func", "(", "agent", "*", "ActionAgent", ")", "TabletExternallyReparented", "(", "ctx", "context", ".", "Context", ",", "externalID", "string", ")", "error", "{", "if", "err", ":=", "agent", ".", "lock", "(", "ctx", ")", ";", "err", "!=", "nil", "{", ...
// TabletExternallyReparented updates all topo records so the current // tablet is the new master for this shard.
[ "TabletExternallyReparented", "updates", "all", "topo", "records", "so", "the", "current", "tablet", "is", "the", "new", "master", "for", "this", "shard", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_external_reparent.go#L52-L135
135,285
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_external_reparent.go
setExternallyReparentedTime
func (agent *ActionAgent) setExternallyReparentedTime(t time.Time) { agent.mutex.Lock() defer agent.mutex.Unlock() agent._tabletExternallyReparentedTime = t agent._replicationDelay = 0 }
go
func (agent *ActionAgent) setExternallyReparentedTime(t time.Time) { agent.mutex.Lock() defer agent.mutex.Unlock() agent._tabletExternallyReparentedTime = t agent._replicationDelay = 0 }
[ "func", "(", "agent", "*", "ActionAgent", ")", "setExternallyReparentedTime", "(", "t", "time", ".", "Time", ")", "{", "agent", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "agent", ".", "mutex", ".", "Unlock", "(", ")", "\n\n", "agent", ".", ...
// setExternallyReparentedTime remembers the last time when we were told we're // the master. // If another tablet claims to be master and offers a more recent time, // that tablet will be trusted over us.
[ "setExternallyReparentedTime", "remembers", "the", "last", "time", "when", "we", "were", "told", "we", "re", "the", "master", ".", "If", "another", "tablet", "claims", "to", "be", "master", "and", "offers", "a", "more", "recent", "time", "that", "tablet", "w...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_external_reparent.go#L253-L259
135,286
vitessio/vitess
go/vt/vttablet/tabletmanager/vreplication/vplayer.go
play
func (vp *vplayer) play(ctx context.Context) error { if !vp.stopPos.IsZero() && vp.startPos.AtLeast(vp.stopPos) { if vp.saveStop { return vp.vr.setState(binlogplayer.BlpStopped, fmt.Sprintf("Stop position %v already reached: %v", vp.startPos, vp.stopPos)) } return nil } plan, err := buildReplicatorPlan(vp....
go
func (vp *vplayer) play(ctx context.Context) error { if !vp.stopPos.IsZero() && vp.startPos.AtLeast(vp.stopPos) { if vp.saveStop { return vp.vr.setState(binlogplayer.BlpStopped, fmt.Sprintf("Stop position %v already reached: %v", vp.startPos, vp.stopPos)) } return nil } plan, err := buildReplicatorPlan(vp....
[ "func", "(", "vp", "*", "vplayer", ")", "play", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "!", "vp", ".", "stopPos", ".", "IsZero", "(", ")", "&&", "vp", ".", "startPos", ".", "AtLeast", "(", "vp", ".", "stopPos", ")", "{", ...
// play is not resumable. If pausePos is set, play returns without updating the vreplication state.
[ "play", "is", "not", "resumable", ".", "If", "pausePos", "is", "set", "play", "returns", "without", "updating", "the", "vreplication", "state", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/vplayer.go#L79-L105
135,287
vitessio/vitess
go/vt/vtgate/planbuilder/vindex_func.go
PushFilter
func (vf *vindexFunc) PushFilter(pb *primitiveBuilder, filter sqlparser.Expr, whereType string, _ builder) error { if vf.eVindexFunc.Opcode != engine.VindexNone { return errors.New("unsupported: where clause for vindex function must be of the form id = <val> (multiple filters)") } // Check LHS. comparison, ok :=...
go
func (vf *vindexFunc) PushFilter(pb *primitiveBuilder, filter sqlparser.Expr, whereType string, _ builder) error { if vf.eVindexFunc.Opcode != engine.VindexNone { return errors.New("unsupported: where clause for vindex function must be of the form id = <val> (multiple filters)") } // Check LHS. comparison, ok :=...
[ "func", "(", "vf", "*", "vindexFunc", ")", "PushFilter", "(", "pb", "*", "primitiveBuilder", ",", "filter", "sqlparser", ".", "Expr", ",", "whereType", "string", ",", "_", "builder", ")", "error", "{", "if", "vf", ".", "eVindexFunc", ".", "Opcode", "!=",...
// PushFilter satisfies the builder interface. // Only some where clauses are allowed.
[ "PushFilter", "satisfies", "the", "builder", "interface", ".", "Only", "some", "where", "clauses", "are", "allowed", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/vindex_func.go#L97-L130
135,288
vitessio/vitess
go/vt/vtgate/vindexes/reverse_bits.go
NewReverseBits
func NewReverseBits(name string, m map[string]string) (Vindex, error) { return &ReverseBits{name: name}, nil }
go
func NewReverseBits(name string, m map[string]string) (Vindex, error) { return &ReverseBits{name: name}, nil }
[ "func", "NewReverseBits", "(", "name", "string", ",", "m", "map", "[", "string", "]", "string", ")", "(", "Vindex", ",", "error", ")", "{", "return", "&", "ReverseBits", "{", "name", ":", "name", "}", ",", "nil", "\n", "}" ]
// NewReverseBits creates a new ReverseBits.
[ "NewReverseBits", "creates", "a", "new", "ReverseBits", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/reverse_bits.go#L43-L45
135,289
vitessio/vitess
go/vt/vtgate/vindexes/reverse_bits.go
Map
func (vind *ReverseBits) Map(cursor VCursor, ids []sqltypes.Value) ([]key.Destination, error) { out := make([]key.Destination, len(ids)) for i, id := range ids { num, err := sqltypes.ToUint64(id) if err != nil { out[i] = key.DestinationNone{} continue } out[i] = key.DestinationKeyspaceID(reverse(num)) ...
go
func (vind *ReverseBits) Map(cursor VCursor, ids []sqltypes.Value) ([]key.Destination, error) { out := make([]key.Destination, len(ids)) for i, id := range ids { num, err := sqltypes.ToUint64(id) if err != nil { out[i] = key.DestinationNone{} continue } out[i] = key.DestinationKeyspaceID(reverse(num)) ...
[ "func", "(", "vind", "*", "ReverseBits", ")", "Map", "(", "cursor", "VCursor", ",", "ids", "[", "]", "sqltypes", ".", "Value", ")", "(", "[", "]", "key", ".", "Destination", ",", "error", ")", "{", "out", ":=", "make", "(", "[", "]", "key", ".", ...
// Map returns the corresponding KeyspaceId values for the given ids.
[ "Map", "returns", "the", "corresponding", "KeyspaceId", "values", "for", "the", "given", "ids", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/reverse_bits.go#L68-L79
135,290
vitessio/vitess
go/vt/vtgate/vindexes/reverse_bits.go
ReverseMap
func (vind *ReverseBits) ReverseMap(_ VCursor, ksids [][]byte) ([]sqltypes.Value, error) { reverseIds := make([]sqltypes.Value, 0, len(ksids)) for _, keyspaceID := range ksids { val, err := unreverse(keyspaceID) if err != nil { return reverseIds, err } reverseIds = append(reverseIds, sqltypes.NewUint64(val...
go
func (vind *ReverseBits) ReverseMap(_ VCursor, ksids [][]byte) ([]sqltypes.Value, error) { reverseIds := make([]sqltypes.Value, 0, len(ksids)) for _, keyspaceID := range ksids { val, err := unreverse(keyspaceID) if err != nil { return reverseIds, err } reverseIds = append(reverseIds, sqltypes.NewUint64(val...
[ "func", "(", "vind", "*", "ReverseBits", ")", "ReverseMap", "(", "_", "VCursor", ",", "ksids", "[", "]", "[", "]", "byte", ")", "(", "[", "]", "sqltypes", ".", "Value", ",", "error", ")", "{", "reverseIds", ":=", "make", "(", "[", "]", "sqltypes", ...
// ReverseMap returns the ids from ksids.
[ "ReverseMap", "returns", "the", "ids", "from", "ksids", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vindexes/reverse_bits.go#L95-L105
135,291
vitessio/vitess
go/stats/multidimensional.go
CounterForDimension
func CounterForDimension(mt MultiTracker, dimension string) CountTracker { for i, lab := range mt.Labels() { if lab == dimension { return wrappedCountTracker{ f: func() map[string]int64 { result := make(map[string]int64) for k, v := range mt.Counts() { if k == "All" { result[k] = v ...
go
func CounterForDimension(mt MultiTracker, dimension string) CountTracker { for i, lab := range mt.Labels() { if lab == dimension { return wrappedCountTracker{ f: func() map[string]int64 { result := make(map[string]int64) for k, v := range mt.Counts() { if k == "All" { result[k] = v ...
[ "func", "CounterForDimension", "(", "mt", "MultiTracker", ",", "dimension", "string", ")", "CountTracker", "{", "for", "i", ",", "lab", ":=", "range", "mt", ".", "Labels", "(", ")", "{", "if", "lab", "==", "dimension", "{", "return", "wrappedCountTracker", ...
// CounterForDimension returns a CountTracker for the provided // dimension. It will panic if the dimension isn't a legal label for // mt.
[ "CounterForDimension", "returns", "a", "CountTracker", "for", "the", "provided", "dimension", ".", "It", "will", "panic", "if", "the", "dimension", "isn", "t", "a", "legal", "label", "for", "mt", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/multidimensional.go#L34-L54
135,292
vitessio/vitess
go/vt/vtctld/tablet_stats_cache.go
StatsUpdate
func (c *tabletStatsCache) StatsUpdate(stats *discovery.TabletStats) { c.mu.Lock() defer c.mu.Unlock() keyspace := stats.Tablet.Keyspace shard := stats.Tablet.Shard cell := stats.Tablet.Alias.Cell tabletType := stats.Tablet.Type aliasKey := tabletToMapKey(stats) ts, ok := c.statusesByAlias[aliasKey] if !stat...
go
func (c *tabletStatsCache) StatsUpdate(stats *discovery.TabletStats) { c.mu.Lock() defer c.mu.Unlock() keyspace := stats.Tablet.Keyspace shard := stats.Tablet.Shard cell := stats.Tablet.Alias.Cell tabletType := stats.Tablet.Type aliasKey := tabletToMapKey(stats) ts, ok := c.statusesByAlias[aliasKey] if !stat...
[ "func", "(", "c", "*", "tabletStatsCache", ")", "StatsUpdate", "(", "stats", "*", "discovery", ".", "TabletStats", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "keyspace", ":=", "s...
// StatsUpdate is part of the discovery.HealthCheckStatsListener interface. // Upon receiving a new TabletStats, it updates the two maps in tablet_stats_cache.
[ "StatsUpdate", "is", "part", "of", "the", "discovery", ".", "HealthCheckStatsListener", "interface", ".", "Upon", "receiving", "a", "new", "TabletStats", "it", "updates", "the", "two", "maps", "in", "tablet_stats_cache", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/tablet_stats_cache.go#L110-L166
135,293
vitessio/vitess
go/vt/vtctld/tablet_stats_cache.go
keyspacesLocked
func (c *tabletStatsCache) keyspacesLocked(keyspace string) []string { if keyspace != "all" { return []string{keyspace} } var keyspaces []string for ks := range c.statuses { keyspaces = append(keyspaces, ks) } sort.Strings(keyspaces) return keyspaces }
go
func (c *tabletStatsCache) keyspacesLocked(keyspace string) []string { if keyspace != "all" { return []string{keyspace} } var keyspaces []string for ks := range c.statuses { keyspaces = append(keyspaces, ks) } sort.Strings(keyspaces) return keyspaces }
[ "func", "(", "c", "*", "tabletStatsCache", ")", "keyspacesLocked", "(", "keyspace", "string", ")", "[", "]", "string", "{", "if", "keyspace", "!=", "\"", "\"", "{", "return", "[", "]", "string", "{", "keyspace", "}", "\n", "}", "\n", "var", "keyspaces"...
// keyspacesLocked returns the keyspaces to be displayed in the heatmap based on the dropdown filters. // It returns one keyspace if a specific one was chosen or returns all of them if 'all' is chosen. // This method is used by heatmapData to traverse over desired keyspaces and // topologyInfo to send all available opt...
[ "keyspacesLocked", "returns", "the", "keyspaces", "to", "be", "displayed", "in", "the", "heatmap", "based", "on", "the", "dropdown", "filters", ".", "It", "returns", "one", "keyspace", "if", "a", "specific", "one", "was", "chosen", "or", "returns", "all", "o...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/tablet_stats_cache.go#L207-L217
135,294
vitessio/vitess
go/vt/vtctld/tablet_stats_cache.go
cellsLocked
func (c *tabletStatsCache) cellsLocked(keyspace, cell string) []string { if cell != "all" { return []string{cell} } return c.cellsInTopology(keyspace) }
go
func (c *tabletStatsCache) cellsLocked(keyspace, cell string) []string { if cell != "all" { return []string{cell} } return c.cellsInTopology(keyspace) }
[ "func", "(", "c", "*", "tabletStatsCache", ")", "cellsLocked", "(", "keyspace", ",", "cell", "string", ")", "[", "]", "string", "{", "if", "cell", "!=", "\"", "\"", "{", "return", "[", "]", "string", "{", "cell", "}", "\n", "}", "\n", "return", "c"...
// cellsLocked returns the cells needed to be displayed in the heatmap based on the dropdown filters. // returns one cell if a specific one was chosen or returns all of them if 'all' is chosen. // This method is used by heatmapData to traverse over the desired cells.
[ "cellsLocked", "returns", "the", "cells", "needed", "to", "be", "displayed", "in", "the", "heatmap", "based", "on", "the", "dropdown", "filters", ".", "returns", "one", "cell", "if", "a", "specific", "one", "was", "chosen", "or", "returns", "all", "of", "t...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/tablet_stats_cache.go#L222-L227
135,295
vitessio/vitess
go/vt/vtctld/tablet_stats_cache.go
cellsInTopology
func (c *tabletStatsCache) cellsInTopology(keyspace string) []string { keyspaces := c.keyspacesLocked(keyspace) cells := make(map[string]bool) // Going through all shards in each keyspace to get all existing cells for _, ks := range keyspaces { shardsPerKeyspace := c.statuses[ks] for s := range shardsPerKeyspac...
go
func (c *tabletStatsCache) cellsInTopology(keyspace string) []string { keyspaces := c.keyspacesLocked(keyspace) cells := make(map[string]bool) // Going through all shards in each keyspace to get all existing cells for _, ks := range keyspaces { shardsPerKeyspace := c.statuses[ks] for s := range shardsPerKeyspac...
[ "func", "(", "c", "*", "tabletStatsCache", ")", "cellsInTopology", "(", "keyspace", "string", ")", "[", "]", "string", "{", "keyspaces", ":=", "c", ".", "keyspacesLocked", "(", "keyspace", ")", "\n", "cells", ":=", "make", "(", "map", "[", "string", "]",...
// cellsInTopology returns all the cells in the given keyspace. // If all keyspaces is chosen, it returns the cells from every keyspace. // This method is used by topologyInfo to send all available options for the cell dropdown
[ "cellsInTopology", "returns", "all", "the", "cells", "in", "the", "given", "keyspace", ".", "If", "all", "keyspaces", "is", "chosen", "it", "returns", "the", "cells", "from", "every", "keyspace", ".", "This", "method", "is", "used", "by", "topologyInfo", "to...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/tablet_stats_cache.go#L243-L262
135,296
vitessio/vitess
go/vt/vtctld/tablet_stats_cache.go
typesInTopology
func (c *tabletStatsCache) typesInTopology(keyspace, cell string) []topodatapb.TabletType { keyspaces := c.keyspacesLocked(keyspace) types := make(map[topodatapb.TabletType]bool) // Going through the shards in every cell in every keyspace to get existing tablet types for _, ks := range keyspaces { cellsPerKeyspac...
go
func (c *tabletStatsCache) typesInTopology(keyspace, cell string) []topodatapb.TabletType { keyspaces := c.keyspacesLocked(keyspace) types := make(map[topodatapb.TabletType]bool) // Going through the shards in every cell in every keyspace to get existing tablet types for _, ks := range keyspaces { cellsPerKeyspac...
[ "func", "(", "c", "*", "tabletStatsCache", ")", "typesInTopology", "(", "keyspace", ",", "cell", "string", ")", "[", "]", "topodatapb", ".", "TabletType", "{", "keyspaces", ":=", "c", ".", "keyspacesLocked", "(", "keyspace", ")", "\n", "types", ":=", "make...
// typesInTopology returns all the types in the given keyspace and cell. // If all keyspaces and cells is chosen, it returns the types from every cell in every keyspace. // This method is used by topologyInfo to send all available options for the tablet type dropdown
[ "typesInTopology", "returns", "all", "the", "types", "in", "the", "given", "keyspace", "and", "cell", ".", "If", "all", "keyspaces", "and", "cells", "is", "chosen", "it", "returns", "the", "types", "from", "every", "cell", "in", "every", "keyspace", ".", "...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctld/tablet_stats_cache.go#L267-L288
135,297
vitessio/vitess
go/vt/logutil/logger.go
EventToBuffer
func EventToBuffer(event *logutilpb.Event, buf *bytes.Buffer) { // Avoid Fprintf, for speed. The format is so simple that we // can do it quickly by hand. It's worth about 3X. Fprintf is hard. // Lmmdd hh:mm:ss.uuuuuu file:line] switch event.Level { case logutilpb.Level_INFO: buf.WriteByte('I') case logutilpb...
go
func EventToBuffer(event *logutilpb.Event, buf *bytes.Buffer) { // Avoid Fprintf, for speed. The format is so simple that we // can do it quickly by hand. It's worth about 3X. Fprintf is hard. // Lmmdd hh:mm:ss.uuuuuu file:line] switch event.Level { case logutilpb.Level_INFO: buf.WriteByte('I') case logutilpb...
[ "func", "EventToBuffer", "(", "event", "*", "logutilpb", ".", "Event", ",", "buf", "*", "bytes", ".", "Buffer", ")", "{", "// Avoid Fprintf, for speed. The format is so simple that we", "// can do it quickly by hand. It's worth about 3X. Fprintf is hard.", "// Lmmdd hh:mm:ss.uuu...
// EventToBuffer formats an individual Event into a buffer, without the // final '\n'
[ "EventToBuffer", "formats", "an", "individual", "Event", "into", "a", "buffer", "without", "the", "final", "\\", "n" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L59-L96
135,298
vitessio/vitess
go/vt/logutil/logger.go
EventString
func EventString(event *logutilpb.Event) string { buf := new(bytes.Buffer) EventToBuffer(event, buf) return buf.String() }
go
func EventString(event *logutilpb.Event) string { buf := new(bytes.Buffer) EventToBuffer(event, buf) return buf.String() }
[ "func", "EventString", "(", "event", "*", "logutilpb", ".", "Event", ")", "string", "{", "buf", ":=", "new", "(", "bytes", ".", "Buffer", ")", "\n", "EventToBuffer", "(", "event", ",", "buf", ")", "\n", "return", "buf", ".", "String", "(", ")", "\n",...
// EventString returns the line in one string
[ "EventString", "returns", "the", "line", "in", "one", "string" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/logger.go#L99-L103
135,299
vitessio/vitess
go/vt/logutil/logger.go
Warningf
func (cl *CallbackLogger) Warningf(format string, v ...interface{}) { cl.WarningDepth(1, fmt.Sprintf(format, v...)) }
go
func (cl *CallbackLogger) Warningf(format string, v ...interface{}) { cl.WarningDepth(1, fmt.Sprintf(format, v...)) }
[ "func", "(", "cl", "*", "CallbackLogger", ")", "Warningf", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "cl", ".", "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#L178-L180