repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
vitessio/vitess
go/vt/vtgate/grpcvtgateservice/server.go
MessageAck
func (vtg *VTGate) MessageAck(ctx context.Context, request *vtgatepb.MessageAckRequest) (response *querypb.MessageAckResponse, err error) { defer vtg.server.HandlePanic(&err) ctx = withCallerIDContext(ctx, request.CallerId) count, vtgErr := vtg.server.MessageAck(ctx, request.Keyspace, request.Name, request.Ids) if ...
go
func (vtg *VTGate) MessageAck(ctx context.Context, request *vtgatepb.MessageAckRequest) (response *querypb.MessageAckResponse, err error) { defer vtg.server.HandlePanic(&err) ctx = withCallerIDContext(ctx, request.CallerId) count, vtgErr := vtg.server.MessageAck(ctx, request.Keyspace, request.Name, request.Ids) if ...
[ "func", "(", "vtg", "*", "VTGate", ")", "MessageAck", "(", "ctx", "context", ".", "Context", ",", "request", "*", "vtgatepb", ".", "MessageAckRequest", ")", "(", "response", "*", "querypb", ".", "MessageAckResponse", ",", "err", "error", ")", "{", "defer",...
// MessageAck is the RPC version of vtgateservice.VTGateService method
[ "MessageAck", "is", "the", "RPC", "version", "of", "vtgateservice", ".", "VTGateService", "method" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L424-L436
train
vitessio/vitess
go/vt/vtgate/grpcvtgateservice/server.go
SplitQuery
func (vtg *VTGate) SplitQuery(ctx context.Context, request *vtgatepb.SplitQueryRequest) (response *vtgatepb.SplitQueryResponse, err error) { defer vtg.server.HandlePanic(&err) ctx = withCallerIDContext(ctx, request.CallerId) splits, vtgErr := vtg.server.SplitQuery( ctx, request.Keyspace, request.Query.Sql, ...
go
func (vtg *VTGate) SplitQuery(ctx context.Context, request *vtgatepb.SplitQueryRequest) (response *vtgatepb.SplitQueryResponse, err error) { defer vtg.server.HandlePanic(&err) ctx = withCallerIDContext(ctx, request.CallerId) splits, vtgErr := vtg.server.SplitQuery( ctx, request.Keyspace, request.Query.Sql, ...
[ "func", "(", "vtg", "*", "VTGate", ")", "SplitQuery", "(", "ctx", "context", ".", "Context", ",", "request", "*", "vtgatepb", ".", "SplitQueryRequest", ")", "(", "response", "*", "vtgatepb", ".", "SplitQueryResponse", ",", "err", "error", ")", "{", "defer"...
// SplitQuery is the RPC version of vtgateservice.VTGateService method
[ "SplitQuery", "is", "the", "RPC", "version", "of", "vtgateservice", ".", "VTGateService", "method" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L455-L474
train
vitessio/vitess
go/vt/vtgate/grpcvtgateservice/server.go
GetSrvKeyspace
func (vtg *VTGate) GetSrvKeyspace(ctx context.Context, request *vtgatepb.GetSrvKeyspaceRequest) (response *vtgatepb.GetSrvKeyspaceResponse, err error) { defer vtg.server.HandlePanic(&err) sk, vtgErr := vtg.server.GetSrvKeyspace(ctx, request.Keyspace) if vtgErr != nil { return nil, vterrors.ToGRPC(vtgErr) } retur...
go
func (vtg *VTGate) GetSrvKeyspace(ctx context.Context, request *vtgatepb.GetSrvKeyspaceRequest) (response *vtgatepb.GetSrvKeyspaceResponse, err error) { defer vtg.server.HandlePanic(&err) sk, vtgErr := vtg.server.GetSrvKeyspace(ctx, request.Keyspace) if vtgErr != nil { return nil, vterrors.ToGRPC(vtgErr) } retur...
[ "func", "(", "vtg", "*", "VTGate", ")", "GetSrvKeyspace", "(", "ctx", "context", ".", "Context", ",", "request", "*", "vtgatepb", ".", "GetSrvKeyspaceRequest", ")", "(", "response", "*", "vtgatepb", ".", "GetSrvKeyspaceResponse", ",", "err", "error", ")", "{...
// GetSrvKeyspace is the RPC version of vtgateservice.VTGateService method
[ "GetSrvKeyspace", "is", "the", "RPC", "version", "of", "vtgateservice", ".", "VTGateService", "method" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L477-L486
train
vitessio/vitess
go/vt/vtgate/grpcvtgateservice/server.go
UpdateStream
func (vtg *VTGate) UpdateStream(request *vtgatepb.UpdateStreamRequest, stream vtgateservicepb.Vitess_UpdateStreamServer) (err error) { defer vtg.server.HandlePanic(&err) ctx := withCallerIDContext(stream.Context(), request.CallerId) vtgErr := vtg.server.UpdateStream(ctx, request.Keyspace, request.Shard, reques...
go
func (vtg *VTGate) UpdateStream(request *vtgatepb.UpdateStreamRequest, stream vtgateservicepb.Vitess_UpdateStreamServer) (err error) { defer vtg.server.HandlePanic(&err) ctx := withCallerIDContext(stream.Context(), request.CallerId) vtgErr := vtg.server.UpdateStream(ctx, request.Keyspace, request.Shard, reques...
[ "func", "(", "vtg", "*", "VTGate", ")", "UpdateStream", "(", "request", "*", "vtgatepb", ".", "UpdateStreamRequest", ",", "stream", "vtgateservicepb", ".", "Vitess_UpdateStreamServer", ")", "(", "err", "error", ")", "{", "defer", "vtg", ".", "server", ".", "...
// UpdateStream is the RPC version of vtgateservice.VTGateService method
[ "UpdateStream", "is", "the", "RPC", "version", "of", "vtgateservice", ".", "VTGateService", "method" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/grpcvtgateservice/server.go#L489-L508
train
vitessio/vitess
go/vt/dbconnpool/connection.go
ExecuteFetch
func (dbc *DBConnection) ExecuteFetch(query string, maxrows int, wantfields bool) (*sqltypes.Result, error) { defer dbc.mysqlStats.Record("Exec", time.Now()) mqr, err := dbc.Conn.ExecuteFetch(query, maxrows, wantfields) if err != nil { dbc.handleError(err) return nil, err } return mqr, nil }
go
func (dbc *DBConnection) ExecuteFetch(query string, maxrows int, wantfields bool) (*sqltypes.Result, error) { defer dbc.mysqlStats.Record("Exec", time.Now()) mqr, err := dbc.Conn.ExecuteFetch(query, maxrows, wantfields) if err != nil { dbc.handleError(err) return nil, err } return mqr, nil }
[ "func", "(", "dbc", "*", "DBConnection", ")", "ExecuteFetch", "(", "query", "string", ",", "maxrows", "int", ",", "wantfields", "bool", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "defer", "dbc", ".", "mysqlStats", ".", "Record", ...
// ExecuteFetch overwrites mysql.Conn.ExecuteFetch.
[ "ExecuteFetch", "overwrites", "mysql", ".", "Conn", ".", "ExecuteFetch", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/dbconnpool/connection.go#L46-L54
train
vitessio/vitess
go/vt/dbconnpool/connection.go
ExecuteStreamFetch
func (dbc *DBConnection) ExecuteStreamFetch(query string, callback func(*sqltypes.Result) error, streamBufferSize int) error { defer dbc.mysqlStats.Record("ExecStream", time.Now()) err := dbc.Conn.ExecuteStreamFetch(query) if err != nil { dbc.handleError(err) return err } defer dbc.CloseResult() // first ca...
go
func (dbc *DBConnection) ExecuteStreamFetch(query string, callback func(*sqltypes.Result) error, streamBufferSize int) error { defer dbc.mysqlStats.Record("ExecStream", time.Now()) err := dbc.Conn.ExecuteStreamFetch(query) if err != nil { dbc.handleError(err) return err } defer dbc.CloseResult() // first ca...
[ "func", "(", "dbc", "*", "DBConnection", ")", "ExecuteStreamFetch", "(", "query", "string", ",", "callback", "func", "(", "*", "sqltypes", ".", "Result", ")", "error", ",", "streamBufferSize", "int", ")", "error", "{", "defer", "dbc", ".", "mysqlStats", "....
// ExecuteStreamFetch overwrites mysql.Conn.ExecuteStreamFetch.
[ "ExecuteStreamFetch", "overwrites", "mysql", ".", "Conn", ".", "ExecuteStreamFetch", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/dbconnpool/connection.go#L57-L115
train
vitessio/vitess
go/vt/dbconnpool/connection.go
NewDBConnection
func NewDBConnection(info *mysql.ConnParams, mysqlStats *stats.Timings) (*DBConnection, error) { start := time.Now() defer mysqlStats.Record("Connect", start) params, err := dbconfigs.WithCredentials(info) if err != nil { return nil, err } ctx := context.Background() c, err := mysql.Connect(ctx, params) if er...
go
func NewDBConnection(info *mysql.ConnParams, mysqlStats *stats.Timings) (*DBConnection, error) { start := time.Now() defer mysqlStats.Record("Connect", start) params, err := dbconfigs.WithCredentials(info) if err != nil { return nil, err } ctx := context.Background() c, err := mysql.Connect(ctx, params) if er...
[ "func", "NewDBConnection", "(", "info", "*", "mysql", ".", "ConnParams", ",", "mysqlStats", "*", "stats", ".", "Timings", ")", "(", "*", "DBConnection", ",", "error", ")", "{", "start", ":=", "time", ".", "Now", "(", ")", "\n", "defer", "mysqlStats", "...
// NewDBConnection returns a new DBConnection based on the ConnParams // and will use the provided stats to collect timing.
[ "NewDBConnection", "returns", "a", "new", "DBConnection", "based", "on", "the", "ConnParams", "and", "will", "use", "the", "provided", "stats", "to", "collect", "timing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/dbconnpool/connection.go#L119-L132
train
vitessio/vitess
go/vt/vtgate/buffer/timeout_thread.go
waitForEntry
func (tt *timeoutThread) waitForEntry(e *entry) bool { windowExceeded := time.NewTimer(time.Until(e.deadline)) defer windowExceeded.Stop() select { // a) Always check these channels, regardless of the state. case <-tt.maxDuration.C: // Max duration is up. Stop buffering. Do not error out entries explicitly. t...
go
func (tt *timeoutThread) waitForEntry(e *entry) bool { windowExceeded := time.NewTimer(time.Until(e.deadline)) defer windowExceeded.Stop() select { // a) Always check these channels, regardless of the state. case <-tt.maxDuration.C: // Max duration is up. Stop buffering. Do not error out entries explicitly. t...
[ "func", "(", "tt", "*", "timeoutThread", ")", "waitForEntry", "(", "e", "*", "entry", ")", "bool", "{", "windowExceeded", ":=", "time", ".", "NewTimer", "(", "time", ".", "Until", "(", "e", ".", "deadline", ")", ")", "\n", "defer", "windowExceeded", "....
// waitForEntry blocks until "e" exceeds its buffering window or buffering stops // in general. It returns true if the timeout thread should stop.
[ "waitForEntry", "blocks", "until", "e", "exceeds", "its", "buffering", "window", "or", "buffering", "stops", "in", "general", ".", "It", "returns", "true", "if", "the", "timeout", "thread", "should", "stop", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/buffer/timeout_thread.go#L97-L124
train
vitessio/vitess
go/vt/vtgate/buffer/timeout_thread.go
waitForNonEmptyQueue
func (tt *timeoutThread) waitForNonEmptyQueue() bool { tt.mu.Lock() queueNotEmpty := tt.queueNotEmpty tt.mu.Unlock() select { // a) Always check these channels, regardless of the state. case <-tt.maxDuration.C: // Max duration is up. Stop buffering. Do not error out entries explicitly. tt.sb.stopBufferingDue...
go
func (tt *timeoutThread) waitForNonEmptyQueue() bool { tt.mu.Lock() queueNotEmpty := tt.queueNotEmpty tt.mu.Unlock() select { // a) Always check these channels, regardless of the state. case <-tt.maxDuration.C: // Max duration is up. Stop buffering. Do not error out entries explicitly. tt.sb.stopBufferingDue...
[ "func", "(", "tt", "*", "timeoutThread", ")", "waitForNonEmptyQueue", "(", ")", "bool", "{", "tt", ".", "mu", ".", "Lock", "(", ")", "\n", "queueNotEmpty", ":=", "tt", ".", "queueNotEmpty", "\n", "tt", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "sel...
// waitForNonEmptyQueue blocks until the buffer queue gets a new element or // the timeout thread should be stopped. // It returns true if the timeout thread should stop.
[ "waitForNonEmptyQueue", "blocks", "until", "the", "buffer", "queue", "gets", "a", "new", "element", "or", "the", "timeout", "thread", "should", "be", "stopped", ".", "It", "returns", "true", "if", "the", "timeout", "thread", "should", "stop", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/buffer/timeout_thread.go#L129-L148
train
vitessio/vitess
go/vt/vttime/interval.go
NewInterval
func NewInterval(earliest, latest time.Time) (Interval, error) { if latest.Sub(earliest) < 0 { return Interval{}, fmt.Errorf("NewInterval: earliest has to be smaller or equal to latest, but got: earliest=%v latest=%v", earliest, latest) } return Interval{ earliest: earliest, latest: latest, }, nil }
go
func NewInterval(earliest, latest time.Time) (Interval, error) { if latest.Sub(earliest) < 0 { return Interval{}, fmt.Errorf("NewInterval: earliest has to be smaller or equal to latest, but got: earliest=%v latest=%v", earliest, latest) } return Interval{ earliest: earliest, latest: latest, }, nil }
[ "func", "NewInterval", "(", "earliest", ",", "latest", "time", ".", "Time", ")", "(", "Interval", ",", "error", ")", "{", "if", "latest", ".", "Sub", "(", "earliest", ")", "<", "0", "{", "return", "Interval", "{", "}", ",", "fmt", ".", "Errorf", "(...
// NewInterval creates a new Interval from the provided times. // earliest has to be smaller or equal to latest, or an error is returned.
[ "NewInterval", "creates", "a", "new", "Interval", "from", "the", "provided", "times", ".", "earliest", "has", "to", "be", "smaller", "or", "equal", "to", "latest", "or", "an", "error", "is", "returned", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttime/interval.go#L32-L40
train
vitessio/vitess
go/vt/vttime/interval.go
Less
func (i Interval) Less(other Interval) bool { return i.latest.Sub(other.earliest) < 0 }
go
func (i Interval) Less(other Interval) bool { return i.latest.Sub(other.earliest) < 0 }
[ "func", "(", "i", "Interval", ")", "Less", "(", "other", "Interval", ")", "bool", "{", "return", "i", ".", "latest", ".", "Sub", "(", "other", ".", "earliest", ")", "<", "0", "\n", "}" ]
// Less returns true if the provided interval is earlier than the parameter. // Since both intervals are inclusive, comparison has to be strict.
[ "Less", "returns", "true", "if", "the", "provided", "interval", "is", "earlier", "than", "the", "parameter", ".", "Since", "both", "intervals", "are", "inclusive", "comparison", "has", "to", "be", "strict", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttime/interval.go#L58-L60
train
vitessio/vitess
go/vt/servenv/grpc_server_auth_static.go
Authenticate
func (sa *StaticAuthPlugin) Authenticate(ctx context.Context, fullMethod string) (context.Context, error) { if md, ok := metadata.FromIncomingContext(ctx); ok { if len(md["username"]) == 0 || len(md["password"]) == 0 { return nil, status.Errorf(codes.Unauthenticated, "username and password must be provided") } ...
go
func (sa *StaticAuthPlugin) Authenticate(ctx context.Context, fullMethod string) (context.Context, error) { if md, ok := metadata.FromIncomingContext(ctx); ok { if len(md["username"]) == 0 || len(md["password"]) == 0 { return nil, status.Errorf(codes.Unauthenticated, "username and password must be provided") } ...
[ "func", "(", "sa", "*", "StaticAuthPlugin", ")", "Authenticate", "(", "ctx", "context", ".", "Context", ",", "fullMethod", "string", ")", "(", "context", ".", "Context", ",", "error", ")", "{", "if", "md", ",", "ok", ":=", "metadata", ".", "FromIncomingC...
// Authenticate implements AuthPlugin interface. This method will be used inside a middleware in grpc_server to authenticate // incoming requests.
[ "Authenticate", "implements", "AuthPlugin", "interface", ".", "This", "method", "will", "be", "used", "inside", "a", "middleware", "in", "grpc_server", "to", "authenticate", "incoming", "requests", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/grpc_server_auth_static.go#L56-L71
train
vitessio/vitess
go/vt/logutil/purge.go
purgeLogsOnce
func purgeLogsOnce(now time.Time, dir, program string, keep time.Duration) { current := make(map[string]bool) for _, level := range levels { c, err := os.Readlink(path.Join(dir, fmt.Sprintf("%s.%s", program, level))) if err != nil { continue } current[c] = true } files, err := filepath.Glob(path.Join(di...
go
func purgeLogsOnce(now time.Time, dir, program string, keep time.Duration) { current := make(map[string]bool) for _, level := range levels { c, err := os.Readlink(path.Join(dir, fmt.Sprintf("%s.%s", program, level))) if err != nil { continue } current[c] = true } files, err := filepath.Glob(path.Join(di...
[ "func", "purgeLogsOnce", "(", "now", "time", ".", "Time", ",", "dir", ",", "program", "string", ",", "keep", "time", ".", "Duration", ")", "{", "current", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "for", "_", ",", "level", ":...
// purgeLogsOnce removes logfiles for program for dir, if their age // relative to now is greater than keep.
[ "purgeLogsOnce", "removes", "logfiles", "for", "program", "for", "dir", "if", "their", "age", "relative", "to", "now", "is", "greater", "than", "keep", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/purge.go#L49-L75
train
vitessio/vitess
go/vt/logutil/purge.go
PurgeLogs
func PurgeLogs() { f := flag.Lookup("log_dir") if f == nil { panic("the logging module doesn't specify a log_dir flag") } if *keepLogs == 0*time.Second { return } logDir := f.Value.String() program := filepath.Base(os.Args[0]) timer := time.NewTimer(*purgeLogsInterval) for range timer.C { purgeLogsOnce...
go
func PurgeLogs() { f := flag.Lookup("log_dir") if f == nil { panic("the logging module doesn't specify a log_dir flag") } if *keepLogs == 0*time.Second { return } logDir := f.Value.String() program := filepath.Base(os.Args[0]) timer := time.NewTimer(*purgeLogsInterval) for range timer.C { purgeLogsOnce...
[ "func", "PurgeLogs", "(", ")", "{", "f", ":=", "flag", ".", "Lookup", "(", "\"", "\"", ")", "\n", "if", "f", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "*", "keepLogs", "==", "0", "*", "time", ".", "Second", "{"...
// PurgeLogs removes any log files that were started more than // keepLogs ago and that aren't the current log.
[ "PurgeLogs", "removes", "any", "log", "files", "that", "were", "started", "more", "than", "keepLogs", "ago", "and", "that", "aren", "t", "the", "current", "log", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/purge.go#L79-L95
train
vitessio/vitess
go/vt/vterrors/proto3.go
ToVTRPC
func ToVTRPC(err error) *vtrpcpb.RPCError { if err == nil { return nil } code := Code(err) return &vtrpcpb.RPCError{ LegacyCode: CodeToLegacyErrorCode(code), Code: code, Message: err.Error(), } }
go
func ToVTRPC(err error) *vtrpcpb.RPCError { if err == nil { return nil } code := Code(err) return &vtrpcpb.RPCError{ LegacyCode: CodeToLegacyErrorCode(code), Code: code, Message: err.Error(), } }
[ "func", "ToVTRPC", "(", "err", "error", ")", "*", "vtrpcpb", ".", "RPCError", "{", "if", "err", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "code", ":=", "Code", "(", "err", ")", "\n", "return", "&", "vtrpcpb", ".", "RPCError", "{", "Legacy...
// ToVTRPC converts from vtError to a vtrpcpb.RPCError.
[ "ToVTRPC", "converts", "from", "vtError", "to", "a", "vtrpcpb", ".", "RPCError", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vterrors/proto3.go#L42-L52
train
vitessio/vitess
go/fileutil/wildcards.go
HasWildcard
func HasWildcard(path string) bool { for i := 0; i < len(path); i++ { switch path[i] { case '\\': if i+1 >= len(path) { return true } i++ case '*', '?', '[': return true } } return false }
go
func HasWildcard(path string) bool { for i := 0; i < len(path); i++ { switch path[i] { case '\\': if i+1 >= len(path) { return true } i++ case '*', '?', '[': return true } } return false }
[ "func", "HasWildcard", "(", "path", "string", ")", "bool", "{", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "path", ")", ";", "i", "++", "{", "switch", "path", "[", "i", "]", "{", "case", "'\\\\'", ":", "if", "i", "+", "1", ">=", "len",...
// HasWildcard checks if a string has a wildcard in it. In the cases // where we detect a bad pattern, we return 'true', and let the path.Match // function find it.
[ "HasWildcard", "checks", "if", "a", "string", "has", "a", "wildcard", "in", "it", ".", "In", "the", "cases", "where", "we", "detect", "a", "bad", "pattern", "we", "return", "true", "and", "let", "the", "path", ".", "Match", "function", "find", "it", "....
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/fileutil/wildcards.go#L23-L36
train
vitessio/vitess
go/event/hooks.go
Add
func (h *Hooks) Add(f func()) { h.mu.Lock() defer h.mu.Unlock() h.funcs = append(h.funcs, f) }
go
func (h *Hooks) Add(f func()) { h.mu.Lock() defer h.mu.Unlock() h.funcs = append(h.funcs, f) }
[ "func", "(", "h", "*", "Hooks", ")", "Add", "(", "f", "func", "(", ")", ")", "{", "h", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "h", ".", "mu", ".", "Unlock", "(", ")", "\n", "h", ".", "funcs", "=", "append", "(", "h", ".", "funcs...
// Add appends the given function to the list to be triggered.
[ "Add", "appends", "the", "given", "function", "to", "the", "list", "to", "be", "triggered", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/event/hooks.go#L31-L35
train
vitessio/vitess
go/vt/worker/legacy_split_clone.go
NewLegacySplitCloneWorker
func NewLegacySplitCloneWorker(wr *wrangler.Wrangler, cell, keyspace, shard string, excludeTables []string, sourceReaderCount, destinationPackCount, destinationWriterCount, minHealthyRdonlyTablets int, maxTPS int64) (Worker, error) { if maxTPS != throttler.MaxRateModuleDisabled { wr.Logger().Infof("throttling enable...
go
func NewLegacySplitCloneWorker(wr *wrangler.Wrangler, cell, keyspace, shard string, excludeTables []string, sourceReaderCount, destinationPackCount, destinationWriterCount, minHealthyRdonlyTablets int, maxTPS int64) (Worker, error) { if maxTPS != throttler.MaxRateModuleDisabled { wr.Logger().Infof("throttling enable...
[ "func", "NewLegacySplitCloneWorker", "(", "wr", "*", "wrangler", ".", "Wrangler", ",", "cell", ",", "keyspace", ",", "shard", "string", ",", "excludeTables", "[", "]", "string", ",", "sourceReaderCount", ",", "destinationPackCount", ",", "destinationWriterCount", ...
// NewLegacySplitCloneWorker returns a new LegacySplitCloneWorker object.
[ "NewLegacySplitCloneWorker", "returns", "a", "new", "LegacySplitCloneWorker", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/legacy_split_clone.go#L102-L133
train
vitessio/vitess
go/vt/worker/legacy_split_clone.go
Run
func (scw *LegacySplitCloneWorker) Run(ctx context.Context) error { resetVars() // Run the command. err := scw.run(ctx) // Cleanup. scw.setState(WorkerStateCleanUp) // Reverse any changes e.g. setting the tablet type of a source RDONLY tablet. cerr := scw.cleaner.CleanUp(scw.wr) if cerr != nil { if err != n...
go
func (scw *LegacySplitCloneWorker) Run(ctx context.Context) error { resetVars() // Run the command. err := scw.run(ctx) // Cleanup. scw.setState(WorkerStateCleanUp) // Reverse any changes e.g. setting the tablet type of a source RDONLY tablet. cerr := scw.cleaner.CleanUp(scw.wr) if cerr != nil { if err != n...
[ "func", "(", "scw", "*", "LegacySplitCloneWorker", ")", "Run", "(", "ctx", "context", ".", "Context", ")", "error", "{", "resetVars", "(", ")", "\n\n", "// Run the command.", "err", ":=", "scw", ".", "run", "(", "ctx", ")", "\n\n", "// Cleanup.", "scw", ...
// Run implements the Worker interface
[ "Run", "implements", "the", "Worker", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/legacy_split_clone.go#L197-L235
train
vitessio/vitess
go/vt/worker/legacy_split_clone.go
processData
func (scw *LegacySplitCloneWorker) processData(ctx context.Context, dbNames []string, td *tabletmanagerdatapb.TableDefinition, tableIndex int, rr ResultReader, rowSplitter *RowSplitter, insertChannels []chan string, destinationPackCount int) error { // Store the baseCmd per destination shard because each tablet may ha...
go
func (scw *LegacySplitCloneWorker) processData(ctx context.Context, dbNames []string, td *tabletmanagerdatapb.TableDefinition, tableIndex int, rr ResultReader, rowSplitter *RowSplitter, insertChannels []chan string, destinationPackCount int) error { // Store the baseCmd per destination shard because each tablet may ha...
[ "func", "(", "scw", "*", "LegacySplitCloneWorker", ")", "processData", "(", "ctx", "context", ".", "Context", ",", "dbNames", "[", "]", "string", ",", "td", "*", "tabletmanagerdatapb", ".", "TableDefinition", ",", "tableIndex", "int", ",", "rr", "ResultReader"...
// processData pumps the data out of the provided QueryResultReader. // It returns any error the source encounters.
[ "processData", "pumps", "the", "data", "out", "of", "the", "provided", "QueryResultReader", ".", "It", "returns", "any", "error", "the", "source", "encounters", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/legacy_split_clone.go#L658-L707
train
vitessio/vitess
go/vt/throttler/throttler.go
updateMaxRate
func (t *Throttler) updateMaxRate() { // Set it to infinite initially. maxRate := int64(math.MaxInt64) // Find out the new max rate (minimum among all modules). for _, m := range t.modules { if moduleMaxRate := m.MaxRate(); moduleMaxRate < maxRate { maxRate = moduleMaxRate } } // Set the new max rate on ...
go
func (t *Throttler) updateMaxRate() { // Set it to infinite initially. maxRate := int64(math.MaxInt64) // Find out the new max rate (minimum among all modules). for _, m := range t.modules { if moduleMaxRate := m.MaxRate(); moduleMaxRate < maxRate { maxRate = moduleMaxRate } } // Set the new max rate on ...
[ "func", "(", "t", "*", "Throttler", ")", "updateMaxRate", "(", ")", "{", "// Set it to infinite initially.", "maxRate", ":=", "int64", "(", "math", ".", "MaxInt64", ")", "\n\n", "// Find out the new max rate (minimum among all modules).", "for", "_", ",", "m", ":=",...
// updateMaxRate recalculates the current max rate and updates all // threadThrottlers accordingly. // The rate changes when the number of thread changes or a module updated its // max rate.
[ "updateMaxRate", "recalculates", "the", "current", "max", "rate", "and", "updates", "all", "threadThrottlers", "accordingly", ".", "The", "rate", "changes", "when", "the", "number", "of", "thread", "changes", "or", "a", "module", "updated", "its", "max", "rate",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/throttler.go#L245-L283
train
vitessio/vitess
go/vt/throttler/throttler.go
UpdateConfiguration
func (t *Throttler) UpdateConfiguration(configuration *throttlerdatapb.Configuration, copyZeroValues bool) error { return t.maxReplicationLagModule.updateConfiguration(configuration, copyZeroValues) }
go
func (t *Throttler) UpdateConfiguration(configuration *throttlerdatapb.Configuration, copyZeroValues bool) error { return t.maxReplicationLagModule.updateConfiguration(configuration, copyZeroValues) }
[ "func", "(", "t", "*", "Throttler", ")", "UpdateConfiguration", "(", "configuration", "*", "throttlerdatapb", ".", "Configuration", ",", "copyZeroValues", "bool", ")", "error", "{", "return", "t", ".", "maxReplicationLagModule", ".", "updateConfiguration", "(", "c...
// UpdateConfiguration updates the configuration of the MaxReplicationLag module.
[ "UpdateConfiguration", "updates", "the", "configuration", "of", "the", "MaxReplicationLag", "module", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/throttler.go#L308-L310
train
vitessio/vitess
go/vt/vtgate/planbuilder/limit.go
newLimit
func newLimit(bldr builder) *limit { return &limit{ order: bldr.Order() + 1, resultColumns: bldr.ResultColumns(), input: bldr, elimit: &engine.Limit{}, } }
go
func newLimit(bldr builder) *limit { return &limit{ order: bldr.Order() + 1, resultColumns: bldr.ResultColumns(), input: bldr, elimit: &engine.Limit{}, } }
[ "func", "newLimit", "(", "bldr", "builder", ")", "*", "limit", "{", "return", "&", "limit", "{", "order", ":", "bldr", ".", "Order", "(", ")", "+", "1", ",", "resultColumns", ":", "bldr", ".", "ResultColumns", "(", ")", ",", "input", ":", "bldr", "...
// newLimit builds a new limit.
[ "newLimit", "builds", "a", "new", "limit", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/limit.go#L39-L46
train
vitessio/vitess
go/vt/vtgate/planbuilder/limit.go
SetLimit
func (l *limit) SetLimit(limit *sqlparser.Limit) error { count, ok := limit.Rowcount.(*sqlparser.SQLVal) if !ok { return fmt.Errorf("unexpected expression in LIMIT: %v", sqlparser.String(limit)) } pv, err := sqlparser.NewPlanValue(count) if err != nil { return err } l.elimit.Count = pv switch offset := lim...
go
func (l *limit) SetLimit(limit *sqlparser.Limit) error { count, ok := limit.Rowcount.(*sqlparser.SQLVal) if !ok { return fmt.Errorf("unexpected expression in LIMIT: %v", sqlparser.String(limit)) } pv, err := sqlparser.NewPlanValue(count) if err != nil { return err } l.elimit.Count = pv switch offset := lim...
[ "func", "(", "l", "*", "limit", ")", "SetLimit", "(", "limit", "*", "sqlparser", ".", "Limit", ")", "error", "{", "count", ",", "ok", ":=", "limit", ".", "Rowcount", ".", "(", "*", "sqlparser", ".", "SQLVal", ")", "\n", "if", "!", "ok", "{", "ret...
// SetLimit sets the limit for the primitive. It calls the underlying // primitive's SetUpperLimit, which is an optimization hint that informs // the underlying primitive that it doesn't need to return more rows than // specified.
[ "SetLimit", "sets", "the", "limit", "for", "the", "primitive", ".", "It", "calls", "the", "underlying", "primitive", "s", "SetUpperLimit", "which", "is", "an", "optimization", "hint", "that", "informs", "the", "underlying", "primitive", "that", "it", "doesn", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/limit.go#L109-L135
train
vitessio/vitess
go/stats/counters.go
ResetAll
func (c *counters) ResetAll() { c.mu.Lock() defer c.mu.Unlock() c.counts = make(map[string]*int64) }
go
func (c *counters) ResetAll() { c.mu.Lock() defer c.mu.Unlock() c.counts = make(map[string]*int64) }
[ "func", "(", "c", "*", "counters", ")", "ResetAll", "(", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "c", ".", "counts", "=", "make", "(", "map", "[", "string", "]", "*", "i...
// ResetAll resets all counter values and clears all keys.
[ "ResetAll", "resets", "all", "counter", "values", "and", "clears", "all", "keys", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L91-L95
train
vitessio/vitess
go/stats/counters.go
ZeroAll
func (c *counters) ZeroAll() { c.mu.Lock() defer c.mu.Unlock() for _, a := range c.counts { atomic.StoreInt64(a, int64(0)) } }
go
func (c *counters) ZeroAll() { c.mu.Lock() defer c.mu.Unlock() for _, a := range c.counts { atomic.StoreInt64(a, int64(0)) } }
[ "func", "(", "c", "*", "counters", ")", "ZeroAll", "(", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "for", "_", ",", "a", ":=", "range", "c", ".", "counts", "{", "atomic", "...
// ZeroAll resets all counter values to zero
[ "ZeroAll", "resets", "all", "counter", "values", "to", "zero" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L98-L104
train
vitessio/vitess
go/stats/counters.go
Reset
func (c *counters) Reset(name string) { a := c.getValueAddr(name) atomic.StoreInt64(a, int64(0)) }
go
func (c *counters) Reset(name string) { a := c.getValueAddr(name) atomic.StoreInt64(a, int64(0)) }
[ "func", "(", "c", "*", "counters", ")", "Reset", "(", "name", "string", ")", "{", "a", ":=", "c", ".", "getValueAddr", "(", "name", ")", "\n", "atomic", ".", "StoreInt64", "(", "a", ",", "int64", "(", "0", ")", ")", "\n", "}" ]
// Reset resets a specific counter value to 0.
[ "Reset", "resets", "a", "specific", "counter", "value", "to", "0", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L107-L110
train
vitessio/vitess
go/stats/counters.go
NewCountersWithSingleLabel
func NewCountersWithSingleLabel(name, help, label string, tags ...string) *CountersWithSingleLabel { c := &CountersWithSingleLabel{ counters: counters{ counts: make(map[string]*int64), help: help, }, label: label, } for _, tag := range tags { c.counts[tag] = new(int64) } if name != "" { publish(...
go
func NewCountersWithSingleLabel(name, help, label string, tags ...string) *CountersWithSingleLabel { c := &CountersWithSingleLabel{ counters: counters{ counts: make(map[string]*int64), help: help, }, label: label, } for _, tag := range tags { c.counts[tag] = new(int64) } if name != "" { publish(...
[ "func", "NewCountersWithSingleLabel", "(", "name", ",", "help", ",", "label", "string", ",", "tags", "...", "string", ")", "*", "CountersWithSingleLabel", "{", "c", ":=", "&", "CountersWithSingleLabel", "{", "counters", ":", "counters", "{", "counts", ":", "ma...
// NewCountersWithSingleLabel create a new Counters instance. // If name is set, the variable gets published. // The function also accepts an optional list of tags that pre-creates them // initialized to 0. // label is a category name used to organize the tags. It is currently only // used by Prometheus, but not by the...
[ "NewCountersWithSingleLabel", "create", "a", "new", "Counters", "instance", ".", "If", "name", "is", "set", "the", "variable", "gets", "published", ".", "The", "function", "also", "accepts", "an", "optional", "list", "of", "tags", "that", "pre", "-", "creates"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L143-L159
train
vitessio/vitess
go/stats/counters.go
NewCountersWithMultiLabels
func NewCountersWithMultiLabels(name, help string, labels []string) *CountersWithMultiLabels { t := &CountersWithMultiLabels{ counters: counters{ counts: make(map[string]*int64), help: help}, labels: labels, } if name != "" { publish(name, t) } return t }
go
func NewCountersWithMultiLabels(name, help string, labels []string) *CountersWithMultiLabels { t := &CountersWithMultiLabels{ counters: counters{ counts: make(map[string]*int64), help: help}, labels: labels, } if name != "" { publish(name, t) } return t }
[ "func", "NewCountersWithMultiLabels", "(", "name", ",", "help", "string", ",", "labels", "[", "]", "string", ")", "*", "CountersWithMultiLabels", "{", "t", ":=", "&", "CountersWithMultiLabels", "{", "counters", ":", "counters", "{", "counts", ":", "make", "(",...
// NewCountersWithMultiLabels creates a new CountersWithMultiLabels // instance, and publishes it if name is set.
[ "NewCountersWithMultiLabels", "creates", "a", "new", "CountersWithMultiLabels", "instance", "and", "publishes", "it", "if", "name", "is", "set", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L190-L202
train
vitessio/vitess
go/stats/counters.go
NewCountersFuncWithMultiLabels
func NewCountersFuncWithMultiLabels(name, help string, labels []string, f func() map[string]int64) *CountersFuncWithMultiLabels { t := &CountersFuncWithMultiLabels{ f: f, help: help, labels: labels, } if name != "" { publish(name, t) } return t }
go
func NewCountersFuncWithMultiLabels(name, help string, labels []string, f func() map[string]int64) *CountersFuncWithMultiLabels { t := &CountersFuncWithMultiLabels{ f: f, help: help, labels: labels, } if name != "" { publish(name, t) } return t }
[ "func", "NewCountersFuncWithMultiLabels", "(", "name", ",", "help", "string", ",", "labels", "[", "]", "string", ",", "f", "func", "(", ")", "map", "[", "string", "]", "int64", ")", "*", "CountersFuncWithMultiLabels", "{", "t", ":=", "&", "CountersFuncWithMu...
// NewCountersFuncWithMultiLabels creates a new CountersFuncWithMultiLabels // mapping to the provided function.
[ "NewCountersFuncWithMultiLabels", "creates", "a", "new", "CountersFuncWithMultiLabels", "mapping", "to", "the", "provided", "function", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L269-L280
train
vitessio/vitess
go/stats/counters.go
NewGaugesWithSingleLabel
func NewGaugesWithSingleLabel(name, help, label string, tags ...string) *GaugesWithSingleLabel { g := &GaugesWithSingleLabel{ CountersWithSingleLabel: CountersWithSingleLabel{ counters: counters{ counts: make(map[string]*int64), help: help, }, label: label, }, } for _, tag := range tags { g...
go
func NewGaugesWithSingleLabel(name, help, label string, tags ...string) *GaugesWithSingleLabel { g := &GaugesWithSingleLabel{ CountersWithSingleLabel: CountersWithSingleLabel{ counters: counters{ counts: make(map[string]*int64), help: help, }, label: label, }, } for _, tag := range tags { g...
[ "func", "NewGaugesWithSingleLabel", "(", "name", ",", "help", ",", "label", "string", ",", "tags", "...", "string", ")", "*", "GaugesWithSingleLabel", "{", "g", ":=", "&", "GaugesWithSingleLabel", "{", "CountersWithSingleLabel", ":", "CountersWithSingleLabel", "{", ...
// NewGaugesWithSingleLabel creates a new GaugesWithSingleLabel and // publishes it if the name is set.
[ "NewGaugesWithSingleLabel", "creates", "a", "new", "GaugesWithSingleLabel", "and", "publishes", "it", "if", "the", "name", "is", "set", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L316-L334
train
vitessio/vitess
go/stats/counters.go
Set
func (g *GaugesWithSingleLabel) Set(name string, value int64) { a := g.getValueAddr(name) atomic.StoreInt64(a, value) }
go
func (g *GaugesWithSingleLabel) Set(name string, value int64) { a := g.getValueAddr(name) atomic.StoreInt64(a, value) }
[ "func", "(", "g", "*", "GaugesWithSingleLabel", ")", "Set", "(", "name", "string", ",", "value", "int64", ")", "{", "a", ":=", "g", ".", "getValueAddr", "(", "name", ")", "\n", "atomic", ".", "StoreInt64", "(", "a", ",", "value", ")", "\n", "}" ]
// Set sets the value of a named gauge.
[ "Set", "sets", "the", "value", "of", "a", "named", "gauge", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L337-L340
train
vitessio/vitess
go/stats/counters.go
Add
func (g *GaugesWithSingleLabel) Add(name string, value int64) { a := g.getValueAddr(name) atomic.AddInt64(a, value) }
go
func (g *GaugesWithSingleLabel) Add(name string, value int64) { a := g.getValueAddr(name) atomic.AddInt64(a, value) }
[ "func", "(", "g", "*", "GaugesWithSingleLabel", ")", "Add", "(", "name", "string", ",", "value", "int64", ")", "{", "a", ":=", "g", ".", "getValueAddr", "(", "name", ")", "\n", "atomic", ".", "AddInt64", "(", "a", ",", "value", ")", "\n", "}" ]
// Add adds a value to a named gauge.
[ "Add", "adds", "a", "value", "to", "a", "named", "gauge", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L343-L346
train
vitessio/vitess
go/stats/counters.go
NewGaugesWithMultiLabels
func NewGaugesWithMultiLabels(name, help string, labels []string) *GaugesWithMultiLabels { t := &GaugesWithMultiLabels{ CountersWithMultiLabels: CountersWithMultiLabels{ counters: counters{ counts: make(map[string]*int64), help: help, }, labels: labels, }} if name != "" { publish(name, t) } ...
go
func NewGaugesWithMultiLabels(name, help string, labels []string) *GaugesWithMultiLabels { t := &GaugesWithMultiLabels{ CountersWithMultiLabels: CountersWithMultiLabels{ counters: counters{ counts: make(map[string]*int64), help: help, }, labels: labels, }} if name != "" { publish(name, t) } ...
[ "func", "NewGaugesWithMultiLabels", "(", "name", ",", "help", "string", ",", "labels", "[", "]", "string", ")", "*", "GaugesWithMultiLabels", "{", "t", ":=", "&", "GaugesWithMultiLabels", "{", "CountersWithMultiLabels", ":", "CountersWithMultiLabels", "{", "counters...
// NewGaugesWithMultiLabels creates a new GaugesWithMultiLabels instance, // and publishes it if name is set.
[ "NewGaugesWithMultiLabels", "creates", "a", "new", "GaugesWithMultiLabels", "instance", "and", "publishes", "it", "if", "name", "is", "set", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L356-L370
train
vitessio/vitess
go/stats/counters.go
NewGaugesFuncWithMultiLabels
func NewGaugesFuncWithMultiLabels(name, help string, labels []string, f func() map[string]int64) *GaugesFuncWithMultiLabels { t := &GaugesFuncWithMultiLabels{ CountersFuncWithMultiLabels: CountersFuncWithMultiLabels{ f: f, help: help, labels: labels, }} if name != "" { publish(name, t) } ret...
go
func NewGaugesFuncWithMultiLabels(name, help string, labels []string, f func() map[string]int64) *GaugesFuncWithMultiLabels { t := &GaugesFuncWithMultiLabels{ CountersFuncWithMultiLabels: CountersFuncWithMultiLabels{ f: f, help: help, labels: labels, }} if name != "" { publish(name, t) } ret...
[ "func", "NewGaugesFuncWithMultiLabels", "(", "name", ",", "help", "string", ",", "labels", "[", "]", "string", ",", "f", "func", "(", ")", "map", "[", "string", "]", "int64", ")", "*", "GaugesFuncWithMultiLabels", "{", "t", ":=", "&", "GaugesFuncWithMultiLab...
// NewGaugesFuncWithMultiLabels creates a new GaugesFuncWithMultiLabels // mapping to the provided function.
[ "NewGaugesFuncWithMultiLabels", "creates", "a", "new", "GaugesFuncWithMultiLabels", "mapping", "to", "the", "provided", "function", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/counters.go#L401-L414
train
vitessio/vitess
go/vt/topotools/utils.go
FindTabletByHostAndPort
func FindTabletByHostAndPort(tabletMap map[string]*topo.TabletInfo, addr, portName string, port int32) (*topodatapb.TabletAlias, error) { for _, ti := range tabletMap { if ti.Hostname == addr && ti.PortMap[portName] == port { return ti.Alias, nil } } return nil, topo.NewError(topo.NoNode, addr+":"+portName) }
go
func FindTabletByHostAndPort(tabletMap map[string]*topo.TabletInfo, addr, portName string, port int32) (*topodatapb.TabletAlias, error) { for _, ti := range tabletMap { if ti.Hostname == addr && ti.PortMap[portName] == port { return ti.Alias, nil } } return nil, topo.NewError(topo.NoNode, addr+":"+portName) }
[ "func", "FindTabletByHostAndPort", "(", "tabletMap", "map", "[", "string", "]", "*", "topo", ".", "TabletInfo", ",", "addr", ",", "portName", "string", ",", "port", "int32", ")", "(", "*", "topodatapb", ".", "TabletAlias", ",", "error", ")", "{", "for", ...
// FindTabletByHostAndPort searches within a tablet map for tablets.
[ "FindTabletByHostAndPort", "searches", "within", "a", "tablet", "map", "for", "tablets", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/utils.go#L34-L41
train
vitessio/vitess
go/vt/topotools/utils.go
GetAllTablets
func GetAllTablets(ctx context.Context, ts *topo.Server, cell string) ([]*topo.TabletInfo, error) { aliases, err := ts.GetTabletsByCell(ctx, cell) if err != nil { return nil, err } sort.Sort(topoproto.TabletAliasList(aliases)) tabletMap, err := ts.GetTabletMap(ctx, aliases) if err != nil { // we got another ...
go
func GetAllTablets(ctx context.Context, ts *topo.Server, cell string) ([]*topo.TabletInfo, error) { aliases, err := ts.GetTabletsByCell(ctx, cell) if err != nil { return nil, err } sort.Sort(topoproto.TabletAliasList(aliases)) tabletMap, err := ts.GetTabletMap(ctx, aliases) if err != nil { // we got another ...
[ "func", "GetAllTablets", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "topo", ".", "Server", ",", "cell", "string", ")", "(", "[", "]", "*", "topo", ".", "TabletInfo", ",", "error", ")", "{", "aliases", ",", "err", ":=", "ts", ".", "GetTa...
// GetAllTablets returns a sorted list of tablets.
[ "GetAllTablets", "returns", "a", "sorted", "list", "of", "tablets", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/utils.go#L44-L69
train
vitessio/vitess
go/vt/topotools/utils.go
GetAllTabletsAcrossCells
func GetAllTabletsAcrossCells(ctx context.Context, ts *topo.Server) ([]*topo.TabletInfo, error) { cells, err := ts.GetKnownCells(ctx) if err != nil { return nil, err } results := make([][]*topo.TabletInfo, len(cells)) errors := make([]error, len(cells)) wg := sync.WaitGroup{} wg.Add(len(cells)) for i, cell :...
go
func GetAllTabletsAcrossCells(ctx context.Context, ts *topo.Server) ([]*topo.TabletInfo, error) { cells, err := ts.GetKnownCells(ctx) if err != nil { return nil, err } results := make([][]*topo.TabletInfo, len(cells)) errors := make([]error, len(cells)) wg := sync.WaitGroup{} wg.Add(len(cells)) for i, cell :...
[ "func", "GetAllTabletsAcrossCells", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "topo", ".", "Server", ")", "(", "[", "]", "*", "topo", ".", "TabletInfo", ",", "error", ")", "{", "cells", ",", "err", ":=", "ts", ".", "GetKnownCells", "(", ...
// GetAllTabletsAcrossCells returns all tablets from known cells. // If it returns topo.ErrPartialResult, then the list is valid, but partial.
[ "GetAllTabletsAcrossCells", "returns", "all", "tablets", "from", "known", "cells", ".", "If", "it", "returns", "topo", ".", "ErrPartialResult", "then", "the", "list", "is", "valid", "but", "partial", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/utils.go#L73-L101
train
vitessio/vitess
go/vt/topotools/utils.go
CopyMapKeys
func CopyMapKeys(m interface{}, typeHint interface{}) interface{} { mapVal := reflect.ValueOf(m) keys := reflect.MakeSlice(reflect.TypeOf(typeHint), 0, mapVal.Len()) for _, k := range mapVal.MapKeys() { keys = reflect.Append(keys, k) } return keys.Interface() }
go
func CopyMapKeys(m interface{}, typeHint interface{}) interface{} { mapVal := reflect.ValueOf(m) keys := reflect.MakeSlice(reflect.TypeOf(typeHint), 0, mapVal.Len()) for _, k := range mapVal.MapKeys() { keys = reflect.Append(keys, k) } return keys.Interface() }
[ "func", "CopyMapKeys", "(", "m", "interface", "{", "}", ",", "typeHint", "interface", "{", "}", ")", "interface", "{", "}", "{", "mapVal", ":=", "reflect", ".", "ValueOf", "(", "m", ")", "\n", "keys", ":=", "reflect", ".", "MakeSlice", "(", "reflect", ...
// CopyMapKeys copies keys from from map m into a new slice with the // type specified by typeHint. Reflection can't make a new slice type // just based on the key type AFAICT.
[ "CopyMapKeys", "copies", "keys", "from", "from", "map", "m", "into", "a", "new", "slice", "with", "the", "type", "specified", "by", "typeHint", ".", "Reflection", "can", "t", "make", "a", "new", "slice", "type", "just", "based", "on", "the", "key", "type...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/utils.go#L125-L132
train
vitessio/vitess
go/vt/topotools/utils.go
CopyMapValues
func CopyMapValues(m interface{}, typeHint interface{}) interface{} { mapVal := reflect.ValueOf(m) vals := reflect.MakeSlice(reflect.TypeOf(typeHint), 0, mapVal.Len()) for _, k := range mapVal.MapKeys() { vals = reflect.Append(vals, mapVal.MapIndex(k)) } return vals.Interface() }
go
func CopyMapValues(m interface{}, typeHint interface{}) interface{} { mapVal := reflect.ValueOf(m) vals := reflect.MakeSlice(reflect.TypeOf(typeHint), 0, mapVal.Len()) for _, k := range mapVal.MapKeys() { vals = reflect.Append(vals, mapVal.MapIndex(k)) } return vals.Interface() }
[ "func", "CopyMapValues", "(", "m", "interface", "{", "}", ",", "typeHint", "interface", "{", "}", ")", "interface", "{", "}", "{", "mapVal", ":=", "reflect", ".", "ValueOf", "(", "m", ")", "\n", "vals", ":=", "reflect", ".", "MakeSlice", "(", "reflect"...
// CopyMapValues copies values from from map m into a new slice with the // type specified by typeHint. Reflection can't make a new slice type // just based on the key type AFAICT.
[ "CopyMapValues", "copies", "values", "from", "from", "map", "m", "into", "a", "new", "slice", "with", "the", "type", "specified", "by", "typeHint", ".", "Reflection", "can", "t", "make", "a", "new", "slice", "type", "just", "based", "on", "the", "key", "...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/utils.go#L137-L144
train
vitessio/vitess
go/vt/topotools/utils.go
MapKeys
func MapKeys(m interface{}) []interface{} { keys := make([]interface{}, 0, 16) mapVal := reflect.ValueOf(m) for _, kv := range mapVal.MapKeys() { keys = append(keys, kv.Interface()) } return keys }
go
func MapKeys(m interface{}) []interface{} { keys := make([]interface{}, 0, 16) mapVal := reflect.ValueOf(m) for _, kv := range mapVal.MapKeys() { keys = append(keys, kv.Interface()) } return keys }
[ "func", "MapKeys", "(", "m", "interface", "{", "}", ")", "[", "]", "interface", "{", "}", "{", "keys", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "0", ",", "16", ")", "\n", "mapVal", ":=", "reflect", ".", "ValueOf", "(", "m", ")",...
// MapKeys returns an array with th provided map keys.
[ "MapKeys", "returns", "an", "array", "with", "th", "provided", "map", "keys", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topotools/utils.go#L147-L154
train
vitessio/vitess
go/vt/vttablet/tabletmanager/vreplication/engine.go
NewEngine
func NewEngine(ts *topo.Server, cell string, mysqld mysqlctl.MysqlDaemon, dbClientFactory func() binlogplayer.DBClient, dbName string) *Engine { vre := &Engine{ controllers: make(map[int]*controller), ts: ts, cell: cell, mysqld: mysqld, dbClientFactory: dbClientFactory, ...
go
func NewEngine(ts *topo.Server, cell string, mysqld mysqlctl.MysqlDaemon, dbClientFactory func() binlogplayer.DBClient, dbName string) *Engine { vre := &Engine{ controllers: make(map[int]*controller), ts: ts, cell: cell, mysqld: mysqld, dbClientFactory: dbClientFactory, ...
[ "func", "NewEngine", "(", "ts", "*", "topo", ".", "Server", ",", "cell", "string", ",", "mysqld", "mysqlctl", ".", "MysqlDaemon", ",", "dbClientFactory", "func", "(", ")", "binlogplayer", ".", "DBClient", ",", "dbName", "string", ")", "*", "Engine", "{", ...
// NewEngine creates a new Engine. // A nil ts means that the Engine is disabled.
[ "NewEngine", "creates", "a", "new", "Engine", ".", "A", "nil", "ts", "means", "that", "the", "Engine", "is", "disabled", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/engine.go#L69-L79
train
vitessio/vitess
go/vt/vttablet/tabletmanager/vreplication/engine.go
executeFetchMaybeCreateTable
func (vre *Engine) executeFetchMaybeCreateTable(dbClient binlogplayer.DBClient, query string, maxrows int) (qr *sqltypes.Result, err error) { qr, err = dbClient.ExecuteFetch(query, maxrows) if err == nil { return } // If it's a bad table or db, it could be because _vt.vreplication wasn't created. // In that ca...
go
func (vre *Engine) executeFetchMaybeCreateTable(dbClient binlogplayer.DBClient, query string, maxrows int) (qr *sqltypes.Result, err error) { qr, err = dbClient.ExecuteFetch(query, maxrows) if err == nil { return } // If it's a bad table or db, it could be because _vt.vreplication wasn't created. // In that ca...
[ "func", "(", "vre", "*", "Engine", ")", "executeFetchMaybeCreateTable", "(", "dbClient", "binlogplayer", ".", "DBClient", ",", "query", "string", ",", "maxrows", "int", ")", "(", "qr", "*", "sqltypes", ".", "Result", ",", "err", "error", ")", "{", "qr", ...
// executeFetchMaybeCreateTable calls DBClient.ExecuteFetch and does one retry if // there's a failure due to mysql.ERNoSuchTable or mysql.ERBadDb which can be fixed // by re-creating the _vt.vreplication table.
[ "executeFetchMaybeCreateTable", "calls", "DBClient", ".", "ExecuteFetch", "and", "does", "one", "retry", "if", "there", "s", "a", "failure", "due", "to", "mysql", ".", "ERNoSuchTable", "or", "mysql", ".", "ERBadDb", "which", "can", "be", "fixed", "by", "re", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/engine.go#L106-L142
train
vitessio/vitess
go/vt/vttablet/tabletmanager/vreplication/engine.go
IsOpen
func (vre *Engine) IsOpen() bool { vre.mu.Lock() defer vre.mu.Unlock() return vre.isOpen }
go
func (vre *Engine) IsOpen() bool { vre.mu.Lock() defer vre.mu.Unlock() return vre.isOpen }
[ "func", "(", "vre", "*", "Engine", ")", "IsOpen", "(", ")", "bool", "{", "vre", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "vre", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "vre", ".", "isOpen", "\n", "}" ]
// IsOpen returns true if Engine is open.
[ "IsOpen", "returns", "true", "if", "Engine", "is", "open", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/engine.go#L176-L180
train
vitessio/vitess
go/vt/vttablet/tabletmanager/vreplication/engine.go
WaitForPos
func (vre *Engine) WaitForPos(ctx context.Context, id int, pos string) error { mPos, err := mysql.DecodePosition(pos) if err != nil { return err } if err := func() error { vre.mu.Lock() defer vre.mu.Unlock() if !vre.isOpen { return errors.New("vreplication engine is closed") } // Ensure that the en...
go
func (vre *Engine) WaitForPos(ctx context.Context, id int, pos string) error { mPos, err := mysql.DecodePosition(pos) if err != nil { return err } if err := func() error { vre.mu.Lock() defer vre.mu.Unlock() if !vre.isOpen { return errors.New("vreplication engine is closed") } // Ensure that the en...
[ "func", "(", "vre", "*", "Engine", ")", "WaitForPos", "(", "ctx", "context", ".", "Context", ",", "id", "int", ",", "pos", "string", ")", "error", "{", "mPos", ",", "err", ":=", "mysql", ".", "DecodePosition", "(", "pos", ")", "\n", "if", "err", "!...
// WaitForPos waits for the replication to reach the specified position.
[ "WaitForPos", "waits", "for", "the", "replication", "to", "reach", "the", "specified", "position", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/engine.go#L298-L356
train
vitessio/vitess
go/vt/vttablet/tabletmanager/vreplication/engine.go
updateStats
func (vre *Engine) updateStats() { globalStats.mu.Lock() defer globalStats.mu.Unlock() globalStats.isOpen = vre.isOpen globalStats.controllers = make(map[int]*controller, len(vre.controllers)) for id, ct := range vre.controllers { globalStats.controllers[id] = ct } }
go
func (vre *Engine) updateStats() { globalStats.mu.Lock() defer globalStats.mu.Unlock() globalStats.isOpen = vre.isOpen globalStats.controllers = make(map[int]*controller, len(vre.controllers)) for id, ct := range vre.controllers { globalStats.controllers[id] = ct } }
[ "func", "(", "vre", "*", "Engine", ")", "updateStats", "(", ")", "{", "globalStats", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "globalStats", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "globalStats", ".", "isOpen", "=", "vre", ".", "isOpen", ...
// UpdateStats must be called with lock held.
[ "UpdateStats", "must", "be", "called", "with", "lock", "held", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/engine.go#L359-L368
train
vitessio/vitess
go/vt/vttablet/tabletmanager/vreplication/engine.go
rowToMap
func rowToMap(qr *sqltypes.Result, rownum int) (map[string]string, error) { row := qr.Rows[rownum] m := make(map[string]string, len(row)) for i, fld := range qr.Fields { if row[i].IsNull() { continue } m[fld.Name] = row[i].ToString() } return m, nil }
go
func rowToMap(qr *sqltypes.Result, rownum int) (map[string]string, error) { row := qr.Rows[rownum] m := make(map[string]string, len(row)) for i, fld := range qr.Fields { if row[i].IsNull() { continue } m[fld.Name] = row[i].ToString() } return m, nil }
[ "func", "rowToMap", "(", "qr", "*", "sqltypes", ".", "Result", ",", "rownum", "int", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "row", ":=", "qr", ".", "Rows", "[", "rownum", "]", "\n", "m", ":=", "make", "(", "map", ...
// rowToMap converts a row into a map for easier processing.
[ "rowToMap", "converts", "a", "row", "into", "a", "map", "for", "easier", "processing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/engine.go#L401-L411
train
vitessio/vitess
go/vt/vtgate/engine/insert.go
NewQueryInsert
func NewQueryInsert(opcode InsertOpcode, keyspace *vindexes.Keyspace, query string) *Insert { return &Insert{ Opcode: opcode, Keyspace: keyspace, Query: query, } }
go
func NewQueryInsert(opcode InsertOpcode, keyspace *vindexes.Keyspace, query string) *Insert { return &Insert{ Opcode: opcode, Keyspace: keyspace, Query: query, } }
[ "func", "NewQueryInsert", "(", "opcode", "InsertOpcode", ",", "keyspace", "*", "vindexes", ".", "Keyspace", ",", "query", "string", ")", "*", "Insert", "{", "return", "&", "Insert", "{", "Opcode", ":", "opcode", ",", "Keyspace", ":", "keyspace", ",", "Quer...
// NewQueryInsert creates an Insert with a query string.
[ "NewQueryInsert", "creates", "an", "Insert", "with", "a", "query", "string", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L86-L92
train
vitessio/vitess
go/vt/vtgate/engine/insert.go
NewSimpleInsert
func NewSimpleInsert(opcode InsertOpcode, table *vindexes.Table, keyspace *vindexes.Keyspace) *Insert { return &Insert{ Opcode: opcode, Table: table, Keyspace: keyspace, } }
go
func NewSimpleInsert(opcode InsertOpcode, table *vindexes.Table, keyspace *vindexes.Keyspace) *Insert { return &Insert{ Opcode: opcode, Table: table, Keyspace: keyspace, } }
[ "func", "NewSimpleInsert", "(", "opcode", "InsertOpcode", ",", "table", "*", "vindexes", ".", "Table", ",", "keyspace", "*", "vindexes", ".", "Keyspace", ")", "*", "Insert", "{", "return", "&", "Insert", "{", "Opcode", ":", "opcode", ",", "Table", ":", "...
// NewSimpleInsert creates an Insert for a Table.
[ "NewSimpleInsert", "creates", "an", "Insert", "for", "a", "Table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L95-L101
train
vitessio/vitess
go/vt/vtgate/engine/insert.go
NewInsert
func NewInsert(opcode InsertOpcode, keyspace *vindexes.Keyspace, vindexValues []sqltypes.PlanValue, table *vindexes.Table, prefix string, mid []string, suffix string) *Insert { return &Insert{ Opcode: opcode, Keyspace: keyspace, VindexValues: vindexValues, Table: table, Prefix: prefix,...
go
func NewInsert(opcode InsertOpcode, keyspace *vindexes.Keyspace, vindexValues []sqltypes.PlanValue, table *vindexes.Table, prefix string, mid []string, suffix string) *Insert { return &Insert{ Opcode: opcode, Keyspace: keyspace, VindexValues: vindexValues, Table: table, Prefix: prefix,...
[ "func", "NewInsert", "(", "opcode", "InsertOpcode", ",", "keyspace", "*", "vindexes", ".", "Keyspace", ",", "vindexValues", "[", "]", "sqltypes", ".", "PlanValue", ",", "table", "*", "vindexes", ".", "Table", ",", "prefix", "string", ",", "mid", "[", "]", ...
// NewInsert creates a new Insert.
[ "NewInsert", "creates", "a", "new", "Insert", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L104-L114
train
vitessio/vitess
go/vt/vtgate/engine/insert.go
MarshalJSON
func (ins *Insert) MarshalJSON() ([]byte, error) { var tname string if ins.Table != nil { tname = ins.Table.Name.String() } marshalInsert := struct { Opcode InsertOpcode Keyspace *vindexes.Keyspace `json:",omitempty"` Query string `json:",omitempty"` ...
go
func (ins *Insert) MarshalJSON() ([]byte, error) { var tname string if ins.Table != nil { tname = ins.Table.Name.String() } marshalInsert := struct { Opcode InsertOpcode Keyspace *vindexes.Keyspace `json:",omitempty"` Query string `json:",omitempty"` ...
[ "func", "(", "ins", "*", "Insert", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "tname", "string", "\n", "if", "ins", ".", "Table", "!=", "nil", "{", "tname", "=", "ins", ".", "Table", ".", "Name", ".", "S...
// MarshalJSON serializes the Insert into a JSON representation. // It's used for testing and diagnostics.
[ "MarshalJSON", "serializes", "the", "Insert", "into", "a", "JSON", "representation", ".", "It", "s", "used", "for", "testing", "and", "diagnostics", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L118-L149
train
vitessio/vitess
go/vt/vtgate/engine/insert.go
processGenerate
func (ins *Insert) processGenerate(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (insertID int64, err error) { if ins.Generate == nil { return 0, nil } // Scan input values to compute the number of values to generate, and // keep track of where they should be filled. resolved, err := ins.Generate....
go
func (ins *Insert) processGenerate(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (insertID int64, err error) { if ins.Generate == nil { return 0, nil } // Scan input values to compute the number of values to generate, and // keep track of where they should be filled. resolved, err := ins.Generate....
[ "func", "(", "ins", "*", "Insert", ")", "processGenerate", "(", "vcursor", "VCursor", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ")", "(", "insertID", "int64", ",", "err", "error", ")", "{", "if", "ins", ".", "Gene...
// processGenerate generates new values using a sequence if necessary. // If no value was generated, it returns 0. Values are generated only // for cases where none are supplied.
[ "processGenerate", "generates", "new", "values", "using", "a", "sequence", "if", "necessary", ".", "If", "no", "value", "was", "generated", "it", "returns", "0", ".", "Values", "are", "generated", "only", "for", "cases", "where", "none", "are", "supplied", "...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L279-L330
train
vitessio/vitess
go/vt/vtgate/engine/insert.go
processPrimary
func (ins *Insert) processPrimary(vcursor VCursor, vindexKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable) ([][]byte, error) { var flattenedVindexKeys []sqltypes.Value // TODO: @rafael - this will change once vindex Primary keys also support multicolumns for _, val := ra...
go
func (ins *Insert) processPrimary(vcursor VCursor, vindexKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable) ([][]byte, error) { var flattenedVindexKeys []sqltypes.Value // TODO: @rafael - this will change once vindex Primary keys also support multicolumns for _, val := ra...
[ "func", "(", "ins", "*", "Insert", ")", "processPrimary", "(", "vcursor", "VCursor", ",", "vindexKeys", "[", "]", "[", "]", "sqltypes", ".", "Value", ",", "colVindex", "*", "vindexes", ".", "ColumnVindex", ",", "bv", "map", "[", "string", "]", "*", "qu...
// processPrimary maps the primary vindex values to the kesypace ids.
[ "processPrimary", "maps", "the", "primary", "vindex", "values", "to", "the", "kesypace", "ids", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L455-L493
train
vitessio/vitess
go/vt/vtgate/engine/insert.go
processOwned
func (ins *Insert) processOwned(vcursor VCursor, vindexColumnsKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable, ksids [][]byte) error { for rowNum, rowColumnKeys := range vindexColumnsKeys { for colIdx, vindexKey := range rowColumnKeys { col := colVindex.Columns[colId...
go
func (ins *Insert) processOwned(vcursor VCursor, vindexColumnsKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable, ksids [][]byte) error { for rowNum, rowColumnKeys := range vindexColumnsKeys { for colIdx, vindexKey := range rowColumnKeys { col := colVindex.Columns[colId...
[ "func", "(", "ins", "*", "Insert", ")", "processOwned", "(", "vcursor", "VCursor", ",", "vindexColumnsKeys", "[", "]", "[", "]", "sqltypes", ".", "Value", ",", "colVindex", "*", "vindexes", ".", "ColumnVindex", ",", "bv", "map", "[", "string", "]", "*", ...
// processOwned creates vindex entries for the values of an owned column for InsertSharded.
[ "processOwned", "creates", "vindex", "entries", "for", "the", "values", "of", "an", "owned", "column", "for", "InsertSharded", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L496-L504
train
vitessio/vitess
go/vt/vtgate/engine/insert.go
processOwnedIgnore
func (ins *Insert) processOwnedIgnore(vcursor VCursor, vindexColumnsKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable, ksids [][]byte) error { var createIndexes []int var createKeys [][]sqltypes.Value var createKsids [][]byte for rowNum, rowColumnKeys := range vindexCol...
go
func (ins *Insert) processOwnedIgnore(vcursor VCursor, vindexColumnsKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable, ksids [][]byte) error { var createIndexes []int var createKeys [][]sqltypes.Value var createKsids [][]byte for rowNum, rowColumnKeys := range vindexCol...
[ "func", "(", "ins", "*", "Insert", ")", "processOwnedIgnore", "(", "vcursor", "VCursor", ",", "vindexColumnsKeys", "[", "]", "[", "]", "sqltypes", ".", "Value", ",", "colVindex", "*", "vindexes", ".", "ColumnVindex", ",", "bv", "map", "[", "string", "]", ...
// processOwnedIgnore creates vindex entries for the values of an owned column for InsertShardedIgnore.
[ "processOwnedIgnore", "creates", "vindex", "entries", "for", "the", "values", "of", "an", "owned", "column", "for", "InsertShardedIgnore", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L507-L552
train
vitessio/vitess
go/vt/vtgate/engine/insert.go
processUnowned
func (ins *Insert) processUnowned(vcursor VCursor, vindexColumnsKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable, ksids [][]byte) error { var reverseIndexes []int var reverseKsids [][]byte var verifyIndexes []int var verifyKeys []sqltypes.Value var verifyKsids [][]byte...
go
func (ins *Insert) processUnowned(vcursor VCursor, vindexColumnsKeys [][]sqltypes.Value, colVindex *vindexes.ColumnVindex, bv map[string]*querypb.BindVariable, ksids [][]byte) error { var reverseIndexes []int var reverseKsids [][]byte var verifyIndexes []int var verifyKeys []sqltypes.Value var verifyKsids [][]byte...
[ "func", "(", "ins", "*", "Insert", ")", "processUnowned", "(", "vcursor", "VCursor", ",", "vindexColumnsKeys", "[", "]", "[", "]", "sqltypes", ".", "Value", ",", "colVindex", "*", "vindexes", ".", "ColumnVindex", ",", "bv", "map", "[", "string", "]", "*"...
// processUnowned either reverse maps or validates the values for an unowned column.
[ "processUnowned", "either", "reverse", "maps", "or", "validates", "the", "values", "for", "an", "unowned", "column", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/insert.go#L555-L626
train
vitessio/vitess
go/cmd/vtctl/vtctl.go
installSignalHandlers
func installSignalHandlers(cancel func()) { sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGTERM, syscall.SIGINT) go func() { <-sigChan // we got a signal, cancel the current ctx cancel() }() }
go
func installSignalHandlers(cancel func()) { sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGTERM, syscall.SIGINT) go func() { <-sigChan // we got a signal, cancel the current ctx cancel() }() }
[ "func", "installSignalHandlers", "(", "cancel", "func", "(", ")", ")", "{", "sigChan", ":=", "make", "(", "chan", "os", ".", "Signal", ",", "1", ")", "\n", "signal", ".", "Notify", "(", "sigChan", ",", "syscall", ".", "SIGTERM", ",", "syscall", ".", ...
// signal handling, centralized here
[ "signal", "handling", "centralized", "here" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cmd/vtctl/vtctl.go#L59-L67
train
vitessio/vitess
go/vt/topo/errors.go
NewError
func NewError(code ErrorCode, node string) error { var message string switch code { case NodeExists: message = fmt.Sprintf("node already exists: %s", node) case NoNode: message = fmt.Sprintf("node doesn't exist: %s", node) case NodeNotEmpty: message = fmt.Sprintf("node not empty: %s", node) case Timeout: ...
go
func NewError(code ErrorCode, node string) error { var message string switch code { case NodeExists: message = fmt.Sprintf("node already exists: %s", node) case NoNode: message = fmt.Sprintf("node doesn't exist: %s", node) case NodeNotEmpty: message = fmt.Sprintf("node not empty: %s", node) case Timeout: ...
[ "func", "NewError", "(", "code", "ErrorCode", ",", "node", "string", ")", "error", "{", "var", "message", "string", "\n", "switch", "code", "{", "case", "NodeExists", ":", "message", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "node", ")", "\n", ...
// NewError creates a new topo error.
[ "NewError", "creates", "a", "new", "topo", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/errors.go#L46-L74
train
vitessio/vitess
go/vt/topo/errors.go
IsErrType
func IsErrType(err error, code ErrorCode) bool { if e, ok := err.(Error); ok { return e.code == code } return false }
go
func IsErrType(err error, code ErrorCode) bool { if e, ok := err.(Error); ok { return e.code == code } return false }
[ "func", "IsErrType", "(", "err", "error", ",", "code", "ErrorCode", ")", "bool", "{", "if", "e", ",", "ok", ":=", "err", ".", "(", "Error", ")", ";", "ok", "{", "return", "e", ".", "code", "==", "code", "\n", "}", "\n", "return", "false", "\n", ...
// IsErrType returns true if the error has the specified ErrorCode.
[ "IsErrType", "returns", "true", "if", "the", "error", "has", "the", "specified", "ErrorCode", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/errors.go#L82-L87
train
vitessio/vitess
go/vt/vtgate/planbuilder/join.go
newJoin
func newJoin(lpb, rpb *primitiveBuilder, ajoin *sqlparser.JoinTableExpr) error { // This function converts ON clauses to WHERE clauses. The WHERE clause // scope can see all tables, whereas the ON clause can only see the // participants of the JOIN. However, since the ON clause doesn't allow // external references,...
go
func newJoin(lpb, rpb *primitiveBuilder, ajoin *sqlparser.JoinTableExpr) error { // This function converts ON clauses to WHERE clauses. The WHERE clause // scope can see all tables, whereas the ON clause can only see the // participants of the JOIN. However, since the ON clause doesn't allow // external references,...
[ "func", "newJoin", "(", "lpb", ",", "rpb", "*", "primitiveBuilder", ",", "ajoin", "*", "sqlparser", ".", "JoinTableExpr", ")", "error", "{", "// This function converts ON clauses to WHERE clauses. The WHERE clause", "// scope can see all tables, whereas the ON clause can only see...
// newJoin makes a new join using the two planBuilder. ajoin can be nil // if the join is on a ',' operator. lpb will contain the resulting join. // rpb will be discarded.
[ "newJoin", "makes", "a", "new", "join", "using", "the", "two", "planBuilder", ".", "ajoin", "can", "be", "nil", "if", "the", "join", "is", "on", "a", "operator", ".", "lpb", "will", "contain", "the", "resulting", "join", ".", "rpb", "will", "be", "disc...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/join.go#L71-L113
train
vitessio/vitess
go/vt/workflow/manager.go
NewManager
func NewManager(ts *topo.Server) *Manager { return &Manager{ ts: ts, nodeManager: NewNodeManager(), started: make(chan struct{}), workflows: make(map[string]*runningWorkflow), } }
go
func NewManager(ts *topo.Server) *Manager { return &Manager{ ts: ts, nodeManager: NewNodeManager(), started: make(chan struct{}), workflows: make(map[string]*runningWorkflow), } }
[ "func", "NewManager", "(", "ts", "*", "topo", ".", "Server", ")", "*", "Manager", "{", "return", "&", "Manager", "{", "ts", ":", "ts", ",", "nodeManager", ":", "NewNodeManager", "(", ")", ",", "started", ":", "make", "(", "chan", "struct", "{", "}", ...
// NewManager creates an initialized Manager.
[ "NewManager", "creates", "an", "initialized", "Manager", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L127-L134
train
vitessio/vitess
go/vt/workflow/manager.go
Run
func (m *Manager) Run(ctx context.Context) { // Save the context for all other jobs usage, and to indicate // the manager is running. m.mu.Lock() if m.ctx != nil { m.mu.Unlock() panic("Manager is already running") } m.ctx = ctx m.loadAndStartJobsLocked() // Signal the successful startup. close(m.started) ...
go
func (m *Manager) Run(ctx context.Context) { // Save the context for all other jobs usage, and to indicate // the manager is running. m.mu.Lock() if m.ctx != nil { m.mu.Unlock() panic("Manager is already running") } m.ctx = ctx m.loadAndStartJobsLocked() // Signal the successful startup. close(m.started) ...
[ "func", "(", "m", "*", "Manager", ")", "Run", "(", "ctx", "context", ".", "Context", ")", "{", "// Save the context for all other jobs usage, and to indicate", "// the manager is running.", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "if", "m", ".", "ctx", "!...
// Run is the main entry point for the Manager. It will read each // checkpoint from the topo Server, and for the ones that are in the // Running state, will load them in memory and run them. // It will not return until ctx is canceled.
[ "Run", "is", "the", "main", "entry", "point", "for", "the", "Manager", ".", "It", "will", "read", "each", "checkpoint", "from", "the", "topo", "Server", "and", "for", "the", "ones", "that", "are", "in", "the", "Running", "state", "will", "load", "them", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L157-L190
train
vitessio/vitess
go/vt/workflow/manager.go
loadAndStartJobsLocked
func (m *Manager) loadAndStartJobsLocked() { uuids, err := m.ts.GetWorkflowNames(m.ctx) if err != nil { log.Errorf("GetWorkflowNames failed to find existing workflows: %v", err) return } for _, uuid := range uuids { // Load workflows from the topo server, only look at // 'Running' ones. wi, err := m.ts.G...
go
func (m *Manager) loadAndStartJobsLocked() { uuids, err := m.ts.GetWorkflowNames(m.ctx) if err != nil { log.Errorf("GetWorkflowNames failed to find existing workflows: %v", err) return } for _, uuid := range uuids { // Load workflows from the topo server, only look at // 'Running' ones. wi, err := m.ts.G...
[ "func", "(", "m", "*", "Manager", ")", "loadAndStartJobsLocked", "(", ")", "{", "uuids", ",", "err", ":=", "m", ".", "ts", ".", "GetWorkflowNames", "(", "m", ".", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "...
// loadAndStartJobsLocked will try to load and start all existing jobs // in the topo Server. It needs to be run holding m.mu.
[ "loadAndStartJobsLocked", "will", "try", "to", "load", "and", "start", "all", "existing", "jobs", "in", "the", "topo", "Server", ".", "It", "needs", "to", "be", "run", "holding", "m", ".", "mu", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L213-L240
train
vitessio/vitess
go/vt/workflow/manager.go
Create
func (m *Manager) Create(ctx context.Context, factoryName string, args []string) (string, error) { m.mu.Lock() defer m.mu.Unlock() // Find the factory. factory, ok := factories[factoryName] if !ok { return "", fmt.Errorf("no factory named %v is registered", factoryName) } // Create the initial workflowpb.Wor...
go
func (m *Manager) Create(ctx context.Context, factoryName string, args []string) (string, error) { m.mu.Lock() defer m.mu.Unlock() // Find the factory. factory, ok := factories[factoryName] if !ok { return "", fmt.Errorf("no factory named %v is registered", factoryName) } // Create the initial workflowpb.Wor...
[ "func", "(", "m", "*", "Manager", ")", "Create", "(", "ctx", "context", ".", "Context", ",", "factoryName", "string", ",", "args", "[", "]", "string", ")", "(", "string", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer...
// Create creates a workflow from the given factory name with the // provided args. Returns the unique UUID of the workflow. The // workflowpb.Workflow object is saved in the topo server after // creation.
[ "Create", "creates", "a", "workflow", "from", "the", "given", "factory", "name", "with", "the", "provided", "args", ".", "Returns", "the", "unique", "UUID", "of", "the", "workflow", ".", "The", "workflowpb", ".", "Workflow", "object", "is", "saved", "in", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L246-L283
train
vitessio/vitess
go/vt/workflow/manager.go
Stop
func (m *Manager) Stop(ctx context.Context, uuid string) error { // Find the workflow, mark it as stopped. m.mu.Lock() rw, ok := m.workflows[uuid] if !ok { m.mu.Unlock() return fmt.Errorf("no running workflow with uuid %v", uuid) } rw.stopped = true m.mu.Unlock() // Cancel the running guy, and waits for it...
go
func (m *Manager) Stop(ctx context.Context, uuid string) error { // Find the workflow, mark it as stopped. m.mu.Lock() rw, ok := m.workflows[uuid] if !ok { m.mu.Unlock() return fmt.Errorf("no running workflow with uuid %v", uuid) } rw.stopped = true m.mu.Unlock() // Cancel the running guy, and waits for it...
[ "func", "(", "m", "*", "Manager", ")", "Stop", "(", "ctx", "context", ".", "Context", ",", "uuid", "string", ")", "error", "{", "// Find the workflow, mark it as stopped.", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "rw", ",", "ok", ":=", "m", ".", ...
// Stop stops the running workflow. It will cancel its context and // wait for it to exit.
[ "Stop", "stops", "the", "running", "workflow", ".", "It", "will", "cancel", "its", "context", "and", "wait", "for", "it", "to", "exit", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L416-L436
train
vitessio/vitess
go/vt/workflow/manager.go
Delete
func (m *Manager) Delete(ctx context.Context, uuid string) error { m.mu.Lock() defer m.mu.Unlock() rw, ok := m.workflows[uuid] if !ok { return fmt.Errorf("no workflow with uuid %v", uuid) } if rw.wi.State == workflowpb.WorkflowState_Running { return fmt.Errorf("cannot delete running workflow") } if err := ...
go
func (m *Manager) Delete(ctx context.Context, uuid string) error { m.mu.Lock() defer m.mu.Unlock() rw, ok := m.workflows[uuid] if !ok { return fmt.Errorf("no workflow with uuid %v", uuid) } if rw.wi.State == workflowpb.WorkflowState_Running { return fmt.Errorf("cannot delete running workflow") } if err := ...
[ "func", "(", "m", "*", "Manager", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "uuid", "string", ")", "error", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "rw", ",", ...
// Delete deletes the finished or not started workflow.
[ "Delete", "deletes", "the", "finished", "or", "not", "started", "workflow", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L439-L456
train
vitessio/vitess
go/vt/workflow/manager.go
Wait
func (m *Manager) Wait(ctx context.Context, uuid string) error { // Find the workflow. rw, err := m.runningWorkflow(uuid) if err != nil { return err } // Just wait for it. select { case <-rw.done: break case <-ctx.Done(): return ctx.Err() } return nil }
go
func (m *Manager) Wait(ctx context.Context, uuid string) error { // Find the workflow. rw, err := m.runningWorkflow(uuid) if err != nil { return err } // Just wait for it. select { case <-rw.done: break case <-ctx.Done(): return ctx.Err() } return nil }
[ "func", "(", "m", "*", "Manager", ")", "Wait", "(", "ctx", "context", ".", "Context", ",", "uuid", "string", ")", "error", "{", "// Find the workflow.", "rw", ",", "err", ":=", "m", ".", "runningWorkflow", "(", "uuid", ")", "\n", "if", "err", "!=", "...
// Wait waits for the provided workflow to end.
[ "Wait", "waits", "for", "the", "provided", "workflow", "to", "end", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L459-L474
train
vitessio/vitess
go/vt/workflow/manager.go
runningWorkflow
func (m *Manager) runningWorkflow(uuid string) (*runningWorkflow, error) { m.mu.Lock() defer m.mu.Unlock() rw, ok := m.workflows[uuid] if !ok { return nil, fmt.Errorf("no running workflow with uuid %v", uuid) } return rw, nil }
go
func (m *Manager) runningWorkflow(uuid string) (*runningWorkflow, error) { m.mu.Lock() defer m.mu.Unlock() rw, ok := m.workflows[uuid] if !ok { return nil, fmt.Errorf("no running workflow with uuid %v", uuid) } return rw, nil }
[ "func", "(", "m", "*", "Manager", ")", "runningWorkflow", "(", "uuid", "string", ")", "(", "*", "runningWorkflow", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "rw"...
// runningWorkflow returns a runningWorkflow by uuid.
[ "runningWorkflow", "returns", "a", "runningWorkflow", "by", "uuid", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L498-L507
train
vitessio/vitess
go/vt/workflow/manager.go
Unregister
func Unregister(name string) { if _, ok := factories[name]; !ok { log.Warningf("workflow %v doesn't exist, cannot remove it", name) } else { delete(factories, name) } }
go
func Unregister(name string) { if _, ok := factories[name]; !ok { log.Warningf("workflow %v doesn't exist, cannot remove it", name) } else { delete(factories, name) } }
[ "func", "Unregister", "(", "name", "string", ")", "{", "if", "_", ",", "ok", ":=", "factories", "[", "name", "]", ";", "!", "ok", "{", "log", ".", "Warningf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "else", "{", "delete", "(", "factories", ...
// Unregister removes a factory object. // Typically called from a flag to remove dangerous workflows.
[ "Unregister", "removes", "a", "factory", "object", ".", "Typically", "called", "from", "a", "flag", "to", "remove", "dangerous", "workflows", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L572-L578
train
vitessio/vitess
go/vt/workflow/manager.go
AvailableFactories
func AvailableFactories() map[string]bool { result := make(map[string]bool) for n := range factories { result[n] = true } return result }
go
func AvailableFactories() map[string]bool { result := make(map[string]bool) for n := range factories { result[n] = true } return result }
[ "func", "AvailableFactories", "(", ")", "map", "[", "string", "]", "bool", "{", "result", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "for", "n", ":=", "range", "factories", "{", "result", "[", "n", "]", "=", "true", "\n", "}",...
// AvailableFactories returns a map with the names of the available // factories as keys and 'true' as value.
[ "AvailableFactories", "returns", "a", "map", "with", "the", "names", "of", "the", "available", "factories", "as", "keys", "and", "true", "as", "value", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L582-L588
train
vitessio/vitess
go/vt/workflow/manager.go
StartManager
func StartManager(m *Manager) (*sync.WaitGroup, context.Context, context.CancelFunc) { ctx, cancel := context.WithCancel(context.Background()) wg := &sync.WaitGroup{} wg.Add(1) go func() { m.Run(ctx) wg.Done() }() m.WaitUntilRunning() return wg, ctx, cancel }
go
func StartManager(m *Manager) (*sync.WaitGroup, context.Context, context.CancelFunc) { ctx, cancel := context.WithCancel(context.Background()) wg := &sync.WaitGroup{} wg.Add(1) go func() { m.Run(ctx) wg.Done() }() m.WaitUntilRunning() return wg, ctx, cancel }
[ "func", "StartManager", "(", "m", "*", "Manager", ")", "(", "*", "sync", ".", "WaitGroup", ",", "context", ".", "Context", ",", "context", ".", "CancelFunc", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithCancel", "(", "context", ".", "Back...
// StartManager starts a manager. This function should only be used for tests purposes.
[ "StartManager", "starts", "a", "manager", ".", "This", "function", "should", "only", "be", "used", "for", "tests", "purposes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/manager.go#L591-L603
train
vitessio/vitess
go/vt/worker/events/split_syslog.go
Syslog
func (ev *SplitClone) Syslog() (syslog.Priority, string) { return syslog.LOG_INFO, fmt.Sprintf("%s/%s/%s [split clone] %s", ev.Keyspace, ev.Shard, ev.Cell, ev.Status) }
go
func (ev *SplitClone) Syslog() (syslog.Priority, string) { return syslog.LOG_INFO, fmt.Sprintf("%s/%s/%s [split clone] %s", ev.Keyspace, ev.Shard, ev.Cell, ev.Status) }
[ "func", "(", "ev", "*", "SplitClone", ")", "Syslog", "(", ")", "(", "syslog", ".", "Priority", ",", "string", ")", "{", "return", "syslog", ".", "LOG_INFO", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ev", ".", "Keyspace", ",", "ev", ".", ...
// Syslog writes a SplitClone event to syslog.
[ "Syslog", "writes", "a", "SplitClone", "event", "to", "syslog", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/events/split_syslog.go#L27-L30
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_executor.go
Stream
func (qre *QueryExecutor) Stream(callback func(*sqltypes.Result) error) error { qre.logStats.OriginalSQL = qre.query qre.logStats.PlanType = qre.plan.PlanID.String() defer func(start time.Time) { tabletenv.QueryStats.Record(qre.plan.PlanID.String(), start) tabletenv.RecordUserQuery(qre.ctx, qre.plan.TableName()...
go
func (qre *QueryExecutor) Stream(callback func(*sqltypes.Result) error) error { qre.logStats.OriginalSQL = qre.query qre.logStats.PlanType = qre.plan.PlanID.String() defer func(start time.Time) { tabletenv.QueryStats.Record(qre.plan.PlanID.String(), start) tabletenv.RecordUserQuery(qre.ctx, qre.plan.TableName()...
[ "func", "(", "qre", "*", "QueryExecutor", ")", "Stream", "(", "callback", "func", "(", "*", "sqltypes", ".", "Result", ")", "error", ")", "error", "{", "qre", ".", "logStats", ".", "OriginalSQL", "=", "qre", ".", "query", "\n", "qre", ".", "logStats", ...
// Stream performs a streaming query execution.
[ "Stream", "performs", "a", "streaming", "query", "execution", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_executor.go#L204-L240
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_executor.go
MessageStream
func (qre *QueryExecutor) MessageStream(callback func(*sqltypes.Result) error) error { qre.logStats.OriginalSQL = qre.query qre.logStats.PlanType = qre.plan.PlanID.String() defer func(start time.Time) { tabletenv.QueryStats.Record(qre.plan.PlanID.String(), start) tabletenv.RecordUserQuery(qre.ctx, qre.plan.Tabl...
go
func (qre *QueryExecutor) MessageStream(callback func(*sqltypes.Result) error) error { qre.logStats.OriginalSQL = qre.query qre.logStats.PlanType = qre.plan.PlanID.String() defer func(start time.Time) { tabletenv.QueryStats.Record(qre.plan.PlanID.String(), start) tabletenv.RecordUserQuery(qre.ctx, qre.plan.Tabl...
[ "func", "(", "qre", "*", "QueryExecutor", ")", "MessageStream", "(", "callback", "func", "(", "*", "sqltypes", ".", "Result", ")", "error", ")", "error", "{", "qre", ".", "logStats", ".", "OriginalSQL", "=", "qre", ".", "query", "\n", "qre", ".", "logS...
// MessageStream streams messages from a message table.
[ "MessageStream", "streams", "messages", "from", "a", "message", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_executor.go#L243-L269
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_executor.go
execDirect
func (qre *QueryExecutor) execDirect(conn *TxConnection) (*sqltypes.Result, error) { if qre.plan.Fields != nil { result, err := qre.txFetch(conn, qre.plan.FullQuery, qre.bindVars, nil, "", true, false) if err != nil { return nil, err } result.Fields = qre.plan.Fields return result, nil } return qre.txFe...
go
func (qre *QueryExecutor) execDirect(conn *TxConnection) (*sqltypes.Result, error) { if qre.plan.Fields != nil { result, err := qre.txFetch(conn, qre.plan.FullQuery, qre.bindVars, nil, "", true, false) if err != nil { return nil, err } result.Fields = qre.plan.Fields return result, nil } return qre.txFe...
[ "func", "(", "qre", "*", "QueryExecutor", ")", "execDirect", "(", "conn", "*", "TxConnection", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "if", "qre", ".", "plan", ".", "Fields", "!=", "nil", "{", "result", ",", "err", ":=", ...
// execDirect is for reads inside transactions. Always send to MySQL.
[ "execDirect", "is", "for", "reads", "inside", "transactions", ".", "Always", "send", "to", "MySQL", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_executor.go#L523-L533
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_executor.go
execSelect
func (qre *QueryExecutor) execSelect() (*sqltypes.Result, error) { if qre.plan.Fields != nil { result, err := qre.qFetch(qre.logStats, qre.plan.FullQuery, qre.bindVars) if err != nil { return nil, err } // result is read-only. So, let's copy it before modifying. newResult := *result newResult.Fields = q...
go
func (qre *QueryExecutor) execSelect() (*sqltypes.Result, error) { if qre.plan.Fields != nil { result, err := qre.qFetch(qre.logStats, qre.plan.FullQuery, qre.bindVars) if err != nil { return nil, err } // result is read-only. So, let's copy it before modifying. newResult := *result newResult.Fields = q...
[ "func", "(", "qre", "*", "QueryExecutor", ")", "execSelect", "(", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "if", "qre", ".", "plan", ".", "Fields", "!=", "nil", "{", "result", ",", "err", ":=", "qre", ".", "qFetch", "(", ...
// execSelect sends a query to mysql only if another identical query is not running. Otherwise, it waits and // reuses the result. If the plan is missng field info, it sends the query to mysql requesting full info.
[ "execSelect", "sends", "a", "query", "to", "mysql", "only", "if", "another", "identical", "query", "is", "not", "running", ".", "Otherwise", "it", "waits", "and", "reuses", "the", "result", ".", "If", "the", "plan", "is", "missng", "field", "info", "it", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_executor.go#L537-L554
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_executor.go
txFetch
func (qre *QueryExecutor) txFetch(conn *TxConnection, parsedQuery *sqlparser.ParsedQuery, bindVars map[string]*querypb.BindVariable, extras map[string]sqlparser.Encodable, buildStreamComment string, wantfields, record bool) (*sqltypes.Result, error) { sql, _, err := qre.generateFinalSQL(parsedQuery, bindVars, extras, ...
go
func (qre *QueryExecutor) txFetch(conn *TxConnection, parsedQuery *sqlparser.ParsedQuery, bindVars map[string]*querypb.BindVariable, extras map[string]sqlparser.Encodable, buildStreamComment string, wantfields, record bool) (*sqltypes.Result, error) { sql, _, err := qre.generateFinalSQL(parsedQuery, bindVars, extras, ...
[ "func", "(", "qre", "*", "QueryExecutor", ")", "txFetch", "(", "conn", "*", "TxConnection", ",", "parsedQuery", "*", "sqlparser", ".", "ParsedQuery", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "extras", "map", "["...
// txFetch fetches from a TxConnection.
[ "txFetch", "fetches", "from", "a", "TxConnection", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_executor.go#L861-L875
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_executor.go
dbConnFetch
func (qre *QueryExecutor) dbConnFetch(conn *connpool.DBConn, parsedQuery *sqlparser.ParsedQuery, bindVars map[string]*querypb.BindVariable, buildStreamComment string, wantfields bool) (*sqltypes.Result, error) { sql, _, err := qre.generateFinalSQL(parsedQuery, bindVars, nil, buildStreamComment) if err != nil { retu...
go
func (qre *QueryExecutor) dbConnFetch(conn *connpool.DBConn, parsedQuery *sqlparser.ParsedQuery, bindVars map[string]*querypb.BindVariable, buildStreamComment string, wantfields bool) (*sqltypes.Result, error) { sql, _, err := qre.generateFinalSQL(parsedQuery, bindVars, nil, buildStreamComment) if err != nil { retu...
[ "func", "(", "qre", "*", "QueryExecutor", ")", "dbConnFetch", "(", "conn", "*", "connpool", ".", "DBConn", ",", "parsedQuery", "*", "sqlparser", ".", "ParsedQuery", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "buil...
// dbConnFetch fetches from a connpool.DBConn.
[ "dbConnFetch", "fetches", "from", "a", "connpool", ".", "DBConn", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_executor.go#L878-L884
train
vitessio/vitess
go/vt/vttablet/tabletserver/query_executor.go
streamFetch
func (qre *QueryExecutor) streamFetch(conn *connpool.DBConn, parsedQuery *sqlparser.ParsedQuery, bindVars map[string]*querypb.BindVariable, buildStreamComment string, callback func(*sqltypes.Result) error) error { sql, _, err := qre.generateFinalSQL(parsedQuery, bindVars, nil, buildStreamComment) if err != nil { re...
go
func (qre *QueryExecutor) streamFetch(conn *connpool.DBConn, parsedQuery *sqlparser.ParsedQuery, bindVars map[string]*querypb.BindVariable, buildStreamComment string, callback func(*sqltypes.Result) error) error { sql, _, err := qre.generateFinalSQL(parsedQuery, bindVars, nil, buildStreamComment) if err != nil { re...
[ "func", "(", "qre", "*", "QueryExecutor", ")", "streamFetch", "(", "conn", "*", "connpool", ".", "DBConn", ",", "parsedQuery", "*", "sqlparser", ".", "ParsedQuery", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "buil...
// streamFetch performs a streaming fetch.
[ "streamFetch", "performs", "a", "streaming", "fetch", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/query_executor.go#L887-L893
train
vitessio/vitess
go/vt/vtctl/fakevtctlclient/fakevtctlclient.go
FakeVtctlClientFactory
func (f *FakeVtctlClient) FakeVtctlClientFactory(addr string) (vtctlclient.VtctlClient, error) { return f, nil }
go
func (f *FakeVtctlClient) FakeVtctlClientFactory(addr string) (vtctlclient.VtctlClient, error) { return f, nil }
[ "func", "(", "f", "*", "FakeVtctlClient", ")", "FakeVtctlClientFactory", "(", "addr", "string", ")", "(", "vtctlclient", ".", "VtctlClient", ",", "error", ")", "{", "return", "f", ",", "nil", "\n", "}" ]
// FakeVtctlClientFactory always returns the current instance.
[ "FakeVtctlClientFactory", "always", "returns", "the", "current", "instance", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctl/fakevtctlclient/fakevtctlclient.go#L41-L43
train
vitessio/vitess
go/vt/vtctl/fakevtctlclient/fakevtctlclient.go
ExecuteVtctlCommand
func (f *FakeVtctlClient) ExecuteVtctlCommand(ctx context.Context, args []string, actionTimeout time.Duration) (logutil.EventStream, error) { return f.FakeLoggerEventStreamingClient.StreamResult("" /* addr */, args) }
go
func (f *FakeVtctlClient) ExecuteVtctlCommand(ctx context.Context, args []string, actionTimeout time.Duration) (logutil.EventStream, error) { return f.FakeLoggerEventStreamingClient.StreamResult("" /* addr */, args) }
[ "func", "(", "f", "*", "FakeVtctlClient", ")", "ExecuteVtctlCommand", "(", "ctx", "context", ".", "Context", ",", "args", "[", "]", "string", ",", "actionTimeout", "time", ".", "Duration", ")", "(", "logutil", ".", "EventStream", ",", "error", ")", "{", ...
// ExecuteVtctlCommand is part of the vtctlclient interface.
[ "ExecuteVtctlCommand", "is", "part", "of", "the", "vtctlclient", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtctl/fakevtctlclient/fakevtctlclient.go#L46-L48
train
vitessio/vitess
go/vt/vttablet/tabletmanager/vreplication/replicator_plan.go
buildExecutionPlan
func (rp *ReplicatorPlan) buildExecutionPlan(fieldEvent *binlogdatapb.FieldEvent) (*TablePlan, error) { prelim := rp.TablePlans[fieldEvent.TableName] if prelim == nil { // Unreachable code. return nil, fmt.Errorf("plan not found for %s", fieldEvent.TableName) } if prelim.Insert != nil { tplanv := *prelim tp...
go
func (rp *ReplicatorPlan) buildExecutionPlan(fieldEvent *binlogdatapb.FieldEvent) (*TablePlan, error) { prelim := rp.TablePlans[fieldEvent.TableName] if prelim == nil { // Unreachable code. return nil, fmt.Errorf("plan not found for %s", fieldEvent.TableName) } if prelim.Insert != nil { tplanv := *prelim tp...
[ "func", "(", "rp", "*", "ReplicatorPlan", ")", "buildExecutionPlan", "(", "fieldEvent", "*", "binlogdatapb", ".", "FieldEvent", ")", "(", "*", "TablePlan", ",", "error", ")", "{", "prelim", ":=", "rp", ".", "TablePlans", "[", "fieldEvent", ".", "TableName", ...
// buildExecution plan uses the field info as input and the partially built // TablePlan for that table to build a full plan.
[ "buildExecution", "plan", "uses", "the", "field", "info", "as", "input", "and", "the", "partially", "built", "TablePlan", "for", "that", "table", "to", "build", "a", "full", "plan", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/vreplication/replicator_plan.go#L47-L65
train
vitessio/vitess
go/vt/vttablet/tabletserver/queryz.go
MysqlTimePQ
func (qzs *queryzRow) MysqlTimePQ() string { val := float64(qzs.mysqlTime) / (1e9 * float64(qzs.Count)) return fmt.Sprintf("%.6f", val) }
go
func (qzs *queryzRow) MysqlTimePQ() string { val := float64(qzs.mysqlTime) / (1e9 * float64(qzs.Count)) return fmt.Sprintf("%.6f", val) }
[ "func", "(", "qzs", "*", "queryzRow", ")", "MysqlTimePQ", "(", ")", "string", "{", "val", ":=", "float64", "(", "qzs", ".", "mysqlTime", ")", "/", "(", "1e9", "*", "float64", "(", "qzs", ".", "Count", ")", ")", "\n", "return", "fmt", ".", "Sprintf"...
// MysqlTimePQ returns the time per query as a string.
[ "MysqlTimePQ", "returns", "the", "time", "per", "query", "as", "a", "string", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/queryz.go#L106-L109
train
vitessio/vitess
go/vt/vttablet/tabletserver/queryz.go
RowsPQ
func (qzs *queryzRow) RowsPQ() string { val := float64(qzs.Rows) / float64(qzs.Count) return fmt.Sprintf("%.6f", val) }
go
func (qzs *queryzRow) RowsPQ() string { val := float64(qzs.Rows) / float64(qzs.Count) return fmt.Sprintf("%.6f", val) }
[ "func", "(", "qzs", "*", "queryzRow", ")", "RowsPQ", "(", ")", "string", "{", "val", ":=", "float64", "(", "qzs", ".", "Rows", ")", "/", "float64", "(", "qzs", ".", "Count", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "val",...
// RowsPQ returns the row count per query as a string.
[ "RowsPQ", "returns", "the", "row", "count", "per", "query", "as", "a", "string", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/queryz.go#L112-L115
train
vitessio/vitess
go/vt/vttablet/tabletserver/queryz.go
ErrorsPQ
func (qzs *queryzRow) ErrorsPQ() string { return fmt.Sprintf("%.6f", float64(qzs.Errors)/float64(qzs.Count)) }
go
func (qzs *queryzRow) ErrorsPQ() string { return fmt.Sprintf("%.6f", float64(qzs.Errors)/float64(qzs.Count)) }
[ "func", "(", "qzs", "*", "queryzRow", ")", "ErrorsPQ", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "float64", "(", "qzs", ".", "Errors", ")", "/", "float64", "(", "qzs", ".", "Count", ")", ")", "\n", "}" ]
// ErrorsPQ returns the error count per query as a string.
[ "ErrorsPQ", "returns", "the", "error", "count", "per", "query", "as", "a", "string", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/queryz.go#L118-L120
train
vitessio/vitess
go/vt/worker/table_status.go
format
func (t *tableStatusList) format() ([]string, time.Time) { if !t.isInitialized() { return nil, time.Now() } copiedRows := uint64(0) rowCount := uint64(0) result := make([]string, len(t.tableStatuses)) for i, ts := range t.tableStatuses { ts.mu.Lock() if ts.isView { // views are not copied result[i] =...
go
func (t *tableStatusList) format() ([]string, time.Time) { if !t.isInitialized() { return nil, time.Now() } copiedRows := uint64(0) rowCount := uint64(0) result := make([]string, len(t.tableStatuses)) for i, ts := range t.tableStatuses { ts.mu.Lock() if ts.isView { // views are not copied result[i] =...
[ "func", "(", "t", "*", "tableStatusList", ")", "format", "(", ")", "(", "[", "]", "string", ",", "time", ".", "Time", ")", "{", "if", "!", "t", ".", "isInitialized", "(", ")", "{", "return", "nil", ",", "time", ".", "Now", "(", ")", "\n", "}", ...
// format returns a status for each table and the overall ETA.
[ "format", "returns", "a", "status", "for", "each", "table", "and", "the", "overall", "ETA", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/table_status.go#L104-L143
train
vitessio/vitess
go/vt/workflow/checkpoint.go
NewCheckpointWriter
func NewCheckpointWriter(ts *topo.Server, checkpoint *workflowpb.WorkflowCheckpoint, wi *topo.WorkflowInfo) *CheckpointWriter { return &CheckpointWriter{ topoServer: ts, checkpoint: checkpoint, wi: wi, } }
go
func NewCheckpointWriter(ts *topo.Server, checkpoint *workflowpb.WorkflowCheckpoint, wi *topo.WorkflowInfo) *CheckpointWriter { return &CheckpointWriter{ topoServer: ts, checkpoint: checkpoint, wi: wi, } }
[ "func", "NewCheckpointWriter", "(", "ts", "*", "topo", ".", "Server", ",", "checkpoint", "*", "workflowpb", ".", "WorkflowCheckpoint", ",", "wi", "*", "topo", ".", "WorkflowInfo", ")", "*", "CheckpointWriter", "{", "return", "&", "CheckpointWriter", "{", "topo...
// NewCheckpointWriter creates a CheckpointWriter.
[ "NewCheckpointWriter", "creates", "a", "CheckpointWriter", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/checkpoint.go#L41-L47
train
vitessio/vitess
go/vt/workflow/checkpoint.go
UpdateTask
func (c *CheckpointWriter) UpdateTask(taskID string, status workflowpb.TaskState, err error) error { c.mu.Lock() defer c.mu.Unlock() errorMessage := "" if err != nil { errorMessage = err.Error() } t := c.checkpoint.Tasks[taskID] t.State = status t.Error = errorMessage return c.saveLocked() }
go
func (c *CheckpointWriter) UpdateTask(taskID string, status workflowpb.TaskState, err error) error { c.mu.Lock() defer c.mu.Unlock() errorMessage := "" if err != nil { errorMessage = err.Error() } t := c.checkpoint.Tasks[taskID] t.State = status t.Error = errorMessage return c.saveLocked() }
[ "func", "(", "c", "*", "CheckpointWriter", ")", "UpdateTask", "(", "taskID", "string", ",", "status", "workflowpb", ".", "TaskState", ",", "err", "error", ")", "error", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", ...
// UpdateTask updates the task status in the checkpointing copy and // saves the full checkpoint to the topology server.
[ "UpdateTask", "updates", "the", "task", "status", "in", "the", "checkpointing", "copy", "and", "saves", "the", "full", "checkpoint", "to", "the", "topology", "server", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/workflow/checkpoint.go#L51-L64
train
vitessio/vitess
go/vt/vttablet/customrule/topocustomrule/topocustomrule.go
activateTopoCustomRules
func activateTopoCustomRules(qsc tabletserver.Controller) { if *rulePath != "" { qsc.RegisterQueryRuleSource(topoCustomRuleSource) cr, err := newTopoCustomRule(qsc, *ruleCell, *rulePath) if err != nil { log.Fatalf("cannot start TopoCustomRule: %v", err) } cr.start() servenv.OnTerm(cr.stop) } }
go
func activateTopoCustomRules(qsc tabletserver.Controller) { if *rulePath != "" { qsc.RegisterQueryRuleSource(topoCustomRuleSource) cr, err := newTopoCustomRule(qsc, *ruleCell, *rulePath) if err != nil { log.Fatalf("cannot start TopoCustomRule: %v", err) } cr.start() servenv.OnTerm(cr.stop) } }
[ "func", "activateTopoCustomRules", "(", "qsc", "tabletserver", ".", "Controller", ")", "{", "if", "*", "rulePath", "!=", "\"", "\"", "{", "qsc", ".", "RegisterQueryRuleSource", "(", "topoCustomRuleSource", ")", "\n\n", "cr", ",", "err", ":=", "newTopoCustomRule"...
// activateTopoCustomRules activates topo dynamic custom rule mechanism.
[ "activateTopoCustomRules", "activates", "topo", "dynamic", "custom", "rule", "mechanism", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/customrule/topocustomrule/topocustomrule.go#L189-L201
train
vitessio/vitess
go/vt/vtexplain/vtexplain_vttablet.go
CreateTransaction
func (t *explainTablet) CreateTransaction(ctx context.Context, target *querypb.Target, dtid string, participants []*querypb.Target) (err error) { t.mu.Lock() t.currentTime = batchTime.Wait() t.mu.Unlock() return t.tsv.CreateTransaction(ctx, target, dtid, participants) }
go
func (t *explainTablet) CreateTransaction(ctx context.Context, target *querypb.Target, dtid string, participants []*querypb.Target) (err error) { t.mu.Lock() t.currentTime = batchTime.Wait() t.mu.Unlock() return t.tsv.CreateTransaction(ctx, target, dtid, participants) }
[ "func", "(", "t", "*", "explainTablet", ")", "CreateTransaction", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "dtid", "string", ",", "participants", "[", "]", "*", "querypb", ".", "Target", ")", "(", "err", ...
// CreateTransaction is part of the QueryService interface.
[ "CreateTransaction", "is", "part", "of", "the", "QueryService", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtexplain/vtexplain_vttablet.go#L186-L191
train
vitessio/vitess
go/vt/vtexplain/vtexplain_vttablet.go
Close
func (t *explainTablet) Close(ctx context.Context) error { return t.tsv.Close(ctx) }
go
func (t *explainTablet) Close(ctx context.Context) error { return t.tsv.Close(ctx) }
[ "func", "(", "t", "*", "explainTablet", ")", "Close", "(", "ctx", "context", ".", "Context", ")", "error", "{", "return", "t", ".", "tsv", ".", "Close", "(", "ctx", ")", "\n", "}" ]
// Close is part of the QueryService interface.
[ "Close", "is", "part", "of", "the", "QueryService", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtexplain/vtexplain_vttablet.go#L261-L263
train
vitessio/vitess
go/vt/discovery/topology_watcher.go
NewCellTabletsWatcher
func NewCellTabletsWatcher(ctx context.Context, topoServer *topo.Server, tr TabletRecorder, cell string, refreshInterval time.Duration, refreshKnownTablets bool, topoReadConcurrency int) *TopologyWatcher { return NewTopologyWatcher(ctx, topoServer, tr, cell, refreshInterval, refreshKnownTablets, topoReadConcurrency, f...
go
func NewCellTabletsWatcher(ctx context.Context, topoServer *topo.Server, tr TabletRecorder, cell string, refreshInterval time.Duration, refreshKnownTablets bool, topoReadConcurrency int) *TopologyWatcher { return NewTopologyWatcher(ctx, topoServer, tr, cell, refreshInterval, refreshKnownTablets, topoReadConcurrency, f...
[ "func", "NewCellTabletsWatcher", "(", "ctx", "context", ".", "Context", ",", "topoServer", "*", "topo", ".", "Server", ",", "tr", "TabletRecorder", ",", "cell", "string", ",", "refreshInterval", "time", ".", "Duration", ",", "refreshKnownTablets", "bool", ",", ...
// NewCellTabletsWatcher returns a TopologyWatcher that monitors all // the tablets in a cell, and starts refreshing.
[ "NewCellTabletsWatcher", "returns", "a", "TopologyWatcher", "that", "monitors", "all", "the", "tablets", "in", "a", "cell", "and", "starts", "refreshing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L72-L76
train
vitessio/vitess
go/vt/discovery/topology_watcher.go
NewTopologyWatcher
func NewTopologyWatcher(ctx context.Context, topoServer *topo.Server, tr TabletRecorder, cell string, refreshInterval time.Duration, refreshKnownTablets bool, topoReadConcurrency int, getTablets func(tw *TopologyWatcher) ([]*topodatapb.TabletAlias, error)) *TopologyWatcher { tw := &TopologyWatcher{ topoServer: ...
go
func NewTopologyWatcher(ctx context.Context, topoServer *topo.Server, tr TabletRecorder, cell string, refreshInterval time.Duration, refreshKnownTablets bool, topoReadConcurrency int, getTablets func(tw *TopologyWatcher) ([]*topodatapb.TabletAlias, error)) *TopologyWatcher { tw := &TopologyWatcher{ topoServer: ...
[ "func", "NewTopologyWatcher", "(", "ctx", "context", ".", "Context", ",", "topoServer", "*", "topo", ".", "Server", ",", "tr", "TabletRecorder", ",", "cell", "string", ",", "refreshInterval", "time", ".", "Duration", ",", "refreshKnownTablets", "bool", ",", "t...
// NewTopologyWatcher returns a TopologyWatcher that monitors all // the tablets in a cell, and starts refreshing.
[ "NewTopologyWatcher", "returns", "a", "TopologyWatcher", "that", "monitors", "all", "the", "tablets", "in", "a", "cell", "and", "starts", "refreshing", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L141-L160
train
vitessio/vitess
go/vt/discovery/topology_watcher.go
RefreshLag
func (tw *TopologyWatcher) RefreshLag() time.Duration { tw.mu.Lock() defer tw.mu.Unlock() return time.Since(tw.lastRefresh) }
go
func (tw *TopologyWatcher) RefreshLag() time.Duration { tw.mu.Lock() defer tw.mu.Unlock() return time.Since(tw.lastRefresh) }
[ "func", "(", "tw", "*", "TopologyWatcher", ")", "RefreshLag", "(", ")", "time", ".", "Duration", "{", "tw", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tw", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "return", "time", ".", "Since", "(", "t...
// RefreshLag returns the time since the last refresh
[ "RefreshLag", "returns", "the", "time", "since", "the", "last", "refresh" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L323-L328
train
vitessio/vitess
go/vt/discovery/topology_watcher.go
TopoChecksum
func (tw *TopologyWatcher) TopoChecksum() uint32 { tw.mu.Lock() defer tw.mu.Unlock() return tw.topoChecksum }
go
func (tw *TopologyWatcher) TopoChecksum() uint32 { tw.mu.Lock() defer tw.mu.Unlock() return tw.topoChecksum }
[ "func", "(", "tw", "*", "TopologyWatcher", ")", "TopoChecksum", "(", ")", "uint32", "{", "tw", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tw", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "return", "tw", ".", "topoChecksum", "\n", "}" ]
// TopoChecksum returns the checksum of the current state of the topo
[ "TopoChecksum", "returns", "the", "checksum", "of", "the", "current", "state", "of", "the", "topo" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L331-L336
train
vitessio/vitess
go/vt/discovery/topology_watcher.go
NewFilterByShard
func NewFilterByShard(tr TabletRecorder, filters []string) (*FilterByShard, error) { m := make(map[string][]*filterShard) for _, filter := range filters { parts := strings.Split(filter, "|") if len(parts) != 2 { return nil, fmt.Errorf("invalid FilterByShard parameter: %v", filter) } keyspace := parts[0] ...
go
func NewFilterByShard(tr TabletRecorder, filters []string) (*FilterByShard, error) { m := make(map[string][]*filterShard) for _, filter := range filters { parts := strings.Split(filter, "|") if len(parts) != 2 { return nil, fmt.Errorf("invalid FilterByShard parameter: %v", filter) } keyspace := parts[0] ...
[ "func", "NewFilterByShard", "(", "tr", "TabletRecorder", ",", "filters", "[", "]", "string", ")", "(", "*", "FilterByShard", ",", "error", ")", "{", "m", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "*", "filterShard", ")", "\n", "for", "_...
// NewFilterByShard creates a new FilterByShard on top of an existing // TabletRecorder. Each filter is a keyspace|shard entry, where shard // can either be a shard name, or a keyrange. All tablets that match // at least one keyspace|shard tuple will be forwarded to the // underlying TabletRecorder.
[ "NewFilterByShard", "creates", "a", "new", "FilterByShard", "on", "top", "of", "an", "existing", "TabletRecorder", ".", "Each", "filter", "is", "a", "keyspace|shard", "entry", "where", "shard", "can", "either", "be", "a", "shard", "name", "or", "a", "keyrange"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L361-L396
train
vitessio/vitess
go/vt/discovery/topology_watcher.go
AddTablet
func (fbs *FilterByShard) AddTablet(tablet *topodatapb.Tablet, name string) { if fbs.isIncluded(tablet) { fbs.tr.AddTablet(tablet, name) } }
go
func (fbs *FilterByShard) AddTablet(tablet *topodatapb.Tablet, name string) { if fbs.isIncluded(tablet) { fbs.tr.AddTablet(tablet, name) } }
[ "func", "(", "fbs", "*", "FilterByShard", ")", "AddTablet", "(", "tablet", "*", "topodatapb", ".", "Tablet", ",", "name", "string", ")", "{", "if", "fbs", ".", "isIncluded", "(", "tablet", ")", "{", "fbs", ".", "tr", ".", "AddTablet", "(", "tablet", ...
// AddTablet is part of the TabletRecorder interface.
[ "AddTablet", "is", "part", "of", "the", "TabletRecorder", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L399-L403
train
vitessio/vitess
go/vt/discovery/topology_watcher.go
RemoveTablet
func (fbs *FilterByShard) RemoveTablet(tablet *topodatapb.Tablet) { if fbs.isIncluded(tablet) { fbs.tr.RemoveTablet(tablet) } }
go
func (fbs *FilterByShard) RemoveTablet(tablet *topodatapb.Tablet) { if fbs.isIncluded(tablet) { fbs.tr.RemoveTablet(tablet) } }
[ "func", "(", "fbs", "*", "FilterByShard", ")", "RemoveTablet", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "{", "if", "fbs", ".", "isIncluded", "(", "tablet", ")", "{", "fbs", ".", "tr", ".", "RemoveTablet", "(", "tablet", ")", "\n", "}", "...
// RemoveTablet is part of the TabletRecorder interface.
[ "RemoveTablet", "is", "part", "of", "the", "TabletRecorder", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L406-L410
train
vitessio/vitess
go/vt/discovery/topology_watcher.go
ReplaceTablet
func (fbs *FilterByShard) ReplaceTablet(old, new *topodatapb.Tablet, name string) { if fbs.isIncluded(old) && fbs.isIncluded(new) { fbs.tr.ReplaceTablet(old, new, name) } }
go
func (fbs *FilterByShard) ReplaceTablet(old, new *topodatapb.Tablet, name string) { if fbs.isIncluded(old) && fbs.isIncluded(new) { fbs.tr.ReplaceTablet(old, new, name) } }
[ "func", "(", "fbs", "*", "FilterByShard", ")", "ReplaceTablet", "(", "old", ",", "new", "*", "topodatapb", ".", "Tablet", ",", "name", "string", ")", "{", "if", "fbs", ".", "isIncluded", "(", "old", ")", "&&", "fbs", ".", "isIncluded", "(", "new", ")...
// ReplaceTablet is part of the TabletRecorder interface.
[ "ReplaceTablet", "is", "part", "of", "the", "TabletRecorder", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L413-L417
train
vitessio/vitess
go/vt/discovery/topology_watcher.go
isIncluded
func (fbs *FilterByShard) isIncluded(tablet *topodatapb.Tablet) bool { canonical, kr, err := topo.ValidateShardName(tablet.Shard) if err != nil { log.Errorf("Error parsing shard name %v, will ignore tablet: %v", tablet.Shard, err) return false } for _, c := range fbs.filters[tablet.Keyspace] { if canonical =...
go
func (fbs *FilterByShard) isIncluded(tablet *topodatapb.Tablet) bool { canonical, kr, err := topo.ValidateShardName(tablet.Shard) if err != nil { log.Errorf("Error parsing shard name %v, will ignore tablet: %v", tablet.Shard, err) return false } for _, c := range fbs.filters[tablet.Keyspace] { if canonical =...
[ "func", "(", "fbs", "*", "FilterByShard", ")", "isIncluded", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "bool", "{", "canonical", ",", "kr", ",", "err", ":=", "topo", ".", "ValidateShardName", "(", "tablet", ".", "Shard", ")", "\n", "if", "e...
// isIncluded returns true iff the tablet's keyspace and shard should be // forwarded to the underlying TabletRecorder.
[ "isIncluded", "returns", "true", "iff", "the", "tablet", "s", "keyspace", "and", "shard", "should", "be", "forwarded", "to", "the", "underlying", "TabletRecorder", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/topology_watcher.go#L421-L439
train