id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
136,000
vitessio/vitess
go/vt/wrangler/reparent.go
ReparentTablet
func (wr *Wrangler) ReparentTablet(ctx context.Context, tabletAlias *topodatapb.TabletAlias) error { // Get specified tablet. // Get current shard master tablet. // Sanity check they are in the same keyspace/shard. // Issue a SetMaster to the tablet. ti, err := wr.ts.GetTablet(ctx, tabletAlias) if err != nil { ...
go
func (wr *Wrangler) ReparentTablet(ctx context.Context, tabletAlias *topodatapb.TabletAlias) error { // Get specified tablet. // Get current shard master tablet. // Sanity check they are in the same keyspace/shard. // Issue a SetMaster to the tablet. ti, err := wr.ts.GetTablet(ctx, tabletAlias) if err != nil { ...
[ "func", "(", "wr", "*", "Wrangler", ")", "ReparentTablet", "(", "ctx", "context", ".", "Context", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ")", "error", "{", "// Get specified tablet.", "// Get current shard master tablet.", "// Sanity check they are i...
// ReparentTablet tells a tablet to reparent this tablet to the current // master, based on the current replication position. If there is no // match, it will fail.
[ "ReparentTablet", "tells", "a", "tablet", "to", "reparent", "this", "tablet", "to", "the", "current", "master", "based", "on", "the", "current", "replication", "position", ".", "If", "there", "is", "no", "match", "it", "will", "fail", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/reparent.go#L98-L131
136,001
vitessio/vitess
go/vt/wrangler/reparent.go
PlannedReparentShard
func (wr *Wrangler) PlannedReparentShard(ctx context.Context, keyspace, shard string, masterElectTabletAlias, avoidMasterAlias *topodatapb.TabletAlias, waitSlaveTimeout time.Duration) (err error) { // lock the shard lockAction := fmt.Sprintf( "PlannedReparentShard(%v, avoid_master=%v)", topoproto.TabletAliasStrin...
go
func (wr *Wrangler) PlannedReparentShard(ctx context.Context, keyspace, shard string, masterElectTabletAlias, avoidMasterAlias *topodatapb.TabletAlias, waitSlaveTimeout time.Duration) (err error) { // lock the shard lockAction := fmt.Sprintf( "PlannedReparentShard(%v, avoid_master=%v)", topoproto.TabletAliasStrin...
[ "func", "(", "wr", "*", "Wrangler", ")", "PlannedReparentShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "masterElectTabletAlias", ",", "avoidMasterAlias", "*", "topodatapb", ".", "TabletAlias", ",", "waitSlaveTimeout",...
// PlannedReparentShard will make the provided tablet the master for the shard, // when both the current and new master are reachable and in good shape.
[ "PlannedReparentShard", "will", "make", "the", "provided", "tablet", "the", "master", "for", "the", "shard", "when", "both", "the", "current", "and", "new", "master", "are", "reachable", "and", "in", "good", "shape", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/reparent.go#L331-L363
136,002
vitessio/vitess
go/vt/wrangler/reparent.go
EmergencyReparentShard
func (wr *Wrangler) EmergencyReparentShard(ctx context.Context, keyspace, shard string, masterElectTabletAlias *topodatapb.TabletAlias, waitSlaveTimeout time.Duration) (err error) { // lock the shard ctx, unlock, lockErr := wr.ts.LockShard(ctx, keyspace, shard, fmt.Sprintf("EmergencyReparentShard(%v)", topoproto.Tabl...
go
func (wr *Wrangler) EmergencyReparentShard(ctx context.Context, keyspace, shard string, masterElectTabletAlias *topodatapb.TabletAlias, waitSlaveTimeout time.Duration) (err error) { // lock the shard ctx, unlock, lockErr := wr.ts.LockShard(ctx, keyspace, shard, fmt.Sprintf("EmergencyReparentShard(%v)", topoproto.Tabl...
[ "func", "(", "wr", "*", "Wrangler", ")", "EmergencyReparentShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "masterElectTabletAlias", "*", "topodatapb", ".", "TabletAlias", ",", "waitSlaveTimeout", "time", ".", "Durati...
// EmergencyReparentShard will make the provided tablet the master for // the shard, when the old master is completely unreachable.
[ "EmergencyReparentShard", "will", "make", "the", "provided", "tablet", "the", "master", "for", "the", "shard", "when", "the", "old", "master", "is", "completely", "unreachable", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/reparent.go#L606-L625
136,003
vitessio/vitess
go/vt/vttablet/tabletserver/messager/engine.go
Subscribe
func (me *Engine) Subscribe(ctx context.Context, name string, send func(*sqltypes.Result) error) (done <-chan struct{}, err error) { me.mu.Lock() defer me.mu.Unlock() if !me.isOpen { return nil, vterrors.Errorf(vtrpcpb.Code_UNAVAILABLE, "messager engine is closed, probably because this is not a master any more") ...
go
func (me *Engine) Subscribe(ctx context.Context, name string, send func(*sqltypes.Result) error) (done <-chan struct{}, err error) { me.mu.Lock() defer me.mu.Unlock() if !me.isOpen { return nil, vterrors.Errorf(vtrpcpb.Code_UNAVAILABLE, "messager engine is closed, probably because this is not a master any more") ...
[ "func", "(", "me", "*", "Engine", ")", "Subscribe", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "send", "func", "(", "*", "sqltypes", ".", "Result", ")", "error", ")", "(", "done", "<-", "chan", "struct", "{", "}", ",", "err"...
// Subscribe subscribes to messages from the requested table. // The function returns a done channel that will be closed when // the subscription ends, which can be initiated by the send function // returning io.EOF. The engine can also end a subscription which is // usually triggered by Close. It's the responsibility ...
[ "Subscribe", "subscribes", "to", "messages", "from", "the", "requested", "table", ".", "The", "function", "returns", "a", "done", "channel", "that", "will", "be", "closed", "when", "the", "subscription", "ends", "which", "can", "be", "initiated", "by", "the", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/engine.go#L117-L128
136,004
vitessio/vitess
go/vt/vttablet/tabletserver/messager/engine.go
LockDB
func (me *Engine) LockDB(newMessages map[string][]*MessageRow, changedMessages map[string][]string) func() { // Short-circuit to avoid taking any locks if there's nothing to do. if len(newMessages) == 0 && len(changedMessages) == 0 { return func() {} } // Build the set of affected messages tables. combined := m...
go
func (me *Engine) LockDB(newMessages map[string][]*MessageRow, changedMessages map[string][]string) func() { // Short-circuit to avoid taking any locks if there's nothing to do. if len(newMessages) == 0 && len(changedMessages) == 0 { return func() {} } // Build the set of affected messages tables. combined := m...
[ "func", "(", "me", "*", "Engine", ")", "LockDB", "(", "newMessages", "map", "[", "string", "]", "[", "]", "*", "MessageRow", ",", "changedMessages", "map", "[", "string", "]", "[", "]", "string", ")", "func", "(", ")", "{", "// Short-circuit to avoid tak...
// LockDB obtains db locks for all messages that need to // be updated and returns the counterpart unlock function.
[ "LockDB", "obtains", "db", "locks", "for", "all", "messages", "that", "need", "to", "be", "updated", "and", "returns", "the", "counterpart", "unlock", "function", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/engine.go#L132-L178
136,005
vitessio/vitess
go/vt/vttablet/tabletserver/messager/engine.go
UpdateCaches
func (me *Engine) UpdateCaches(newMessages map[string][]*MessageRow, changedMessages map[string][]string) { // Short-circuit to avoid taking any locks if there's nothing to do. if len(newMessages) == 0 && len(changedMessages) == 0 { return } me.mu.Lock() defer me.mu.Unlock() now := time.Now().UnixNano() for n...
go
func (me *Engine) UpdateCaches(newMessages map[string][]*MessageRow, changedMessages map[string][]string) { // Short-circuit to avoid taking any locks if there's nothing to do. if len(newMessages) == 0 && len(changedMessages) == 0 { return } me.mu.Lock() defer me.mu.Unlock() now := time.Now().UnixNano() for n...
[ "func", "(", "me", "*", "Engine", ")", "UpdateCaches", "(", "newMessages", "map", "[", "string", "]", "[", "]", "*", "MessageRow", ",", "changedMessages", "map", "[", "string", "]", "[", "]", "string", ")", "{", "// Short-circuit to avoid taking any locks if t...
// UpdateCaches updates the caches for the committed changes.
[ "UpdateCaches", "updates", "the", "caches", "for", "the", "committed", "changes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/engine.go#L181-L211
136,006
vitessio/vitess
go/vt/vttablet/tabletserver/messager/engine.go
GenerateLoadMessagesQuery
func (me *Engine) GenerateLoadMessagesQuery(name string) (*sqlparser.ParsedQuery, error) { me.mu.Lock() defer me.mu.Unlock() mm := me.managers[name] if mm == nil { return nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "message table %s not found in schema", name) } return mm.loadMessagesQuery, nil }
go
func (me *Engine) GenerateLoadMessagesQuery(name string) (*sqlparser.ParsedQuery, error) { me.mu.Lock() defer me.mu.Unlock() mm := me.managers[name] if mm == nil { return nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "message table %s not found in schema", name) } return mm.loadMessagesQuery, nil }
[ "func", "(", "me", "*", "Engine", ")", "GenerateLoadMessagesQuery", "(", "name", "string", ")", "(", "*", "sqlparser", ".", "ParsedQuery", ",", "error", ")", "{", "me", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "me", ".", "mu", ".", "Unlock", ...
// GenerateLoadMessagesQuery returns the ParsedQuery for loading messages by pk. // The results of the query can be used in a BuildMessageRow call.
[ "GenerateLoadMessagesQuery", "returns", "the", "ParsedQuery", "for", "loading", "messages", "by", "pk", ".", "The", "results", "of", "the", "query", "can", "be", "used", "in", "a", "BuildMessageRow", "call", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/engine.go#L215-L223
136,007
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
Connect
func Connect(addr string) *ZkConn { return &ZkConn{ addr: addr, sem: sync2.NewSemaphore(*maxConcurrency, 0), } }
go
func Connect(addr string) *ZkConn { return &ZkConn{ addr: addr, sem: sync2.NewSemaphore(*maxConcurrency, 0), } }
[ "func", "Connect", "(", "addr", "string", ")", "*", "ZkConn", "{", "return", "&", "ZkConn", "{", "addr", ":", "addr", ",", "sem", ":", "sync2", ".", "NewSemaphore", "(", "*", "maxConcurrency", ",", "0", ")", ",", "}", "\n", "}" ]
// Connect to the Zookeeper servers specified in addr // addr can be a comma separated list of servers and each server can be a DNS entry with multiple values. // Connects to the endpoints in a randomized order to avoid hot spots.
[ "Connect", "to", "the", "Zookeeper", "servers", "specified", "in", "addr", "addr", "can", "be", "a", "comma", "separated", "list", "of", "servers", "and", "each", "server", "can", "be", "a", "DNS", "entry", "with", "multiple", "values", ".", "Connects", "t...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L96-L101
136,008
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
Get
func (c *ZkConn) Get(ctx context.Context, path string) (data []byte, stat *zk.Stat, err error) { err = c.withRetry(ctx, func(conn *zk.Conn) error { data, stat, err = conn.Get(path) return err }) return }
go
func (c *ZkConn) Get(ctx context.Context, path string) (data []byte, stat *zk.Stat, err error) { err = c.withRetry(ctx, func(conn *zk.Conn) error { data, stat, err = conn.Get(path) return err }) return }
[ "func", "(", "c", "*", "ZkConn", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "path", "string", ")", "(", "data", "[", "]", "byte", ",", "stat", "*", "zk", ".", "Stat", ",", "err", "error", ")", "{", "err", "=", "c", ".", "withRetry"...
// Get is part of the Conn interface.
[ "Get", "is", "part", "of", "the", "Conn", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L104-L110
136,009
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
Children
func (c *ZkConn) Children(ctx context.Context, path string) (children []string, stat *zk.Stat, err error) { err = c.withRetry(ctx, func(conn *zk.Conn) error { children, stat, err = conn.Children(path) return err }) return }
go
func (c *ZkConn) Children(ctx context.Context, path string) (children []string, stat *zk.Stat, err error) { err = c.withRetry(ctx, func(conn *zk.Conn) error { children, stat, err = conn.Children(path) return err }) return }
[ "func", "(", "c", "*", "ZkConn", ")", "Children", "(", "ctx", "context", ".", "Context", ",", "path", "string", ")", "(", "children", "[", "]", "string", ",", "stat", "*", "zk", ".", "Stat", ",", "err", "error", ")", "{", "err", "=", "c", ".", ...
// Children is part of the Conn interface.
[ "Children", "is", "part", "of", "the", "Conn", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L122-L128
136,010
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
Exists
func (c *ZkConn) Exists(ctx context.Context, path string) (exists bool, stat *zk.Stat, err error) { err = c.withRetry(ctx, func(conn *zk.Conn) error { exists, stat, err = conn.Exists(path) return err }) return }
go
func (c *ZkConn) Exists(ctx context.Context, path string) (exists bool, stat *zk.Stat, err error) { err = c.withRetry(ctx, func(conn *zk.Conn) error { exists, stat, err = conn.Exists(path) return err }) return }
[ "func", "(", "c", "*", "ZkConn", ")", "Exists", "(", "ctx", "context", ".", "Context", ",", "path", "string", ")", "(", "exists", "bool", ",", "stat", "*", "zk", ".", "Stat", ",", "err", "error", ")", "{", "err", "=", "c", ".", "withRetry", "(", ...
// Exists is part of the Conn interface.
[ "Exists", "is", "part", "of", "the", "Conn", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L140-L146
136,011
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
Create
func (c *ZkConn) Create(ctx context.Context, path string, value []byte, flags int32, aclv []zk.ACL) (pathCreated string, err error) { err = c.withRetry(ctx, func(conn *zk.Conn) error { pathCreated, err = conn.Create(path, value, flags, aclv) return err }) return }
go
func (c *ZkConn) Create(ctx context.Context, path string, value []byte, flags int32, aclv []zk.ACL) (pathCreated string, err error) { err = c.withRetry(ctx, func(conn *zk.Conn) error { pathCreated, err = conn.Create(path, value, flags, aclv) return err }) return }
[ "func", "(", "c", "*", "ZkConn", ")", "Create", "(", "ctx", "context", ".", "Context", ",", "path", "string", ",", "value", "[", "]", "byte", ",", "flags", "int32", ",", "aclv", "[", "]", "zk", ".", "ACL", ")", "(", "pathCreated", "string", ",", ...
// Create is part of the Conn interface.
[ "Create", "is", "part", "of", "the", "Conn", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L158-L164
136,012
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
Set
func (c *ZkConn) Set(ctx context.Context, path string, value []byte, version int32) (stat *zk.Stat, err error) { err = c.withRetry(ctx, func(conn *zk.Conn) error { stat, err = conn.Set(path, value, version) return err }) return }
go
func (c *ZkConn) Set(ctx context.Context, path string, value []byte, version int32) (stat *zk.Stat, err error) { err = c.withRetry(ctx, func(conn *zk.Conn) error { stat, err = conn.Set(path, value, version) return err }) return }
[ "func", "(", "c", "*", "ZkConn", ")", "Set", "(", "ctx", "context", ".", "Context", ",", "path", "string", ",", "value", "[", "]", "byte", ",", "version", "int32", ")", "(", "stat", "*", "zk", ".", "Stat", ",", "err", "error", ")", "{", "err", ...
// Set is part of the Conn interface.
[ "Set", "is", "part", "of", "the", "Conn", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L167-L173
136,013
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
Delete
func (c *ZkConn) Delete(ctx context.Context, path string, version int32) error { return c.withRetry(ctx, func(conn *zk.Conn) error { return conn.Delete(path, version) }) }
go
func (c *ZkConn) Delete(ctx context.Context, path string, version int32) error { return c.withRetry(ctx, func(conn *zk.Conn) error { return conn.Delete(path, version) }) }
[ "func", "(", "c", "*", "ZkConn", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "path", "string", ",", "version", "int32", ")", "error", "{", "return", "c", ".", "withRetry", "(", "ctx", ",", "func", "(", "conn", "*", "zk", ".", "Conn",...
// Delete is part of the Conn interface.
[ "Delete", "is", "part", "of", "the", "Conn", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L176-L180
136,014
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
GetACL
func (c *ZkConn) GetACL(ctx context.Context, path string) (aclv []zk.ACL, stat *zk.Stat, err error) { err = c.withRetry(ctx, func(conn *zk.Conn) error { aclv, stat, err = conn.GetACL(path) return err }) return }
go
func (c *ZkConn) GetACL(ctx context.Context, path string) (aclv []zk.ACL, stat *zk.Stat, err error) { err = c.withRetry(ctx, func(conn *zk.Conn) error { aclv, stat, err = conn.GetACL(path) return err }) return }
[ "func", "(", "c", "*", "ZkConn", ")", "GetACL", "(", "ctx", "context", ".", "Context", ",", "path", "string", ")", "(", "aclv", "[", "]", "zk", ".", "ACL", ",", "stat", "*", "zk", ".", "Stat", ",", "err", "error", ")", "{", "err", "=", "c", "...
// GetACL is part of the Conn interface.
[ "GetACL", "is", "part", "of", "the", "Conn", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L183-L189
136,015
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
SetACL
func (c *ZkConn) SetACL(ctx context.Context, path string, aclv []zk.ACL, version int32) error { return c.withRetry(ctx, func(conn *zk.Conn) error { _, err := conn.SetACL(path, aclv, version) return err }) }
go
func (c *ZkConn) SetACL(ctx context.Context, path string, aclv []zk.ACL, version int32) error { return c.withRetry(ctx, func(conn *zk.Conn) error { _, err := conn.SetACL(path, aclv, version) return err }) }
[ "func", "(", "c", "*", "ZkConn", ")", "SetACL", "(", "ctx", "context", ".", "Context", ",", "path", "string", ",", "aclv", "[", "]", "zk", ".", "ACL", ",", "version", "int32", ")", "error", "{", "return", "c", ".", "withRetry", "(", "ctx", ",", "...
// SetACL is part of the Conn interface.
[ "SetACL", "is", "part", "of", "the", "Conn", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L192-L197
136,016
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
AddAuth
func (c *ZkConn) AddAuth(ctx context.Context, scheme string, auth []byte) error { return c.withRetry(ctx, func(conn *zk.Conn) error { err := conn.AddAuth(scheme, auth) return err }) }
go
func (c *ZkConn) AddAuth(ctx context.Context, scheme string, auth []byte) error { return c.withRetry(ctx, func(conn *zk.Conn) error { err := conn.AddAuth(scheme, auth) return err }) }
[ "func", "(", "c", "*", "ZkConn", ")", "AddAuth", "(", "ctx", "context", ".", "Context", ",", "scheme", "string", ",", "auth", "[", "]", "byte", ")", "error", "{", "return", "c", ".", "withRetry", "(", "ctx", ",", "func", "(", "conn", "*", "zk", "...
// AddAuth is part of the Conn interface.
[ "AddAuth", "is", "part", "of", "the", "Conn", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L200-L205
136,017
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
Close
func (c *ZkConn) Close() error { c.mu.Lock() defer c.mu.Unlock() if c.conn != nil { c.conn.Close() } return nil }
go
func (c *ZkConn) Close() error { c.mu.Lock() defer c.mu.Unlock() if c.conn != nil { c.conn.Close() } return nil }
[ "func", "(", "c", "*", "ZkConn", ")", "Close", "(", ")", "error", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "c", ".", "conn", "!=", "nil", "{", "c", ".", "conn", ".", "...
// Close is part of the Conn interface.
[ "Close", "is", "part", "of", "the", "Conn", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L208-L215
136,018
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
getConn
func (c *ZkConn) getConn(ctx context.Context) (*zk.Conn, error) { c.mu.Lock() defer c.mu.Unlock() if c.conn == nil { conn, events, err := dialZk(ctx, c.addr) if err != nil { return nil, err } c.conn = conn go c.handleSessionEvents(conn, events) c.maybeAddAuth(ctx) } return c.conn, nil }
go
func (c *ZkConn) getConn(ctx context.Context) (*zk.Conn, error) { c.mu.Lock() defer c.mu.Unlock() if c.conn == nil { conn, events, err := dialZk(ctx, c.addr) if err != nil { return nil, err } c.conn = conn go c.handleSessionEvents(conn, events) c.maybeAddAuth(ctx) } return c.conn, nil }
[ "func", "(", "c", "*", "ZkConn", ")", "getConn", "(", "ctx", "context", ".", "Context", ")", "(", "*", "zk", ".", "Conn", ",", "error", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", ...
// getConn returns the connection in a thread safe way. It will try to connect // if not connected yet.
[ "getConn", "returns", "the", "connection", "in", "a", "thread", "safe", "way", ".", "It", "will", "try", "to", "connect", "if", "not", "connected", "yet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L272-L286
136,019
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
maybeAddAuth
func (c *ZkConn) maybeAddAuth(ctx context.Context) { if *authFile == "" { return } authInfoBytes, err := ioutil.ReadFile(*authFile) if err != nil { log.Errorf("failed to read topo_zk_auth_file: %v", err) return } authInfo := string(authInfoBytes) authInfoParts := strings.SplitN(authInfo, ":", 2) if len(au...
go
func (c *ZkConn) maybeAddAuth(ctx context.Context) { if *authFile == "" { return } authInfoBytes, err := ioutil.ReadFile(*authFile) if err != nil { log.Errorf("failed to read topo_zk_auth_file: %v", err) return } authInfo := string(authInfoBytes) authInfoParts := strings.SplitN(authInfo, ":", 2) if len(au...
[ "func", "(", "c", "*", "ZkConn", ")", "maybeAddAuth", "(", "ctx", "context", ".", "Context", ")", "{", "if", "*", "authFile", "==", "\"", "\"", "{", "return", "\n", "}", "\n", "authInfoBytes", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "*", ...
// maybeAddAuth calls AddAuth if the `-topo_zk_auth_file` flag was specified
[ "maybeAddAuth", "calls", "AddAuth", "if", "the", "-", "topo_zk_auth_file", "flag", "was", "specified" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L289-L309
136,020
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
handleSessionEvents
func (c *ZkConn) handleSessionEvents(conn *zk.Conn, session <-chan zk.Event) { for event := range session { closeRequired := false switch event.State { case zk.StateExpired, zk.StateConnecting: closeRequired = true fallthrough case zk.StateDisconnected: c.mu.Lock() if c.conn == conn { // The Z...
go
func (c *ZkConn) handleSessionEvents(conn *zk.Conn, session <-chan zk.Event) { for event := range session { closeRequired := false switch event.State { case zk.StateExpired, zk.StateConnecting: closeRequired = true fallthrough case zk.StateDisconnected: c.mu.Lock() if c.conn == conn { // The Z...
[ "func", "(", "c", "*", "ZkConn", ")", "handleSessionEvents", "(", "conn", "*", "zk", ".", "Conn", ",", "session", "<-", "chan", "zk", ".", "Event", ")", "{", "for", "event", ":=", "range", "session", "{", "closeRequired", ":=", "false", "\n\n", "switch...
// handleSessionEvents is processing events from the session channel. // When it detects that the connection is not working any more, it // clears out the connection record.
[ "handleSessionEvents", "is", "processing", "events", "from", "the", "session", "channel", ".", "When", "it", "detects", "that", "the", "connection", "is", "not", "working", "any", "more", "it", "clears", "out", "the", "connection", "record", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L314-L338
136,021
vitessio/vitess
go/vt/topo/zk2topo/zk_conn.go
dialZk
func dialZk(ctx context.Context, addr string) (*zk.Conn, <-chan zk.Event, error) { servers := strings.Split(addr, ",") options := zk.WithDialer(net.DialTimeout) // If TLS is enabled use a TLS enabled dialer option if *certPath != "" && *keyPath != "" { if strings.Contains(addr, ",") { log.Fatalf("This TLS zk c...
go
func dialZk(ctx context.Context, addr string) (*zk.Conn, <-chan zk.Event, error) { servers := strings.Split(addr, ",") options := zk.WithDialer(net.DialTimeout) // If TLS is enabled use a TLS enabled dialer option if *certPath != "" && *keyPath != "" { if strings.Contains(addr, ",") { log.Fatalf("This TLS zk c...
[ "func", "dialZk", "(", "ctx", "context", ".", "Context", ",", "addr", "string", ")", "(", "*", "zk", ".", "Conn", ",", "<-", "chan", "zk", ".", "Event", ",", "error", ")", "{", "servers", ":=", "strings", ".", "Split", "(", "addr", ",", "\"", "\"...
// dialZk dials the server, and waits until connection.
[ "dialZk", "dials", "the", "server", "and", "waits", "until", "connection", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/zk2topo/zk_conn.go#L341-L406
136,022
vitessio/vitess
go/vt/vtgate/planbuilder/delete.go
buildDeletePlan
func buildDeletePlan(del *sqlparser.Delete, vschema ContextVSchema) (*engine.Delete, error) { edel := &engine.Delete{} pb := newPrimitiveBuilder(vschema, newJointab(sqlparser.GetBindvars(del))) ro, err := pb.processDMLTable(del.TableExprs) if err != nil { return nil, err } edel.Query = generateQuery(del) edel....
go
func buildDeletePlan(del *sqlparser.Delete, vschema ContextVSchema) (*engine.Delete, error) { edel := &engine.Delete{} pb := newPrimitiveBuilder(vschema, newJointab(sqlparser.GetBindvars(del))) ro, err := pb.processDMLTable(del.TableExprs) if err != nil { return nil, err } edel.Query = generateQuery(del) edel....
[ "func", "buildDeletePlan", "(", "del", "*", "sqlparser", ".", "Delete", ",", "vschema", "ContextVSchema", ")", "(", "*", "engine", ".", "Delete", ",", "error", ")", "{", "edel", ":=", "&", "engine", ".", "Delete", "{", "}", "\n", "pb", ":=", "newPrimit...
// buildDeletePlan builds the instructions for a DELETE statement.
[ "buildDeletePlan", "builds", "the", "instructions", "for", "a", "DELETE", "statement", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/delete.go#L32-L97
136,023
vitessio/vitess
go/vt/vtgate/planbuilder/delete.go
generateDeleteSubquery
func generateDeleteSubquery(del *sqlparser.Delete, table *vindexes.Table) string { if len(table.Owned) == 0 { return "" } buf := sqlparser.NewTrackedBuffer(nil) buf.WriteString("select ") for vIdx, cv := range table.Owned { for cIdx, column := range cv.Columns { if cIdx == 0 && vIdx == 0 { buf.Myprintf(...
go
func generateDeleteSubquery(del *sqlparser.Delete, table *vindexes.Table) string { if len(table.Owned) == 0 { return "" } buf := sqlparser.NewTrackedBuffer(nil) buf.WriteString("select ") for vIdx, cv := range table.Owned { for cIdx, column := range cv.Columns { if cIdx == 0 && vIdx == 0 { buf.Myprintf(...
[ "func", "generateDeleteSubquery", "(", "del", "*", "sqlparser", ".", "Delete", ",", "table", "*", "vindexes", ".", "Table", ")", "string", "{", "if", "len", "(", "table", ".", "Owned", ")", "==", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "buf"...
// generateDeleteSubquery generates the query to fetch the rows // that will be deleted. This allows VTGate to clean up any // owned vindexes as needed.
[ "generateDeleteSubquery", "generates", "the", "query", "to", "fetch", "the", "rows", "that", "will", "be", "deleted", ".", "This", "allows", "VTGate", "to", "clean", "up", "any", "owned", "vindexes", "as", "needed", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/delete.go#L102-L119
136,024
vitessio/vitess
go/vt/vterrors/stack.go
file
func (f Frame) file() string { fn := runtime.FuncForPC(f.pc()) if fn == nil { return "unknown" } file, _ := fn.FileLine(f.pc()) return file }
go
func (f Frame) file() string { fn := runtime.FuncForPC(f.pc()) if fn == nil { return "unknown" } file, _ := fn.FileLine(f.pc()) return file }
[ "func", "(", "f", "Frame", ")", "file", "(", ")", "string", "{", "fn", ":=", "runtime", ".", "FuncForPC", "(", "f", ".", "pc", "(", ")", ")", "\n", "if", "fn", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "file", ",", "_", ":=", ...
// file returns the full path to the file that contains the // function for this Frame's pc.
[ "file", "returns", "the", "full", "path", "to", "the", "file", "that", "contains", "the", "function", "for", "this", "Frame", "s", "pc", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vterrors/stack.go#L22-L29
136,025
vitessio/vitess
go/vt/vterrors/stack.go
line
func (f Frame) line() int { fn := runtime.FuncForPC(f.pc()) if fn == nil { return 0 } _, line := fn.FileLine(f.pc()) return line }
go
func (f Frame) line() int { fn := runtime.FuncForPC(f.pc()) if fn == nil { return 0 } _, line := fn.FileLine(f.pc()) return line }
[ "func", "(", "f", "Frame", ")", "line", "(", ")", "int", "{", "fn", ":=", "runtime", ".", "FuncForPC", "(", "f", ".", "pc", "(", ")", ")", "\n", "if", "fn", "==", "nil", "{", "return", "0", "\n", "}", "\n", "_", ",", "line", ":=", "fn", "."...
// line returns the line number of source code of the // function for this Frame's pc.
[ "line", "returns", "the", "line", "number", "of", "source", "code", "of", "the", "function", "for", "this", "Frame", "s", "pc", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vterrors/stack.go#L33-L40
136,026
vitessio/vitess
go/vt/vttablet/tabletserver/splitquery/equal_splits_algorithm.go
NewEqualSplitsAlgorithm
func NewEqualSplitsAlgorithm(splitParams *SplitParams, sqlExecuter SQLExecuter) ( *EqualSplitsAlgorithm, error) { if len(splitParams.splitColumns) == 0 { panic(fmt.Sprintf("len(splitParams.splitColumns) == 0." + " SplitParams should have defaulted the split columns to the primary key columns.")) } // This alg...
go
func NewEqualSplitsAlgorithm(splitParams *SplitParams, sqlExecuter SQLExecuter) ( *EqualSplitsAlgorithm, error) { if len(splitParams.splitColumns) == 0 { panic(fmt.Sprintf("len(splitParams.splitColumns) == 0." + " SplitParams should have defaulted the split columns to the primary key columns.")) } // This alg...
[ "func", "NewEqualSplitsAlgorithm", "(", "splitParams", "*", "SplitParams", ",", "sqlExecuter", "SQLExecuter", ")", "(", "*", "EqualSplitsAlgorithm", ",", "error", ")", "{", "if", "len", "(", "splitParams", ".", "splitColumns", ")", "==", "0", "{", "panic", "("...
// NewEqualSplitsAlgorithm constructs a new equal splits algorithm. // It requires an SQLExecuter since it needs to execute a query to figure out the // minimum and maximum elements in the table.
[ "NewEqualSplitsAlgorithm", "constructs", "a", "new", "equal", "splits", "algorithm", ".", "It", "requires", "an", "SQLExecuter", "since", "it", "needs", "to", "execute", "a", "query", "to", "figure", "out", "the", "minimum", "and", "maximum", "elements", "in", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/equal_splits_algorithm.go#L58-L87
136,027
vitessio/vitess
go/vt/vttablet/tabletserver/splitquery/equal_splits_algorithm.go
bigIntToSliceOfBytes
func bigIntToSliceOfBytes(bigInt *big.Int) []byte { // Go1.6 introduced the method bigInt.Append() which makes this conversion // a lot easier. // TODO(erez): Use bigInt.Append() once we switch to GO-1.6. result := strconv.AppendQuoteToASCII([]byte{}, bigInt.String()) // AppendQuoteToASCII adds a double-quoted str...
go
func bigIntToSliceOfBytes(bigInt *big.Int) []byte { // Go1.6 introduced the method bigInt.Append() which makes this conversion // a lot easier. // TODO(erez): Use bigInt.Append() once we switch to GO-1.6. result := strconv.AppendQuoteToASCII([]byte{}, bigInt.String()) // AppendQuoteToASCII adds a double-quoted str...
[ "func", "bigIntToSliceOfBytes", "(", "bigInt", "*", "big", ".", "Int", ")", "[", "]", "byte", "{", "// Go1.6 introduced the method bigInt.Append() which makes this conversion", "// a lot easier.", "// TODO(erez): Use bigInt.Append() once we switch to GO-1.6.", "result", ":=", "st...
// Converts a big.Int into a slice of bytes.
[ "Converts", "a", "big", ".", "Int", "into", "a", "slice", "of", "bytes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/splitquery/equal_splits_algorithm.go#L229-L236
136,028
vitessio/vitess
go/vt/worker/interactive.go
InitInteractiveMode
func (wi *Instance) InitInteractiveMode() { indexTemplate := mustParseTemplate("index", indexHTML) subIndexTemplate := mustParseTemplate("subIndex", subIndexHTML) // toplevel menu http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { if err := acl.CheckAccessHTTP(r, acl.ADMIN); err != nil { acl....
go
func (wi *Instance) InitInteractiveMode() { indexTemplate := mustParseTemplate("index", indexHTML) subIndexTemplate := mustParseTemplate("subIndex", subIndexHTML) // toplevel menu http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { if err := acl.CheckAccessHTTP(r, acl.ADMIN); err != nil { acl....
[ "func", "(", "wi", "*", "Instance", ")", "InitInteractiveMode", "(", ")", "{", "indexTemplate", ":=", "mustParseTemplate", "(", "\"", "\"", ",", "indexHTML", ")", "\n", "subIndexTemplate", ":=", "mustParseTemplate", "(", "\"", "\"", ",", "subIndexHTML", ")", ...
// InitInteractiveMode installs webserver handlers for each known command.
[ "InitInteractiveMode", "installs", "webserver", "handlers", "for", "each", "known", "command", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/interactive.go#L80-L140
136,029
vitessio/vitess
go/mysql/schema.go
ShowIndexFromTableRow
func ShowIndexFromTableRow(table string, unique bool, keyName string, seqInIndex int, columnName string, nullable bool) []sqltypes.Value { nonUnique := "1" if unique { nonUnique = "0" } nullableStr := "" if nullable { nullableStr = "YES" } return []sqltypes.Value{ sqltypes.MakeTrusted(sqltypes.VarChar, []b...
go
func ShowIndexFromTableRow(table string, unique bool, keyName string, seqInIndex int, columnName string, nullable bool) []sqltypes.Value { nonUnique := "1" if unique { nonUnique = "0" } nullableStr := "" if nullable { nullableStr = "YES" } return []sqltypes.Value{ sqltypes.MakeTrusted(sqltypes.VarChar, []b...
[ "func", "ShowIndexFromTableRow", "(", "table", "string", ",", "unique", "bool", ",", "keyName", "string", ",", "seqInIndex", "int", ",", "columnName", "string", ",", "nullable", "bool", ")", "[", "]", "sqltypes", ".", "Value", "{", "nonUnique", ":=", "\"", ...
// ShowIndexFromTableRow returns the fields from a 'show index from table' // command. // 'table' is the table name. // 'unique' is true for unique indexes, false for non-unique indexes. // 'keyName' is 'PRIMARY' for PKs, otherwise the name of the index. // 'seqInIndex' is starting at 1 for first key in index. // 'colu...
[ "ShowIndexFromTableRow", "returns", "the", "fields", "from", "a", "show", "index", "from", "table", "command", ".", "table", "is", "the", "table", "name", ".", "unique", "is", "true", "for", "unique", "indexes", "false", "for", "non", "-", "unique", "indexes...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/schema.go#L296-L320
136,030
vitessio/vitess
go/mysql/schema.go
BaseShowTablesRow
func BaseShowTablesRow(tableName string, isView bool, comment string) []sqltypes.Value { tableType := "BASE TABLE" if isView { tableType = "VIEW" } return []sqltypes.Value{ sqltypes.MakeTrusted(sqltypes.VarChar, []byte(tableName)), sqltypes.MakeTrusted(sqltypes.VarChar, []byte(tableType)), sqltypes.MakeTrus...
go
func BaseShowTablesRow(tableName string, isView bool, comment string) []sqltypes.Value { tableType := "BASE TABLE" if isView { tableType = "VIEW" } return []sqltypes.Value{ sqltypes.MakeTrusted(sqltypes.VarChar, []byte(tableName)), sqltypes.MakeTrusted(sqltypes.VarChar, []byte(tableType)), sqltypes.MakeTrus...
[ "func", "BaseShowTablesRow", "(", "tableName", "string", ",", "isView", "bool", ",", "comment", "string", ")", "[", "]", "sqltypes", ".", "Value", "{", "tableType", ":=", "\"", "\"", "\n", "if", "isView", "{", "tableType", "=", "\"", "\"", "\n", "}", "...
// BaseShowTablesRow returns the fields from a BaseShowTables or // BaseShowTablesForTable command.
[ "BaseShowTablesRow", "returns", "the", "fields", "from", "a", "BaseShowTables", "or", "BaseShowTablesForTable", "command", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/schema.go#L433-L449
136,031
vitessio/vitess
go/event/event.go
Dispatch
func Dispatch(ev interface{}) { listenersMutex.RLock() defer listenersMutex.RUnlock() evType := reflect.TypeOf(ev) vals := []reflect.Value{reflect.ValueOf(ev)} // call listeners for the actual static type callListeners(evType, vals) // also check if the type implements any of the registered interfaces for _,...
go
func Dispatch(ev interface{}) { listenersMutex.RLock() defer listenersMutex.RUnlock() evType := reflect.TypeOf(ev) vals := []reflect.Value{reflect.ValueOf(ev)} // call listeners for the actual static type callListeners(evType, vals) // also check if the type implements any of the registered interfaces for _,...
[ "func", "Dispatch", "(", "ev", "interface", "{", "}", ")", "{", "listenersMutex", ".", "RLock", "(", ")", "\n", "defer", "listenersMutex", ".", "RUnlock", "(", ")", "\n\n", "evType", ":=", "reflect", ".", "TypeOf", "(", "ev", ")", "\n", "vals", ":=", ...
// Dispatch sends an event to all registered listeners that were declared // to accept values of the event's type, or interfaces that the value implements.
[ "Dispatch", "sends", "an", "event", "to", "all", "registered", "listeners", "that", "were", "declared", "to", "accept", "values", "of", "the", "event", "s", "type", "or", "interfaces", "that", "the", "value", "implements", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/event/event.go#L132-L148
136,032
vitessio/vitess
go/vt/vtgate/planbuilder/insert.go
buildInsertPlan
func buildInsertPlan(ins *sqlparser.Insert, vschema ContextVSchema) (*engine.Insert, error) { pb := newPrimitiveBuilder(vschema, newJointab(sqlparser.GetBindvars(ins))) exprs := sqlparser.TableExprs{&sqlparser.AliasedTableExpr{Expr: ins.Table}} ro, err := pb.processDMLTable(exprs) if err != nil { return nil, err ...
go
func buildInsertPlan(ins *sqlparser.Insert, vschema ContextVSchema) (*engine.Insert, error) { pb := newPrimitiveBuilder(vschema, newJointab(sqlparser.GetBindvars(ins))) exprs := sqlparser.TableExprs{&sqlparser.AliasedTableExpr{Expr: ins.Table}} ro, err := pb.processDMLTable(exprs) if err != nil { return nil, err ...
[ "func", "buildInsertPlan", "(", "ins", "*", "sqlparser", ".", "Insert", ",", "vschema", "ContextVSchema", ")", "(", "*", "engine", ".", "Insert", ",", "error", ")", "{", "pb", ":=", "newPrimitiveBuilder", "(", "vschema", ",", "newJointab", "(", "sqlparser", ...
// buildInsertPlan builds the route for an INSERT statement.
[ "buildInsertPlan", "builds", "the", "route", "for", "an", "INSERT", "statement", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/insert.go#L32-L54
136,033
vitessio/vitess
go/vt/vtgate/planbuilder/insert.go
modifyForAutoinc
func modifyForAutoinc(ins *sqlparser.Insert, eins *engine.Insert) error { pos := findOrAddColumn(ins, eins.Table.AutoIncrement.Column) autoIncValues, err := swapBindVariables(ins.Rows.(sqlparser.Values), pos, ":"+engine.SeqVarName) if err != nil { return err } eins.Generate = &engine.Generate{ Keyspace: eins.T...
go
func modifyForAutoinc(ins *sqlparser.Insert, eins *engine.Insert) error { pos := findOrAddColumn(ins, eins.Table.AutoIncrement.Column) autoIncValues, err := swapBindVariables(ins.Rows.(sqlparser.Values), pos, ":"+engine.SeqVarName) if err != nil { return err } eins.Generate = &engine.Generate{ Keyspace: eins.T...
[ "func", "modifyForAutoinc", "(", "ins", "*", "sqlparser", ".", "Insert", ",", "eins", "*", "engine", ".", "Insert", ")", "error", "{", "pos", ":=", "findOrAddColumn", "(", "ins", ",", "eins", ".", "Table", ".", "AutoIncrement", ".", "Column", ")", "\n", ...
// modifyForAutoinc modfies the AST and the plan to generate // necessary autoinc values. It must be called only if eins.Table.AutoIncrement // is set.
[ "modifyForAutoinc", "modfies", "the", "AST", "and", "the", "plan", "to", "generate", "necessary", "autoinc", "values", ".", "It", "must", "be", "called", "only", "if", "eins", ".", "Table", ".", "AutoIncrement", "is", "set", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/insert.go#L192-L204
136,034
vitessio/vitess
go/vt/vtgate/planbuilder/insert.go
swapBindVariables
func swapBindVariables(rows sqlparser.Values, colNum int, baseName string) (sqltypes.PlanValue, error) { pv := sqltypes.PlanValue{} for rowNum, row := range rows { innerpv, err := sqlparser.NewPlanValue(row[colNum]) if err != nil { return pv, fmt.Errorf("could not compute value for vindex or auto-inc column: %...
go
func swapBindVariables(rows sqlparser.Values, colNum int, baseName string) (sqltypes.PlanValue, error) { pv := sqltypes.PlanValue{} for rowNum, row := range rows { innerpv, err := sqlparser.NewPlanValue(row[colNum]) if err != nil { return pv, fmt.Errorf("could not compute value for vindex or auto-inc column: %...
[ "func", "swapBindVariables", "(", "rows", "sqlparser", ".", "Values", ",", "colNum", "int", ",", "baseName", "string", ")", "(", "sqltypes", ".", "PlanValue", ",", "error", ")", "{", "pv", ":=", "sqltypes", ".", "PlanValue", "{", "}", "\n", "for", "rowNu...
// swapBindVariables swaps in bind variable names at the specified // column position in the AST values and returns the converted values back. // Bind variable names are generated using baseName.
[ "swapBindVariables", "swaps", "in", "bind", "variable", "names", "at", "the", "specified", "column", "position", "in", "the", "AST", "values", "and", "returns", "the", "converted", "values", "back", ".", "Bind", "variable", "names", "are", "generated", "using", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/insert.go#L209-L220
136,035
vitessio/vitess
go/vt/vtgate/planbuilder/insert.go
findOrAddColumn
func findOrAddColumn(ins *sqlparser.Insert, col sqlparser.ColIdent) int { for i, column := range ins.Columns { if col.Equal(column) { return i } } ins.Columns = append(ins.Columns, col) rows := ins.Rows.(sqlparser.Values) for i := range rows { rows[i] = append(rows[i], &sqlparser.NullVal{}) } return len...
go
func findOrAddColumn(ins *sqlparser.Insert, col sqlparser.ColIdent) int { for i, column := range ins.Columns { if col.Equal(column) { return i } } ins.Columns = append(ins.Columns, col) rows := ins.Rows.(sqlparser.Values) for i := range rows { rows[i] = append(rows[i], &sqlparser.NullVal{}) } return len...
[ "func", "findOrAddColumn", "(", "ins", "*", "sqlparser", ".", "Insert", ",", "col", "sqlparser", ".", "ColIdent", ")", "int", "{", "for", "i", ",", "column", ":=", "range", "ins", ".", "Columns", "{", "if", "col", ".", "Equal", "(", "column", ")", "{...
// findOrAddColumn finds the position of a column in the insert. If it's // absent it appends it to the with NULL values and returns that position.
[ "findOrAddColumn", "finds", "the", "position", "of", "a", "column", "in", "the", "insert", ".", "If", "it", "s", "absent", "it", "appends", "it", "to", "the", "with", "NULL", "values", "and", "returns", "that", "position", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/insert.go#L224-L236
136,036
vitessio/vitess
go/vt/vtgate/planbuilder/insert.go
isVindexChanging
func isVindexChanging(setClauses sqlparser.UpdateExprs, colVindexes []*vindexes.ColumnVindex) bool { for _, assignment := range setClauses { for _, vcol := range colVindexes { for _, col := range vcol.Columns { if col.Equal(assignment.Name.Name) { valueExpr, isValuesFuncExpr := assignment.Expr.(*sqlparse...
go
func isVindexChanging(setClauses sqlparser.UpdateExprs, colVindexes []*vindexes.ColumnVindex) bool { for _, assignment := range setClauses { for _, vcol := range colVindexes { for _, col := range vcol.Columns { if col.Equal(assignment.Name.Name) { valueExpr, isValuesFuncExpr := assignment.Expr.(*sqlparse...
[ "func", "isVindexChanging", "(", "setClauses", "sqlparser", ".", "UpdateExprs", ",", "colVindexes", "[", "]", "*", "vindexes", ".", "ColumnVindex", ")", "bool", "{", "for", "_", ",", "assignment", ":=", "range", "setClauses", "{", "for", "_", ",", "vcol", ...
// isVindexChanging returns true if any of the update // expressions modify a vindex column.
[ "isVindexChanging", "returns", "true", "if", "any", "of", "the", "update", "expressions", "modify", "a", "vindex", "column", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/insert.go#L240-L258
136,037
vitessio/vitess
go/vt/hook/hook.go
NewHook
func NewHook(name string, params []string) *Hook { return &Hook{Name: name, Parameters: params} }
go
func NewHook(name string, params []string) *Hook { return &Hook{Name: name, Parameters: params} }
[ "func", "NewHook", "(", "name", "string", ",", "params", "[", "]", "string", ")", "*", "Hook", "{", "return", "&", "Hook", "{", "Name", ":", "name", ",", "Parameters", ":", "params", "}", "\n", "}" ]
// NewHook returns a Hook object with the provided name and params.
[ "NewHook", "returns", "a", "Hook", "object", "with", "the", "provided", "name", "and", "params", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/hook/hook.go#L79-L81
136,038
vitessio/vitess
go/vt/hook/hook.go
NewHookWithEnv
func NewHookWithEnv(name string, params []string, env map[string]string) *Hook { return &Hook{Name: name, Parameters: params, ExtraEnv: env} }
go
func NewHookWithEnv(name string, params []string, env map[string]string) *Hook { return &Hook{Name: name, Parameters: params, ExtraEnv: env} }
[ "func", "NewHookWithEnv", "(", "name", "string", ",", "params", "[", "]", "string", ",", "env", "map", "[", "string", "]", "string", ")", "*", "Hook", "{", "return", "&", "Hook", "{", "Name", ":", "name", ",", "Parameters", ":", "params", ",", "Extra...
// NewHookWithEnv returns a Hook object with the provided name, params and ExtraEnv.
[ "NewHookWithEnv", "returns", "a", "Hook", "object", "with", "the", "provided", "name", "params", "and", "ExtraEnv", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/hook/hook.go#L89-L91
136,039
vitessio/vitess
go/vt/hook/hook.go
findHook
func (hook *Hook) findHook() (*exec.Cmd, int, error) { // Check the hook path. if strings.Contains(hook.Name, "/") { return nil, HOOK_INVALID_NAME, fmt.Errorf("hook cannot contain '/'") } // Find our root. root, err := vtenv.VtRoot() if err != nil { return nil, HOOK_VTROOT_ERROR, fmt.Errorf("cannot get VTROO...
go
func (hook *Hook) findHook() (*exec.Cmd, int, error) { // Check the hook path. if strings.Contains(hook.Name, "/") { return nil, HOOK_INVALID_NAME, fmt.Errorf("hook cannot contain '/'") } // Find our root. root, err := vtenv.VtRoot() if err != nil { return nil, HOOK_VTROOT_ERROR, fmt.Errorf("cannot get VTROO...
[ "func", "(", "hook", "*", "Hook", ")", "findHook", "(", ")", "(", "*", "exec", ".", "Cmd", ",", "int", ",", "error", ")", "{", "// Check the hook path.", "if", "strings", ".", "Contains", "(", "hook", ".", "Name", ",", "\"", "\"", ")", "{", "return...
// findHook trie to locate the hook, and returns the exec.Cmd for it.
[ "findHook", "trie", "to", "locate", "the", "hook", "and", "returns", "the", "exec", ".", "Cmd", "for", "it", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/hook/hook.go#L94-L128
136,040
vitessio/vitess
go/vt/hook/hook.go
Execute
func (hook *Hook) Execute() (result *HookResult) { result = &HookResult{} // Find the hook. cmd, status, err := hook.findHook() if err != nil { result.ExitStatus = status result.Stderr = err.Error() + "\n" return result } // Run it. var stdout, stderr bytes.Buffer cmd.Stdout = &stdout cmd.Stderr = &std...
go
func (hook *Hook) Execute() (result *HookResult) { result = &HookResult{} // Find the hook. cmd, status, err := hook.findHook() if err != nil { result.ExitStatus = status result.Stderr = err.Error() + "\n" return result } // Run it. var stdout, stderr bytes.Buffer cmd.Stdout = &stdout cmd.Stderr = &std...
[ "func", "(", "hook", "*", "Hook", ")", "Execute", "(", ")", "(", "result", "*", "HookResult", ")", "{", "result", "=", "&", "HookResult", "{", "}", "\n\n", "// Find the hook.", "cmd", ",", "status", ",", "err", ":=", "hook", ".", "findHook", "(", ")"...
// Execute tries to execute the Hook and returns a HookResult.
[ "Execute", "tries", "to", "execute", "the", "Hook", "and", "returns", "a", "HookResult", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/hook/hook.go#L131-L163
136,041
vitessio/vitess
go/vt/hook/hook.go
ExecuteOptional
func (hook *Hook) ExecuteOptional() error { hr := hook.Execute() switch hr.ExitStatus { case HOOK_DOES_NOT_EXIST: log.Infof("%v hook doesn't exist", hook.Name) case HOOK_VTROOT_ERROR: log.Infof("VTROOT not set, so %v hook doesn't exist", hook.Name) case HOOK_SUCCESS: // nothing to do here default: return ...
go
func (hook *Hook) ExecuteOptional() error { hr := hook.Execute() switch hr.ExitStatus { case HOOK_DOES_NOT_EXIST: log.Infof("%v hook doesn't exist", hook.Name) case HOOK_VTROOT_ERROR: log.Infof("VTROOT not set, so %v hook doesn't exist", hook.Name) case HOOK_SUCCESS: // nothing to do here default: return ...
[ "func", "(", "hook", "*", "Hook", ")", "ExecuteOptional", "(", ")", "error", "{", "hr", ":=", "hook", ".", "Execute", "(", ")", "\n", "switch", "hr", ".", "ExitStatus", "{", "case", "HOOK_DOES_NOT_EXIST", ":", "log", ".", "Infof", "(", "\"", "\"", ",...
// ExecuteOptional executes an optional hook, logs if it doesn't // exist, and returns a printable error.
[ "ExecuteOptional", "executes", "an", "optional", "hook", "logs", "if", "it", "doesn", "t", "exist", "and", "returns", "a", "printable", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/hook/hook.go#L167-L180
136,042
vitessio/vitess
go/vt/hook/hook.go
String
func (hr *HookResult) String() string { result := "result: " switch hr.ExitStatus { case HOOK_SUCCESS: result += "HOOK_SUCCESS" case HOOK_DOES_NOT_EXIST: result += "HOOK_DOES_NOT_EXIST" case HOOK_STAT_FAILED: result += "HOOK_STAT_FAILED" case HOOK_CANNOT_GET_EXIT_STATUS: result += "HOOK_CANNOT_GET_EXIT_ST...
go
func (hr *HookResult) String() string { result := "result: " switch hr.ExitStatus { case HOOK_SUCCESS: result += "HOOK_SUCCESS" case HOOK_DOES_NOT_EXIST: result += "HOOK_DOES_NOT_EXIST" case HOOK_STAT_FAILED: result += "HOOK_STAT_FAILED" case HOOK_CANNOT_GET_EXIT_STATUS: result += "HOOK_CANNOT_GET_EXIT_ST...
[ "func", "(", "hr", "*", "HookResult", ")", "String", "(", ")", "string", "{", "result", ":=", "\"", "\"", "\n", "switch", "hr", ".", "ExitStatus", "{", "case", "HOOK_SUCCESS", ":", "result", "+=", "\"", "\"", "\n", "case", "HOOK_DOES_NOT_EXIST", ":", "...
// String returns a printable version of the HookResult
[ "String", "returns", "a", "printable", "version", "of", "the", "HookResult" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/hook/hook.go#L261-L286
136,043
vitessio/vitess
go/vt/vttablet/tabletmanager/state_change.go
loadBlacklistRules
func (agent *ActionAgent) loadBlacklistRules(tablet *topodatapb.Tablet, blacklistedTables []string) (err error) { blacklistRules := rules.New() if len(blacklistedTables) > 0 { // tables, first resolve wildcards tables, err := mysqlctl.ResolveTables(agent.MysqlDaemon, topoproto.TabletDbName(tablet), blacklistedTab...
go
func (agent *ActionAgent) loadBlacklistRules(tablet *topodatapb.Tablet, blacklistedTables []string) (err error) { blacklistRules := rules.New() if len(blacklistedTables) > 0 { // tables, first resolve wildcards tables, err := mysqlctl.ResolveTables(agent.MysqlDaemon, topoproto.TabletDbName(tablet), blacklistedTab...
[ "func", "(", "agent", "*", "ActionAgent", ")", "loadBlacklistRules", "(", "tablet", "*", "topodatapb", ".", "Tablet", ",", "blacklistedTables", "[", "]", "string", ")", "(", "err", "error", ")", "{", "blacklistRules", ":=", "rules", ".", "New", "(", ")", ...
// loadBlacklistRules loads and builds the blacklist query rules
[ "loadBlacklistRules", "loads", "and", "builds", "the", "blacklist", "query", "rules" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/state_change.go#L60-L86
136,044
vitessio/vitess
go/vt/vttablet/tabletmanager/state_change.go
lameduck
func (agent *ActionAgent) lameduck(reason string) { log.Infof("Agent is entering lameduck, reason: %v", reason) agent.QueryServiceControl.EnterLameduck() agent.broadcastHealth() time.Sleep(*gracePeriod) log.Infof("Agent is leaving lameduck") }
go
func (agent *ActionAgent) lameduck(reason string) { log.Infof("Agent is entering lameduck, reason: %v", reason) agent.QueryServiceControl.EnterLameduck() agent.broadcastHealth() time.Sleep(*gracePeriod) log.Infof("Agent is leaving lameduck") }
[ "func", "(", "agent", "*", "ActionAgent", ")", "lameduck", "(", "reason", "string", ")", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "reason", ")", "\n", "agent", ".", "QueryServiceControl", ".", "EnterLameduck", "(", ")", "\n", "agent", ".", "broa...
// lameduck changes the QueryServiceControl state to lameduck, // brodcasts the new health, then sleep for grace period, to give time // to clients to get the new status.
[ "lameduck", "changes", "the", "QueryServiceControl", "state", "to", "lameduck", "brodcasts", "the", "new", "health", "then", "sleep", "for", "grace", "period", "to", "give", "time", "to", "clients", "to", "get", "the", "new", "status", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/state_change.go#L91-L97
136,045
vitessio/vitess
go/vt/vttablet/tabletmanager/state_change.go
refreshTablet
func (agent *ActionAgent) refreshTablet(ctx context.Context, reason string) error { agent.checkLock() log.Infof("Executing post-action state refresh: %v", reason) span, ctx := trace.NewSpan(ctx, "ActionAgent.refreshTablet") span.Annotate("reason", reason) defer span.Finish() // Actions should have side effects ...
go
func (agent *ActionAgent) refreshTablet(ctx context.Context, reason string) error { agent.checkLock() log.Infof("Executing post-action state refresh: %v", reason) span, ctx := trace.NewSpan(ctx, "ActionAgent.refreshTablet") span.Annotate("reason", reason) defer span.Finish() // Actions should have side effects ...
[ "func", "(", "agent", "*", "ActionAgent", ")", "refreshTablet", "(", "ctx", "context", ".", "Context", ",", "reason", "string", ")", "error", "{", "agent", ".", "checkLock", "(", ")", "\n", "log", ".", "Infof", "(", "\"", "\"", ",", "reason", ")", "\...
// refreshTablet needs to be run after an action may have changed the current // state of the tablet.
[ "refreshTablet", "needs", "to", "be", "run", "after", "an", "action", "may", "have", "changed", "the", "current", "state", "of", "the", "tablet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/state_change.go#L132-L160
136,046
vitessio/vitess
go/vt/vttablet/tabletmanager/state_change.go
updateState
func (agent *ActionAgent) updateState(ctx context.Context, newTablet *topodatapb.Tablet, reason string) { oldTablet := agent.Tablet() if oldTablet == nil { oldTablet = &topodatapb.Tablet{} } log.Infof("Running tablet callback because: %v", reason) agent.changeCallback(ctx, oldTablet, newTablet) agent.setTablet(...
go
func (agent *ActionAgent) updateState(ctx context.Context, newTablet *topodatapb.Tablet, reason string) { oldTablet := agent.Tablet() if oldTablet == nil { oldTablet = &topodatapb.Tablet{} } log.Infof("Running tablet callback because: %v", reason) agent.changeCallback(ctx, oldTablet, newTablet) agent.setTablet(...
[ "func", "(", "agent", "*", "ActionAgent", ")", "updateState", "(", "ctx", "context", ".", "Context", ",", "newTablet", "*", "topodatapb", ".", "Tablet", ",", "reason", "string", ")", "{", "oldTablet", ":=", "agent", ".", "Tablet", "(", ")", "\n", "if", ...
// updateState will use the provided tablet record as the new tablet state, // the current tablet as a base, run changeCallback, and dispatch the event.
[ "updateState", "will", "use", "the", "provided", "tablet", "record", "as", "the", "new", "tablet", "state", "the", "current", "tablet", "as", "a", "base", "run", "changeCallback", "and", "dispatch", "the", "event", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/state_change.go#L164-L177
136,047
vitessio/vitess
go/sqltypes/result.go
Repair
func (result *Result) Repair(fields []*querypb.Field) { // Usage of j is intentional. for j, f := range fields { for _, r := range result.Rows { if r[j].typ != Null { r[j].typ = f.Type } } } }
go
func (result *Result) Repair(fields []*querypb.Field) { // Usage of j is intentional. for j, f := range fields { for _, r := range result.Rows { if r[j].typ != Null { r[j].typ = f.Type } } } }
[ "func", "(", "result", "*", "Result", ")", "Repair", "(", "fields", "[", "]", "*", "querypb", ".", "Field", ")", "{", "// Usage of j is intentional.", "for", "j", ",", "f", ":=", "range", "fields", "{", "for", "_", ",", "r", ":=", "range", "result", ...
// Repair fixes the type info in the rows // to conform to the supplied field types.
[ "Repair", "fixes", "the", "type", "info", "in", "the", "rows", "to", "conform", "to", "the", "supplied", "field", "types", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L45-L54
136,048
vitessio/vitess
go/sqltypes/result.go
Copy
func (result *Result) Copy() *Result { out := &Result{ InsertID: result.InsertID, RowsAffected: result.RowsAffected, } if result.Fields != nil { fieldsp := make([]*querypb.Field, len(result.Fields)) fields := make([]querypb.Field, len(result.Fields)) for i, f := range result.Fields { fields[i] = *f ...
go
func (result *Result) Copy() *Result { out := &Result{ InsertID: result.InsertID, RowsAffected: result.RowsAffected, } if result.Fields != nil { fieldsp := make([]*querypb.Field, len(result.Fields)) fields := make([]querypb.Field, len(result.Fields)) for i, f := range result.Fields { fields[i] = *f ...
[ "func", "(", "result", "*", "Result", ")", "Copy", "(", ")", "*", "Result", "{", "out", ":=", "&", "Result", "{", "InsertID", ":", "result", ".", "InsertID", ",", "RowsAffected", ":", "result", ".", "RowsAffected", ",", "}", "\n", "if", "result", "."...
// Copy creates a deep copy of Result.
[ "Copy", "creates", "a", "deep", "copy", "of", "Result", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L57-L90
136,049
vitessio/vitess
go/sqltypes/result.go
CopyRow
func CopyRow(r []Value) []Value { // The raw bytes of the values are supposed to be treated as read-only. // So, there's no need to copy them. out := make([]Value, len(r)) copy(out, r) return out }
go
func CopyRow(r []Value) []Value { // The raw bytes of the values are supposed to be treated as read-only. // So, there's no need to copy them. out := make([]Value, len(r)) copy(out, r) return out }
[ "func", "CopyRow", "(", "r", "[", "]", "Value", ")", "[", "]", "Value", "{", "// The raw bytes of the values are supposed to be treated as read-only.", "// So, there's no need to copy them.", "out", ":=", "make", "(", "[", "]", "Value", ",", "len", "(", "r", ")", ...
// CopyRow makes a copy of the row.
[ "CopyRow", "makes", "a", "copy", "of", "the", "row", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L93-L99
136,050
vitessio/vitess
go/sqltypes/result.go
Truncate
func (result *Result) Truncate(l int) *Result { if l == 0 { return result } out := &Result{ InsertID: result.InsertID, RowsAffected: result.RowsAffected, } if result.Fields != nil { out.Fields = result.Fields[:l] } if result.Rows != nil { out.Rows = make([][]Value, 0, len(result.Rows)) for _, r ...
go
func (result *Result) Truncate(l int) *Result { if l == 0 { return result } out := &Result{ InsertID: result.InsertID, RowsAffected: result.RowsAffected, } if result.Fields != nil { out.Fields = result.Fields[:l] } if result.Rows != nil { out.Rows = make([][]Value, 0, len(result.Rows)) for _, r ...
[ "func", "(", "result", "*", "Result", ")", "Truncate", "(", "l", "int", ")", "*", "Result", "{", "if", "l", "==", "0", "{", "return", "result", "\n", "}", "\n\n", "out", ":=", "&", "Result", "{", "InsertID", ":", "result", ".", "InsertID", ",", "...
// Truncate returns a new Result with all the rows truncated // to the specified number of columns.
[ "Truncate", "returns", "a", "new", "Result", "with", "all", "the", "rows", "truncated", "to", "the", "specified", "number", "of", "columns", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L103-L134
136,051
vitessio/vitess
go/sqltypes/result.go
FieldsEqual
func FieldsEqual(f1, f2 []*querypb.Field) bool { if len(f1) != len(f2) { return false } for i, f := range f1 { if !proto.Equal(f, f2[i]) { return false } } return true }
go
func FieldsEqual(f1, f2 []*querypb.Field) bool { if len(f1) != len(f2) { return false } for i, f := range f1 { if !proto.Equal(f, f2[i]) { return false } } return true }
[ "func", "FieldsEqual", "(", "f1", ",", "f2", "[", "]", "*", "querypb", ".", "Field", ")", "bool", "{", "if", "len", "(", "f1", ")", "!=", "len", "(", "f2", ")", "{", "return", "false", "\n", "}", "\n", "for", "i", ",", "f", ":=", "range", "f1...
// FieldsEqual compares two arrays of fields. // reflect.DeepEqual shouldn't be used because of the protos.
[ "FieldsEqual", "compares", "two", "arrays", "of", "fields", ".", "reflect", ".", "DeepEqual", "shouldn", "t", "be", "used", "because", "of", "the", "protos", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L138-L148
136,052
vitessio/vitess
go/sqltypes/result.go
Equal
func (result *Result) Equal(other *Result) bool { // Check for nil cases if result == nil { return other == nil } if other == nil { return false } // Compare Fields, RowsAffected, InsertID, Rows, Extras. return FieldsEqual(result.Fields, other.Fields) && result.RowsAffected == other.RowsAffected && resu...
go
func (result *Result) Equal(other *Result) bool { // Check for nil cases if result == nil { return other == nil } if other == nil { return false } // Compare Fields, RowsAffected, InsertID, Rows, Extras. return FieldsEqual(result.Fields, other.Fields) && result.RowsAffected == other.RowsAffected && resu...
[ "func", "(", "result", "*", "Result", ")", "Equal", "(", "other", "*", "Result", ")", "bool", "{", "// Check for nil cases", "if", "result", "==", "nil", "{", "return", "other", "==", "nil", "\n", "}", "\n", "if", "other", "==", "nil", "{", "return", ...
// Equal compares the Result with another one. // reflect.DeepEqual shouldn't be used because of the protos.
[ "Equal", "compares", "the", "Result", "with", "another", "one", ".", "reflect", ".", "DeepEqual", "shouldn", "t", "be", "used", "because", "of", "the", "protos", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L152-L167
136,053
vitessio/vitess
go/sqltypes/result.go
ResultsEqual
func ResultsEqual(r1, r2 []Result) bool { if len(r1) != len(r2) { return false } for i, r := range r1 { if !r.Equal(&r2[i]) { return false } } return true }
go
func ResultsEqual(r1, r2 []Result) bool { if len(r1) != len(r2) { return false } for i, r := range r1 { if !r.Equal(&r2[i]) { return false } } return true }
[ "func", "ResultsEqual", "(", "r1", ",", "r2", "[", "]", "Result", ")", "bool", "{", "if", "len", "(", "r1", ")", "!=", "len", "(", "r2", ")", "{", "return", "false", "\n", "}", "\n", "for", "i", ",", "r", ":=", "range", "r1", "{", "if", "!", ...
// ResultsEqual compares two arrays of Result. // reflect.DeepEqual shouldn't be used because of the protos.
[ "ResultsEqual", "compares", "two", "arrays", "of", "Result", ".", "reflect", ".", "DeepEqual", "shouldn", "t", "be", "used", "because", "of", "the", "protos", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L171-L181
136,054
vitessio/vitess
go/sqltypes/result.go
IncludeFieldsOrDefault
func IncludeFieldsOrDefault(options *querypb.ExecuteOptions) querypb.ExecuteOptions_IncludedFields { if options == nil { return querypb.ExecuteOptions_TYPE_AND_NAME } return options.IncludedFields }
go
func IncludeFieldsOrDefault(options *querypb.ExecuteOptions) querypb.ExecuteOptions_IncludedFields { if options == nil { return querypb.ExecuteOptions_TYPE_AND_NAME } return options.IncludedFields }
[ "func", "IncludeFieldsOrDefault", "(", "options", "*", "querypb", ".", "ExecuteOptions", ")", "querypb", ".", "ExecuteOptions_IncludedFields", "{", "if", "options", "==", "nil", "{", "return", "querypb", ".", "ExecuteOptions_TYPE_AND_NAME", "\n", "}", "\n\n", "retur...
// IncludeFieldsOrDefault normalizes the passed Execution Options. // It returns the default value if options is nil.
[ "IncludeFieldsOrDefault", "normalizes", "the", "passed", "Execution", "Options", ".", "It", "returns", "the", "default", "value", "if", "options", "is", "nil", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L202-L208
136,055
vitessio/vitess
go/sqltypes/result.go
StripMetadata
func (result *Result) StripMetadata(incl querypb.ExecuteOptions_IncludedFields) *Result { if incl == querypb.ExecuteOptions_ALL || len(result.Fields) == 0 { return result } r := *result r.Fields = make([]*querypb.Field, len(result.Fields)) newFieldsArray := make([]querypb.Field, len(result.Fields)) for i, f := ...
go
func (result *Result) StripMetadata(incl querypb.ExecuteOptions_IncludedFields) *Result { if incl == querypb.ExecuteOptions_ALL || len(result.Fields) == 0 { return result } r := *result r.Fields = make([]*querypb.Field, len(result.Fields)) newFieldsArray := make([]querypb.Field, len(result.Fields)) for i, f := ...
[ "func", "(", "result", "*", "Result", ")", "StripMetadata", "(", "incl", "querypb", ".", "ExecuteOptions_IncludedFields", ")", "*", "Result", "{", "if", "incl", "==", "querypb", ".", "ExecuteOptions_ALL", "||", "len", "(", "result", ".", "Fields", ")", "==",...
// StripMetadata will return a new Result that has the same Rows, // but the Field objects will have their non-critical metadata emptied. Note we don't // proto.Copy each Field for performance reasons, but we only copy the // individual fields.
[ "StripMetadata", "will", "return", "a", "new", "Result", "that", "has", "the", "same", "Rows", "but", "the", "Field", "objects", "will", "have", "their", "non", "-", "critical", "metadata", "emptied", ".", "Note", "we", "don", "t", "proto", ".", "Copy", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L214-L229
136,056
vitessio/vitess
go/sqltypes/result.go
AppendResult
func (result *Result) AppendResult(src *Result) { if src.RowsAffected == 0 && len(src.Fields) == 0 { return } if result.Fields == nil { result.Fields = src.Fields } result.RowsAffected += src.RowsAffected if src.InsertID != 0 { result.InsertID = src.InsertID } if len(result.Rows) == 0 { // we haven't go...
go
func (result *Result) AppendResult(src *Result) { if src.RowsAffected == 0 && len(src.Fields) == 0 { return } if result.Fields == nil { result.Fields = src.Fields } result.RowsAffected += src.RowsAffected if src.InsertID != 0 { result.InsertID = src.InsertID } if len(result.Rows) == 0 { // we haven't go...
[ "func", "(", "result", "*", "Result", ")", "AppendResult", "(", "src", "*", "Result", ")", "{", "if", "src", ".", "RowsAffected", "==", "0", "&&", "len", "(", "src", ".", "Fields", ")", "==", "0", "{", "return", "\n", "}", "\n", "if", "result", "...
// AppendResult will combine the Results Objects of one result // to another result.Note currently it doesn't handle cases like // if two results have different fields.We will enhance this function.
[ "AppendResult", "will", "combine", "the", "Results", "Objects", "of", "one", "result", "to", "another", "result", ".", "Note", "currently", "it", "doesn", "t", "handle", "cases", "like", "if", "two", "results", "have", "different", "fields", ".", "We", "will...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/result.go#L234-L271
136,057
vitessio/vitess
go/vt/topo/replication.go
NewShardReplicationInfo
func NewShardReplicationInfo(sr *topodatapb.ShardReplication, cell, keyspace, shard string) *ShardReplicationInfo { return &ShardReplicationInfo{ ShardReplication: sr, cell: cell, keyspace: keyspace, shard: shard, } }
go
func NewShardReplicationInfo(sr *topodatapb.ShardReplication, cell, keyspace, shard string) *ShardReplicationInfo { return &ShardReplicationInfo{ ShardReplication: sr, cell: cell, keyspace: keyspace, shard: shard, } }
[ "func", "NewShardReplicationInfo", "(", "sr", "*", "topodatapb", ".", "ShardReplication", ",", "cell", ",", "keyspace", ",", "shard", "string", ")", "*", "ShardReplicationInfo", "{", "return", "&", "ShardReplicationInfo", "{", "ShardReplication", ":", "sr", ",", ...
// NewShardReplicationInfo is for topo.Server implementations to // create the structure
[ "NewShardReplicationInfo", "is", "for", "topo", ".", "Server", "implementations", "to", "create", "the", "structure" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/replication.go#L44-L51
136,058
vitessio/vitess
go/vt/topo/replication.go
GetShardReplicationNode
func (sri *ShardReplicationInfo) GetShardReplicationNode(tabletAlias *topodatapb.TabletAlias) (*topodatapb.ShardReplication_Node, error) { for _, rl := range sri.Nodes { if proto.Equal(rl.TabletAlias, tabletAlias) { return rl, nil } } return nil, NewError(NoNode, tabletAlias.String()) }
go
func (sri *ShardReplicationInfo) GetShardReplicationNode(tabletAlias *topodatapb.TabletAlias) (*topodatapb.ShardReplication_Node, error) { for _, rl := range sri.Nodes { if proto.Equal(rl.TabletAlias, tabletAlias) { return rl, nil } } return nil, NewError(NoNode, tabletAlias.String()) }
[ "func", "(", "sri", "*", "ShardReplicationInfo", ")", "GetShardReplicationNode", "(", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ")", "(", "*", "topodatapb", ".", "ShardReplication_Node", ",", "error", ")", "{", "for", "_", ",", "rl", ":=", "range",...
// GetShardReplicationNode finds a node for a given tablet.
[ "GetShardReplicationNode", "finds", "a", "node", "for", "a", "given", "tablet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/replication.go#L69-L76
136,059
vitessio/vitess
go/vt/topo/replication.go
RemoveShardReplicationRecord
func RemoveShardReplicationRecord(ctx context.Context, ts *Server, cell, keyspace, shard string, tabletAlias *topodatapb.TabletAlias) error { err := ts.UpdateShardReplicationFields(ctx, cell, keyspace, shard, func(sr *topodatapb.ShardReplication) error { nodes := make([]*topodatapb.ShardReplication_Node, 0, len(sr.N...
go
func RemoveShardReplicationRecord(ctx context.Context, ts *Server, cell, keyspace, shard string, tabletAlias *topodatapb.TabletAlias) error { err := ts.UpdateShardReplicationFields(ctx, cell, keyspace, shard, func(sr *topodatapb.ShardReplication) error { nodes := make([]*topodatapb.ShardReplication_Node, 0, len(sr.N...
[ "func", "RemoveShardReplicationRecord", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "Server", ",", "cell", ",", "keyspace", ",", "shard", "string", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ")", "error", "{", "err", ":=", "ts", ...
// RemoveShardReplicationRecord is a low level function to remove an // entry from the ShardReplication object.
[ "RemoveShardReplicationRecord", "is", "a", "low", "level", "function", "to", "remove", "an", "entry", "from", "the", "ShardReplication", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/replication.go#L118-L130
136,060
vitessio/vitess
go/vt/topo/replication.go
FixShardReplication
func FixShardReplication(ctx context.Context, ts *Server, logger logutil.Logger, cell, keyspace, shard string) error { sri, err := ts.GetShardReplication(ctx, cell, keyspace, shard) if err != nil { return err } for _, node := range sri.Nodes { ti, err := ts.GetTablet(ctx, node.TabletAlias) if IsErrType(err, ...
go
func FixShardReplication(ctx context.Context, ts *Server, logger logutil.Logger, cell, keyspace, shard string) error { sri, err := ts.GetShardReplication(ctx, cell, keyspace, shard) if err != nil { return err } for _, node := range sri.Nodes { ti, err := ts.GetTablet(ctx, node.TabletAlias) if IsErrType(err, ...
[ "func", "FixShardReplication", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "Server", ",", "logger", "logutil", ".", "Logger", ",", "cell", ",", "keyspace", ",", "shard", "string", ")", "error", "{", "sri", ",", "err", ":=", "ts", ".", "GetSh...
// FixShardReplication will fix the first problem it encounters within // a ShardReplication object.
[ "FixShardReplication", "will", "fix", "the", "first", "problem", "it", "encounters", "within", "a", "ShardReplication", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/replication.go#L134-L161
136,061
vitessio/vitess
go/vt/topo/replication.go
UpdateShardReplicationFields
func (ts *Server) UpdateShardReplicationFields(ctx context.Context, cell, keyspace, shard string, update func(*topodatapb.ShardReplication) error) error { nodePath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardReplicationFile) conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } ...
go
func (ts *Server) UpdateShardReplicationFields(ctx context.Context, cell, keyspace, shard string, update func(*topodatapb.ShardReplication) error) error { nodePath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardReplicationFile) conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } ...
[ "func", "(", "ts", "*", "Server", ")", "UpdateShardReplicationFields", "(", "ctx", "context", ".", "Context", ",", "cell", ",", "keyspace", ",", "shard", "string", ",", "update", "func", "(", "*", "topodatapb", ".", "ShardReplication", ")", "error", ")", "...
// UpdateShardReplicationFields updates the fields inside a topo.ShardReplication object.
[ "UpdateShardReplicationFields", "updates", "the", "fields", "inside", "a", "topo", ".", "ShardReplication", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/replication.go#L164-L221
136,062
vitessio/vitess
go/vt/topo/replication.go
GetShardReplication
func (ts *Server) GetShardReplication(ctx context.Context, cell, keyspace, shard string) (*ShardReplicationInfo, error) { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return nil, err } nodePath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardReplicationFile) data, _, err := conn.Get(ctx,...
go
func (ts *Server) GetShardReplication(ctx context.Context, cell, keyspace, shard string) (*ShardReplicationInfo, error) { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return nil, err } nodePath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardReplicationFile) data, _, err := conn.Get(ctx,...
[ "func", "(", "ts", "*", "Server", ")", "GetShardReplication", "(", "ctx", "context", ".", "Context", ",", "cell", ",", "keyspace", ",", "shard", "string", ")", "(", "*", "ShardReplicationInfo", ",", "error", ")", "{", "conn", ",", "err", ":=", "ts", "....
// GetShardReplication returns the ShardReplicationInfo object.
[ "GetShardReplication", "returns", "the", "ShardReplicationInfo", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/replication.go#L224-L242
136,063
vitessio/vitess
go/vt/topo/replication.go
DeleteShardReplication
func (ts *Server) DeleteShardReplication(ctx context.Context, cell, keyspace, shard string) error { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } nodePath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardReplicationFile) return conn.Delete(ctx, nodePath, nil) }
go
func (ts *Server) DeleteShardReplication(ctx context.Context, cell, keyspace, shard string) error { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } nodePath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardReplicationFile) return conn.Delete(ctx, nodePath, nil) }
[ "func", "(", "ts", "*", "Server", ")", "DeleteShardReplication", "(", "ctx", "context", ".", "Context", ",", "cell", ",", "keyspace", ",", "shard", "string", ")", "error", "{", "conn", ",", "err", ":=", "ts", ".", "ConnForCell", "(", "ctx", ",", "cell"...
// DeleteShardReplication deletes a ShardReplication object.
[ "DeleteShardReplication", "deletes", "a", "ShardReplication", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/replication.go#L245-L253
136,064
vitessio/vitess
go/vt/topo/workflow.go
CreateWorkflow
func (ts *Server) CreateWorkflow(ctx context.Context, w *workflowpb.Workflow) (*WorkflowInfo, error) { // Pack the content. contents, err := proto.Marshal(w) if err != nil { return nil, err } // Save it. filePath := pathForWorkflow(w.Uuid) version, err := ts.globalCell.Create(ctx, filePath, contents) if err ...
go
func (ts *Server) CreateWorkflow(ctx context.Context, w *workflowpb.Workflow) (*WorkflowInfo, error) { // Pack the content. contents, err := proto.Marshal(w) if err != nil { return nil, err } // Save it. filePath := pathForWorkflow(w.Uuid) version, err := ts.globalCell.Create(ctx, filePath, contents) if err ...
[ "func", "(", "ts", "*", "Server", ")", "CreateWorkflow", "(", "ctx", "context", ".", "Context", ",", "w", "*", "workflowpb", ".", "Workflow", ")", "(", "*", "WorkflowInfo", ",", "error", ")", "{", "// Pack the content.", "contents", ",", "err", ":=", "pr...
// CreateWorkflow creates the given workflow, and returns the initial // WorkflowInfo.
[ "CreateWorkflow", "creates", "the", "given", "workflow", "and", "returns", "the", "initial", "WorkflowInfo", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/workflow.go#L62-L79
136,065
vitessio/vitess
go/vt/topo/workflow.go
GetWorkflow
func (ts *Server) GetWorkflow(ctx context.Context, uuid string) (*WorkflowInfo, error) { // Read the file. filePath := pathForWorkflow(uuid) contents, version, err := ts.globalCell.Get(ctx, filePath) if err != nil { return nil, err } // Unpack the contents. w := &workflowpb.Workflow{} if err := proto.Unmarsh...
go
func (ts *Server) GetWorkflow(ctx context.Context, uuid string) (*WorkflowInfo, error) { // Read the file. filePath := pathForWorkflow(uuid) contents, version, err := ts.globalCell.Get(ctx, filePath) if err != nil { return nil, err } // Unpack the contents. w := &workflowpb.Workflow{} if err := proto.Unmarsh...
[ "func", "(", "ts", "*", "Server", ")", "GetWorkflow", "(", "ctx", "context", ".", "Context", ",", "uuid", "string", ")", "(", "*", "WorkflowInfo", ",", "error", ")", "{", "// Read the file.", "filePath", ":=", "pathForWorkflow", "(", "uuid", ")", "\n", "...
// GetWorkflow reads a workflow from the global cell.
[ "GetWorkflow", "reads", "a", "workflow", "from", "the", "global", "cell", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/workflow.go#L82-L100
136,066
vitessio/vitess
go/vt/topo/workflow.go
SaveWorkflow
func (ts *Server) SaveWorkflow(ctx context.Context, wi *WorkflowInfo) error { // Pack the content. contents, err := proto.Marshal(wi.Workflow) if err != nil { return err } // Save it. filePath := pathForWorkflow(wi.Uuid) version, err := ts.globalCell.Update(ctx, filePath, contents, wi.version) if err != nil ...
go
func (ts *Server) SaveWorkflow(ctx context.Context, wi *WorkflowInfo) error { // Pack the content. contents, err := proto.Marshal(wi.Workflow) if err != nil { return err } // Save it. filePath := pathForWorkflow(wi.Uuid) version, err := ts.globalCell.Update(ctx, filePath, contents, wi.version) if err != nil ...
[ "func", "(", "ts", "*", "Server", ")", "SaveWorkflow", "(", "ctx", "context", ".", "Context", ",", "wi", "*", "WorkflowInfo", ")", "error", "{", "// Pack the content.", "contents", ",", "err", ":=", "proto", ".", "Marshal", "(", "wi", ".", "Workflow", ")...
// SaveWorkflow saves the WorkflowInfo object. If the version is not // good any more, ErrBadVersion is returned.
[ "SaveWorkflow", "saves", "the", "WorkflowInfo", "object", ".", "If", "the", "version", "is", "not", "good", "any", "more", "ErrBadVersion", "is", "returned", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/workflow.go#L104-L121
136,067
vitessio/vitess
go/vt/topo/workflow.go
DeleteWorkflow
func (ts *Server) DeleteWorkflow(ctx context.Context, wi *WorkflowInfo) error { filePath := pathForWorkflow(wi.Uuid) return ts.globalCell.Delete(ctx, filePath, wi.version) }
go
func (ts *Server) DeleteWorkflow(ctx context.Context, wi *WorkflowInfo) error { filePath := pathForWorkflow(wi.Uuid) return ts.globalCell.Delete(ctx, filePath, wi.version) }
[ "func", "(", "ts", "*", "Server", ")", "DeleteWorkflow", "(", "ctx", "context", ".", "Context", ",", "wi", "*", "WorkflowInfo", ")", "error", "{", "filePath", ":=", "pathForWorkflow", "(", "wi", ".", "Uuid", ")", "\n", "return", "ts", ".", "globalCell", ...
// DeleteWorkflow deletes the specified workflow. After this, the // WorkflowInfo object should not be used any more.
[ "DeleteWorkflow", "deletes", "the", "specified", "workflow", ".", "After", "this", "the", "WorkflowInfo", "object", "should", "not", "be", "used", "any", "more", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/workflow.go#L125-L128
136,068
vitessio/vitess
go/vt/vtcombo/tablet_map.go
CreateTablet
func CreateTablet(ctx context.Context, ts *topo.Server, cell string, uid uint32, keyspace, shard, dbname string, tabletType topodatapb.TabletType, mysqld mysqlctl.MysqlDaemon, dbcfgs *dbconfigs.DBConfigs) error { alias := &topodatapb.TabletAlias{ Cell: cell, Uid: uid, } log.Infof("Creating %v tablet %v for %v/%...
go
func CreateTablet(ctx context.Context, ts *topo.Server, cell string, uid uint32, keyspace, shard, dbname string, tabletType topodatapb.TabletType, mysqld mysqlctl.MysqlDaemon, dbcfgs *dbconfigs.DBConfigs) error { alias := &topodatapb.TabletAlias{ Cell: cell, Uid: uid, } log.Infof("Creating %v tablet %v for %v/%...
[ "func", "CreateTablet", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "topo", ".", "Server", ",", "cell", "string", ",", "uid", "uint32", ",", "keyspace", ",", "shard", ",", "dbname", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ...
// CreateTablet creates an individual tablet, with its agent, and adds // it to the map. If it's a master tablet, it also issues a TER.
[ "CreateTablet", "creates", "an", "individual", "tablet", "with", "its", "agent", "and", "adds", "it", "to", "the", "map", ".", "If", "it", "s", "a", "master", "tablet", "it", "also", "issues", "a", "TER", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L77-L106
136,069
vitessio/vitess
go/vt/vtcombo/tablet_map.go
dialer
func dialer(tablet *topodatapb.Tablet, failFast grpcclient.FailFast) (queryservice.QueryService, error) { t, ok := tabletMap[tablet.Alias.Uid] if !ok { return nil, vterrors.New(vtrpcpb.Code_UNAVAILABLE, "connection refused") } return &internalTabletConn{ tablet: t, topoTablet: tablet, }, nil }
go
func dialer(tablet *topodatapb.Tablet, failFast grpcclient.FailFast) (queryservice.QueryService, error) { t, ok := tabletMap[tablet.Alias.Uid] if !ok { return nil, vterrors.New(vtrpcpb.Code_UNAVAILABLE, "connection refused") } return &internalTabletConn{ tablet: t, topoTablet: tablet, }, nil }
[ "func", "dialer", "(", "tablet", "*", "topodatapb", ".", "Tablet", ",", "failFast", "grpcclient", ".", "FailFast", ")", "(", "queryservice", ".", "QueryService", ",", "error", ")", "{", "t", ",", "ok", ":=", "tabletMap", "[", "tablet", ".", "Alias", ".",...
// // TabletConn implementation // // dialer is our tabletconn.Dialer
[ "TabletConn", "implementation", "dialer", "is", "our", "tabletconn", ".", "Dialer" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L274-L284
136,070
vitessio/vitess
go/vt/vtcombo/tablet_map.go
Execute
func (itc *internalTabletConn) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]*querypb.BindVariable, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) { bindVars = sqltypes.CopyBindVariables(bindVars) reply, err := itc.tablet.qsc.QueryService().Exe...
go
func (itc *internalTabletConn) Execute(ctx context.Context, target *querypb.Target, query string, bindVars map[string]*querypb.BindVariable, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error) { bindVars = sqltypes.CopyBindVariables(bindVars) reply, err := itc.tablet.qsc.QueryService().Exe...
[ "func", "(", "itc", "*", "internalTabletConn", ")", "Execute", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "query", "string", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", "...
// Execute is part of queryservice.QueryService // We need to copy the bind variables as tablet server will change them.
[ "Execute", "is", "part", "of", "queryservice", ".", "QueryService", "We", "need", "to", "copy", "the", "bind", "variables", "as", "tablet", "server", "will", "change", "them", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L295-L302
136,071
vitessio/vitess
go/vt/vtcombo/tablet_map.go
ExecuteBatch
func (itc *internalTabletConn) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []*querypb.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) { q := make([]*querypb.BoundQuery, len(queries)) for i, query := range queries { q[i] = &queryp...
go
func (itc *internalTabletConn) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []*querypb.BoundQuery, asTransaction bool, transactionID int64, options *querypb.ExecuteOptions) ([]sqltypes.Result, error) { q := make([]*querypb.BoundQuery, len(queries)) for i, query := range queries { q[i] = &queryp...
[ "func", "(", "itc", "*", "internalTabletConn", ")", "ExecuteBatch", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "queries", "[", "]", "*", "querypb", ".", "BoundQuery", ",", "asTransaction", "bool", ",", "transa...
// ExecuteBatch is part of queryservice.QueryService // We need to copy the bind variables as tablet server will change them.
[ "ExecuteBatch", "is", "part", "of", "queryservice", ".", "QueryService", "We", "need", "to", "copy", "the", "bind", "variables", "as", "tablet", "server", "will", "change", "them", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L306-L319
136,072
vitessio/vitess
go/vt/vtcombo/tablet_map.go
Begin
func (itc *internalTabletConn) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (int64, error) { transactionID, err := itc.tablet.qsc.QueryService().Begin(ctx, target, options) if err != nil { return 0, tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) } return transactionID, nil }
go
func (itc *internalTabletConn) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (int64, error) { transactionID, err := itc.tablet.qsc.QueryService().Begin(ctx, target, options) if err != nil { return 0, tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) } return transactionID, nil }
[ "func", "(", "itc", "*", "internalTabletConn", ")", "Begin", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "options", "*", "querypb", ".", "ExecuteOptions", ")", "(", "int64", ",", "error", ")", "{", "transacti...
// Begin is part of queryservice.QueryService
[ "Begin", "is", "part", "of", "queryservice", ".", "QueryService" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L330-L336
136,073
vitessio/vitess
go/vt/vtcombo/tablet_map.go
Commit
func (itc *internalTabletConn) Commit(ctx context.Context, target *querypb.Target, transactionID int64) error { err := itc.tablet.qsc.QueryService().Commit(ctx, target, transactionID) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
go
func (itc *internalTabletConn) Commit(ctx context.Context, target *querypb.Target, transactionID int64) error { err := itc.tablet.qsc.QueryService().Commit(ctx, target, transactionID) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
[ "func", "(", "itc", "*", "internalTabletConn", ")", "Commit", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "transactionID", "int64", ")", "error", "{", "err", ":=", "itc", ".", "tablet", ".", "qsc", ".", "Qu...
// Commit is part of queryservice.QueryService
[ "Commit", "is", "part", "of", "queryservice", ".", "QueryService" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L339-L342
136,074
vitessio/vitess
go/vt/vtcombo/tablet_map.go
BeginExecuteBatch
func (itc *internalTabletConn) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []*querypb.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error) { transactionID, err := itc.Begin(ctx, target, options) if err != nil { return nil, 0, err } results, ...
go
func (itc *internalTabletConn) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []*querypb.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error) { transactionID, err := itc.Begin(ctx, target, options) if err != nil { return nil, 0, err } results, ...
[ "func", "(", "itc", "*", "internalTabletConn", ")", "BeginExecuteBatch", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "queries", "[", "]", "*", "querypb", ".", "BoundQuery", ",", "asTransaction", "bool", ",", "o...
// BeginExecuteBatch is part of queryservice.QueryService
[ "BeginExecuteBatch", "is", "part", "of", "queryservice", ".", "QueryService" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L409-L416
136,075
vitessio/vitess
go/vt/vtcombo/tablet_map.go
MessageStream
func (itc *internalTabletConn) MessageStream(ctx context.Context, target *querypb.Target, name string, callback func(*sqltypes.Result) error) error { err := itc.tablet.qsc.QueryService().MessageStream(ctx, target, name, callback) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
go
func (itc *internalTabletConn) MessageStream(ctx context.Context, target *querypb.Target, name string, callback func(*sqltypes.Result) error) error { err := itc.tablet.qsc.QueryService().MessageStream(ctx, target, name, callback) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
[ "func", "(", "itc", "*", "internalTabletConn", ")", "MessageStream", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "name", "string", ",", "callback", "func", "(", "*", "sqltypes", ".", "Result", ")", "error", "...
// MessageStream is part of queryservice.QueryService
[ "MessageStream", "is", "part", "of", "queryservice", ".", "QueryService" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L419-L422
136,076
vitessio/vitess
go/vt/vtcombo/tablet_map.go
MessageAck
func (itc *internalTabletConn) MessageAck(ctx context.Context, target *querypb.Target, name string, ids []*querypb.Value) (int64, error) { count, err := itc.tablet.qsc.QueryService().MessageAck(ctx, target, name, ids) return count, tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
go
func (itc *internalTabletConn) MessageAck(ctx context.Context, target *querypb.Target, name string, ids []*querypb.Value) (int64, error) { count, err := itc.tablet.qsc.QueryService().MessageAck(ctx, target, name, ids) return count, tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
[ "func", "(", "itc", "*", "internalTabletConn", ")", "MessageAck", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "name", "string", ",", "ids", "[", "]", "*", "querypb", ".", "Value", ")", "(", "int64", ",", ...
// MessageAck is part of queryservice.QueryService
[ "MessageAck", "is", "part", "of", "queryservice", ".", "QueryService" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L425-L428
136,077
vitessio/vitess
go/vt/vtcombo/tablet_map.go
SplitQuery
func (itc *internalTabletConn) SplitQuery( ctx context.Context, target *querypb.Target, query *querypb.BoundQuery, splitColumns []string, splitCount int64, numRowsPerQueryPart int64, algorithm querypb.SplitQueryRequest_Algorithm) ([]*querypb.QuerySplit, error) { splits, err := itc.tablet.qsc.QueryService().Spl...
go
func (itc *internalTabletConn) SplitQuery( ctx context.Context, target *querypb.Target, query *querypb.BoundQuery, splitColumns []string, splitCount int64, numRowsPerQueryPart int64, algorithm querypb.SplitQueryRequest_Algorithm) ([]*querypb.QuerySplit, error) { splits, err := itc.tablet.qsc.QueryService().Spl...
[ "func", "(", "itc", "*", "internalTabletConn", ")", "SplitQuery", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "query", "*", "querypb", ".", "BoundQuery", ",", "splitColumns", "[", "]", "string", ",", "splitCoun...
// SplitQuery is part of queryservice.QueryService
[ "SplitQuery", "is", "part", "of", "queryservice", ".", "QueryService" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L445-L466
136,078
vitessio/vitess
go/vt/vtcombo/tablet_map.go
StreamHealth
func (itc *internalTabletConn) StreamHealth(ctx context.Context, callback func(*querypb.StreamHealthResponse) error) error { err := itc.tablet.qsc.QueryService().StreamHealth(ctx, callback) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
go
func (itc *internalTabletConn) StreamHealth(ctx context.Context, callback func(*querypb.StreamHealthResponse) error) error { err := itc.tablet.qsc.QueryService().StreamHealth(ctx, callback) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
[ "func", "(", "itc", "*", "internalTabletConn", ")", "StreamHealth", "(", "ctx", "context", ".", "Context", ",", "callback", "func", "(", "*", "querypb", ".", "StreamHealthResponse", ")", "error", ")", "error", "{", "err", ":=", "itc", ".", "tablet", ".", ...
// StreamHealth is part of queryservice.QueryService
[ "StreamHealth", "is", "part", "of", "queryservice", ".", "QueryService" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L469-L472
136,079
vitessio/vitess
go/vt/vtcombo/tablet_map.go
UpdateStream
func (itc *internalTabletConn) UpdateStream(ctx context.Context, target *querypb.Target, position string, timestamp int64, callback func(*querypb.StreamEvent) error) error { err := itc.tablet.qsc.QueryService().UpdateStream(ctx, target, position, timestamp, callback) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(er...
go
func (itc *internalTabletConn) UpdateStream(ctx context.Context, target *querypb.Target, position string, timestamp int64, callback func(*querypb.StreamEvent) error) error { err := itc.tablet.qsc.QueryService().UpdateStream(ctx, target, position, timestamp, callback) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(er...
[ "func", "(", "itc", "*", "internalTabletConn", ")", "UpdateStream", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "position", "string", ",", "timestamp", "int64", ",", "callback", "func", "(", "*", "querypb", "."...
// UpdateStream is part of queryservice.QueryService.
[ "UpdateStream", "is", "part", "of", "queryservice", ".", "QueryService", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L475-L478
136,080
vitessio/vitess
go/vt/vtcombo/tablet_map.go
VStream
func (itc *internalTabletConn) VStream(ctx context.Context, target *querypb.Target, startPos string, filter *binlogdatapb.Filter, send func([]*binlogdatapb.VEvent) error) error { err := itc.tablet.qsc.QueryService().VStream(ctx, target, startPos, filter, send) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
go
func (itc *internalTabletConn) VStream(ctx context.Context, target *querypb.Target, startPos string, filter *binlogdatapb.Filter, send func([]*binlogdatapb.VEvent) error) error { err := itc.tablet.qsc.QueryService().VStream(ctx, target, startPos, filter, send) return tabletconn.ErrorFromGRPC(vterrors.ToGRPC(err)) }
[ "func", "(", "itc", "*", "internalTabletConn", ")", "VStream", "(", "ctx", "context", ".", "Context", ",", "target", "*", "querypb", ".", "Target", ",", "startPos", "string", ",", "filter", "*", "binlogdatapb", ".", "Filter", ",", "send", "func", "(", "[...
// VStream is part of queryservice.QueryService.
[ "VStream", "is", "part", "of", "queryservice", ".", "QueryService", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtcombo/tablet_map.go#L481-L484
136,081
vitessio/vitess
go/vt/mysqlctl/schema.go
executeSchemaCommands
func (mysqld *Mysqld) executeSchemaCommands(sql string) error { params, err := dbconfigs.WithCredentials(mysqld.dbcfgs.Dba()) if err != nil { return err } return mysqld.executeMysqlScript(params, strings.NewReader(sql)) }
go
func (mysqld *Mysqld) executeSchemaCommands(sql string) error { params, err := dbconfigs.WithCredentials(mysqld.dbcfgs.Dba()) if err != nil { return err } return mysqld.executeMysqlScript(params, strings.NewReader(sql)) }
[ "func", "(", "mysqld", "*", "Mysqld", ")", "executeSchemaCommands", "(", "sql", "string", ")", "error", "{", "params", ",", "err", ":=", "dbconfigs", ".", "WithCredentials", "(", "mysqld", ".", "dbcfgs", ".", "Dba", "(", ")", ")", "\n", "if", "err", "!...
// executeSchemaCommands executes some SQL commands, using the mysql // command line tool. It uses the dba connection parameters, with credentials.
[ "executeSchemaCommands", "executes", "some", "SQL", "commands", "using", "the", "mysql", "command", "line", "tool", ".", "It", "uses", "the", "dba", "connection", "parameters", "with", "credentials", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/schema.go#L39-L46
136,082
vitessio/vitess
go/vt/mysqlctl/schema.go
ResolveTables
func ResolveTables(mysqld MysqlDaemon, dbName string, tables []string) ([]string, error) { sd, err := mysqld.GetSchema(dbName, tables, nil, true) if err != nil { return nil, err } result := make([]string, len(sd.TableDefinitions)) for i, td := range sd.TableDefinitions { result[i] = td.Name } return result, ...
go
func ResolveTables(mysqld MysqlDaemon, dbName string, tables []string) ([]string, error) { sd, err := mysqld.GetSchema(dbName, tables, nil, true) if err != nil { return nil, err } result := make([]string, len(sd.TableDefinitions)) for i, td := range sd.TableDefinitions { result[i] = td.Name } return result, ...
[ "func", "ResolveTables", "(", "mysqld", "MysqlDaemon", ",", "dbName", "string", ",", "tables", "[", "]", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "sd", ",", "err", ":=", "mysqld", ".", "GetSchema", "(", "dbName", ",", "tables", ...
// ResolveTables returns a list of actual tables+views matching a list // of regexps
[ "ResolveTables", "returns", "a", "list", "of", "actual", "tables", "+", "views", "matching", "a", "list", "of", "regexps" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/schema.go#L149-L159
136,083
vitessio/vitess
go/vt/mysqlctl/schema.go
GetColumns
func (mysqld *Mysqld) GetColumns(dbName, table string) ([]string, error) { conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool) if err != nil { return nil, err } defer conn.Recycle() qr, err := conn.ExecuteFetch(fmt.Sprintf("SELECT * FROM %s.%s WHERE 1=0", sqlescape.EscapeID(dbName), sqlescape.EscapeID(...
go
func (mysqld *Mysqld) GetColumns(dbName, table string) ([]string, error) { conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool) if err != nil { return nil, err } defer conn.Recycle() qr, err := conn.ExecuteFetch(fmt.Sprintf("SELECT * FROM %s.%s WHERE 1=0", sqlescape.EscapeID(dbName), sqlescape.EscapeID(...
[ "func", "(", "mysqld", "*", "Mysqld", ")", "GetColumns", "(", "dbName", ",", "table", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "conn", ",", "err", ":=", "getPoolReconnect", "(", "context", ".", "TODO", "(", ")", ",", "mysqld", ...
// GetColumns returns the columns of table.
[ "GetColumns", "returns", "the", "columns", "of", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/schema.go#L162-L178
136,084
vitessio/vitess
go/vt/mysqlctl/schema.go
GetPrimaryKeyColumns
func (mysqld *Mysqld) GetPrimaryKeyColumns(dbName, table string) ([]string, error) { conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool) if err != nil { return nil, err } defer conn.Recycle() qr, err := conn.ExecuteFetch(fmt.Sprintf("SHOW INDEX FROM %s.%s", sqlescape.EscapeID(dbName), sqlescape.EscapeI...
go
func (mysqld *Mysqld) GetPrimaryKeyColumns(dbName, table string) ([]string, error) { conn, err := getPoolReconnect(context.TODO(), mysqld.dbaPool) if err != nil { return nil, err } defer conn.Recycle() qr, err := conn.ExecuteFetch(fmt.Sprintf("SHOW INDEX FROM %s.%s", sqlescape.EscapeID(dbName), sqlescape.EscapeI...
[ "func", "(", "mysqld", "*", "Mysqld", ")", "GetPrimaryKeyColumns", "(", "dbName", ",", "table", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "conn", ",", "err", ":=", "getPoolReconnect", "(", "context", ".", "TODO", "(", ")", ",", ...
// GetPrimaryKeyColumns returns the primary key columns of table.
[ "GetPrimaryKeyColumns", "returns", "the", "primary", "key", "columns", "of", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/schema.go#L181-L229
136,085
vitessio/vitess
go/vt/mysqlctl/schema.go
PreflightSchemaChange
func (mysqld *Mysqld) PreflightSchemaChange(dbName string, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) { results := make([]*tabletmanagerdatapb.SchemaChangeResult, len(changes)) // Get current schema from the real database. originalSchema, err := mysqld.GetSchema(dbName, nil, nil, true) if...
go
func (mysqld *Mysqld) PreflightSchemaChange(dbName string, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) { results := make([]*tabletmanagerdatapb.SchemaChangeResult, len(changes)) // Get current schema from the real database. originalSchema, err := mysqld.GetSchema(dbName, nil, nil, true) if...
[ "func", "(", "mysqld", "*", "Mysqld", ")", "PreflightSchemaChange", "(", "dbName", "string", ",", "changes", "[", "]", "string", ")", "(", "[", "]", "*", "tabletmanagerdatapb", ".", "SchemaChangeResult", ",", "error", ")", "{", "results", ":=", "make", "("...
// PreflightSchemaChange checks the schema changes in "changes" by applying them // to an intermediate database that has the same schema as the target database.
[ "PreflightSchemaChange", "checks", "the", "schema", "changes", "in", "changes", "by", "applying", "them", "to", "an", "intermediate", "database", "that", "has", "the", "same", "schema", "as", "the", "target", "database", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/schema.go#L233-L296
136,086
vitessio/vitess
go/vt/mysqlctl/schema.go
ApplySchemaChange
func (mysqld *Mysqld) ApplySchemaChange(dbName string, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error) { // check current schema matches beforeSchema, err := mysqld.GetSchema(dbName, nil, nil, true) if err != nil { return nil, err } if change.BeforeSchema != nil { schemaDiffs := ...
go
func (mysqld *Mysqld) ApplySchemaChange(dbName string, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error) { // check current schema matches beforeSchema, err := mysqld.GetSchema(dbName, nil, nil, true) if err != nil { return nil, err } if change.BeforeSchema != nil { schemaDiffs := ...
[ "func", "(", "mysqld", "*", "Mysqld", ")", "ApplySchemaChange", "(", "dbName", "string", ",", "change", "*", "tmutils", ".", "SchemaChange", ")", "(", "*", "tabletmanagerdatapb", ".", "SchemaChangeResult", ",", "error", ")", "{", "// check current schema matches",...
// ApplySchemaChange will apply the schema change to the given database.
[ "ApplySchemaChange", "will", "apply", "the", "schema", "change", "to", "the", "given", "database", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/schema.go#L299-L369
136,087
vitessio/vitess
go/vt/logutil/proto3.go
ProtoToTime
func ProtoToTime(ts *logutilpb.Time) time.Time { if ts == nil { // treat nil like the empty Timestamp return time.Unix(0, 0).UTC() } return time.Unix(ts.Seconds, int64(ts.Nanoseconds)).UTC() }
go
func ProtoToTime(ts *logutilpb.Time) time.Time { if ts == nil { // treat nil like the empty Timestamp return time.Unix(0, 0).UTC() } return time.Unix(ts.Seconds, int64(ts.Nanoseconds)).UTC() }
[ "func", "ProtoToTime", "(", "ts", "*", "logutilpb", ".", "Time", ")", "time", ".", "Time", "{", "if", "ts", "==", "nil", "{", "// treat nil like the empty Timestamp", "return", "time", ".", "Unix", "(", "0", ",", "0", ")", ".", "UTC", "(", ")", "\n", ...
// This file contains a few functions to help with proto3. // ProtoToTime converts a logutilpb.Time to a time.Time. // proto3 will eventually support timestamps, at which point we'll retire // this. // // A nil pointer is like the empty timestamp.
[ "This", "file", "contains", "a", "few", "functions", "to", "help", "with", "proto3", ".", "ProtoToTime", "converts", "a", "logutilpb", ".", "Time", "to", "a", "time", ".", "Time", ".", "proto3", "will", "eventually", "support", "timestamps", "at", "which", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/proto3.go#L32-L38
136,088
vitessio/vitess
go/vt/logutil/proto3.go
TimeToProto
func TimeToProto(t time.Time) *logutilpb.Time { seconds := t.Unix() nanos := int64(t.Sub(time.Unix(seconds, 0))) return &logutilpb.Time{ Seconds: seconds, Nanoseconds: int32(nanos), } }
go
func TimeToProto(t time.Time) *logutilpb.Time { seconds := t.Unix() nanos := int64(t.Sub(time.Unix(seconds, 0))) return &logutilpb.Time{ Seconds: seconds, Nanoseconds: int32(nanos), } }
[ "func", "TimeToProto", "(", "t", "time", ".", "Time", ")", "*", "logutilpb", ".", "Time", "{", "seconds", ":=", "t", ".", "Unix", "(", ")", "\n", "nanos", ":=", "int64", "(", "t", ".", "Sub", "(", "time", ".", "Unix", "(", "seconds", ",", "0", ...
// TimeToProto converts the time.Time to a logutilpb.Time.
[ "TimeToProto", "converts", "the", "time", ".", "Time", "to", "a", "logutilpb", ".", "Time", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logutil/proto3.go#L41-L48
136,089
vitessio/vitess
go/vt/worker/split_diff_cmd.go
shardsWithSources
func shardsWithSources(ctx context.Context, wr *wrangler.Wrangler) ([]map[string]string, error) { shortCtx, cancel := context.WithTimeout(ctx, *remoteActionsTimeout) keyspaces, err := wr.TopoServer().GetKeyspaces(shortCtx) cancel() if err != nil { return nil, vterrors.Wrap(err, "failed to get list of keyspaces") ...
go
func shardsWithSources(ctx context.Context, wr *wrangler.Wrangler) ([]map[string]string, error) { shortCtx, cancel := context.WithTimeout(ctx, *remoteActionsTimeout) keyspaces, err := wr.TopoServer().GetKeyspaces(shortCtx) cancel() if err != nil { return nil, vterrors.Wrap(err, "failed to get list of keyspaces") ...
[ "func", "shardsWithSources", "(", "ctx", "context", ".", "Context", ",", "wr", "*", "wrangler", ".", "Wrangler", ")", "(", "[", "]", "map", "[", "string", "]", "string", ",", "error", ")", "{", "shortCtx", ",", "cancel", ":=", "context", ".", "WithTime...
// shardsWithSources returns all the shards that have SourceShards set // with no Tables list.
[ "shardsWithSources", "returns", "all", "the", "shards", "that", "have", "SourceShards", "set", "with", "no", "Tables", "list", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/split_diff_cmd.go#L116-L172
136,090
vitessio/vitess
go/cmd/automation_client/automation_client.go
waitForClusterOp
func waitForClusterOp(client automationservicepb.AutomationClient, id string) (*automationpb.GetClusterOperationDetailsResponse, error) { for { req := &automationpb.GetClusterOperationDetailsRequest{ Id: id, } resp, err := client.GetClusterOperationDetails(context.Background(), req, grpc.FailFast(false)) i...
go
func waitForClusterOp(client automationservicepb.AutomationClient, id string) (*automationpb.GetClusterOperationDetailsResponse, error) { for { req := &automationpb.GetClusterOperationDetailsRequest{ Id: id, } resp, err := client.GetClusterOperationDetails(context.Background(), req, grpc.FailFast(false)) i...
[ "func", "waitForClusterOp", "(", "client", "automationservicepb", ".", "AutomationClient", ",", "id", "string", ")", "(", "*", "automationpb", ".", "GetClusterOperationDetailsResponse", ",", "error", ")", "{", "for", "{", "req", ":=", "&", "automationpb", ".", "...
// waitForClusterOp polls and blocks until the ClusterOperation invocation specified by "id" has finished. If an error occurred, it will be returned.
[ "waitForClusterOp", "polls", "and", "blocks", "until", "the", "ClusterOperation", "invocation", "specified", "by", "id", "has", "finished", ".", "If", "an", "error", "occurred", "it", "will", "be", "returned", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cmd/automation_client/automation_client.go#L110-L133
136,091
vitessio/vitess
go/vt/topo/etcd2topo/server.go
NewServer
func NewServer(serverAddr, root string) (*Server, error) { cli, err := clientv3.New(clientv3.Config{ Endpoints: strings.Split(serverAddr, ","), DialTimeout: 5 * time.Second, }) if err != nil { return nil, err } return &Server{ cli: cli, root: root, }, nil }
go
func NewServer(serverAddr, root string) (*Server, error) { cli, err := clientv3.New(clientv3.Config{ Endpoints: strings.Split(serverAddr, ","), DialTimeout: 5 * time.Second, }) if err != nil { return nil, err } return &Server{ cli: cli, root: root, }, nil }
[ "func", "NewServer", "(", "serverAddr", ",", "root", "string", ")", "(", "*", "Server", ",", "error", ")", "{", "cli", ",", "err", ":=", "clientv3", ".", "New", "(", "clientv3", ".", "Config", "{", "Endpoints", ":", "strings", ".", "Split", "(", "ser...
// NewServer returns a new etcdtopo.Server.
[ "NewServer", "returns", "a", "new", "etcdtopo", ".", "Server", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/etcd2topo/server.go#L75-L88
136,092
vitessio/vitess
go/mysql/streaming_query.go
Fields
func (c *Conn) Fields() ([]*querypb.Field, error) { if c.fields == nil { return nil, NewSQLError(CRCommandsOutOfSync, SSUnknownSQLState, "no streaming query in progress") } if len(c.fields) == 0 { // The query returned an empty field list. return nil, nil } return c.fields, nil }
go
func (c *Conn) Fields() ([]*querypb.Field, error) { if c.fields == nil { return nil, NewSQLError(CRCommandsOutOfSync, SSUnknownSQLState, "no streaming query in progress") } if len(c.fields) == 0 { // The query returned an empty field list. return nil, nil } return c.fields, nil }
[ "func", "(", "c", "*", "Conn", ")", "Fields", "(", ")", "(", "[", "]", "*", "querypb", ".", "Field", ",", "error", ")", "{", "if", "c", ".", "fields", "==", "nil", "{", "return", "nil", ",", "NewSQLError", "(", "CRCommandsOutOfSync", ",", "SSUnknow...
// Fields returns the fields for an ongoing streaming query.
[ "Fields", "returns", "the", "fields", "for", "an", "ongoing", "streaming", "query", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/streaming_query.go#L97-L106
136,093
vitessio/vitess
go/mysql/streaming_query.go
CloseResult
func (c *Conn) CloseResult() { for c.fields != nil { rows, err := c.FetchNext() if err != nil || rows == nil { // We either got an error, or got the last result. c.fields = nil } } }
go
func (c *Conn) CloseResult() { for c.fields != nil { rows, err := c.FetchNext() if err != nil || rows == nil { // We either got an error, or got the last result. c.fields = nil } } }
[ "func", "(", "c", "*", "Conn", ")", "CloseResult", "(", ")", "{", "for", "c", ".", "fields", "!=", "nil", "{", "rows", ",", "err", ":=", "c", ".", "FetchNext", "(", ")", "\n", "if", "err", "!=", "nil", "||", "rows", "==", "nil", "{", "// We eit...
// CloseResult can be used to terminate a streaming query // early. It just drains the remaining values.
[ "CloseResult", "can", "be", "used", "to", "terminate", "a", "streaming", "query", "early", ".", "It", "just", "drains", "the", "remaining", "values", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/streaming_query.go#L141-L149
136,094
vitessio/vitess
go/vt/vtgate/planbuilder/subquery.go
newSubquery
func newSubquery(alias sqlparser.TableIdent, bldr builder) (*subquery, *symtab, error) { sq := &subquery{ order: bldr.Order() + 1, input: bldr, esubquery: &engine.Subquery{}, } // Create a 'table' that represents the subquery. t := &table{ alias: sqlparser.TableName{Name: alias}, origin: sq, } ...
go
func newSubquery(alias sqlparser.TableIdent, bldr builder) (*subquery, *symtab, error) { sq := &subquery{ order: bldr.Order() + 1, input: bldr, esubquery: &engine.Subquery{}, } // Create a 'table' that represents the subquery. t := &table{ alias: sqlparser.TableName{Name: alias}, origin: sq, } ...
[ "func", "newSubquery", "(", "alias", "sqlparser", ".", "TableIdent", ",", "bldr", "builder", ")", "(", "*", "subquery", ",", "*", "symtab", ",", "error", ")", "{", "sq", ":=", "&", "subquery", "{", "order", ":", "bldr", ".", "Order", "(", ")", "+", ...
// newSubquery builds a new subquery.
[ "newSubquery", "builds", "a", "new", "subquery", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/subquery.go#L46-L71
136,095
vitessio/vitess
go/vt/sqlannotation/sqlannotation.go
AnnotateIfDML
func AnnotateIfDML(sql string, keyspaceIDs [][]byte) string { if !sqlparser.IsDML(sql) { return sql } if len(keyspaceIDs) == 1 { return AddKeyspaceIDs(sql, keyspaceIDs, "") } filteredReplicationUnfriendlyStatementsCount.Add(1) return sql + filteredReplicationUnfriendlyAnnotation }
go
func AnnotateIfDML(sql string, keyspaceIDs [][]byte) string { if !sqlparser.IsDML(sql) { return sql } if len(keyspaceIDs) == 1 { return AddKeyspaceIDs(sql, keyspaceIDs, "") } filteredReplicationUnfriendlyStatementsCount.Add(1) return sql + filteredReplicationUnfriendlyAnnotation }
[ "func", "AnnotateIfDML", "(", "sql", "string", ",", "keyspaceIDs", "[", "]", "[", "]", "byte", ")", "string", "{", "if", "!", "sqlparser", ".", "IsDML", "(", "sql", ")", "{", "return", "sql", "\n", "}", "\n", "if", "len", "(", "keyspaceIDs", ")", "...
// AnnotateIfDML annotates 'sql' based on 'keyspaceIDs' // // If 'sql' is not a DML statement no annotation is added. // If 'sql' is a DML statement and contains exactly one keyspaceID // it is used to annotate 'sql' // Otherwise 'sql' is annotated as replication-unfriendly.
[ "AnnotateIfDML", "annotates", "sql", "based", "on", "keyspaceIDs", "If", "sql", "is", "not", "a", "DML", "statement", "no", "annotation", "is", "added", ".", "If", "sql", "is", "a", "DML", "statement", "and", "contains", "exactly", "one", "keyspaceID", "it",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlannotation/sqlannotation.go#L52-L61
136,096
vitessio/vitess
go/vt/sqlannotation/sqlannotation.go
AddKeyspaceIDs
func AddKeyspaceIDs(sql string, keyspaceIDs [][]byte, marginComments string) string { encodedIDs := make([][]byte, len(keyspaceIDs)) for i, src := range keyspaceIDs { encodedIDs[i] = make([]byte, hex.EncodedLen(len(src))) hex.Encode(encodedIDs[i], src) } return fmt.Sprintf("%s /* vtgate:: keyspace_id:%s */%s", ...
go
func AddKeyspaceIDs(sql string, keyspaceIDs [][]byte, marginComments string) string { encodedIDs := make([][]byte, len(keyspaceIDs)) for i, src := range keyspaceIDs { encodedIDs[i] = make([]byte, hex.EncodedLen(len(src))) hex.Encode(encodedIDs[i], src) } return fmt.Sprintf("%s /* vtgate:: keyspace_id:%s */%s", ...
[ "func", "AddKeyspaceIDs", "(", "sql", "string", ",", "keyspaceIDs", "[", "]", "[", "]", "byte", ",", "marginComments", "string", ")", "string", "{", "encodedIDs", ":=", "make", "(", "[", "]", "[", "]", "byte", ",", "len", "(", "keyspaceIDs", ")", ")", ...
// AddKeyspaceIDs returns a copy of 'sql' annotated // with the given keyspace id. It also appends the // additional marginComments, if any.
[ "AddKeyspaceIDs", "returns", "a", "copy", "of", "sql", "annotated", "with", "the", "given", "keyspace", "id", ".", "It", "also", "appends", "the", "additional", "marginComments", "if", "any", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlannotation/sqlannotation.go#L66-L74
136,097
vitessio/vitess
go/vt/sqlannotation/sqlannotation.go
ExtractKeyspaceIDS
func ExtractKeyspaceIDS(sql string) (keyspaceIDs [][]byte, err error) { _, comments := sqlparser.SplitMarginComments(sql) keyspaceIDString, hasKeyspaceID := extractStringBetween(comments.Trailing, "/* vtgate:: keyspace_id:", " ") hasUnfriendlyAnnotation := strings.Contains(sql, filteredReplicationUnfriendlyAnnotatio...
go
func ExtractKeyspaceIDS(sql string) (keyspaceIDs [][]byte, err error) { _, comments := sqlparser.SplitMarginComments(sql) keyspaceIDString, hasKeyspaceID := extractStringBetween(comments.Trailing, "/* vtgate:: keyspace_id:", " ") hasUnfriendlyAnnotation := strings.Contains(sql, filteredReplicationUnfriendlyAnnotatio...
[ "func", "ExtractKeyspaceIDS", "(", "sql", "string", ")", "(", "keyspaceIDs", "[", "]", "[", "]", "byte", ",", "err", "error", ")", "{", "_", ",", "comments", ":=", "sqlparser", ".", "SplitMarginComments", "(", "sql", ")", "\n", "keyspaceIDString", ",", "...
// ExtractKeyspaceIDS parses the annotation of the given statement and tries // to extract the keyspace id. // If a keyspace-id comment exists 'keyspaceID' is set to the parsed keyspace id // and err is set to nil; otherwise, if a filtered-replication-unfriendly comment exists // or some other parsing error occured, ke...
[ "ExtractKeyspaceIDS", "parses", "the", "annotation", "of", "the", "given", "statement", "and", "tries", "to", "extract", "the", "keyspace", "id", ".", "If", "a", "keyspace", "-", "id", "comment", "exists", "keyspaceID", "is", "set", "to", "the", "parsed", "k...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlannotation/sqlannotation.go#L82-L120
136,098
vitessio/vitess
go/vt/sqlannotation/sqlannotation.go
extractStringBetween
func extractStringBetween(source string, leftDelim string, rightDelim string) (match string, found bool) { leftDelimStart := strings.Index(source, leftDelim) if leftDelimStart == -1 { found = false match = "" return } found = true matchStart := leftDelimStart + len(leftDelim) matchEnd := strings.Index(sourc...
go
func extractStringBetween(source string, leftDelim string, rightDelim string) (match string, found bool) { leftDelimStart := strings.Index(source, leftDelim) if leftDelimStart == -1 { found = false match = "" return } found = true matchStart := leftDelimStart + len(leftDelim) matchEnd := strings.Index(sourc...
[ "func", "extractStringBetween", "(", "source", "string", ",", "leftDelim", "string", ",", "rightDelim", "string", ")", "(", "match", "string", ",", "found", "bool", ")", "{", "leftDelimStart", ":=", "strings", ".", "Index", "(", "source", ",", "leftDelim", "...
// Extracts the string from source contained between the leftmost instance of // 'leftDelim' and the next instance of 'rightDelim'. If there is no next instance // of 'rightDelim', returns the string contained between the end of the leftmost instance // of 'leftDelim' to the end of 'source'. If 'leftDelim' does not app...
[ "Extracts", "the", "string", "from", "source", "contained", "between", "the", "leftmost", "instance", "of", "leftDelim", "and", "the", "next", "instance", "of", "rightDelim", ".", "If", "there", "is", "no", "next", "instance", "of", "rightDelim", "returns", "t...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlannotation/sqlannotation.go#L128-L144
136,099
vitessio/vitess
go/ratelimiter/ratelimiter.go
Allow
func (rl *RateLimiter) Allow() bool { rl.mu.Lock() defer rl.mu.Unlock() if time.Since(rl.lastTime) < rl.interval { if rl.curCount > 0 { rl.curCount-- return true } return false } rl.curCount = rl.maxCount - 1 rl.lastTime = time.Now() return true }
go
func (rl *RateLimiter) Allow() bool { rl.mu.Lock() defer rl.mu.Unlock() if time.Since(rl.lastTime) < rl.interval { if rl.curCount > 0 { rl.curCount-- return true } return false } rl.curCount = rl.maxCount - 1 rl.lastTime = time.Now() return true }
[ "func", "(", "rl", "*", "RateLimiter", ")", "Allow", "(", ")", "bool", "{", "rl", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "rl", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "time", ".", "Since", "(", "rl", ".", "lastTime", ")", "<...
// Allow returns true if a request is within the rate limit norms. // Otherwise, it returns false.
[ "Allow", "returns", "true", "if", "a", "request", "is", "within", "the", "rate", "limit", "norms", ".", "Otherwise", "it", "returns", "false", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/ratelimiter/ratelimiter.go#L53-L66