id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
135,700
vitessio/vitess
go/mysql/fakesqldb/server.go
ConnParamsWithUname
func (db *DB) ConnParamsWithUname(uname string) *mysql.ConnParams { return &mysql.ConnParams{ UnixSocket: db.socketFile, Uname: uname, Pass: "password1", Charset: "utf8", } }
go
func (db *DB) ConnParamsWithUname(uname string) *mysql.ConnParams { return &mysql.ConnParams{ UnixSocket: db.socketFile, Uname: uname, Pass: "password1", Charset: "utf8", } }
[ "func", "(", "db", "*", "DB", ")", "ConnParamsWithUname", "(", "uname", "string", ")", "*", "mysql", ".", "ConnParams", "{", "return", "&", "mysql", ".", "ConnParams", "{", "UnixSocket", ":", "db", ".", "socketFile", ",", "Uname", ":", "uname", ",", "P...
// ConnParamsWithUname returns ConnParams to connect to the DB with the Uname set to the provided value.
[ "ConnParamsWithUname", "returns", "ConnParams", "to", "connect", "to", "the", "DB", "with", "the", "Uname", "set", "to", "the", "provided", "value", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L267-L274
135,701
vitessio/vitess
go/mysql/fakesqldb/server.go
NewConnection
func (db *DB) NewConnection(c *mysql.Conn) { db.mu.Lock() defer db.mu.Unlock() if db.t != nil { db.t.Logf("NewConnection(%v): client %v", db.name, c.ConnectionID) } if db.isConnFail { panic(fmt.Errorf("simulating a connection failure")) } if db.connDelay != 0 { time.Sleep(db.connDelay) } if conn, ok ...
go
func (db *DB) NewConnection(c *mysql.Conn) { db.mu.Lock() defer db.mu.Unlock() if db.t != nil { db.t.Logf("NewConnection(%v): client %v", db.name, c.ConnectionID) } if db.isConnFail { panic(fmt.Errorf("simulating a connection failure")) } if db.connDelay != 0 { time.Sleep(db.connDelay) } if conn, ok ...
[ "func", "(", "db", "*", "DB", ")", "NewConnection", "(", "c", "*", "mysql", ".", "Conn", ")", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "db", ".", "t", "!=", "nil", "...
// // mysql.Handler interface // // NewConnection is part of the mysql.Handler interface.
[ "mysql", ".", "Handler", "interface", "NewConnection", "is", "part", "of", "the", "mysql", ".", "Handler", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L281-L301
135,702
vitessio/vitess
go/mysql/fakesqldb/server.go
ConnectionClosed
func (db *DB) ConnectionClosed(c *mysql.Conn) { db.mu.Lock() defer db.mu.Unlock() if db.t != nil { db.t.Logf("ConnectionClosed(%v): client %v", db.name, c.ConnectionID) } if _, ok := db.connections[c.ConnectionID]; !ok { db.t.Fatalf("BUG: Cannot delete connection from list of open connections because it is n...
go
func (db *DB) ConnectionClosed(c *mysql.Conn) { db.mu.Lock() defer db.mu.Unlock() if db.t != nil { db.t.Logf("ConnectionClosed(%v): client %v", db.name, c.ConnectionID) } if _, ok := db.connections[c.ConnectionID]; !ok { db.t.Fatalf("BUG: Cannot delete connection from list of open connections because it is n...
[ "func", "(", "db", "*", "DB", ")", "ConnectionClosed", "(", "c", "*", "mysql", ".", "Conn", ")", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "db", ".", "t", "!=", "nil", ...
// ConnectionClosed is part of the mysql.Handler interface.
[ "ConnectionClosed", "is", "part", "of", "the", "mysql", ".", "Handler", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L304-L316
135,703
vitessio/vitess
go/mysql/fakesqldb/server.go
ComQuery
func (db *DB) ComQuery(c *mysql.Conn, query string, callback func(*sqltypes.Result) error) error { return db.Handler.HandleQuery(c, query, callback) }
go
func (db *DB) ComQuery(c *mysql.Conn, query string, callback func(*sqltypes.Result) error) error { return db.Handler.HandleQuery(c, query, callback) }
[ "func", "(", "db", "*", "DB", ")", "ComQuery", "(", "c", "*", "mysql", ".", "Conn", ",", "query", "string", ",", "callback", "func", "(", "*", "sqltypes", ".", "Result", ")", "error", ")", "error", "{", "return", "db", ".", "Handler", ".", "HandleQ...
// ComQuery is part of the mysql.Handler interface.
[ "ComQuery", "is", "part", "of", "the", "mysql", ".", "Handler", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L319-L321
135,704
vitessio/vitess
go/mysql/fakesqldb/server.go
HandleQuery
func (db *DB) HandleQuery(c *mysql.Conn, query string, callback func(*sqltypes.Result) error) error { if db.AllowAll { return callback(&sqltypes.Result{}) } if db.t != nil { db.t.Logf("ComQuery(%v): client %v: %v", db.name, c.ConnectionID, query) } if db.orderMatters { result, err := db.comQueryOrdered(quer...
go
func (db *DB) HandleQuery(c *mysql.Conn, query string, callback func(*sqltypes.Result) error) error { if db.AllowAll { return callback(&sqltypes.Result{}) } if db.t != nil { db.t.Logf("ComQuery(%v): client %v: %v", db.name, c.ConnectionID, query) } if db.orderMatters { result, err := db.comQueryOrdered(quer...
[ "func", "(", "db", "*", "DB", ")", "HandleQuery", "(", "c", "*", "mysql", ".", "Conn", ",", "query", "string", ",", "callback", "func", "(", "*", "sqltypes", ".", "Result", ")", "error", ")", "error", "{", "if", "db", ".", "AllowAll", "{", "return"...
// HandleQuery is the default implementation of the QueryHandler interface
[ "HandleQuery", "is", "the", "default", "implementation", "of", "the", "QueryHandler", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L329-L388
135,705
vitessio/vitess
go/mysql/fakesqldb/server.go
AddQuery
func (db *DB) AddQuery(query string, expectedResult *sqltypes.Result) *ExpectedResult { if len(expectedResult.Rows) > 0 && len(expectedResult.Fields) == 0 { panic(fmt.Errorf("please add Fields to this Result so it's valid: %v", query)) } resultCopy := &sqltypes.Result{} *resultCopy = *expectedResult db.mu.Lock()...
go
func (db *DB) AddQuery(query string, expectedResult *sqltypes.Result) *ExpectedResult { if len(expectedResult.Rows) > 0 && len(expectedResult.Fields) == 0 { panic(fmt.Errorf("please add Fields to this Result so it's valid: %v", query)) } resultCopy := &sqltypes.Result{} *resultCopy = *expectedResult db.mu.Lock()...
[ "func", "(", "db", "*", "DB", ")", "AddQuery", "(", "query", "string", ",", "expectedResult", "*", "sqltypes", ".", "Result", ")", "*", "ExpectedResult", "{", "if", "len", "(", "expectedResult", ".", "Rows", ")", ">", "0", "&&", "len", "(", "expectedRe...
// // Methods to add expected queries and results. // // AddQuery adds a query and its expected result.
[ "Methods", "to", "add", "expected", "queries", "and", "results", ".", "AddQuery", "adds", "a", "query", "and", "its", "expected", "result", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L440-L453
135,706
vitessio/vitess
go/mysql/fakesqldb/server.go
SetBeforeFunc
func (db *DB) SetBeforeFunc(query string, f func()) { db.mu.Lock() defer db.mu.Unlock() key := strings.ToLower(query) r, ok := db.data[key] if !ok { db.t.Fatalf("BUG: no query registered for: %v", query) } r.BeforeFunc = f }
go
func (db *DB) SetBeforeFunc(query string, f func()) { db.mu.Lock() defer db.mu.Unlock() key := strings.ToLower(query) r, ok := db.data[key] if !ok { db.t.Fatalf("BUG: no query registered for: %v", query) } r.BeforeFunc = f }
[ "func", "(", "db", "*", "DB", ")", "SetBeforeFunc", "(", "query", "string", ",", "f", "func", "(", ")", ")", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n", "key", ":=", "strings", "...
// SetBeforeFunc sets the BeforeFunc field for the previously registered "query".
[ "SetBeforeFunc", "sets", "the", "BeforeFunc", "field", "for", "the", "previously", "registered", "query", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L456-L466
135,707
vitessio/vitess
go/mysql/fakesqldb/server.go
DeleteQuery
func (db *DB) DeleteQuery(query string) { db.mu.Lock() defer db.mu.Unlock() key := strings.ToLower(query) delete(db.data, key) delete(db.queryCalled, key) }
go
func (db *DB) DeleteQuery(query string) { db.mu.Lock() defer db.mu.Unlock() key := strings.ToLower(query) delete(db.data, key) delete(db.queryCalled, key) }
[ "func", "(", "db", "*", "DB", ")", "DeleteQuery", "(", "query", "string", ")", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n", "key", ":=", "strings", ".", "ToLower", "(", "query", ")"...
// DeleteQuery deletes query from the fake DB.
[ "DeleteQuery", "deletes", "query", "from", "the", "fake", "DB", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L484-L490
135,708
vitessio/vitess
go/mysql/fakesqldb/server.go
AddRejectedQuery
func (db *DB) AddRejectedQuery(query string, err error) { db.mu.Lock() defer db.mu.Unlock() db.rejectedData[strings.ToLower(query)] = err }
go
func (db *DB) AddRejectedQuery(query string, err error) { db.mu.Lock() defer db.mu.Unlock() db.rejectedData[strings.ToLower(query)] = err }
[ "func", "(", "db", "*", "DB", ")", "AddRejectedQuery", "(", "query", "string", ",", "err", "error", ")", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n", "db", ".", "rejectedData", "[", ...
// AddRejectedQuery adds a query which will be rejected at execution time.
[ "AddRejectedQuery", "adds", "a", "query", "which", "will", "be", "rejected", "at", "execution", "time", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L493-L497
135,709
vitessio/vitess
go/mysql/fakesqldb/server.go
DeleteRejectedQuery
func (db *DB) DeleteRejectedQuery(query string) { db.mu.Lock() defer db.mu.Unlock() delete(db.rejectedData, strings.ToLower(query)) }
go
func (db *DB) DeleteRejectedQuery(query string) { db.mu.Lock() defer db.mu.Unlock() delete(db.rejectedData, strings.ToLower(query)) }
[ "func", "(", "db", "*", "DB", ")", "DeleteRejectedQuery", "(", "query", "string", ")", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n", "delete", "(", "db", ".", "rejectedData", ",", "str...
// DeleteRejectedQuery deletes query from the fake DB.
[ "DeleteRejectedQuery", "deletes", "query", "from", "the", "fake", "DB", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L500-L504
135,710
vitessio/vitess
go/mysql/fakesqldb/server.go
GetQueryCalledNum
func (db *DB) GetQueryCalledNum(query string) int { db.mu.Lock() defer db.mu.Unlock() num, ok := db.queryCalled[strings.ToLower(query)] if !ok { return 0 } return num }
go
func (db *DB) GetQueryCalledNum(query string) int { db.mu.Lock() defer db.mu.Unlock() num, ok := db.queryCalled[strings.ToLower(query)] if !ok { return 0 } return num }
[ "func", "(", "db", "*", "DB", ")", "GetQueryCalledNum", "(", "query", "string", ")", "int", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n", "num", ",", "ok", ":=", "db", ".", "queryCal...
// GetQueryCalledNum returns how many times db executes a certain query.
[ "GetQueryCalledNum", "returns", "how", "many", "times", "db", "executes", "a", "certain", "query", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L507-L515
135,711
vitessio/vitess
go/mysql/fakesqldb/server.go
EnableConnFail
func (db *DB) EnableConnFail() { db.mu.Lock() defer db.mu.Unlock() db.isConnFail = true }
go
func (db *DB) EnableConnFail() { db.mu.Lock() defer db.mu.Unlock() db.isConnFail = true }
[ "func", "(", "db", "*", "DB", ")", "EnableConnFail", "(", ")", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n", "db", ".", "isConnFail", "=", "true", "\n", "}" ]
// EnableConnFail makes connection to this fake DB fail.
[ "EnableConnFail", "makes", "connection", "to", "this", "fake", "DB", "fail", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L518-L522
135,712
vitessio/vitess
go/mysql/fakesqldb/server.go
DisableConnFail
func (db *DB) DisableConnFail() { db.mu.Lock() defer db.mu.Unlock() db.isConnFail = false }
go
func (db *DB) DisableConnFail() { db.mu.Lock() defer db.mu.Unlock() db.isConnFail = false }
[ "func", "(", "db", "*", "DB", ")", "DisableConnFail", "(", ")", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n", "db", ".", "isConnFail", "=", "false", "\n", "}" ]
// DisableConnFail makes connection to this fake DB success.
[ "DisableConnFail", "makes", "connection", "to", "this", "fake", "DB", "success", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L525-L529
135,713
vitessio/vitess
go/mysql/fakesqldb/server.go
SetConnDelay
func (db *DB) SetConnDelay(d time.Duration) { db.mu.Lock() defer db.mu.Unlock() db.connDelay = d }
go
func (db *DB) SetConnDelay(d time.Duration) { db.mu.Lock() defer db.mu.Unlock() db.connDelay = d }
[ "func", "(", "db", "*", "DB", ")", "SetConnDelay", "(", "d", "time", ".", "Duration", ")", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n", "db", ".", "connDelay", "=", "d", "\n", "}"...
// SetConnDelay delays connections to this fake DB for the given duration
[ "SetConnDelay", "delays", "connections", "to", "this", "fake", "DB", "for", "the", "given", "duration" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L532-L536
135,714
vitessio/vitess
go/mysql/fakesqldb/server.go
EnableShouldClose
func (db *DB) EnableShouldClose() { db.mu.Lock() defer db.mu.Unlock() db.shouldClose = true }
go
func (db *DB) EnableShouldClose() { db.mu.Lock() defer db.mu.Unlock() db.shouldClose = true }
[ "func", "(", "db", "*", "DB", ")", "EnableShouldClose", "(", ")", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n", "db", ".", "shouldClose", "=", "true", "\n", "}" ]
// EnableShouldClose closes the connection when processing the next query.
[ "EnableShouldClose", "closes", "the", "connection", "when", "processing", "the", "next", "query", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L539-L543
135,715
vitessio/vitess
go/mysql/fakesqldb/server.go
AddExpectedExecuteFetchAtIndex
func (db *DB) AddExpectedExecuteFetchAtIndex(index int, entry ExpectedExecuteFetch) { db.mu.Lock() defer db.mu.Unlock() if db.expectedExecuteFetch == nil || index < 0 || index >= len(db.expectedExecuteFetch) { index = appendEntry } if index == appendEntry { db.expectedExecuteFetch = append(db.expectedExecuteF...
go
func (db *DB) AddExpectedExecuteFetchAtIndex(index int, entry ExpectedExecuteFetch) { db.mu.Lock() defer db.mu.Unlock() if db.expectedExecuteFetch == nil || index < 0 || index >= len(db.expectedExecuteFetch) { index = appendEntry } if index == appendEntry { db.expectedExecuteFetch = append(db.expectedExecuteF...
[ "func", "(", "db", "*", "DB", ")", "AddExpectedExecuteFetchAtIndex", "(", "index", "int", ",", "entry", "ExpectedExecuteFetch", ")", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "...
// AddExpectedExecuteFetchAtIndex inserts a new entry at index. // index values start at 0.
[ "AddExpectedExecuteFetchAtIndex", "inserts", "a", "new", "entry", "at", "index", ".", "index", "values", "start", "at", "0", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L564-L585
135,716
vitessio/vitess
go/mysql/fakesqldb/server.go
AddExpectedQuery
func (db *DB) AddExpectedQuery(query string, err error) { db.AddExpectedExecuteFetch(ExpectedExecuteFetch{ Query: query, QueryResult: &sqltypes.Result{}, Error: err, }) }
go
func (db *DB) AddExpectedQuery(query string, err error) { db.AddExpectedExecuteFetch(ExpectedExecuteFetch{ Query: query, QueryResult: &sqltypes.Result{}, Error: err, }) }
[ "func", "(", "db", "*", "DB", ")", "AddExpectedQuery", "(", "query", "string", ",", "err", "error", ")", "{", "db", ".", "AddExpectedExecuteFetch", "(", "ExpectedExecuteFetch", "{", "Query", ":", "query", ",", "QueryResult", ":", "&", "sqltypes", ".", "Res...
// AddExpectedQuery adds a single query with no result.
[ "AddExpectedQuery", "adds", "a", "single", "query", "with", "no", "result", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L588-L594
135,717
vitessio/vitess
go/mysql/fakesqldb/server.go
AddExpectedQueryAtIndex
func (db *DB) AddExpectedQueryAtIndex(index int, query string, err error) { db.AddExpectedExecuteFetchAtIndex(index, ExpectedExecuteFetch{ Query: query, QueryResult: &sqltypes.Result{}, Error: err, }) }
go
func (db *DB) AddExpectedQueryAtIndex(index int, query string, err error) { db.AddExpectedExecuteFetchAtIndex(index, ExpectedExecuteFetch{ Query: query, QueryResult: &sqltypes.Result{}, Error: err, }) }
[ "func", "(", "db", "*", "DB", ")", "AddExpectedQueryAtIndex", "(", "index", "int", ",", "query", "string", ",", "err", "error", ")", "{", "db", ".", "AddExpectedExecuteFetchAtIndex", "(", "index", ",", "ExpectedExecuteFetch", "{", "Query", ":", "query", ",",...
// AddExpectedQueryAtIndex adds an expected ordered query at an index.
[ "AddExpectedQueryAtIndex", "adds", "an", "expected", "ordered", "query", "at", "an", "index", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L597-L603
135,718
vitessio/vitess
go/mysql/fakesqldb/server.go
GetEntry
func (db *DB) GetEntry(index int) *ExpectedExecuteFetch { db.mu.Lock() defer db.mu.Unlock() if index < 0 || index >= len(db.expectedExecuteFetch) { panic(fmt.Sprintf("index out of range. current length: %v", len(db.expectedExecuteFetch))) } return &db.expectedExecuteFetch[index] }
go
func (db *DB) GetEntry(index int) *ExpectedExecuteFetch { db.mu.Lock() defer db.mu.Unlock() if index < 0 || index >= len(db.expectedExecuteFetch) { panic(fmt.Sprintf("index out of range. current length: %v", len(db.expectedExecuteFetch))) } return &db.expectedExecuteFetch[index] }
[ "func", "(", "db", "*", "DB", ")", "GetEntry", "(", "index", "int", ")", "*", "ExpectedExecuteFetch", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "index", "<", "0", "||", "...
// GetEntry returns the expected entry at "index". If index is out of bounds, // the return value will be nil.
[ "GetEntry", "returns", "the", "expected", "entry", "at", "index", ".", "If", "index", "is", "out", "of", "bounds", "the", "return", "value", "will", "be", "nil", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L607-L616
135,719
vitessio/vitess
go/mysql/fakesqldb/server.go
DeleteAllEntries
func (db *DB) DeleteAllEntries() { db.mu.Lock() defer db.mu.Unlock() db.expectedExecuteFetch = make([]ExpectedExecuteFetch, 0) db.expectedExecuteFetchIndex = 0 }
go
func (db *DB) DeleteAllEntries() { db.mu.Lock() defer db.mu.Unlock() db.expectedExecuteFetch = make([]ExpectedExecuteFetch, 0) db.expectedExecuteFetchIndex = 0 }
[ "func", "(", "db", "*", "DB", ")", "DeleteAllEntries", "(", ")", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "db", ".", "expectedExecuteFetch", "=", "make", "(", "[", "]", "Expecte...
// DeleteAllEntries removes all ordered entries.
[ "DeleteAllEntries", "removes", "all", "ordered", "entries", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L619-L625
135,720
vitessio/vitess
go/mysql/fakesqldb/server.go
DeleteAllEntriesAfterIndex
func (db *DB) DeleteAllEntriesAfterIndex(index int) { db.mu.Lock() defer db.mu.Unlock() if index < 0 || index >= len(db.expectedExecuteFetch) { panic(fmt.Sprintf("index out of range. current length: %v", len(db.expectedExecuteFetch))) } if index+1 < db.expectedExecuteFetchIndex { // Don't delete entries whic...
go
func (db *DB) DeleteAllEntriesAfterIndex(index int) { db.mu.Lock() defer db.mu.Unlock() if index < 0 || index >= len(db.expectedExecuteFetch) { panic(fmt.Sprintf("index out of range. current length: %v", len(db.expectedExecuteFetch))) } if index+1 < db.expectedExecuteFetchIndex { // Don't delete entries whic...
[ "func", "(", "db", "*", "DB", ")", "DeleteAllEntriesAfterIndex", "(", "index", "int", ")", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "index", "<", "0", "||", "index", ">=",...
// DeleteAllEntriesAfterIndex removes all queries after the index.
[ "DeleteAllEntriesAfterIndex", "removes", "all", "queries", "after", "the", "index", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L628-L642
135,721
vitessio/vitess
go/mysql/fakesqldb/server.go
VerifyAllExecutedOrFail
func (db *DB) VerifyAllExecutedOrFail() { db.mu.Lock() defer db.mu.Unlock() if db.expectedExecuteFetchIndex != len(db.expectedExecuteFetch) { db.t.Errorf("%v: not all expected queries were executed. leftovers: %v", db.name, db.expectedExecuteFetch[db.expectedExecuteFetchIndex:]) } }
go
func (db *DB) VerifyAllExecutedOrFail() { db.mu.Lock() defer db.mu.Unlock() if db.expectedExecuteFetchIndex != len(db.expectedExecuteFetch) { db.t.Errorf("%v: not all expected queries were executed. leftovers: %v", db.name, db.expectedExecuteFetch[db.expectedExecuteFetchIndex:]) } }
[ "func", "(", "db", "*", "DB", ")", "VerifyAllExecutedOrFail", "(", ")", "{", "db", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "db", ".", "expectedExecuteFetchIndex", "!=", "len", "(", "d...
// VerifyAllExecutedOrFail checks that all expected queries where actually // received and executed. If not, it will let the test fail.
[ "VerifyAllExecutedOrFail", "checks", "that", "all", "expected", "queries", "where", "actually", "received", "and", "executed", ".", "If", "not", "it", "will", "let", "the", "test", "fail", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L646-L653
135,722
vitessio/vitess
go/vt/vtgate/engine/limit.go
MarshalJSON
func (l *Limit) MarshalJSON() ([]byte, error) { marshalLimit := struct { Opcode string Count sqltypes.PlanValue Offset sqltypes.PlanValue Input Primitive }{ Opcode: "Limit", Count: l.Count, Offset: l.Offset, Input: l.Input, } return json.Marshal(marshalLimit) }
go
func (l *Limit) MarshalJSON() ([]byte, error) { marshalLimit := struct { Opcode string Count sqltypes.PlanValue Offset sqltypes.PlanValue Input Primitive }{ Opcode: "Limit", Count: l.Count, Offset: l.Offset, Input: l.Input, } return json.Marshal(marshalLimit) }
[ "func", "(", "l", "*", "Limit", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "marshalLimit", ":=", "struct", "{", "Opcode", "string", "\n", "Count", "sqltypes", ".", "PlanValue", "\n", "Offset", "sqltypes", ".", "PlanVal...
// MarshalJSON serializes the Limit into a JSON representation. // It's used for testing and diagnostics.
[ "MarshalJSON", "serializes", "the", "Limit", "into", "a", "JSON", "representation", ".", "It", "s", "used", "for", "testing", "and", "diagnostics", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/limit.go#L40-L53
135,723
vitessio/vitess
go/vt/vtgate/engine/limit.go
Execute
func (l *Limit) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) { count, err := l.fetchCount(bindVars) if err != nil { return nil, err } offset, err := l.fetchOffset(bindVars) if err != nil { return nil, err } // When offset is present, we hijack...
go
func (l *Limit) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) { count, err := l.fetchCount(bindVars) if err != nil { return nil, err } offset, err := l.fetchOffset(bindVars) if err != nil { return nil, err } // When offset is present, we hijack...
[ "func", "(", "l", "*", "Limit", ")", "Execute", "(", "vcursor", "VCursor", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "wantfields", "bool", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "...
// Execute satisfies the Primtive interface.
[ "Execute", "satisfies", "the", "Primtive", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/limit.go#L61-L95
135,724
vitessio/vitess
go/vt/vtgate/engine/limit.go
StreamExecute
func (l *Limit) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error { count, err := l.fetchCount(bindVars) if err != nil { return err } if !l.Offset.IsNull() { return fmt.Errorf("offset not supported for stream execute queries")...
go
func (l *Limit) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error { count, err := l.fetchCount(bindVars) if err != nil { return err } if !l.Offset.IsNull() { return fmt.Errorf("offset not supported for stream execute queries")...
[ "func", "(", "l", "*", "Limit", ")", "StreamExecute", "(", "vcursor", "VCursor", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ",", "wantfields", "bool", ",", "callback", "func", "(", "*", "sqltypes", ".", "Result", ")"...
// StreamExecute satisfies the Primtive interface.
[ "StreamExecute", "satisfies", "the", "Primtive", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/limit.go#L98-L147
135,725
vitessio/vitess
go/vt/vtgate/engine/limit.go
GetFields
func (l *Limit) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) { return l.Input.GetFields(vcursor, bindVars) }
go
func (l *Limit) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) { return l.Input.GetFields(vcursor, bindVars) }
[ "func", "(", "l", "*", "Limit", ")", "GetFields", "(", "vcursor", "VCursor", ",", "bindVars", "map", "[", "string", "]", "*", "querypb", ".", "BindVariable", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "return", "l", ".", "Input...
// GetFields satisfies the Primtive interface.
[ "GetFields", "satisfies", "the", "Primtive", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/limit.go#L150-L152
135,726
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
NewFakeMysqlDaemon
func NewFakeMysqlDaemon(db *fakesqldb.DB) *FakeMysqlDaemon { result := &FakeMysqlDaemon{ db: db, Running: true, } if db != nil { result.appPool = dbconnpool.NewConnectionPool("AppConnPool", 5, time.Minute, 0) result.appPool.Open(db.ConnParams(), stats.NewTimings("", "", "")) } return result }
go
func NewFakeMysqlDaemon(db *fakesqldb.DB) *FakeMysqlDaemon { result := &FakeMysqlDaemon{ db: db, Running: true, } if db != nil { result.appPool = dbconnpool.NewConnectionPool("AppConnPool", 5, time.Minute, 0) result.appPool.Open(db.ConnParams(), stats.NewTimings("", "", "")) } return result }
[ "func", "NewFakeMysqlDaemon", "(", "db", "*", "fakesqldb", ".", "DB", ")", "*", "FakeMysqlDaemon", "{", "result", ":=", "&", "FakeMysqlDaemon", "{", "db", ":", "db", ",", "Running", ":", "true", ",", "}", "\n", "if", "db", "!=", "nil", "{", "result", ...
// NewFakeMysqlDaemon returns a FakeMysqlDaemon where mysqld appears // to be running, based on a fakesqldb.DB. // 'db' can be nil if the test doesn't use a database at all.
[ "NewFakeMysqlDaemon", "returns", "a", "FakeMysqlDaemon", "where", "mysqld", "appears", "to", "be", "running", "based", "on", "a", "fakesqldb", ".", "DB", ".", "db", "can", "be", "nil", "if", "the", "test", "doesn", "t", "use", "a", "database", "at", "all",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L150-L160
135,727
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
Start
func (fmd *FakeMysqlDaemon) Start(ctx context.Context, cnf *mysqlctl.Mycnf, mysqldArgs ...string) error { if fmd.Running { return fmt.Errorf("fake mysql daemon already running") } fmd.Running = true return nil }
go
func (fmd *FakeMysqlDaemon) Start(ctx context.Context, cnf *mysqlctl.Mycnf, mysqldArgs ...string) error { if fmd.Running { return fmt.Errorf("fake mysql daemon already running") } fmd.Running = true return nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "Start", "(", "ctx", "context", ".", "Context", ",", "cnf", "*", "mysqlctl", ".", "Mycnf", ",", "mysqldArgs", "...", "string", ")", "error", "{", "if", "fmd", ".", "Running", "{", "return", "fmt", ".", ...
// Start is part of the MysqlDaemon interface
[ "Start", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L163-L169
135,728
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
Shutdown
func (fmd *FakeMysqlDaemon) Shutdown(ctx context.Context, cnf *mysqlctl.Mycnf, waitForMysqld bool) error { if !fmd.Running { return fmt.Errorf("fake mysql daemon not running") } fmd.Running = false return nil }
go
func (fmd *FakeMysqlDaemon) Shutdown(ctx context.Context, cnf *mysqlctl.Mycnf, waitForMysqld bool) error { if !fmd.Running { return fmt.Errorf("fake mysql daemon not running") } fmd.Running = false return nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "Shutdown", "(", "ctx", "context", ".", "Context", ",", "cnf", "*", "mysqlctl", ".", "Mycnf", ",", "waitForMysqld", "bool", ")", "error", "{", "if", "!", "fmd", ".", "Running", "{", "return", "fmt", ".",...
// Shutdown is part of the MysqlDaemon interface
[ "Shutdown", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L172-L178
135,729
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
ReinitConfig
func (fmd *FakeMysqlDaemon) ReinitConfig(ctx context.Context, cnf *mysqlctl.Mycnf) error { return nil }
go
func (fmd *FakeMysqlDaemon) ReinitConfig(ctx context.Context, cnf *mysqlctl.Mycnf) error { return nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "ReinitConfig", "(", "ctx", "context", ".", "Context", ",", "cnf", "*", "mysqlctl", ".", "Mycnf", ")", "error", "{", "return", "nil", "\n", "}" ]
// ReinitConfig is part of the MysqlDaemon interface
[ "ReinitConfig", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L186-L188
135,730
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
GetMysqlPort
func (fmd *FakeMysqlDaemon) GetMysqlPort() (int32, error) { if fmd.MysqlPort == -1 { return 0, fmt.Errorf("FakeMysqlDaemon.GetMysqlPort returns an error") } return fmd.MysqlPort, nil }
go
func (fmd *FakeMysqlDaemon) GetMysqlPort() (int32, error) { if fmd.MysqlPort == -1 { return 0, fmt.Errorf("FakeMysqlDaemon.GetMysqlPort returns an error") } return fmd.MysqlPort, nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "GetMysqlPort", "(", ")", "(", "int32", ",", "error", ")", "{", "if", "fmd", ".", "MysqlPort", "==", "-", "1", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", ...
// GetMysqlPort is part of the MysqlDaemon interface
[ "GetMysqlPort", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L201-L206
135,731
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
SlaveStatus
func (fmd *FakeMysqlDaemon) SlaveStatus() (mysql.SlaveStatus, error) { if fmd.SlaveStatusError != nil { return mysql.SlaveStatus{}, fmd.SlaveStatusError } return mysql.SlaveStatus{ Position: fmd.CurrentMasterPosition, SecondsBehindMaster: fmd.SecondsBehindMaster, SlaveIORunning: fmd.Replicati...
go
func (fmd *FakeMysqlDaemon) SlaveStatus() (mysql.SlaveStatus, error) { if fmd.SlaveStatusError != nil { return mysql.SlaveStatus{}, fmd.SlaveStatusError } return mysql.SlaveStatus{ Position: fmd.CurrentMasterPosition, SecondsBehindMaster: fmd.SecondsBehindMaster, SlaveIORunning: fmd.Replicati...
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "SlaveStatus", "(", ")", "(", "mysql", ".", "SlaveStatus", ",", "error", ")", "{", "if", "fmd", ".", "SlaveStatusError", "!=", "nil", "{", "return", "mysql", ".", "SlaveStatus", "{", "}", ",", "fmd", "."...
// SlaveStatus is part of the MysqlDaemon interface
[ "SlaveStatus", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L209-L221
135,732
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
ResetReplication
func (fmd *FakeMysqlDaemon) ResetReplication(ctx context.Context) error { return fmd.ExecuteSuperQueryList(ctx, []string{ "FAKE RESET ALL REPLICATION", }) }
go
func (fmd *FakeMysqlDaemon) ResetReplication(ctx context.Context) error { return fmd.ExecuteSuperQueryList(ctx, []string{ "FAKE RESET ALL REPLICATION", }) }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "ResetReplication", "(", "ctx", "context", ".", "Context", ")", "error", "{", "return", "fmd", ".", "ExecuteSuperQueryList", "(", "ctx", ",", "[", "]", "string", "{", "\"", "\"", ",", "}", ")", "\n", "}"...
// ResetReplication is part of the MysqlDaemon interface.
[ "ResetReplication", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L224-L228
135,733
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
SetReadOnly
func (fmd *FakeMysqlDaemon) SetReadOnly(on bool) error { fmd.ReadOnly = on return nil }
go
func (fmd *FakeMysqlDaemon) SetReadOnly(on bool) error { fmd.ReadOnly = on return nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "SetReadOnly", "(", "on", "bool", ")", "error", "{", "fmd", ".", "ReadOnly", "=", "on", "\n", "return", "nil", "\n", "}" ]
// SetReadOnly is part of the MysqlDaemon interface
[ "SetReadOnly", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L241-L244
135,734
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
SetSuperReadOnly
func (fmd *FakeMysqlDaemon) SetSuperReadOnly(on bool) error { fmd.SuperReadOnly = on fmd.ReadOnly = on return nil }
go
func (fmd *FakeMysqlDaemon) SetSuperReadOnly(on bool) error { fmd.SuperReadOnly = on fmd.ReadOnly = on return nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "SetSuperReadOnly", "(", "on", "bool", ")", "error", "{", "fmd", ".", "SuperReadOnly", "=", "on", "\n", "fmd", ".", "ReadOnly", "=", "on", "\n", "return", "nil", "\n", "}" ]
// SetSuperReadOnly is part of the MysqlDaemon interface
[ "SetSuperReadOnly", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L247-L251
135,735
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
StartSlave
func (fmd *FakeMysqlDaemon) StartSlave(hookExtraEnv map[string]string) error { return fmd.ExecuteSuperQueryList(context.Background(), []string{ "START SLAVE", }) }
go
func (fmd *FakeMysqlDaemon) StartSlave(hookExtraEnv map[string]string) error { return fmd.ExecuteSuperQueryList(context.Background(), []string{ "START SLAVE", }) }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "StartSlave", "(", "hookExtraEnv", "map", "[", "string", "]", "string", ")", "error", "{", "return", "fmd", ".", "ExecuteSuperQueryList", "(", "context", ".", "Background", "(", ")", ",", "[", "]", "string",...
// StartSlave is part of the MysqlDaemon interface.
[ "StartSlave", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L254-L258
135,736
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
StartSlaveUntilAfter
func (fmd *FakeMysqlDaemon) StartSlaveUntilAfter(ctx context.Context, pos mysql.Position) error { if !reflect.DeepEqual(fmd.StartSlaveUntilAfterPos, pos) { return fmt.Errorf("wrong pos for StartSlaveUntilAfter: expected %v got %v", fmd.SetSlavePositionPos, pos) } return fmd.ExecuteSuperQueryList(context.Backgroun...
go
func (fmd *FakeMysqlDaemon) StartSlaveUntilAfter(ctx context.Context, pos mysql.Position) error { if !reflect.DeepEqual(fmd.StartSlaveUntilAfterPos, pos) { return fmt.Errorf("wrong pos for StartSlaveUntilAfter: expected %v got %v", fmd.SetSlavePositionPos, pos) } return fmd.ExecuteSuperQueryList(context.Backgroun...
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "StartSlaveUntilAfter", "(", "ctx", "context", ".", "Context", ",", "pos", "mysql", ".", "Position", ")", "error", "{", "if", "!", "reflect", ".", "DeepEqual", "(", "fmd", ".", "StartSlaveUntilAfterPos", ",", ...
// StartSlaveUntilAfter is part of the MysqlDaemon interface.
[ "StartSlaveUntilAfter", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L261-L269
135,737
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
SetMaster
func (fmd *FakeMysqlDaemon) SetMaster(ctx context.Context, masterHost string, masterPort int, slaveStopBefore bool, slaveStartAfter bool) error { input := fmt.Sprintf("%v:%v", masterHost, masterPort) if fmd.SetMasterInput != input { return fmt.Errorf("wrong input for SetMasterCommands: expected %v got %v", fmd.SetM...
go
func (fmd *FakeMysqlDaemon) SetMaster(ctx context.Context, masterHost string, masterPort int, slaveStopBefore bool, slaveStartAfter bool) error { input := fmt.Sprintf("%v:%v", masterHost, masterPort) if fmd.SetMasterInput != input { return fmt.Errorf("wrong input for SetMasterCommands: expected %v got %v", fmd.SetM...
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "SetMaster", "(", "ctx", "context", ".", "Context", ",", "masterHost", "string", ",", "masterPort", "int", ",", "slaveStopBefore", "bool", ",", "slaveStartAfter", "bool", ")", "error", "{", "input", ":=", "fmt...
// SetMaster is part of the MysqlDaemon interface.
[ "SetMaster", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L289-L303
135,738
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
WaitForReparentJournal
func (fmd *FakeMysqlDaemon) WaitForReparentJournal(ctx context.Context, timeCreatedNS int64) error { return nil }
go
func (fmd *FakeMysqlDaemon) WaitForReparentJournal(ctx context.Context, timeCreatedNS int64) error { return nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "WaitForReparentJournal", "(", "ctx", "context", ".", "Context", ",", "timeCreatedNS", "int64", ")", "error", "{", "return", "nil", "\n", "}" ]
// WaitForReparentJournal is part of the MysqlDaemon interface
[ "WaitForReparentJournal", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L306-L308
135,739
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
WaitMasterPos
func (fmd *FakeMysqlDaemon) WaitMasterPos(_ context.Context, pos mysql.Position) error { if fmd.TimeoutHook != nil { return fmd.TimeoutHook() } if reflect.DeepEqual(fmd.WaitMasterPosition, pos) { return nil } return fmt.Errorf("wrong input for WaitMasterPos: expected %v got %v", fmd.WaitMasterPosition, pos) }
go
func (fmd *FakeMysqlDaemon) WaitMasterPos(_ context.Context, pos mysql.Position) error { if fmd.TimeoutHook != nil { return fmd.TimeoutHook() } if reflect.DeepEqual(fmd.WaitMasterPosition, pos) { return nil } return fmt.Errorf("wrong input for WaitMasterPos: expected %v got %v", fmd.WaitMasterPosition, pos) }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "WaitMasterPos", "(", "_", "context", ".", "Context", ",", "pos", "mysql", ".", "Position", ")", "error", "{", "if", "fmd", ".", "TimeoutHook", "!=", "nil", "{", "return", "fmd", ".", "TimeoutHook", "(", ...
// WaitMasterPos is part of the MysqlDaemon interface
[ "WaitMasterPos", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L316-L324
135,740
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
PromoteSlave
func (fmd *FakeMysqlDaemon) PromoteSlave(hookExtraEnv map[string]string) (mysql.Position, error) { return fmd.PromoteSlaveResult, nil }
go
func (fmd *FakeMysqlDaemon) PromoteSlave(hookExtraEnv map[string]string) (mysql.Position, error) { return fmd.PromoteSlaveResult, nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "PromoteSlave", "(", "hookExtraEnv", "map", "[", "string", "]", "string", ")", "(", "mysql", ".", "Position", ",", "error", ")", "{", "return", "fmd", ".", "PromoteSlaveResult", ",", "nil", "\n", "}" ]
// PromoteSlave is part of the MysqlDaemon interface
[ "PromoteSlave", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L327-L329
135,741
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
ExecuteSuperQueryList
func (fmd *FakeMysqlDaemon) ExecuteSuperQueryList(ctx context.Context, queryList []string) error { for _, query := range queryList { // test we still have a query to compare if fmd.ExpectedExecuteSuperQueryCurrent >= len(fmd.ExpectedExecuteSuperQueryList) { return fmt.Errorf("unexpected extra query in ExecuteSu...
go
func (fmd *FakeMysqlDaemon) ExecuteSuperQueryList(ctx context.Context, queryList []string) error { for _, query := range queryList { // test we still have a query to compare if fmd.ExpectedExecuteSuperQueryCurrent >= len(fmd.ExpectedExecuteSuperQueryList) { return fmt.Errorf("unexpected extra query in ExecuteSu...
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "ExecuteSuperQueryList", "(", "ctx", "context", ".", "Context", ",", "queryList", "[", "]", "string", ")", "error", "{", "for", "_", ",", "query", ":=", "range", "queryList", "{", "// test we still have a query ...
// ExecuteSuperQueryList is part of the MysqlDaemon interface
[ "ExecuteSuperQueryList", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L332-L363
135,742
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
FetchSuperQuery
func (fmd *FakeMysqlDaemon) FetchSuperQuery(ctx context.Context, query string) (*sqltypes.Result, error) { if fmd.FetchSuperQueryMap == nil { return nil, fmt.Errorf("unexpected query: %v", query) } qr, ok := fmd.FetchSuperQueryMap[query] if !ok { return nil, fmt.Errorf("unexpected query: %v", query) } return...
go
func (fmd *FakeMysqlDaemon) FetchSuperQuery(ctx context.Context, query string) (*sqltypes.Result, error) { if fmd.FetchSuperQueryMap == nil { return nil, fmt.Errorf("unexpected query: %v", query) } qr, ok := fmd.FetchSuperQueryMap[query] if !ok { return nil, fmt.Errorf("unexpected query: %v", query) } return...
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "FetchSuperQuery", "(", "ctx", "context", ".", "Context", ",", "query", "string", ")", "(", "*", "sqltypes", ".", "Result", ",", "error", ")", "{", "if", "fmd", ".", "FetchSuperQueryMap", "==", "nil", "{",...
// FetchSuperQuery returns the results from the map, if any
[ "FetchSuperQuery", "returns", "the", "results", "from", "the", "map", "if", "any" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L366-L376
135,743
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
CheckSuperQueryList
func (fmd *FakeMysqlDaemon) CheckSuperQueryList() error { if fmd.ExpectedExecuteSuperQueryCurrent != len(fmd.ExpectedExecuteSuperQueryList) { return fmt.Errorf("SuperQueryList wasn't consumed, saw %v queries, was expecting %v", fmd.ExpectedExecuteSuperQueryCurrent, len(fmd.ExpectedExecuteSuperQueryList)) } return ...
go
func (fmd *FakeMysqlDaemon) CheckSuperQueryList() error { if fmd.ExpectedExecuteSuperQueryCurrent != len(fmd.ExpectedExecuteSuperQueryList) { return fmt.Errorf("SuperQueryList wasn't consumed, saw %v queries, was expecting %v", fmd.ExpectedExecuteSuperQueryCurrent, len(fmd.ExpectedExecuteSuperQueryList)) } return ...
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "CheckSuperQueryList", "(", ")", "error", "{", "if", "fmd", ".", "ExpectedExecuteSuperQueryCurrent", "!=", "len", "(", "fmd", ".", "ExpectedExecuteSuperQueryList", ")", "{", "return", "fmt", ".", "Errorf", "(", ...
// CheckSuperQueryList returns an error if all the queries we expected // haven't been seen.
[ "CheckSuperQueryList", "returns", "an", "error", "if", "all", "the", "queries", "we", "expected", "haven", "t", "been", "seen", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L399-L404
135,744
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
GetSchema
func (fmd *FakeMysqlDaemon) GetSchema(dbName string, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error) { if fmd.SchemaFunc != nil { return fmd.SchemaFunc() } if fmd.Schema == nil { return nil, fmt.Errorf("no schema defined") } return tmutils.FilterTables(fmd.Sche...
go
func (fmd *FakeMysqlDaemon) GetSchema(dbName string, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error) { if fmd.SchemaFunc != nil { return fmd.SchemaFunc() } if fmd.Schema == nil { return nil, fmt.Errorf("no schema defined") } return tmutils.FilterTables(fmd.Sche...
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "GetSchema", "(", "dbName", "string", ",", "tables", ",", "excludeTables", "[", "]", "string", ",", "includeViews", "bool", ")", "(", "*", "tabletmanagerdatapb", ".", "SchemaDefinition", ",", "error", ")", "{"...
// GetSchema is part of the MysqlDaemon interface
[ "GetSchema", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L407-L415
135,745
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
GetColumns
func (fmd *FakeMysqlDaemon) GetColumns(dbName, table string) ([]string, error) { return []string{}, nil }
go
func (fmd *FakeMysqlDaemon) GetColumns(dbName, table string) ([]string, error) { return []string{}, nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "GetColumns", "(", "dbName", ",", "table", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "return", "[", "]", "string", "{", "}", ",", "nil", "\n", "}" ]
// GetColumns is part of the MysqlDaemon interface
[ "GetColumns", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L418-L420
135,746
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
GetPrimaryKeyColumns
func (fmd *FakeMysqlDaemon) GetPrimaryKeyColumns(dbName, table string) ([]string, error) { return []string{}, nil }
go
func (fmd *FakeMysqlDaemon) GetPrimaryKeyColumns(dbName, table string) ([]string, error) { return []string{}, nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "GetPrimaryKeyColumns", "(", "dbName", ",", "table", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "return", "[", "]", "string", "{", "}", ",", "nil", "\n", "}" ]
// GetPrimaryKeyColumns is part of the MysqlDaemon interface
[ "GetPrimaryKeyColumns", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L423-L425
135,747
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
PreflightSchemaChange
func (fmd *FakeMysqlDaemon) PreflightSchemaChange(dbName string, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) { if fmd.PreflightSchemaChangeResult == nil { return nil, fmt.Errorf("no preflight result defined") } return fmd.PreflightSchemaChangeResult, nil }
go
func (fmd *FakeMysqlDaemon) PreflightSchemaChange(dbName string, changes []string) ([]*tabletmanagerdatapb.SchemaChangeResult, error) { if fmd.PreflightSchemaChangeResult == nil { return nil, fmt.Errorf("no preflight result defined") } return fmd.PreflightSchemaChangeResult, nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "PreflightSchemaChange", "(", "dbName", "string", ",", "changes", "[", "]", "string", ")", "(", "[", "]", "*", "tabletmanagerdatapb", ".", "SchemaChangeResult", ",", "error", ")", "{", "if", "fmd", ".", "Pre...
// PreflightSchemaChange is part of the MysqlDaemon interface
[ "PreflightSchemaChange", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L428-L433
135,748
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
ApplySchemaChange
func (fmd *FakeMysqlDaemon) ApplySchemaChange(dbName string, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error) { if fmd.ApplySchemaChangeResult == nil { return nil, fmt.Errorf("no apply schema defined") } return fmd.ApplySchemaChangeResult, nil }
go
func (fmd *FakeMysqlDaemon) ApplySchemaChange(dbName string, change *tmutils.SchemaChange) (*tabletmanagerdatapb.SchemaChangeResult, error) { if fmd.ApplySchemaChangeResult == nil { return nil, fmt.Errorf("no apply schema defined") } return fmd.ApplySchemaChangeResult, nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "ApplySchemaChange", "(", "dbName", "string", ",", "change", "*", "tmutils", ".", "SchemaChange", ")", "(", "*", "tabletmanagerdatapb", ".", "SchemaChangeResult", ",", "error", ")", "{", "if", "fmd", ".", "App...
// ApplySchemaChange is part of the MysqlDaemon interface
[ "ApplySchemaChange", "is", "part", "of", "the", "MysqlDaemon", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L436-L441
135,749
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
GetAppConnection
func (fmd *FakeMysqlDaemon) GetAppConnection(ctx context.Context) (*dbconnpool.PooledDBConnection, error) { return fmd.appPool.Get(ctx) }
go
func (fmd *FakeMysqlDaemon) GetAppConnection(ctx context.Context) (*dbconnpool.PooledDBConnection, error) { return fmd.appPool.Get(ctx) }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "GetAppConnection", "(", "ctx", "context", ".", "Context", ")", "(", "*", "dbconnpool", ".", "PooledDBConnection", ",", "error", ")", "{", "return", "fmd", ".", "appPool", ".", "Get", "(", "ctx", ")", "\n"...
// GetAppConnection is part of the MysqlDaemon interface.
[ "GetAppConnection", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L444-L446
135,750
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
GetAllPrivsConnection
func (fmd *FakeMysqlDaemon) GetAllPrivsConnection() (*dbconnpool.DBConnection, error) { return dbconnpool.NewDBConnection(fmd.db.ConnParams(), stats.NewTimings("", "", "")) }
go
func (fmd *FakeMysqlDaemon) GetAllPrivsConnection() (*dbconnpool.DBConnection, error) { return dbconnpool.NewDBConnection(fmd.db.ConnParams(), stats.NewTimings("", "", "")) }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "GetAllPrivsConnection", "(", ")", "(", "*", "dbconnpool", ".", "DBConnection", ",", "error", ")", "{", "return", "dbconnpool", ".", "NewDBConnection", "(", "fmd", ".", "db", ".", "ConnParams", "(", ")", ","...
// GetAllPrivsConnection is part of the MysqlDaemon interface.
[ "GetAllPrivsConnection", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L454-L456
135,751
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
SetSemiSyncEnabled
func (fmd *FakeMysqlDaemon) SetSemiSyncEnabled(master, slave bool) error { fmd.SemiSyncMasterEnabled = master fmd.SemiSyncSlaveEnabled = slave return nil }
go
func (fmd *FakeMysqlDaemon) SetSemiSyncEnabled(master, slave bool) error { fmd.SemiSyncMasterEnabled = master fmd.SemiSyncSlaveEnabled = slave return nil }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "SetSemiSyncEnabled", "(", "master", ",", "slave", "bool", ")", "error", "{", "fmd", ".", "SemiSyncMasterEnabled", "=", "master", "\n", "fmd", ".", "SemiSyncSlaveEnabled", "=", "slave", "\n", "return", "nil", ...
// SetSemiSyncEnabled is part of the MysqlDaemon interface.
[ "SetSemiSyncEnabled", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L459-L463
135,752
vitessio/vitess
go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
SemiSyncEnabled
func (fmd *FakeMysqlDaemon) SemiSyncEnabled() (master, slave bool) { return fmd.SemiSyncMasterEnabled, fmd.SemiSyncSlaveEnabled }
go
func (fmd *FakeMysqlDaemon) SemiSyncEnabled() (master, slave bool) { return fmd.SemiSyncMasterEnabled, fmd.SemiSyncSlaveEnabled }
[ "func", "(", "fmd", "*", "FakeMysqlDaemon", ")", "SemiSyncEnabled", "(", ")", "(", "master", ",", "slave", "bool", ")", "{", "return", "fmd", ".", "SemiSyncMasterEnabled", ",", "fmd", ".", "SemiSyncSlaveEnabled", "\n", "}" ]
// SemiSyncEnabled is part of the MysqlDaemon interface.
[ "SemiSyncEnabled", "is", "part", "of", "the", "MysqlDaemon", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go#L466-L468
135,753
vitessio/vitess
go/vt/schemamanager/plain_controller.go
NewPlainController
func NewPlainController(sqlStr string, keyspace string) *PlainController { controller := &PlainController{ sqls: make([]string, 0, 32), keyspace: keyspace, } sqls, err := sqlparser.SplitStatementToPieces(sqlStr) if err != nil { panic(err.Error()) } for _, sql := range sqls { s := strings.TrimSpace(s...
go
func NewPlainController(sqlStr string, keyspace string) *PlainController { controller := &PlainController{ sqls: make([]string, 0, 32), keyspace: keyspace, } sqls, err := sqlparser.SplitStatementToPieces(sqlStr) if err != nil { panic(err.Error()) } for _, sql := range sqls { s := strings.TrimSpace(s...
[ "func", "NewPlainController", "(", "sqlStr", "string", ",", "keyspace", "string", ")", "*", "PlainController", "{", "controller", ":=", "&", "PlainController", "{", "sqls", ":", "make", "(", "[", "]", "string", ",", "0", ",", "32", ")", ",", "keyspace", ...
// NewPlainController creates a new PlainController instance.
[ "NewPlainController", "creates", "a", "new", "PlainController", "instance", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/plain_controller.go#L36-L54
135,754
vitessio/vitess
go/vt/schemamanager/plain_controller.go
Read
func (controller *PlainController) Read(ctx context.Context) ([]string, error) { return controller.sqls, nil }
go
func (controller *PlainController) Read(ctx context.Context) ([]string, error) { return controller.sqls, nil }
[ "func", "(", "controller", "*", "PlainController", ")", "Read", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "string", ",", "error", ")", "{", "return", "controller", ".", "sqls", ",", "nil", "\n", "}" ]
// Read reads schema changes
[ "Read", "reads", "schema", "changes" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/plain_controller.go#L62-L64
135,755
vitessio/vitess
go/vt/schemamanager/plain_controller.go
OnReadSuccess
func (controller *PlainController) OnReadSuccess(ctx context.Context) error { log.Info("Successfully read all schema changes.") return nil }
go
func (controller *PlainController) OnReadSuccess(ctx context.Context) error { log.Info("Successfully read all schema changes.") return nil }
[ "func", "(", "controller", "*", "PlainController", ")", "OnReadSuccess", "(", "ctx", "context", ".", "Context", ")", "error", "{", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}" ]
// OnReadSuccess is called when schemamanager successfully // reads all sql statements.
[ "OnReadSuccess", "is", "called", "when", "schemamanager", "successfully", "reads", "all", "sql", "statements", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/plain_controller.go#L77-L80
135,756
vitessio/vitess
go/vt/schemamanager/plain_controller.go
OnReadFail
func (controller *PlainController) OnReadFail(ctx context.Context, err error) error { log.Errorf("Failed to read schema changes, error: %v\n", err) return err }
go
func (controller *PlainController) OnReadFail(ctx context.Context, err error) error { log.Errorf("Failed to read schema changes, error: %v\n", err) return err }
[ "func", "(", "controller", "*", "PlainController", ")", "OnReadFail", "(", "ctx", "context", ".", "Context", ",", "err", "error", ")", "error", "{", "log", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "return", "err", "\n", "}" ]
// OnReadFail is called when schemamanager fails to read all sql statements.
[ "OnReadFail", "is", "called", "when", "schemamanager", "fails", "to", "read", "all", "sql", "statements", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/plain_controller.go#L83-L86
135,757
vitessio/vitess
go/vt/schemamanager/plain_controller.go
OnExecutorComplete
func (controller *PlainController) OnExecutorComplete(ctx context.Context, result *ExecuteResult) error { out, _ := json.MarshalIndent(result, "", " ") log.Infof("Executor finished, result: %s\n", string(out)) return nil }
go
func (controller *PlainController) OnExecutorComplete(ctx context.Context, result *ExecuteResult) error { out, _ := json.MarshalIndent(result, "", " ") log.Infof("Executor finished, result: %s\n", string(out)) return nil }
[ "func", "(", "controller", "*", "PlainController", ")", "OnExecutorComplete", "(", "ctx", "context", ".", "Context", ",", "result", "*", "ExecuteResult", ")", "error", "{", "out", ",", "_", ":=", "json", ".", "MarshalIndent", "(", "result", ",", "\"", "\""...
// OnExecutorComplete is called when schemamanager finishes applying schema changes.
[ "OnExecutorComplete", "is", "called", "when", "schemamanager", "finishes", "applying", "schema", "changes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/schemamanager/plain_controller.go#L101-L105
135,758
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
SetListener
func (fhc *FakeHealthCheck) SetListener(listener HealthCheckStatsListener, sendDownEvents bool) { fhc.listener = listener }
go
func (fhc *FakeHealthCheck) SetListener(listener HealthCheckStatsListener, sendDownEvents bool) { fhc.listener = listener }
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "SetListener", "(", "listener", "HealthCheckStatsListener", ",", "sendDownEvents", "bool", ")", "{", "fhc", ".", "listener", "=", "listener", "\n", "}" ]
// SetListener is not implemented.
[ "SetListener", "is", "not", "implemented", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L66-L68
135,759
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
AddTablet
func (fhc *FakeHealthCheck) AddTablet(tablet *topodatapb.Tablet, name string) { key := TabletToMapKey(tablet) item := &fhcItem{ ts: &TabletStats{ Key: key, Tablet: tablet, Target: &querypb.Target{ Keyspace: tablet.Keyspace, Shard: tablet.Shard, TabletType: tablet.Type, }, Servin...
go
func (fhc *FakeHealthCheck) AddTablet(tablet *topodatapb.Tablet, name string) { key := TabletToMapKey(tablet) item := &fhcItem{ ts: &TabletStats{ Key: key, Tablet: tablet, Target: &querypb.Target{ Keyspace: tablet.Keyspace, Shard: tablet.Shard, TabletType: tablet.Type, }, Servin...
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "AddTablet", "(", "tablet", "*", "topodatapb", ".", "Tablet", ",", "name", "string", ")", "{", "key", ":=", "TabletToMapKey", "(", "tablet", ")", "\n", "item", ":=", "&", "fhcItem", "{", "ts", ":", "&", ...
// AddTablet adds the tablet and calls the listener.
[ "AddTablet", "adds", "the", "tablet", "and", "calls", "the", "listener", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L75-L100
135,760
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
RemoveTablet
func (fhc *FakeHealthCheck) RemoveTablet(tablet *topodatapb.Tablet) { fhc.mu.Lock() defer fhc.mu.Unlock() key := TabletToMapKey(tablet) delete(fhc.items, key) }
go
func (fhc *FakeHealthCheck) RemoveTablet(tablet *topodatapb.Tablet) { fhc.mu.Lock() defer fhc.mu.Unlock() key := TabletToMapKey(tablet) delete(fhc.items, key) }
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "RemoveTablet", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "{", "fhc", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "fhc", ".", "mu", ".", "Unlock", "(", ")", "\n", "key", ":=", "Table...
// RemoveTablet removes the tablet.
[ "RemoveTablet", "removes", "the", "tablet", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L103-L108
135,761
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
ReplaceTablet
func (fhc *FakeHealthCheck) ReplaceTablet(old, new *topodatapb.Tablet, name string) { fhc.RemoveTablet(old) fhc.AddTablet(new, name) }
go
func (fhc *FakeHealthCheck) ReplaceTablet(old, new *topodatapb.Tablet, name string) { fhc.RemoveTablet(old) fhc.AddTablet(new, name) }
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "ReplaceTablet", "(", "old", ",", "new", "*", "topodatapb", ".", "Tablet", ",", "name", "string", ")", "{", "fhc", ".", "RemoveTablet", "(", "old", ")", "\n", "fhc", ".", "AddTablet", "(", "new", ",", ...
// ReplaceTablet removes the old tablet and adds the new.
[ "ReplaceTablet", "removes", "the", "old", "tablet", "and", "adds", "the", "new", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L111-L114
135,762
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
CacheStatus
func (fhc *FakeHealthCheck) CacheStatus() TabletsCacheStatusList { fhc.mu.Lock() defer fhc.mu.Unlock() stats := make(TabletsCacheStatusList, 0, len(fhc.items)) for _, item := range fhc.items { stats = append(stats, &TabletsCacheStatus{ Cell: "FakeCell", Target: item.ts.Target, TabletsStats...
go
func (fhc *FakeHealthCheck) CacheStatus() TabletsCacheStatusList { fhc.mu.Lock() defer fhc.mu.Unlock() stats := make(TabletsCacheStatusList, 0, len(fhc.items)) for _, item := range fhc.items { stats = append(stats, &TabletsCacheStatus{ Cell: "FakeCell", Target: item.ts.Target, TabletsStats...
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "CacheStatus", "(", ")", "TabletsCacheStatusList", "{", "fhc", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "fhc", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "stats", ":=", "make", "(", "TabletsCach...
// CacheStatus returns the status for each tablet
[ "CacheStatus", "returns", "the", "status", "for", "each", "tablet" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L127-L141
135,763
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
Reset
func (fhc *FakeHealthCheck) Reset() { fhc.mu.Lock() defer fhc.mu.Unlock() fhc.items = make(map[string]*fhcItem) }
go
func (fhc *FakeHealthCheck) Reset() { fhc.mu.Lock() defer fhc.mu.Unlock() fhc.items = make(map[string]*fhcItem) }
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "Reset", "(", ")", "{", "fhc", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "fhc", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "fhc", ".", "items", "=", "make", "(", "map", "[", "string", "]"...
// // Management methods // // Reset cleans up the internal state.
[ "Management", "methods", "Reset", "cleans", "up", "the", "internal", "state", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L153-L158
135,764
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
AddFakeTablet
func (fhc *FakeHealthCheck) AddFakeTablet(cell, host string, port int32, keyspace, shard string, tabletType topodatapb.TabletType, serving bool, reparentTS int64, err error, connFactory func(*topodatapb.Tablet) queryservice.QueryService) queryservice.QueryService { t := topo.NewTablet(0, cell, host) t.Keyspace = keys...
go
func (fhc *FakeHealthCheck) AddFakeTablet(cell, host string, port int32, keyspace, shard string, tabletType topodatapb.TabletType, serving bool, reparentTS int64, err error, connFactory func(*topodatapb.Tablet) queryservice.QueryService) queryservice.QueryService { t := topo.NewTablet(0, cell, host) t.Keyspace = keys...
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "AddFakeTablet", "(", "cell", ",", "host", "string", ",", "port", "int32", ",", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ",", "serving", "bool", ",", "reparentTS"...
// AddFakeTablet inserts a fake entry into FakeHealthCheck. // The Tablet can be talked to using the provided connection. // The Listener is called, as if AddTablet had been called. // For flexibility the connection is created via a connFactory callback
[ "AddFakeTablet", "inserts", "a", "fake", "entry", "into", "FakeHealthCheck", ".", "The", "Tablet", "can", "be", "talked", "to", "using", "the", "provided", "connection", ".", "The", "Listener", "is", "called", "as", "if", "AddTablet", "had", "been", "called", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L164-L201
135,765
vitessio/vitess
go/vt/discovery/fake_healthcheck.go
GetAllTablets
func (fhc *FakeHealthCheck) GetAllTablets() map[string]*topodatapb.Tablet { res := make(map[string]*topodatapb.Tablet) fhc.mu.RLock() defer fhc.mu.RUnlock() for key, t := range fhc.items { res[key] = t.ts.Tablet } return res }
go
func (fhc *FakeHealthCheck) GetAllTablets() map[string]*topodatapb.Tablet { res := make(map[string]*topodatapb.Tablet) fhc.mu.RLock() defer fhc.mu.RUnlock() for key, t := range fhc.items { res[key] = t.ts.Tablet } return res }
[ "func", "(", "fhc", "*", "FakeHealthCheck", ")", "GetAllTablets", "(", ")", "map", "[", "string", "]", "*", "topodatapb", ".", "Tablet", "{", "res", ":=", "make", "(", "map", "[", "string", "]", "*", "topodatapb", ".", "Tablet", ")", "\n", "fhc", "."...
// GetAllTablets returns all the tablets we have.
[ "GetAllTablets", "returns", "all", "the", "tablets", "we", "have", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/discovery/fake_healthcheck.go#L213-L221
135,766
vitessio/vitess
go/vt/vtgate/planbuilder/expr.go
splitAndExpression
func splitAndExpression(filters []sqlparser.Expr, node sqlparser.Expr) []sqlparser.Expr { if node == nil { return filters } switch node := node.(type) { case *sqlparser.AndExpr: filters = splitAndExpression(filters, node.Left) return splitAndExpression(filters, node.Right) case *sqlparser.ParenExpr: // If ...
go
func splitAndExpression(filters []sqlparser.Expr, node sqlparser.Expr) []sqlparser.Expr { if node == nil { return filters } switch node := node.(type) { case *sqlparser.AndExpr: filters = splitAndExpression(filters, node.Left) return splitAndExpression(filters, node.Right) case *sqlparser.ParenExpr: // If ...
[ "func", "splitAndExpression", "(", "filters", "[", "]", "sqlparser", ".", "Expr", ",", "node", "sqlparser", ".", "Expr", ")", "[", "]", "sqlparser", ".", "Expr", "{", "if", "node", "==", "nil", "{", "return", "filters", "\n", "}", "\n", "switch", "node...
// splitAndExpression breaks up the Expr into AND-separated conditions // and appends them to filters, which can be shuffled and recombined // as needed.
[ "splitAndExpression", "breaks", "up", "the", "Expr", "into", "AND", "-", "separated", "conditions", "and", "appends", "them", "to", "filters", "which", "can", "be", "shuffled", "and", "recombined", "as", "needed", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/expr.go#L31-L47
135,767
vitessio/vitess
go/proc/proc.go
Listen
func Listen(port string) (l net.Listener, err error) { if port != "" { killPredecessor(port) } return listen(port) }
go
func Listen(port string) (l net.Listener, err error) { if port != "" { killPredecessor(port) } return listen(port) }
[ "func", "Listen", "(", "port", "string", ")", "(", "l", "net", ".", "Listener", ",", "err", "error", ")", "{", "if", "port", "!=", "\"", "\"", "{", "killPredecessor", "(", "port", ")", "\n", "}", "\n", "return", "listen", "(", "port", ")", "\n", ...
// Listen tries to create a listener on the specified tcp port. // Before creating the listener, it checks to see if there is another // server already using the port. If there is one, it sends a USR1 // signal requesting the server to shutdown, and then attempts to // to create the listener.
[ "Listen", "tries", "to", "create", "a", "listener", "on", "the", "specified", "tcp", "port", ".", "Before", "creating", "the", "listener", "it", "checks", "to", "see", "if", "there", "is", "another", "server", "already", "using", "the", "port", ".", "If", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/proc/proc.go#L43-L48
135,768
vitessio/vitess
go/proc/proc.go
Wait
func Wait() os.Signal { c := make(chan os.Signal, 1) signal.Notify(c, syscall.SIGTERM, syscall.SIGUSR1, syscall.SIGINT) http.HandleFunc(pidURL, func(r http.ResponseWriter, req *http.Request) { r.Write(strconv.AppendInt(nil, int64(os.Getpid()), 10)) }) return <-c }
go
func Wait() os.Signal { c := make(chan os.Signal, 1) signal.Notify(c, syscall.SIGTERM, syscall.SIGUSR1, syscall.SIGINT) http.HandleFunc(pidURL, func(r http.ResponseWriter, req *http.Request) { r.Write(strconv.AppendInt(nil, int64(os.Getpid()), 10)) }) return <-c }
[ "func", "Wait", "(", ")", "os", ".", "Signal", "{", "c", ":=", "make", "(", "chan", "os", ".", "Signal", ",", "1", ")", "\n", "signal", ".", "Notify", "(", "c", ",", "syscall", ".", "SIGTERM", ",", "syscall", ".", "SIGUSR1", ",", "syscall", ".", ...
// Wait creates an HTTP handler on pidURL, and serves the current process // pid on it. It then creates a signal handler and waits for SIGTERM or // SIGUSR1, and returns when the signal is received. A new server that comes // up will query this URL. If it receives a valid response, it will send a // SIGUSR1 signal and ...
[ "Wait", "creates", "an", "HTTP", "handler", "on", "pidURL", "and", "serves", "the", "current", "process", "pid", "on", "it", ".", "It", "then", "creates", "a", "signal", "handler", "and", "waits", "for", "SIGTERM", "or", "SIGUSR1", "and", "returns", "when"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/proc/proc.go#L55-L64
135,769
vitessio/vitess
go/proc/proc.go
ListenAndServe
func ListenAndServe(port string) os.Signal { l, err := Listen(port) if err != nil { log.Fatalf("%s", err) } go http.Serve(l, nil) s := Wait() l.Close() return s }
go
func ListenAndServe(port string) os.Signal { l, err := Listen(port) if err != nil { log.Fatalf("%s", err) } go http.Serve(l, nil) s := Wait() l.Close() return s }
[ "func", "ListenAndServe", "(", "port", "string", ")", "os", ".", "Signal", "{", "l", ",", "err", ":=", "Listen", "(", "port", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatalf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "go...
// ListenAndServe combines Listen and Wait to also run an http // server on the specified port. If it fails to obtain a listener, // the program is fatally terminated. The return value is the signal // received for termination
[ "ListenAndServe", "combines", "Listen", "and", "Wait", "to", "also", "run", "an", "http", "server", "on", "the", "specified", "port", ".", "If", "it", "fails", "to", "obtain", "a", "listener", "the", "program", "is", "fatally", "terminated", ".", "The", "r...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/proc/proc.go#L70-L79
135,770
vitessio/vitess
go/vt/callerid/callerid.go
NewEffectiveCallerID
func NewEffectiveCallerID(principal string, component string, subComponent string) *vtrpcpb.CallerID { return &vtrpcpb.CallerID{Principal: principal, Component: component, Subcomponent: subComponent} }
go
func NewEffectiveCallerID(principal string, component string, subComponent string) *vtrpcpb.CallerID { return &vtrpcpb.CallerID{Principal: principal, Component: component, Subcomponent: subComponent} }
[ "func", "NewEffectiveCallerID", "(", "principal", "string", ",", "component", "string", ",", "subComponent", "string", ")", "*", "vtrpcpb", ".", "CallerID", "{", "return", "&", "vtrpcpb", ".", "CallerID", "{", "Principal", ":", "principal", ",", "Component", "...
// NewEffectiveCallerID creates a new vtrpcpb.CallerID with principal, component and // subComponent
[ "NewEffectiveCallerID", "creates", "a", "new", "vtrpcpb", ".", "CallerID", "with", "principal", "component", "and", "subComponent" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/callerid/callerid.go#L53-L55
135,771
vitessio/vitess
go/mysql/binlog_event_json.go
printJSONData
func printJSONData(data []byte) ([]byte, error) { // It's possible for data to be empty. If so, we have to // treat it as 'null'. // The mysql code also says why, but this wasn't reproduceable: // https://github.com/mysql/mysql-server/blob/8.0/sql/json_binary.cc#L1070 if len(data) == 0 { return []byte("'null'"),...
go
func printJSONData(data []byte) ([]byte, error) { // It's possible for data to be empty. If so, we have to // treat it as 'null'. // The mysql code also says why, but this wasn't reproduceable: // https://github.com/mysql/mysql-server/blob/8.0/sql/json_binary.cc#L1070 if len(data) == 0 { return []byte("'null'"),...
[ "func", "printJSONData", "(", "data", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "// It's possible for data to be empty. If so, we have to", "// treat it as 'null'.", "// The mysql code also says why, but this wasn't reproduceable:", "// https://githu...
// printJSONData parses the MySQL binary format for JSON data, and prints // the result as a string.
[ "printJSONData", "parses", "the", "MySQL", "binary", "format", "for", "JSON", "data", "and", "prints", "the", "result", "as", "a", "string", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_json.go#L55-L69
135,772
vitessio/vitess
go/vt/vttablet/tabletserver/status.go
AddStatusPart
func (tsv *TabletServer) AddStatusPart() { servenv.AddStatusPart("Queryservice", queryserviceStatusTemplate, func() interface{} { status := queryserviceStatus{ State: tsv.GetState(), History: tsv.history.Records(), } rates := tabletenv.QPSRates.Get() if qps, ok := rates["All"]; ok && len(qps) > 0 { ...
go
func (tsv *TabletServer) AddStatusPart() { servenv.AddStatusPart("Queryservice", queryserviceStatusTemplate, func() interface{} { status := queryserviceStatus{ State: tsv.GetState(), History: tsv.history.Records(), } rates := tabletenv.QPSRates.Get() if qps, ok := rates["All"]; ok && len(qps) > 0 { ...
[ "func", "(", "tsv", "*", "TabletServer", ")", "AddStatusPart", "(", ")", "{", "servenv", ".", "AddStatusPart", "(", "\"", "\"", ",", "queryserviceStatusTemplate", ",", "func", "(", ")", "interface", "{", "}", "{", "status", ":=", "queryserviceStatus", "{", ...
// AddStatusPart registers the status part for the status page.
[ "AddStatusPart", "registers", "the", "status", "part", "for", "the", "status", "page", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/status.go#L130-L142
135,773
vitessio/vitess
go/trace/utils.go
LogErrorsWhenClosing
func LogErrorsWhenClosing(in io.Closer) func() { return func() { err := in.Close() if err != nil { log.Error(err) } } }
go
func LogErrorsWhenClosing(in io.Closer) func() { return func() { err := in.Close() if err != nil { log.Error(err) } } }
[ "func", "LogErrorsWhenClosing", "(", "in", "io", ".", "Closer", ")", "func", "(", ")", "{", "return", "func", "(", ")", "{", "err", ":=", "in", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Error", "(", "err", ")", "...
// LogErrorsWhenClosing will close the provided Closer, and log any errors it generates
[ "LogErrorsWhenClosing", "will", "close", "the", "provided", "Closer", "and", "log", "any", "errors", "it", "generates" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/trace/utils.go#L26-L33
135,774
vitessio/vitess
go/vt/mysqlctl/mycnf_flag.go
RegisterFlags
func RegisterFlags() { flagServerID = flag.Int("mycnf_server_id", 0, "mysql server id of the server (if specified, mycnf-file will be ignored)") flagMysqlPort = flag.Int("mycnf_mysql_port", 0, "port mysql is listening on") flagDataDir = flag.String("mycnf_data_dir", "", "data directory for mysql") flagInnodbDataHom...
go
func RegisterFlags() { flagServerID = flag.Int("mycnf_server_id", 0, "mysql server id of the server (if specified, mycnf-file will be ignored)") flagMysqlPort = flag.Int("mycnf_mysql_port", 0, "port mysql is listening on") flagDataDir = flag.String("mycnf_data_dir", "", "data directory for mysql") flagInnodbDataHom...
[ "func", "RegisterFlags", "(", ")", "{", "flagServerID", "=", "flag", ".", "Int", "(", "\"", "\"", ",", "0", ",", "\"", "\"", ")", "\n", "flagMysqlPort", "=", "flag", ".", "Int", "(", "\"", "\"", ",", "0", ",", "\"", "\"", ")", "\n", "flagDataDir"...
// RegisterFlags registers the command line flags for // specifying the values of a mycnf config file. See NewMycnfFromFlags // to get the supported modes.
[ "RegisterFlags", "registers", "the", "command", "line", "flags", "for", "specifying", "the", "values", "of", "a", "mycnf", "config", "file", ".", "See", "NewMycnfFromFlags", "to", "get", "the", "supported", "modes", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/mycnf_flag.go#L56-L76
135,775
vitessio/vitess
go/stats/timings.go
NewTimings
func NewTimings(name, help, label string, categories ...string) *Timings { t := &Timings{ histograms: make(map[string]*Histogram), help: help, label: label, } for _, cat := range categories { t.histograms[cat] = NewGenericHistogram("", "", bucketCutoffs, bucketLabels, "Count", "Time") } if name ...
go
func NewTimings(name, help, label string, categories ...string) *Timings { t := &Timings{ histograms: make(map[string]*Histogram), help: help, label: label, } for _, cat := range categories { t.histograms[cat] = NewGenericHistogram("", "", bucketCutoffs, bucketLabels, "Count", "Time") } if name ...
[ "func", "NewTimings", "(", "name", ",", "help", ",", "label", "string", ",", "categories", "...", "string", ")", "*", "Timings", "{", "t", ":=", "&", "Timings", "{", "histograms", ":", "make", "(", "map", "[", "string", "]", "*", "Histogram", ")", ",...
// NewTimings creates a new Timings object, and publishes it if name is set. // categories is an optional list of categories to initialize to 0. // Categories that aren't initialized will be missing from the map until the // first time they are updated.
[ "NewTimings", "creates", "a", "new", "Timings", "object", "and", "publishes", "it", "if", "name", "is", "set", ".", "categories", "is", "an", "optional", "list", "of", "categories", "to", "initialize", "to", "0", ".", "Categories", "that", "aren", "t", "in...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/timings.go#L48-L62
135,776
vitessio/vitess
go/stats/timings.go
safeJoinLabels
func safeJoinLabels(labels []string) string { sanitizedLabels := make([]string, len(labels)) for idx, label := range labels { sanitizedLabels[idx] = safeLabel(label) } return strings.Join(sanitizedLabels, ".") }
go
func safeJoinLabels(labels []string) string { sanitizedLabels := make([]string, len(labels)) for idx, label := range labels { sanitizedLabels[idx] = safeLabel(label) } return strings.Join(sanitizedLabels, ".") }
[ "func", "safeJoinLabels", "(", "labels", "[", "]", "string", ")", "string", "{", "sanitizedLabels", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "labels", ")", ")", "\n", "for", "idx", ",", "label", ":=", "range", "labels", "{", "sanitizedLa...
// safeJoinLabels joins the label values with ".", but first replaces any existing // "." characters in the labels with the proper replacement, to avoid issues parsing // them apart later.
[ "safeJoinLabels", "joins", "the", "label", "values", "with", ".", "but", "first", "replaces", "any", "existing", ".", "characters", "in", "the", "labels", "with", "the", "proper", "replacement", "to", "avoid", "issues", "parsing", "them", "apart", "later", "."...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/stats/timings.go#L214-L220
135,777
vitessio/vitess
go/vt/vtgate/buffer/buffer.go
mode
func (b *Buffer) mode(keyspace, shard string) bufferMode { // Actual buffering is enabled if // a) no keyspaces and shards were listed in particular, if *enabled && len(b.keyspaces) == 0 && len(b.shards) == 0 { // No explicit whitelist given i.e. all shards should be buffered. return bufferEnabled } // b) or t...
go
func (b *Buffer) mode(keyspace, shard string) bufferMode { // Actual buffering is enabled if // a) no keyspaces and shards were listed in particular, if *enabled && len(b.keyspaces) == 0 && len(b.shards) == 0 { // No explicit whitelist given i.e. all shards should be buffered. return bufferEnabled } // b) or t...
[ "func", "(", "b", "*", "Buffer", ")", "mode", "(", "keyspace", ",", "shard", "string", ")", "bufferMode", "{", "// Actual buffering is enabled if", "// a) no keyspaces and shards were listed in particular,", "if", "*", "enabled", "&&", "len", "(", "b", ".", "keyspac...
// mode determines for the given keyspace and shard if buffering, dry-run // buffering or no buffering at all should be enabled.
[ "mode", "determines", "for", "the", "given", "keyspace", "and", "shard", "if", "buffering", "dry", "-", "run", "buffering", "or", "no", "buffering", "at", "all", "should", "be", "enabled", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/buffer/buffer.go#L158-L180
135,778
vitessio/vitess
go/vt/vtgate/buffer/buffer.go
StatsUpdate
func (b *Buffer) StatsUpdate(ts *discovery.TabletStats) { if ts.Target.TabletType != topodatapb.TabletType_MASTER { panic(fmt.Sprintf("BUG: non MASTER TabletStats object must not be forwarded: %#v", ts)) } timestamp := ts.TabletExternallyReparentedTimestamp if timestamp == 0 { // Masters where TabletExternally...
go
func (b *Buffer) StatsUpdate(ts *discovery.TabletStats) { if ts.Target.TabletType != topodatapb.TabletType_MASTER { panic(fmt.Sprintf("BUG: non MASTER TabletStats object must not be forwarded: %#v", ts)) } timestamp := ts.TabletExternallyReparentedTimestamp if timestamp == 0 { // Masters where TabletExternally...
[ "func", "(", "b", "*", "Buffer", ")", "StatsUpdate", "(", "ts", "*", "discovery", ".", "TabletStats", ")", "{", "if", "ts", ".", "Target", ".", "TabletType", "!=", "topodatapb", ".", "TabletType_MASTER", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "...
// StatsUpdate keeps track of the "tablet_externally_reparented_timestamp" of // each master. This way we can detect the end of a failover. // It is part of the discovery.HealthCheckStatsListener interface.
[ "StatsUpdate", "keeps", "track", "of", "the", "tablet_externally_reparented_timestamp", "of", "each", "master", ".", "This", "way", "we", "can", "detect", "the", "end", "of", "a", "failover", ".", "It", "is", "part", "of", "the", "discovery", ".", "HealthCheck...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/buffer/buffer.go#L219-L237
135,779
vitessio/vitess
go/vt/vtgate/buffer/buffer.go
getOrCreateBuffer
func (b *Buffer) getOrCreateBuffer(keyspace, shard string) *shardBuffer { key := topoproto.KeyspaceShardString(keyspace, shard) b.mu.RLock() sb, ok := b.buffers[key] stopped := b.stopped b.mu.RUnlock() if stopped { return nil } if ok { return sb } b.mu.Lock() defer b.mu.Unlock() // Look it up again be...
go
func (b *Buffer) getOrCreateBuffer(keyspace, shard string) *shardBuffer { key := topoproto.KeyspaceShardString(keyspace, shard) b.mu.RLock() sb, ok := b.buffers[key] stopped := b.stopped b.mu.RUnlock() if stopped { return nil } if ok { return sb } b.mu.Lock() defer b.mu.Unlock() // Look it up again be...
[ "func", "(", "b", "*", "Buffer", ")", "getOrCreateBuffer", "(", "keyspace", ",", "shard", "string", ")", "*", "shardBuffer", "{", "key", ":=", "topoproto", ".", "KeyspaceShardString", "(", "keyspace", ",", "shard", ")", "\n", "b", ".", "mu", ".", "RLock"...
// getOrCreateBuffer returns the ShardBuffer for the given keyspace and shard. // It returns nil if Buffer is shut down and all calls should be ignored.
[ "getOrCreateBuffer", "returns", "the", "ShardBuffer", "for", "the", "given", "keyspace", "and", "shard", ".", "It", "returns", "nil", "if", "Buffer", "is", "shut", "down", "and", "all", "calls", "should", "be", "ignored", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/buffer/buffer.go#L272-L295
135,780
vitessio/vitess
go/vt/topo/shard.go
addCells
func addCells(left, right []string) []string { if len(left) == 0 || len(right) == 0 { return nil } for _, cell := range right { if !InCellList(cell, left) { left = append(left, cell) } } return left }
go
func addCells(left, right []string) []string { if len(left) == 0 || len(right) == 0 { return nil } for _, cell := range right { if !InCellList(cell, left) { left = append(left, cell) } } return left }
[ "func", "addCells", "(", "left", ",", "right", "[", "]", "string", ")", "[", "]", "string", "{", "if", "len", "(", "left", ")", "==", "0", "||", "len", "(", "right", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "for", "_", ",", "c...
// Functions for dealing with shard representations in topology. // addCells will merge both cells list, settling on nil if either list is empty
[ "Functions", "for", "dealing", "with", "shard", "representations", "in", "topology", ".", "addCells", "will", "merge", "both", "cells", "list", "settling", "on", "nil", "if", "either", "list", "is", "empty" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L48-L59
135,781
vitessio/vitess
go/vt/topo/shard.go
removeCellsFromList
func removeCellsFromList(toRemove, fullList []string) []string { leftoverCells := make([]string, 0) for _, cell := range fullList { if !InCellList(cell, toRemove) { leftoverCells = append(leftoverCells, cell) } } return leftoverCells }
go
func removeCellsFromList(toRemove, fullList []string) []string { leftoverCells := make([]string, 0) for _, cell := range fullList { if !InCellList(cell, toRemove) { leftoverCells = append(leftoverCells, cell) } } return leftoverCells }
[ "func", "removeCellsFromList", "(", "toRemove", ",", "fullList", "[", "]", "string", ")", "[", "]", "string", "{", "leftoverCells", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n", "for", "_", ",", "cell", ":=", "range", "fullList", "{", "...
// removeCellsFromList will remove the cells from the provided list. It returns // the new list, and a boolean that indicates the returned list is empty.
[ "removeCellsFromList", "will", "remove", "the", "cells", "from", "the", "provided", "list", ".", "It", "returns", "the", "new", "list", "and", "a", "boolean", "that", "indicates", "the", "returned", "list", "is", "empty", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L63-L71
135,782
vitessio/vitess
go/vt/topo/shard.go
removeCells
func removeCells(cells, toRemove, fullList []string) ([]string, bool) { // The assumption here is we already migrated something, // and we're reverting that part. So we're gonna remove // records only. leftoverCells := make([]string, 0, len(cells)) if len(cells) == 0 { // we migrated all the cells already, take ...
go
func removeCells(cells, toRemove, fullList []string) ([]string, bool) { // The assumption here is we already migrated something, // and we're reverting that part. So we're gonna remove // records only. leftoverCells := make([]string, 0, len(cells)) if len(cells) == 0 { // we migrated all the cells already, take ...
[ "func", "removeCells", "(", "cells", ",", "toRemove", ",", "fullList", "[", "]", "string", ")", "(", "[", "]", "string", ",", "bool", ")", "{", "// The assumption here is we already migrated something,", "// and we're reverting that part. So we're gonna remove", "// recor...
// removeCells will remove the cells from the provided list. It returns // the new list, and a boolean that indicates the returned list is empty.
[ "removeCells", "will", "remove", "the", "cells", "from", "the", "provided", "list", ".", "It", "returns", "the", "new", "list", "and", "a", "boolean", "that", "indicates", "the", "returned", "list", "is", "empty", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L75-L104
135,783
vitessio/vitess
go/vt/topo/shard.go
ValidateShardName
func ValidateShardName(shard string) (string, *topodatapb.KeyRange, error) { if !IsShardUsingRangeBasedSharding(shard) { return shard, nil, nil } parts := strings.Split(shard, "-") if len(parts) != 2 { return "", nil, vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "invalid shardId, can only contain one '-': %v",...
go
func ValidateShardName(shard string) (string, *topodatapb.KeyRange, error) { if !IsShardUsingRangeBasedSharding(shard) { return shard, nil, nil } parts := strings.Split(shard, "-") if len(parts) != 2 { return "", nil, vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "invalid shardId, can only contain one '-': %v",...
[ "func", "ValidateShardName", "(", "shard", "string", ")", "(", "string", ",", "*", "topodatapb", ".", "KeyRange", ",", "error", ")", "{", "if", "!", "IsShardUsingRangeBasedSharding", "(", "shard", ")", "{", "return", "shard", ",", "nil", ",", "nil", "\n", ...
// ValidateShardName takes a shard name and sanitizes it, and also returns // the KeyRange.
[ "ValidateShardName", "takes", "a", "shard", "name", "and", "sanitizes", "it", "and", "also", "returns", "the", "KeyRange", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L114-L134
135,784
vitessio/vitess
go/vt/topo/shard.go
GetShard
func (ts *Server) GetShard(ctx context.Context, keyspace, shard string) (*ShardInfo, error) { span, ctx := trace.NewSpan(ctx, "TopoServer.GetShard") span.Annotate("keyspace", keyspace) span.Annotate("shard", shard) defer span.Finish() shardPath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardFile) ...
go
func (ts *Server) GetShard(ctx context.Context, keyspace, shard string) (*ShardInfo, error) { span, ctx := trace.NewSpan(ctx, "TopoServer.GetShard") span.Annotate("keyspace", keyspace) span.Annotate("shard", shard) defer span.Finish() shardPath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardFile) ...
[ "func", "(", "ts", "*", "Server", ")", "GetShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ")", "(", "*", "ShardInfo", ",", "error", ")", "{", "span", ",", "ctx", ":=", "trace", ".", "NewSpan", "(", "ctx", ",...
// GetShard is a high level function to read shard data. // It generates trace spans.
[ "GetShard", "is", "a", "high", "level", "function", "to", "read", "shard", "data", ".", "It", "generates", "trace", "spans", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L179-L201
135,785
vitessio/vitess
go/vt/topo/shard.go
updateShard
func (ts *Server) updateShard(ctx context.Context, si *ShardInfo) error { span, ctx := trace.NewSpan(ctx, "TopoServer.UpdateShard") span.Annotate("keyspace", si.keyspace) span.Annotate("shard", si.shardName) defer span.Finish() data, err := proto.Marshal(si.Shard) if err != nil { return err } shardPath := pa...
go
func (ts *Server) updateShard(ctx context.Context, si *ShardInfo) error { span, ctx := trace.NewSpan(ctx, "TopoServer.UpdateShard") span.Annotate("keyspace", si.keyspace) span.Annotate("shard", si.shardName) defer span.Finish() data, err := proto.Marshal(si.Shard) if err != nil { return err } shardPath := pa...
[ "func", "(", "ts", "*", "Server", ")", "updateShard", "(", "ctx", "context", ".", "Context", ",", "si", "*", "ShardInfo", ")", "error", "{", "span", ",", "ctx", ":=", "trace", ".", "NewSpan", "(", "ctx", ",", "\"", "\"", ")", "\n", "span", ".", "...
// updateShard updates the shard data, with the right version. // It also creates a span, and dispatches the event.
[ "updateShard", "updates", "the", "shard", "data", "with", "the", "right", "version", ".", "It", "also", "creates", "a", "span", "and", "dispatches", "the", "event", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L205-L229
135,786
vitessio/vitess
go/vt/topo/shard.go
UpdateShardFields
func (ts *Server) UpdateShardFields(ctx context.Context, keyspace, shard string, update func(*ShardInfo) error) (*ShardInfo, error) { for { si, err := ts.GetShard(ctx, keyspace, shard) if err != nil { return nil, err } if err = update(si); err != nil { if IsErrType(err, NoUpdateNeeded) { return nil, ...
go
func (ts *Server) UpdateShardFields(ctx context.Context, keyspace, shard string, update func(*ShardInfo) error) (*ShardInfo, error) { for { si, err := ts.GetShard(ctx, keyspace, shard) if err != nil { return nil, err } if err = update(si); err != nil { if IsErrType(err, NoUpdateNeeded) { return nil, ...
[ "func", "(", "ts", "*", "Server", ")", "UpdateShardFields", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "update", "func", "(", "*", "ShardInfo", ")", "error", ")", "(", "*", "ShardInfo", ",", "error", ")", "{", ...
// UpdateShardFields is a high level helper to read a shard record, call an // update function on it, and then write it back. If the write fails due to // a version mismatch, it will re-read the record and retry the update. // If the update succeeds, it returns the updated ShardInfo. // If the update method returns Err...
[ "UpdateShardFields", "is", "a", "high", "level", "helper", "to", "read", "a", "shard", "record", "call", "an", "update", "function", "on", "it", "and", "then", "write", "it", "back", ".", "If", "the", "write", "fails", "due", "to", "a", "version", "misma...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L240-L256
135,787
vitessio/vitess
go/vt/topo/shard.go
CreateShard
func (ts *Server) CreateShard(ctx context.Context, keyspace, shard string) (err error) { // Lock the keyspace, because we'll be looking at ServedTypes. ctx, unlock, lockErr := ts.LockKeyspace(ctx, keyspace, "CreateShard") if lockErr != nil { return lockErr } defer unlock(&err) // validate parameters name, key...
go
func (ts *Server) CreateShard(ctx context.Context, keyspace, shard string) (err error) { // Lock the keyspace, because we'll be looking at ServedTypes. ctx, unlock, lockErr := ts.LockKeyspace(ctx, keyspace, "CreateShard") if lockErr != nil { return lockErr } defer unlock(&err) // validate parameters name, key...
[ "func", "(", "ts", "*", "Server", ")", "CreateShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ")", "(", "err", "error", ")", "{", "// Lock the keyspace, because we'll be looking at ServedTypes.", "ctx", ",", "unlock", ",",...
// CreateShard creates a new shard and tries to fill in the right information. // This will lock the Keyspace, as we may be looking at other shard servedTypes. // Using GetOrCreateShard is probably a better idea for most use cases.
[ "CreateShard", "creates", "a", "new", "shard", "and", "tries", "to", "fill", "in", "the", "right", "information", ".", "This", "will", "lock", "the", "Keyspace", "as", "we", "may", "be", "looking", "at", "other", "shard", "servedTypes", ".", "Using", "GetO...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L261-L319
135,788
vitessio/vitess
go/vt/topo/shard.go
GetOrCreateShard
func (ts *Server) GetOrCreateShard(ctx context.Context, keyspace, shard string) (si *ShardInfo, err error) { si, err = ts.GetShard(ctx, keyspace, shard) if !IsErrType(err, NoNode) { return } // create the keyspace, maybe it already exists if err = ts.CreateKeyspace(ctx, keyspace, &topodatapb.Keyspace{}); err !=...
go
func (ts *Server) GetOrCreateShard(ctx context.Context, keyspace, shard string) (si *ShardInfo, err error) { si, err = ts.GetShard(ctx, keyspace, shard) if !IsErrType(err, NoNode) { return } // create the keyspace, maybe it already exists if err = ts.CreateKeyspace(ctx, keyspace, &topodatapb.Keyspace{}); err !=...
[ "func", "(", "ts", "*", "Server", ")", "GetOrCreateShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ")", "(", "si", "*", "ShardInfo", ",", "err", "error", ")", "{", "si", ",", "err", "=", "ts", ".", "GetShard", ...
// GetOrCreateShard will return the shard object, or create one if it doesn't // already exist. Note the shard creation is protected by a keyspace Lock.
[ "GetOrCreateShard", "will", "return", "the", "shard", "object", "or", "create", "one", "if", "it", "doesn", "t", "already", "exist", ".", "Note", "the", "shard", "creation", "is", "protected", "by", "a", "keyspace", "Lock", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L323-L342
135,789
vitessio/vitess
go/vt/topo/shard.go
DeleteShard
func (ts *Server) DeleteShard(ctx context.Context, keyspace, shard string) error { shardPath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardFile) if err := ts.globalCell.Delete(ctx, shardPath, nil); err != nil { return err } event.Dispatch(&events.ShardChange{ KeyspaceName: keyspace, ShardName:...
go
func (ts *Server) DeleteShard(ctx context.Context, keyspace, shard string) error { shardPath := path.Join(KeyspacesPath, keyspace, ShardsPath, shard, ShardFile) if err := ts.globalCell.Delete(ctx, shardPath, nil); err != nil { return err } event.Dispatch(&events.ShardChange{ KeyspaceName: keyspace, ShardName:...
[ "func", "(", "ts", "*", "Server", ")", "DeleteShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ")", "error", "{", "shardPath", ":=", "path", ".", "Join", "(", "KeyspacesPath", ",", "keyspace", ",", "ShardsPath", ","...
// DeleteShard wraps the underlying conn.Delete // and dispatches the event.
[ "DeleteShard", "wraps", "the", "underlying", "conn", ".", "Delete", "and", "dispatches", "the", "event", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L346-L358
135,790
vitessio/vitess
go/vt/topo/shard.go
GetTabletControl
func (si *ShardInfo) GetTabletControl(tabletType topodatapb.TabletType) *topodatapb.Shard_TabletControl { for _, tc := range si.TabletControls { if tc.TabletType == tabletType { return tc } } return nil }
go
func (si *ShardInfo) GetTabletControl(tabletType topodatapb.TabletType) *topodatapb.Shard_TabletControl { for _, tc := range si.TabletControls { if tc.TabletType == tabletType { return tc } } return nil }
[ "func", "(", "si", "*", "ShardInfo", ")", "GetTabletControl", "(", "tabletType", "topodatapb", ".", "TabletType", ")", "*", "topodatapb", ".", "Shard_TabletControl", "{", "for", "_", ",", "tc", ":=", "range", "si", ".", "TabletControls", "{", "if", "tc", "...
// GetTabletControl returns the Shard_TabletControl for the given tablet type, // or nil if it is not in the map.
[ "GetTabletControl", "returns", "the", "Shard_TabletControl", "for", "the", "given", "tablet", "type", "or", "nil", "if", "it", "is", "not", "in", "the", "map", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L362-L369
135,791
vitessio/vitess
go/vt/topo/shard.go
GetServedType
func (si *ShardInfo) GetServedType(tabletType topodatapb.TabletType) *topodatapb.Shard_ServedType { for _, st := range si.ServedTypes { if st.TabletType == tabletType { return st } } return nil }
go
func (si *ShardInfo) GetServedType(tabletType topodatapb.TabletType) *topodatapb.Shard_ServedType { for _, st := range si.ServedTypes { if st.TabletType == tabletType { return st } } return nil }
[ "func", "(", "si", "*", "ShardInfo", ")", "GetServedType", "(", "tabletType", "topodatapb", ".", "TabletType", ")", "*", "topodatapb", ".", "Shard_ServedType", "{", "for", "_", ",", "st", ":=", "range", "si", ".", "ServedTypes", "{", "if", "st", ".", "Ta...
// GetServedType returns the Shard_ServedType for a TabletType, or nil
[ "GetServedType", "returns", "the", "Shard_ServedType", "for", "a", "TabletType", "or", "nil" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L433-L440
135,792
vitessio/vitess
go/vt/topo/shard.go
InCellList
func InCellList(cell string, cells []string) bool { if len(cells) == 0 { return true } for _, c := range cells { if c == cell { return true } } return false }
go
func InCellList(cell string, cells []string) bool { if len(cells) == 0 { return true } for _, c := range cells { if c == cell { return true } } return false }
[ "func", "InCellList", "(", "cell", "string", ",", "cells", "[", "]", "string", ")", "bool", "{", "if", "len", "(", "cells", ")", "==", "0", "{", "return", "true", "\n", "}", "\n", "for", "_", ",", "c", ":=", "range", "cells", "{", "if", "c", "=...
// // Utility functions for shards // // InCellList returns true if the cell list is empty, // or if the passed cell is in the cell list.
[ "Utility", "functions", "for", "shards", "InCellList", "returns", "true", "if", "the", "cell", "list", "is", "empty", "or", "if", "the", "passed", "cell", "is", "in", "the", "cell", "list", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L448-L458
135,793
vitessio/vitess
go/vt/topo/shard.go
FindAllTabletAliasesInShard
func (ts *Server) FindAllTabletAliasesInShard(ctx context.Context, keyspace, shard string) ([]*topodatapb.TabletAlias, error) { return ts.FindAllTabletAliasesInShardByCell(ctx, keyspace, shard, nil) }
go
func (ts *Server) FindAllTabletAliasesInShard(ctx context.Context, keyspace, shard string) ([]*topodatapb.TabletAlias, error) { return ts.FindAllTabletAliasesInShardByCell(ctx, keyspace, shard, nil) }
[ "func", "(", "ts", "*", "Server", ")", "FindAllTabletAliasesInShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ")", "(", "[", "]", "*", "topodatapb", ".", "TabletAlias", ",", "error", ")", "{", "return", "ts", ".", ...
// FindAllTabletAliasesInShard uses the replication graph to find all the // tablet aliases in the given shard. // // It can return ErrPartialResult if some cells were not fetched, // in which case the result only contains the cells that were fetched. // // The tablet aliases are sorted by cell, then by UID.
[ "FindAllTabletAliasesInShard", "uses", "the", "replication", "graph", "to", "find", "all", "the", "tablet", "aliases", "in", "the", "given", "shard", ".", "It", "can", "return", "ErrPartialResult", "if", "some", "cells", "were", "not", "fetched", "in", "which", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L467-L469
135,794
vitessio/vitess
go/vt/topo/shard.go
FindAllTabletAliasesInShardByCell
func (ts *Server) FindAllTabletAliasesInShardByCell(ctx context.Context, keyspace, shard string, cells []string) ([]*topodatapb.TabletAlias, error) { span, ctx := trace.NewSpan(ctx, "topo.FindAllTabletAliasesInShardbyCell") span.Annotate("keyspace", keyspace) span.Annotate("shard", shard) span.Annotate("num_cells",...
go
func (ts *Server) FindAllTabletAliasesInShardByCell(ctx context.Context, keyspace, shard string, cells []string) ([]*topodatapb.TabletAlias, error) { span, ctx := trace.NewSpan(ctx, "topo.FindAllTabletAliasesInShardbyCell") span.Annotate("keyspace", keyspace) span.Annotate("shard", shard) span.Annotate("num_cells",...
[ "func", "(", "ts", "*", "Server", ")", "FindAllTabletAliasesInShardByCell", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ",", "cells", "[", "]", "string", ")", "(", "[", "]", "*", "topodatapb", ".", "TabletAlias", ",", ...
// FindAllTabletAliasesInShardByCell uses the replication graph to find all the // tablet aliases in the given shard. // // It can return ErrPartialResult if some cells were not fetched, // in which case the result only contains the cells that were fetched. // // The tablet aliases are sorted by cell, then by UID.
[ "FindAllTabletAliasesInShardByCell", "uses", "the", "replication", "graph", "to", "find", "all", "the", "tablet", "aliases", "in", "the", "given", "shard", ".", "It", "can", "return", "ErrPartialResult", "if", "some", "cells", "were", "not", "fetched", "in", "wh...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/shard.go#L478-L546
135,795
vitessio/vitess
go/mysql/gtid.go
ParseGTID
func ParseGTID(flavor, value string) (GTID, error) { parser := gtidParsers[flavor] if parser == nil { return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "parse error: unknown GTID flavor %#v", flavor) } return parser(value) }
go
func ParseGTID(flavor, value string) (GTID, error) { parser := gtidParsers[flavor] if parser == nil { return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "parse error: unknown GTID flavor %#v", flavor) } return parser(value) }
[ "func", "ParseGTID", "(", "flavor", ",", "value", "string", ")", "(", "GTID", ",", "error", ")", "{", "parser", ":=", "gtidParsers", "[", "flavor", "]", "\n", "if", "parser", "==", "nil", "{", "return", "nil", ",", "vterrors", ".", "Errorf", "(", "vt...
// ParseGTID calls the GTID parser for the specified flavor.
[ "ParseGTID", "calls", "the", "GTID", "parser", "for", "the", "specified", "flavor", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/gtid.go#L63-L69
135,796
vitessio/vitess
go/mysql/gtid.go
MustParseGTID
func MustParseGTID(flavor, value string) GTID { gtid, err := ParseGTID(flavor, value) if err != nil { panic(err) } return gtid }
go
func MustParseGTID(flavor, value string) GTID { gtid, err := ParseGTID(flavor, value) if err != nil { panic(err) } return gtid }
[ "func", "MustParseGTID", "(", "flavor", ",", "value", "string", ")", "GTID", "{", "gtid", ",", "err", ":=", "ParseGTID", "(", "flavor", ",", "value", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "gt...
// MustParseGTID calls ParseGTID and panics on error.
[ "MustParseGTID", "calls", "ParseGTID", "and", "panics", "on", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/gtid.go#L72-L78
135,797
vitessio/vitess
go/mysql/gtid.go
EncodeGTID
func EncodeGTID(gtid GTID) string { if gtid == nil { return "" } return fmt.Sprintf("%s/%s", gtid.Flavor(), gtid.String()) }
go
func EncodeGTID(gtid GTID) string { if gtid == nil { return "" } return fmt.Sprintf("%s/%s", gtid.Flavor(), gtid.String()) }
[ "func", "EncodeGTID", "(", "gtid", "GTID", ")", "string", "{", "if", "gtid", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "gtid", ".", "Flavor", "(", ")", ",", "gtid", ".", "Str...
// EncodeGTID returns a string that contains both the flavor and value of the // GTID, so that the correct parser can be selected when that string is passed // to DecodeGTID.
[ "EncodeGTID", "returns", "a", "string", "that", "contains", "both", "the", "flavor", "and", "value", "of", "the", "GTID", "so", "that", "the", "correct", "parser", "can", "be", "selected", "when", "that", "string", "is", "passed", "to", "DecodeGTID", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/gtid.go#L83-L89
135,798
vitessio/vitess
go/mysql/gtid.go
DecodeGTID
func DecodeGTID(s string) (GTID, error) { if s == "" { return nil, nil } parts := strings.SplitN(s, "/", 2) if len(parts) != 2 { // There is no flavor. Try looking for a default parser. return ParseGTID("", s) } return ParseGTID(parts[0], parts[1]) }
go
func DecodeGTID(s string) (GTID, error) { if s == "" { return nil, nil } parts := strings.SplitN(s, "/", 2) if len(parts) != 2 { // There is no flavor. Try looking for a default parser. return ParseGTID("", s) } return ParseGTID(parts[0], parts[1]) }
[ "func", "DecodeGTID", "(", "s", "string", ")", "(", "GTID", ",", "error", ")", "{", "if", "s", "==", "\"", "\"", "{", "return", "nil", ",", "nil", "\n", "}", "\n\n", "parts", ":=", "strings", ".", "SplitN", "(", "s", ",", "\"", "\"", ",", "2", ...
// DecodeGTID converts a string in the format returned by EncodeGTID back into // a GTID interface value with the correct underlying flavor.
[ "DecodeGTID", "converts", "a", "string", "in", "the", "format", "returned", "by", "EncodeGTID", "back", "into", "a", "GTID", "interface", "value", "with", "the", "correct", "underlying", "flavor", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/gtid.go#L93-L104
135,799
vitessio/vitess
go/mysql/gtid.go
MustDecodeGTID
func MustDecodeGTID(s string) GTID { gtid, err := DecodeGTID(s) if err != nil { panic(err) } return gtid }
go
func MustDecodeGTID(s string) GTID { gtid, err := DecodeGTID(s) if err != nil { panic(err) } return gtid }
[ "func", "MustDecodeGTID", "(", "s", "string", ")", "GTID", "{", "gtid", ",", "err", ":=", "DecodeGTID", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "gtid", "\n", "}" ]
// MustDecodeGTID calls DecodeGTID and panics on error.
[ "MustDecodeGTID", "calls", "DecodeGTID", "and", "panics", "on", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/gtid.go#L107-L113