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,600 | vitessio/vitess | go/vt/vtgate/engine/merge_sort.go | mergeSort | func mergeSort(vcursor VCursor, query string, orderBy []OrderbyParams, rss []*srvtopo.ResolvedShard, bvs []map[string]*querypb.BindVariable, callback func(*sqltypes.Result) error) error {
ctx, cancel := context.WithCancel(vcursor.Context())
defer cancel()
handles := make([]*streamHandle, len(rss))
id := 0
for i, ... | go | func mergeSort(vcursor VCursor, query string, orderBy []OrderbyParams, rss []*srvtopo.ResolvedShard, bvs []map[string]*querypb.BindVariable, callback func(*sqltypes.Result) error) error {
ctx, cancel := context.WithCancel(vcursor.Context())
defer cancel()
handles := make([]*streamHandle, len(rss))
id := 0
for i, ... | [
"func",
"mergeSort",
"(",
"vcursor",
"VCursor",
",",
"query",
"string",
",",
"orderBy",
"[",
"]",
"OrderbyParams",
",",
"rss",
"[",
"]",
"*",
"srvtopo",
".",
"ResolvedShard",
",",
"bvs",
"[",
"]",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVa... | // mergeSort performs a merge-sort of rows returned by a streaming scatter query.
// Each shard of the scatter query is treated as a stream. One row from each stream
// is added to the merge-sorter heap. Every time a value is pulled out of the heap,
// a new value is added to it from the stream that was the source of t... | [
"mergeSort",
"performs",
"a",
"merge",
"-",
"sort",
"of",
"rows",
"returned",
"by",
"a",
"streaming",
"scatter",
"query",
".",
"Each",
"shard",
"of",
"the",
"scatter",
"query",
"is",
"treated",
"as",
"a",
"stream",
".",
"One",
"row",
"from",
"each",
"str... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/merge_sort.go#L39-L120 |
135,601 | vitessio/vitess | go/vt/vtgate/engine/merge_sort.go | runOneStream | func runOneStream(ctx context.Context, vcursor VCursor, query string, rs *srvtopo.ResolvedShard, vars map[string]*querypb.BindVariable) *streamHandle {
handle := &streamHandle{
fields: make(chan []*querypb.Field, 1),
row: make(chan []sqltypes.Value, 10),
}
go func() {
defer close(handle.fields)
defer clo... | go | func runOneStream(ctx context.Context, vcursor VCursor, query string, rs *srvtopo.ResolvedShard, vars map[string]*querypb.BindVariable) *streamHandle {
handle := &streamHandle{
fields: make(chan []*querypb.Field, 1),
row: make(chan []sqltypes.Value, 10),
}
go func() {
defer close(handle.fields)
defer clo... | [
"func",
"runOneStream",
"(",
"ctx",
"context",
".",
"Context",
",",
"vcursor",
"VCursor",
",",
"query",
"string",
",",
"rs",
"*",
"srvtopo",
".",
"ResolvedShard",
",",
"vars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
")",
"*",
"str... | // runOnestream starts a streaming query on one shard, and returns a streamHandle for it. | [
"runOnestream",
"starts",
"a",
"streaming",
"query",
"on",
"one",
"shard",
"and",
"returns",
"a",
"streamHandle",
"for",
"it",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/merge_sort.go#L136-L172 |
135,602 | vitessio/vitess | go/vt/vttablet/tabletserver/messager/message_manager.go | newMessageManager | func newMessageManager(tsv TabletService, table *schema.Table, conns *connpool.Pool, postponeSema *sync2.Semaphore) *messageManager {
mm := &messageManager{
tsv: tsv,
name: table.Name,
fieldResult: &sqltypes.Result{
Fields: table.MessageInfo.Fields,
},
ackWaitTime: table.MessageInfo.AckWaitDuration,
p... | go | func newMessageManager(tsv TabletService, table *schema.Table, conns *connpool.Pool, postponeSema *sync2.Semaphore) *messageManager {
mm := &messageManager{
tsv: tsv,
name: table.Name,
fieldResult: &sqltypes.Result{
Fields: table.MessageInfo.Fields,
},
ackWaitTime: table.MessageInfo.AckWaitDuration,
p... | [
"func",
"newMessageManager",
"(",
"tsv",
"TabletService",
",",
"table",
"*",
"schema",
".",
"Table",
",",
"conns",
"*",
"connpool",
".",
"Pool",
",",
"postponeSema",
"*",
"sync2",
".",
"Semaphore",
")",
"*",
"messageManager",
"{",
"mm",
":=",
"&",
"message... | // newMessageManager creates a new message manager.
// Calls into tsv have to be made asynchronously. Otherwise,
// it can lead to deadlocks. | [
"newMessageManager",
"creates",
"a",
"new",
"message",
"manager",
".",
"Calls",
"into",
"tsv",
"have",
"to",
"be",
"made",
"asynchronously",
".",
"Otherwise",
"it",
"can",
"lead",
"to",
"deadlocks",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/message_manager.go#L206-L241 |
135,603 | vitessio/vitess | go/vt/vttablet/tabletserver/messager/message_manager.go | buildSelectColumnList | func buildSelectColumnList(t *schema.Table) string {
buf := sqlparser.NewTrackedBuffer(nil)
for i, c := range t.MessageInfo.Fields {
// Column names may have to be escaped.
if i == 0 {
buf.Myprintf("%v", sqlparser.NewColIdent(c.Name))
} else {
buf.Myprintf(", %v", sqlparser.NewColIdent(c.Name))
}
}
re... | go | func buildSelectColumnList(t *schema.Table) string {
buf := sqlparser.NewTrackedBuffer(nil)
for i, c := range t.MessageInfo.Fields {
// Column names may have to be escaped.
if i == 0 {
buf.Myprintf("%v", sqlparser.NewColIdent(c.Name))
} else {
buf.Myprintf(", %v", sqlparser.NewColIdent(c.Name))
}
}
re... | [
"func",
"buildSelectColumnList",
"(",
"t",
"*",
"schema",
".",
"Table",
")",
"string",
"{",
"buf",
":=",
"sqlparser",
".",
"NewTrackedBuffer",
"(",
"nil",
")",
"\n",
"for",
"i",
",",
"c",
":=",
"range",
"t",
".",
"MessageInfo",
".",
"Fields",
"{",
"// ... | // buildSelectColumnList is a convenience function that
// builds a 'select' list for the user-defined columns. | [
"buildSelectColumnList",
"is",
"a",
"convenience",
"function",
"that",
"builds",
"a",
"select",
"list",
"for",
"the",
"user",
"-",
"defined",
"columns",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/message_manager.go#L245-L256 |
135,604 | vitessio/vitess | go/vt/vttablet/tabletserver/messager/message_manager.go | Open | func (mm *messageManager) Open() {
mm.mu.Lock()
defer mm.mu.Unlock()
if mm.isOpen {
return
}
mm.isOpen = true
mm.wg.Add(1)
mm.curReceiver = -1
go mm.runSend()
// TODO(sougou): improve ticks to add randomness.
mm.pollerTicks.Start(mm.runPoller)
mm.purgeTicks.Start(mm.runPurge)
} | go | func (mm *messageManager) Open() {
mm.mu.Lock()
defer mm.mu.Unlock()
if mm.isOpen {
return
}
mm.isOpen = true
mm.wg.Add(1)
mm.curReceiver = -1
go mm.runSend()
// TODO(sougou): improve ticks to add randomness.
mm.pollerTicks.Start(mm.runPoller)
mm.purgeTicks.Start(mm.runPurge)
} | [
"func",
"(",
"mm",
"*",
"messageManager",
")",
"Open",
"(",
")",
"{",
"mm",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mm",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"mm",
".",
"isOpen",
"{",
"return",
"\n",
"}",
"\n",
"mm",
".",... | // Open starts the messageManager service. | [
"Open",
"starts",
"the",
"messageManager",
"service",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/message_manager.go#L259-L273 |
135,605 | vitessio/vitess | go/vt/vttablet/tabletserver/messager/message_manager.go | Close | func (mm *messageManager) Close() {
mm.pollerTicks.Stop()
mm.purgeTicks.Stop()
mm.mu.Lock()
if !mm.isOpen {
mm.mu.Unlock()
return
}
mm.isOpen = false
for _, rcvr := range mm.receivers {
rcvr.receiver.cancel()
}
mm.receivers = nil
MessageStats.Set([]string{mm.name.String(), "ClientCount"}, 0)
mm.cache.... | go | func (mm *messageManager) Close() {
mm.pollerTicks.Stop()
mm.purgeTicks.Stop()
mm.mu.Lock()
if !mm.isOpen {
mm.mu.Unlock()
return
}
mm.isOpen = false
for _, rcvr := range mm.receivers {
rcvr.receiver.cancel()
}
mm.receivers = nil
MessageStats.Set([]string{mm.name.String(), "ClientCount"}, 0)
mm.cache.... | [
"func",
"(",
"mm",
"*",
"messageManager",
")",
"Close",
"(",
")",
"{",
"mm",
".",
"pollerTicks",
".",
"Stop",
"(",
")",
"\n",
"mm",
".",
"purgeTicks",
".",
"Stop",
"(",
")",
"\n\n",
"mm",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"if",
"!",
"mm",... | // Close stops the messageManager service. | [
"Close",
"stops",
"the",
"messageManager",
"service",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/message_manager.go#L276-L296 |
135,606 | vitessio/vitess | go/vt/vttablet/tabletserver/messager/message_manager.go | rescanReceivers | func (mm *messageManager) rescanReceivers(start int) {
cur := start
for range mm.receivers {
cur = (cur + 1) % len(mm.receivers)
if !mm.receivers[cur].busy {
if mm.curReceiver == -1 {
mm.cond.Broadcast()
}
mm.curReceiver = cur
return
}
}
// Nothing was found.
mm.curReceiver = -1
} | go | func (mm *messageManager) rescanReceivers(start int) {
cur := start
for range mm.receivers {
cur = (cur + 1) % len(mm.receivers)
if !mm.receivers[cur].busy {
if mm.curReceiver == -1 {
mm.cond.Broadcast()
}
mm.curReceiver = cur
return
}
}
// Nothing was found.
mm.curReceiver = -1
} | [
"func",
"(",
"mm",
"*",
"messageManager",
")",
"rescanReceivers",
"(",
"start",
"int",
")",
"{",
"cur",
":=",
"start",
"\n",
"for",
"range",
"mm",
".",
"receivers",
"{",
"cur",
"=",
"(",
"cur",
"+",
"1",
")",
"%",
"len",
"(",
"mm",
".",
"receivers"... | // rescanReceivers finds the next available receiver
// using start as the starting point. If one was found,
// it sets curReceiver to that index. If curReceiver
// was previously -1, it broadcasts. If none was found,
// curReceiver is set to -1. If there's no starting point,
// it must be specified as -1. | [
"rescanReceivers",
"finds",
"the",
"next",
"available",
"receiver",
"using",
"start",
"as",
"the",
"starting",
"point",
".",
"If",
"one",
"was",
"found",
"it",
"sets",
"curReceiver",
"to",
"that",
"index",
".",
"If",
"curReceiver",
"was",
"previously",
"-",
... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/message_manager.go#L353-L367 |
135,607 | vitessio/vitess | go/vt/vttablet/tabletserver/messager/message_manager.go | Add | func (mm *messageManager) Add(mr *MessageRow) bool {
mm.mu.Lock()
defer mm.mu.Unlock()
if len(mm.receivers) == 0 {
return false
}
if !mm.cache.Add(mr) {
// Cache is full. Enter "messagesPending" mode to let the poller
// fill the cache with messages from disk as soon as a cache
// slot becomes available.
... | go | func (mm *messageManager) Add(mr *MessageRow) bool {
mm.mu.Lock()
defer mm.mu.Unlock()
if len(mm.receivers) == 0 {
return false
}
if !mm.cache.Add(mr) {
// Cache is full. Enter "messagesPending" mode to let the poller
// fill the cache with messages from disk as soon as a cache
// slot becomes available.
... | [
"func",
"(",
"mm",
"*",
"messageManager",
")",
"Add",
"(",
"mr",
"*",
"MessageRow",
")",
"bool",
"{",
"mm",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mm",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"len",
"(",
"mm",
".",
"receivers... | // Add adds the message to the cache. It returns true
// if successful. If the message is already present,
// it still returns true. | [
"Add",
"adds",
"the",
"message",
"to",
"the",
"cache",
".",
"It",
"returns",
"true",
"if",
"successful",
".",
"If",
"the",
"message",
"is",
"already",
"present",
"it",
"still",
"returns",
"true",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/message_manager.go#L372-L389 |
135,608 | vitessio/vitess | go/vt/vttablet/tabletserver/messager/message_manager.go | purge | func purge(tsv TabletService, name string, purgeAfter, purgeInterval time.Duration) {
ctx, cancel := context.WithTimeout(tabletenv.LocalContext(), purgeInterval)
defer func() {
tabletenv.LogError()
cancel()
}()
for {
count, err := tsv.PurgeMessages(ctx, nil, name, time.Now().Add(-purgeAfter).UnixNano())
if ... | go | func purge(tsv TabletService, name string, purgeAfter, purgeInterval time.Duration) {
ctx, cancel := context.WithTimeout(tabletenv.LocalContext(), purgeInterval)
defer func() {
tabletenv.LogError()
cancel()
}()
for {
count, err := tsv.PurgeMessages(ctx, nil, name, time.Now().Add(-purgeAfter).UnixNano())
if ... | [
"func",
"purge",
"(",
"tsv",
"TabletService",
",",
"name",
"string",
",",
"purgeAfter",
",",
"purgeInterval",
"time",
".",
"Duration",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"tabletenv",
".",
"LocalContext",
"(",
")",
","... | // purge is a non-member because it should be called asynchronously and should
// not rely on members of messageManager. | [
"purge",
"is",
"a",
"non",
"-",
"member",
"because",
"it",
"should",
"be",
"called",
"asynchronously",
"and",
"should",
"not",
"rely",
"on",
"members",
"of",
"messageManager",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/message_manager.go#L614-L633 |
135,609 | vitessio/vitess | go/vt/vttablet/tabletserver/messager/message_manager.go | BuildMessageRow | func BuildMessageRow(row []sqltypes.Value) (*MessageRow, error) {
timeNext, err := sqltypes.ToInt64(row[0])
if err != nil {
return nil, err
}
epoch, err := sqltypes.ToInt64(row[1])
if err != nil {
return nil, err
}
timeCreated, err := sqltypes.ToInt64(row[2])
if err != nil {
return nil, err
}
return &Me... | go | func BuildMessageRow(row []sqltypes.Value) (*MessageRow, error) {
timeNext, err := sqltypes.ToInt64(row[0])
if err != nil {
return nil, err
}
epoch, err := sqltypes.ToInt64(row[1])
if err != nil {
return nil, err
}
timeCreated, err := sqltypes.ToInt64(row[2])
if err != nil {
return nil, err
}
return &Me... | [
"func",
"BuildMessageRow",
"(",
"row",
"[",
"]",
"sqltypes",
".",
"Value",
")",
"(",
"*",
"MessageRow",
",",
"error",
")",
"{",
"timeNext",
",",
"err",
":=",
"sqltypes",
".",
"ToInt64",
"(",
"row",
"[",
"0",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil"... | // BuildMessageRow builds a MessageRow for a db row. | [
"BuildMessageRow",
"builds",
"a",
"MessageRow",
"for",
"a",
"db",
"row",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/messager/message_manager.go#L680-L699 |
135,610 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | Equal | func (qrs *Rules) Equal(other *Rules) bool {
if len(qrs.rules) != len(other.rules) {
return false
}
for i := 0; i < len(qrs.rules); i++ {
if !qrs.rules[i].Equal(other.rules[i]) {
return false
}
}
return true
} | go | func (qrs *Rules) Equal(other *Rules) bool {
if len(qrs.rules) != len(other.rules) {
return false
}
for i := 0; i < len(qrs.rules); i++ {
if !qrs.rules[i].Equal(other.rules[i]) {
return false
}
}
return true
} | [
"func",
"(",
"qrs",
"*",
"Rules",
")",
"Equal",
"(",
"other",
"*",
"Rules",
")",
"bool",
"{",
"if",
"len",
"(",
"qrs",
".",
"rules",
")",
"!=",
"len",
"(",
"other",
".",
"rules",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"for",
"i",
":=",
... | // Equal returns true if other is equal to this object, otherwise false. | [
"Equal",
"returns",
"true",
"if",
"other",
"is",
"equal",
"to",
"this",
"object",
"otherwise",
"false",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L48-L58 |
135,611 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | Copy | func (qrs *Rules) Copy() (newqrs *Rules) {
newqrs = New()
if qrs.rules != nil {
newqrs.rules = make([]*Rule, 0, len(qrs.rules))
for _, qr := range qrs.rules {
newqrs.rules = append(newqrs.rules, qr.Copy())
}
}
return newqrs
} | go | func (qrs *Rules) Copy() (newqrs *Rules) {
newqrs = New()
if qrs.rules != nil {
newqrs.rules = make([]*Rule, 0, len(qrs.rules))
for _, qr := range qrs.rules {
newqrs.rules = append(newqrs.rules, qr.Copy())
}
}
return newqrs
} | [
"func",
"(",
"qrs",
"*",
"Rules",
")",
"Copy",
"(",
")",
"(",
"newqrs",
"*",
"Rules",
")",
"{",
"newqrs",
"=",
"New",
"(",
")",
"\n",
"if",
"qrs",
".",
"rules",
"!=",
"nil",
"{",
"newqrs",
".",
"rules",
"=",
"make",
"(",
"[",
"]",
"*",
"Rule"... | // Copy performs a deep copy of Rules.
// A nil input produces a nil output. | [
"Copy",
"performs",
"a",
"deep",
"copy",
"of",
"Rules",
".",
"A",
"nil",
"input",
"produces",
"a",
"nil",
"output",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L62-L71 |
135,612 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | Append | func (qrs *Rules) Append(otherqrs *Rules) {
qrs.rules = append(qrs.rules, otherqrs.rules...)
} | go | func (qrs *Rules) Append(otherqrs *Rules) {
qrs.rules = append(qrs.rules, otherqrs.rules...)
} | [
"func",
"(",
"qrs",
"*",
"Rules",
")",
"Append",
"(",
"otherqrs",
"*",
"Rules",
")",
"{",
"qrs",
".",
"rules",
"=",
"append",
"(",
"qrs",
".",
"rules",
",",
"otherqrs",
".",
"rules",
"...",
")",
"\n",
"}"
] | // Append merges the rules from another Rules into the receiver | [
"Append",
"merges",
"the",
"rules",
"from",
"another",
"Rules",
"into",
"the",
"receiver"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L74-L76 |
135,613 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | Add | func (qrs *Rules) Add(qr *Rule) {
qrs.rules = append(qrs.rules, qr)
} | go | func (qrs *Rules) Add(qr *Rule) {
qrs.rules = append(qrs.rules, qr)
} | [
"func",
"(",
"qrs",
"*",
"Rules",
")",
"Add",
"(",
"qr",
"*",
"Rule",
")",
"{",
"qrs",
".",
"rules",
"=",
"append",
"(",
"qrs",
".",
"rules",
",",
"qr",
")",
"\n",
"}"
] | // Add adds a Rule to Rules. It does not check
// for duplicates. | [
"Add",
"adds",
"a",
"Rule",
"to",
"Rules",
".",
"It",
"does",
"not",
"check",
"for",
"duplicates",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L80-L82 |
135,614 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | Find | func (qrs *Rules) Find(name string) (qr *Rule) {
for _, qr = range qrs.rules {
if qr.Name == name {
return qr
}
}
return nil
} | go | func (qrs *Rules) Find(name string) (qr *Rule) {
for _, qr = range qrs.rules {
if qr.Name == name {
return qr
}
}
return nil
} | [
"func",
"(",
"qrs",
"*",
"Rules",
")",
"Find",
"(",
"name",
"string",
")",
"(",
"qr",
"*",
"Rule",
")",
"{",
"for",
"_",
",",
"qr",
"=",
"range",
"qrs",
".",
"rules",
"{",
"if",
"qr",
".",
"Name",
"==",
"name",
"{",
"return",
"qr",
"\n",
"}",... | // Find finds the first occurrence of a Rule by matching
// the Name field. It returns nil if the rule was not found. | [
"Find",
"finds",
"the",
"first",
"occurrence",
"of",
"a",
"Rule",
"by",
"matching",
"the",
"Name",
"field",
".",
"It",
"returns",
"nil",
"if",
"the",
"rule",
"was",
"not",
"found",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L86-L93 |
135,615 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | Delete | func (qrs *Rules) Delete(name string) (qr *Rule) {
for i, qr := range qrs.rules {
if qr.Name == name {
for j := i; j < len(qrs.rules)-i-1; j++ {
qrs.rules[j] = qrs.rules[j+1]
}
qrs.rules = qrs.rules[:len(qrs.rules)-1]
return qr
}
}
return nil
} | go | func (qrs *Rules) Delete(name string) (qr *Rule) {
for i, qr := range qrs.rules {
if qr.Name == name {
for j := i; j < len(qrs.rules)-i-1; j++ {
qrs.rules[j] = qrs.rules[j+1]
}
qrs.rules = qrs.rules[:len(qrs.rules)-1]
return qr
}
}
return nil
} | [
"func",
"(",
"qrs",
"*",
"Rules",
")",
"Delete",
"(",
"name",
"string",
")",
"(",
"qr",
"*",
"Rule",
")",
"{",
"for",
"i",
",",
"qr",
":=",
"range",
"qrs",
".",
"rules",
"{",
"if",
"qr",
".",
"Name",
"==",
"name",
"{",
"for",
"j",
":=",
"i",
... | // Delete deletes a Rule by name and returns the rule
// that was deleted. It returns nil if the rule was not found. | [
"Delete",
"deletes",
"a",
"Rule",
"by",
"name",
"and",
"returns",
"the",
"rule",
"that",
"was",
"deleted",
".",
"It",
"returns",
"nil",
"if",
"the",
"rule",
"was",
"not",
"found",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L97-L108 |
135,616 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | UnmarshalJSON | func (qrs *Rules) UnmarshalJSON(data []byte) (err error) {
var rulesInfo []map[string]interface{}
dec := json.NewDecoder(bytes.NewReader(data))
dec.UseNumber()
err = dec.Decode(&rulesInfo)
if err != nil {
return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "%v", err)
}
for _, ruleInfo := range rulesInfo {
... | go | func (qrs *Rules) UnmarshalJSON(data []byte) (err error) {
var rulesInfo []map[string]interface{}
dec := json.NewDecoder(bytes.NewReader(data))
dec.UseNumber()
err = dec.Decode(&rulesInfo)
if err != nil {
return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "%v", err)
}
for _, ruleInfo := range rulesInfo {
... | [
"func",
"(",
"qrs",
"*",
"Rules",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"var",
"rulesInfo",
"[",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"\n",
"dec",
":=",
"json",
".",
"NewDecoder",... | // UnmarshalJSON unmarshals Rules. | [
"UnmarshalJSON",
"unmarshals",
"Rules",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L111-L127 |
135,617 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | FilterByPlan | func (qrs *Rules) FilterByPlan(query string, planid planbuilder.PlanType, tableName string) (newqrs *Rules) {
var newrules []*Rule
for _, qr := range qrs.rules {
if newrule := qr.FilterByPlan(query, planid, tableName); newrule != nil {
newrules = append(newrules, newrule)
}
}
return &Rules{newrules}
} | go | func (qrs *Rules) FilterByPlan(query string, planid planbuilder.PlanType, tableName string) (newqrs *Rules) {
var newrules []*Rule
for _, qr := range qrs.rules {
if newrule := qr.FilterByPlan(query, planid, tableName); newrule != nil {
newrules = append(newrules, newrule)
}
}
return &Rules{newrules}
} | [
"func",
"(",
"qrs",
"*",
"Rules",
")",
"FilterByPlan",
"(",
"query",
"string",
",",
"planid",
"planbuilder",
".",
"PlanType",
",",
"tableName",
"string",
")",
"(",
"newqrs",
"*",
"Rules",
")",
"{",
"var",
"newrules",
"[",
"]",
"*",
"Rule",
"\n",
"for",... | // FilterByPlan creates a new Rules by prefiltering on the query and planId. This allows
// us to create query plan specific Rules out of the original Rules. In the new rules,
// query, plans and tableNames predicates are empty. | [
"FilterByPlan",
"creates",
"a",
"new",
"Rules",
"by",
"prefiltering",
"on",
"the",
"query",
"and",
"planId",
".",
"This",
"allows",
"us",
"to",
"create",
"query",
"plan",
"specific",
"Rules",
"out",
"of",
"the",
"original",
"Rules",
".",
"In",
"the",
"new"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L146-L154 |
135,618 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | GetAction | func (qrs *Rules) GetAction(ip, user string, bindVars map[string]*querypb.BindVariable) (action Action, desc string) {
for _, qr := range qrs.rules {
if act := qr.GetAction(ip, user, bindVars); act != QRContinue {
return act, qr.Description
}
}
return QRContinue, ""
} | go | func (qrs *Rules) GetAction(ip, user string, bindVars map[string]*querypb.BindVariable) (action Action, desc string) {
for _, qr := range qrs.rules {
if act := qr.GetAction(ip, user, bindVars); act != QRContinue {
return act, qr.Description
}
}
return QRContinue, ""
} | [
"func",
"(",
"qrs",
"*",
"Rules",
")",
"GetAction",
"(",
"ip",
",",
"user",
"string",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
")",
"(",
"action",
"Action",
",",
"desc",
"string",
")",
"{",
"for",
"_",
",",
"... | // GetAction runs the input against the rules engine and returns the action to be performed. | [
"GetAction",
"runs",
"the",
"input",
"against",
"the",
"rules",
"engine",
"and",
"returns",
"the",
"action",
"to",
"be",
"performed",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L157-L164 |
135,619 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | Equal | func (nr namedRegexp) Equal(other namedRegexp) bool {
if nr.Regexp == nil || other.Regexp == nil {
return nr.Regexp == nil && other.Regexp == nil && nr.name == other.name
}
return nr.name == other.name && nr.String() == other.String()
} | go | func (nr namedRegexp) Equal(other namedRegexp) bool {
if nr.Regexp == nil || other.Regexp == nil {
return nr.Regexp == nil && other.Regexp == nil && nr.name == other.name
}
return nr.name == other.name && nr.String() == other.String()
} | [
"func",
"(",
"nr",
"namedRegexp",
")",
"Equal",
"(",
"other",
"namedRegexp",
")",
"bool",
"{",
"if",
"nr",
".",
"Regexp",
"==",
"nil",
"||",
"other",
".",
"Regexp",
"==",
"nil",
"{",
"return",
"nr",
".",
"Regexp",
"==",
"nil",
"&&",
"other",
".",
"... | // Equal returns true if other is equal to this namedRegexp, otherwise false. | [
"Equal",
"returns",
"true",
"if",
"other",
"is",
"equal",
"to",
"this",
"namedRegexp",
"otherwise",
"false",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L209-L214 |
135,620 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | NewQueryRule | func NewQueryRule(description, name string, act Action) (qr *Rule) {
// We ignore act because there's only one action right now
return &Rule{Description: description, Name: name, act: act}
} | go | func NewQueryRule(description, name string, act Action) (qr *Rule) {
// We ignore act because there's only one action right now
return &Rule{Description: description, Name: name, act: act}
} | [
"func",
"NewQueryRule",
"(",
"description",
",",
"name",
"string",
",",
"act",
"Action",
")",
"(",
"qr",
"*",
"Rule",
")",
"{",
"// We ignore act because there's only one action right now",
"return",
"&",
"Rule",
"{",
"Description",
":",
"description",
",",
"Name"... | // NewQueryRule creates a new Rule. | [
"NewQueryRule",
"creates",
"a",
"new",
"Rule",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L217-L220 |
135,621 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | Equal | func (qr *Rule) Equal(other *Rule) bool {
if qr == nil || other == nil {
return qr == nil && other == nil
}
return (qr.Description == other.Description &&
qr.Name == other.Name &&
qr.requestIP.Equal(other.requestIP) &&
qr.user.Equal(other.user) &&
qr.query.Equal(other.query) &&
reflect.DeepEqual(qr.plans... | go | func (qr *Rule) Equal(other *Rule) bool {
if qr == nil || other == nil {
return qr == nil && other == nil
}
return (qr.Description == other.Description &&
qr.Name == other.Name &&
qr.requestIP.Equal(other.requestIP) &&
qr.user.Equal(other.user) &&
qr.query.Equal(other.query) &&
reflect.DeepEqual(qr.plans... | [
"func",
"(",
"qr",
"*",
"Rule",
")",
"Equal",
"(",
"other",
"*",
"Rule",
")",
"bool",
"{",
"if",
"qr",
"==",
"nil",
"||",
"other",
"==",
"nil",
"{",
"return",
"qr",
"==",
"nil",
"&&",
"other",
"==",
"nil",
"\n",
"}",
"\n",
"return",
"(",
"qr",
... | // Equal returns true if other is equal to this Rule, otherwise false. | [
"Equal",
"returns",
"true",
"if",
"other",
"is",
"equal",
"to",
"this",
"Rule",
"otherwise",
"false",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L223-L236 |
135,622 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | Copy | func (qr *Rule) Copy() (newqr *Rule) {
newqr = &Rule{
Description: qr.Description,
Name: qr.Name,
requestIP: qr.requestIP,
user: qr.user,
query: qr.query,
act: qr.act,
}
if qr.plans != nil {
newqr.plans = make([]planbuilder.PlanType, len(qr.plans))
copy(newqr.plans, qr.p... | go | func (qr *Rule) Copy() (newqr *Rule) {
newqr = &Rule{
Description: qr.Description,
Name: qr.Name,
requestIP: qr.requestIP,
user: qr.user,
query: qr.query,
act: qr.act,
}
if qr.plans != nil {
newqr.plans = make([]planbuilder.PlanType, len(qr.plans))
copy(newqr.plans, qr.p... | [
"func",
"(",
"qr",
"*",
"Rule",
")",
"Copy",
"(",
")",
"(",
"newqr",
"*",
"Rule",
")",
"{",
"newqr",
"=",
"&",
"Rule",
"{",
"Description",
":",
"qr",
".",
"Description",
",",
"Name",
":",
"qr",
".",
"Name",
",",
"requestIP",
":",
"qr",
".",
"re... | // Copy performs a deep copy of a Rule. | [
"Copy",
"performs",
"a",
"deep",
"copy",
"of",
"a",
"Rule",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L239-L261 |
135,623 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | SetUserCond | func (qr *Rule) SetUserCond(pattern string) (err error) {
qr.user.name = pattern
qr.user.Regexp, err = regexp.Compile(makeExact(pattern))
return
} | go | func (qr *Rule) SetUserCond(pattern string) (err error) {
qr.user.name = pattern
qr.user.Regexp, err = regexp.Compile(makeExact(pattern))
return
} | [
"func",
"(",
"qr",
"*",
"Rule",
")",
"SetUserCond",
"(",
"pattern",
"string",
")",
"(",
"err",
"error",
")",
"{",
"qr",
".",
"user",
".",
"name",
"=",
"pattern",
"\n",
"qr",
".",
"user",
".",
"Regexp",
",",
"err",
"=",
"regexp",
".",
"Compile",
"... | // SetUserCond adds a regular expression condition for the user name
// used by the client. | [
"SetUserCond",
"adds",
"a",
"regular",
"expression",
"condition",
"for",
"the",
"user",
"name",
"used",
"by",
"the",
"client",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L303-L307 |
135,624 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | SetQueryCond | func (qr *Rule) SetQueryCond(pattern string) (err error) {
qr.query.name = pattern
qr.query.Regexp, err = regexp.Compile(makeExact(pattern))
return
} | go | func (qr *Rule) SetQueryCond(pattern string) (err error) {
qr.query.name = pattern
qr.query.Regexp, err = regexp.Compile(makeExact(pattern))
return
} | [
"func",
"(",
"qr",
"*",
"Rule",
")",
"SetQueryCond",
"(",
"pattern",
"string",
")",
"(",
"err",
"error",
")",
"{",
"qr",
".",
"query",
".",
"name",
"=",
"pattern",
"\n",
"qr",
".",
"query",
".",
"Regexp",
",",
"err",
"=",
"regexp",
".",
"Compile",
... | // SetQueryCond adds a regular expression condition for the query. | [
"SetQueryCond",
"adds",
"a",
"regular",
"expression",
"condition",
"for",
"the",
"query",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L324-L328 |
135,625 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | FilterByPlan | func (qr *Rule) FilterByPlan(query string, planid planbuilder.PlanType, tableName string) (newqr *Rule) {
if !reMatch(qr.query.Regexp, query) {
return nil
}
if !planMatch(qr.plans, planid) {
return nil
}
if !tableMatch(qr.tableNames, tableName) {
return nil
}
newqr = qr.Copy()
newqr.query = namedRegexp{}
... | go | func (qr *Rule) FilterByPlan(query string, planid planbuilder.PlanType, tableName string) (newqr *Rule) {
if !reMatch(qr.query.Regexp, query) {
return nil
}
if !planMatch(qr.plans, planid) {
return nil
}
if !tableMatch(qr.tableNames, tableName) {
return nil
}
newqr = qr.Copy()
newqr.query = namedRegexp{}
... | [
"func",
"(",
"qr",
"*",
"Rule",
")",
"FilterByPlan",
"(",
"query",
"string",
",",
"planid",
"planbuilder",
".",
"PlanType",
",",
"tableName",
"string",
")",
"(",
"newqr",
"*",
"Rule",
")",
"{",
"if",
"!",
"reMatch",
"(",
"qr",
".",
"query",
".",
"Reg... | // FilterByPlan returns a new Rule if the query and planid match.
// The new Rule will contain all the original constraints other
// than the plan and query. If the plan and query don't match the Rule,
// then it returns nil. | [
"FilterByPlan",
"returns",
"a",
"new",
"Rule",
"if",
"the",
"query",
"and",
"planid",
"match",
".",
"The",
"new",
"Rule",
"will",
"contain",
"all",
"the",
"original",
"constraints",
"other",
"than",
"the",
"plan",
"and",
"query",
".",
"If",
"the",
"plan",
... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L397-L412 |
135,626 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | GetAction | func (qr *Rule) GetAction(ip, user string, bindVars map[string]*querypb.BindVariable) Action {
if !reMatch(qr.requestIP.Regexp, ip) {
return QRContinue
}
if !reMatch(qr.user.Regexp, user) {
return QRContinue
}
for _, bvcond := range qr.bindVarConds {
if !bvMatch(bvcond, bindVars) {
return QRContinue
}
... | go | func (qr *Rule) GetAction(ip, user string, bindVars map[string]*querypb.BindVariable) Action {
if !reMatch(qr.requestIP.Regexp, ip) {
return QRContinue
}
if !reMatch(qr.user.Regexp, user) {
return QRContinue
}
for _, bvcond := range qr.bindVarConds {
if !bvMatch(bvcond, bindVars) {
return QRContinue
}
... | [
"func",
"(",
"qr",
"*",
"Rule",
")",
"GetAction",
"(",
"ip",
",",
"user",
"string",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
")",
"Action",
"{",
"if",
"!",
"reMatch",
"(",
"qr",
".",
"requestIP",
".",
"Regexp",... | // GetAction returns the action for a single rule. | [
"GetAction",
"returns",
"the",
"action",
"for",
"a",
"single",
"rule",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L415-L428 |
135,627 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | getuint64 | func getuint64(val *querypb.BindVariable) (uv uint64, status int) {
bv, err := sqltypes.BindVariableToValue(val)
if err != nil {
return 0, QROutOfRange
}
v, err := sqltypes.ToUint64(bv)
if err != nil {
return 0, QROutOfRange
}
return v, QROK
} | go | func getuint64(val *querypb.BindVariable) (uv uint64, status int) {
bv, err := sqltypes.BindVariableToValue(val)
if err != nil {
return 0, QROutOfRange
}
v, err := sqltypes.ToUint64(bv)
if err != nil {
return 0, QROutOfRange
}
return v, QROK
} | [
"func",
"getuint64",
"(",
"val",
"*",
"querypb",
".",
"BindVariable",
")",
"(",
"uv",
"uint64",
",",
"status",
"int",
")",
"{",
"bv",
",",
"err",
":=",
"sqltypes",
".",
"BindVariableToValue",
"(",
"val",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ret... | // getuint64 returns QROutOfRange for negative values | [
"getuint64",
"returns",
"QROutOfRange",
"for",
"negative",
"values"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L730-L740 |
135,628 | vitessio/vitess | go/vt/vttablet/tabletserver/rules/rules.go | getint64 | func getint64(val *querypb.BindVariable) (iv int64, status int) {
bv, err := sqltypes.BindVariableToValue(val)
if err != nil {
return 0, QROutOfRange
}
v, err := sqltypes.ToInt64(bv)
if err != nil {
return 0, QROutOfRange
}
return v, QROK
} | go | func getint64(val *querypb.BindVariable) (iv int64, status int) {
bv, err := sqltypes.BindVariableToValue(val)
if err != nil {
return 0, QROutOfRange
}
v, err := sqltypes.ToInt64(bv)
if err != nil {
return 0, QROutOfRange
}
return v, QROK
} | [
"func",
"getint64",
"(",
"val",
"*",
"querypb",
".",
"BindVariable",
")",
"(",
"iv",
"int64",
",",
"status",
"int",
")",
"{",
"bv",
",",
"err",
":=",
"sqltypes",
".",
"BindVariableToValue",
"(",
"val",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"retur... | // getint64 returns QROutOfRange if a uint64 is too large | [
"getint64",
"returns",
"QROutOfRange",
"if",
"a",
"uint64",
"is",
"too",
"large"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/rules/rules.go#L743-L753 |
135,629 | vitessio/vitess | go/vt/vtaclcheck/vtaclcheck.go | Run | func Run() error {
if options.ACLFile != "" {
tableacl.Register("simpleacl", &simpleacl.Factory{})
err := tableacl.Init(
options.ACLFile,
func() {},
)
if err != nil {
return fmt.Errorf("fail to initialize Table ACL: %v", err)
}
fmt.Printf("JSON ACL file %s looks good\n", options.ACLFile)
}
if ... | go | func Run() error {
if options.ACLFile != "" {
tableacl.Register("simpleacl", &simpleacl.Factory{})
err := tableacl.Init(
options.ACLFile,
func() {},
)
if err != nil {
return fmt.Errorf("fail to initialize Table ACL: %v", err)
}
fmt.Printf("JSON ACL file %s looks good\n", options.ACLFile)
}
if ... | [
"func",
"Run",
"(",
")",
"error",
"{",
"if",
"options",
".",
"ACLFile",
"!=",
"\"",
"\"",
"{",
"tableacl",
".",
"Register",
"(",
"\"",
"\"",
",",
"&",
"simpleacl",
".",
"Factory",
"{",
"}",
")",
"\n",
"err",
":=",
"tableacl",
".",
"Init",
"(",
"o... | // Run the check on the given file | [
"Run",
"the",
"check",
"on",
"the",
"given",
"file"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtaclcheck/vtaclcheck.go#L57-L78 |
135,630 | vitessio/vitess | go/vt/topo/helpers/copy.go | CopyKeyspaces | func CopyKeyspaces(ctx context.Context, fromTS, toTS *topo.Server) {
keyspaces, err := fromTS.GetKeyspaces(ctx)
if err != nil {
log.Fatalf("GetKeyspaces: %v", err)
}
for _, keyspace := range keyspaces {
ki, err := fromTS.GetKeyspace(ctx, keyspace)
if err != nil {
log.Fatalf("GetKeyspace(%v): %v", keyspac... | go | func CopyKeyspaces(ctx context.Context, fromTS, toTS *topo.Server) {
keyspaces, err := fromTS.GetKeyspaces(ctx)
if err != nil {
log.Fatalf("GetKeyspaces: %v", err)
}
for _, keyspace := range keyspaces {
ki, err := fromTS.GetKeyspace(ctx, keyspace)
if err != nil {
log.Fatalf("GetKeyspace(%v): %v", keyspac... | [
"func",
"CopyKeyspaces",
"(",
"ctx",
"context",
".",
"Context",
",",
"fromTS",
",",
"toTS",
"*",
"topo",
".",
"Server",
")",
"{",
"keyspaces",
",",
"err",
":=",
"fromTS",
".",
"GetKeyspaces",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log... | // CopyKeyspaces will create the keyspaces in the destination topo. | [
"CopyKeyspaces",
"will",
"create",
"the",
"keyspaces",
"in",
"the",
"destination",
"topo",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/helpers/copy.go#L30-L63 |
135,631 | vitessio/vitess | go/vt/topo/helpers/copy.go | CopyShards | func CopyShards(ctx context.Context, fromTS, toTS *topo.Server) {
keyspaces, err := fromTS.GetKeyspaces(ctx)
if err != nil {
log.Fatalf("fromTS.GetKeyspaces: %v", err)
}
for _, keyspace := range keyspaces {
shards, err := fromTS.GetShardNames(ctx, keyspace)
if err != nil {
log.Fatalf("GetShardNames(%v): %... | go | func CopyShards(ctx context.Context, fromTS, toTS *topo.Server) {
keyspaces, err := fromTS.GetKeyspaces(ctx)
if err != nil {
log.Fatalf("fromTS.GetKeyspaces: %v", err)
}
for _, keyspace := range keyspaces {
shards, err := fromTS.GetShardNames(ctx, keyspace)
if err != nil {
log.Fatalf("GetShardNames(%v): %... | [
"func",
"CopyShards",
"(",
"ctx",
"context",
".",
"Context",
",",
"fromTS",
",",
"toTS",
"*",
"topo",
".",
"Server",
")",
"{",
"keyspaces",
",",
"err",
":=",
"fromTS",
".",
"GetKeyspaces",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
... | // CopyShards will create the shards in the destination topo. | [
"CopyShards",
"will",
"create",
"the",
"shards",
"in",
"the",
"destination",
"topo",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/helpers/copy.go#L66-L101 |
135,632 | vitessio/vitess | go/vt/topo/helpers/copy.go | CopyTablets | func CopyTablets(ctx context.Context, fromTS, toTS *topo.Server) {
cells, err := fromTS.GetKnownCells(ctx)
if err != nil {
log.Fatalf("fromTS.GetKnownCells: %v", err)
}
for _, cell := range cells {
tabletAliases, err := fromTS.GetTabletsByCell(ctx, cell)
if err != nil {
log.Fatalf("GetTabletsByCell(%v): %... | go | func CopyTablets(ctx context.Context, fromTS, toTS *topo.Server) {
cells, err := fromTS.GetKnownCells(ctx)
if err != nil {
log.Fatalf("fromTS.GetKnownCells: %v", err)
}
for _, cell := range cells {
tabletAliases, err := fromTS.GetTabletsByCell(ctx, cell)
if err != nil {
log.Fatalf("GetTabletsByCell(%v): %... | [
"func",
"CopyTablets",
"(",
"ctx",
"context",
".",
"Context",
",",
"fromTS",
",",
"toTS",
"*",
"topo",
".",
"Server",
")",
"{",
"cells",
",",
"err",
":=",
"fromTS",
".",
"GetKnownCells",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
... | // CopyTablets will create the tablets in the destination topo. | [
"CopyTablets",
"will",
"create",
"the",
"tablets",
"in",
"the",
"destination",
"topo",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/helpers/copy.go#L104-L139 |
135,633 | vitessio/vitess | go/vt/topo/helpers/copy.go | CopyShardReplications | func CopyShardReplications(ctx context.Context, fromTS, toTS *topo.Server) {
keyspaces, err := fromTS.GetKeyspaces(ctx)
if err != nil {
log.Fatalf("fromTS.GetKeyspaces: %v", err)
}
cells, err := fromTS.GetCellInfoNames(ctx)
if err != nil {
log.Fatalf("GetCellInfoNames(): %v", err)
}
for _, keyspace := rang... | go | func CopyShardReplications(ctx context.Context, fromTS, toTS *topo.Server) {
keyspaces, err := fromTS.GetKeyspaces(ctx)
if err != nil {
log.Fatalf("fromTS.GetKeyspaces: %v", err)
}
cells, err := fromTS.GetCellInfoNames(ctx)
if err != nil {
log.Fatalf("GetCellInfoNames(): %v", err)
}
for _, keyspace := rang... | [
"func",
"CopyShardReplications",
"(",
"ctx",
"context",
".",
"Context",
",",
"fromTS",
",",
"toTS",
"*",
"topo",
".",
"Server",
")",
"{",
"keyspaces",
",",
"err",
":=",
"fromTS",
".",
"GetKeyspaces",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{"... | // CopyShardReplications will create the ShardReplication objects in
// the destination topo. | [
"CopyShardReplications",
"will",
"create",
"the",
"ShardReplication",
"objects",
"in",
"the",
"destination",
"topo",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/helpers/copy.go#L143-L177 |
135,634 | vitessio/vitess | go/vt/topo/helpers/copy.go | CopyRoutingRules | func CopyRoutingRules(ctx context.Context, fromTS, toTS *topo.Server) {
rr, err := fromTS.GetRoutingRules(ctx)
if err != nil {
log.Fatalf("GetRoutingRules: %v", err)
}
if err := toTS.SaveRoutingRules(ctx, rr); err != nil {
log.Errorf("SaveRoutingRules(%v): %v", rr, err)
}
} | go | func CopyRoutingRules(ctx context.Context, fromTS, toTS *topo.Server) {
rr, err := fromTS.GetRoutingRules(ctx)
if err != nil {
log.Fatalf("GetRoutingRules: %v", err)
}
if err := toTS.SaveRoutingRules(ctx, rr); err != nil {
log.Errorf("SaveRoutingRules(%v): %v", rr, err)
}
} | [
"func",
"CopyRoutingRules",
"(",
"ctx",
"context",
".",
"Context",
",",
"fromTS",
",",
"toTS",
"*",
"topo",
".",
"Server",
")",
"{",
"rr",
",",
"err",
":=",
"fromTS",
".",
"GetRoutingRules",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log"... | // CopyRoutingRules will create the routing rules in the destination topo. | [
"CopyRoutingRules",
"will",
"create",
"the",
"routing",
"rules",
"in",
"the",
"destination",
"topo",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/helpers/copy.go#L180-L188 |
135,635 | vitessio/vitess | go/vt/logz/logz_utils.go | Wrappable | func Wrappable(in string) string {
buf := bytes.NewBuffer(nil)
for _, ch := range in {
buf.WriteRune(ch)
if ch == ',' || ch == ')' {
// zero-width whitespace
buf.WriteRune('\u200B')
}
}
return buf.String()
} | go | func Wrappable(in string) string {
buf := bytes.NewBuffer(nil)
for _, ch := range in {
buf.WriteRune(ch)
if ch == ',' || ch == ')' {
// zero-width whitespace
buf.WriteRune('\u200B')
}
}
return buf.String()
} | [
"func",
"Wrappable",
"(",
"in",
"string",
")",
"string",
"{",
"buf",
":=",
"bytes",
".",
"NewBuffer",
"(",
"nil",
")",
"\n",
"for",
"_",
",",
"ch",
":=",
"range",
"in",
"{",
"buf",
".",
"WriteRune",
"(",
"ch",
")",
"\n",
"if",
"ch",
"==",
"','",
... | // Wrappable inserts zero-width whitespaces to make
// the string wrappable. | [
"Wrappable",
"inserts",
"zero",
"-",
"width",
"whitespaces",
"to",
"make",
"the",
"string",
"wrappable",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/logz/logz_utils.go#L145-L155 |
135,636 | vitessio/vitess | go/sqltypes/value.go | NewInt64 | func NewInt64(v int64) Value {
return MakeTrusted(Int64, strconv.AppendInt(nil, v, 10))
} | go | func NewInt64(v int64) Value {
return MakeTrusted(Int64, strconv.AppendInt(nil, v, 10))
} | [
"func",
"NewInt64",
"(",
"v",
"int64",
")",
"Value",
"{",
"return",
"MakeTrusted",
"(",
"Int64",
",",
"strconv",
".",
"AppendInt",
"(",
"nil",
",",
"v",
",",
"10",
")",
")",
"\n",
"}"
] | // NewInt64 builds an Int64 Value. | [
"NewInt64",
"builds",
"an",
"Int64",
"Value",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/value.go#L99-L101 |
135,637 | vitessio/vitess | go/sqltypes/value.go | NewInt8 | func NewInt8(v int8) Value {
return MakeTrusted(Int8, strconv.AppendInt(nil, int64(v), 10))
} | go | func NewInt8(v int8) Value {
return MakeTrusted(Int8, strconv.AppendInt(nil, int64(v), 10))
} | [
"func",
"NewInt8",
"(",
"v",
"int8",
")",
"Value",
"{",
"return",
"MakeTrusted",
"(",
"Int8",
",",
"strconv",
".",
"AppendInt",
"(",
"nil",
",",
"int64",
"(",
"v",
")",
",",
"10",
")",
")",
"\n",
"}"
] | // NewInt8 builds an Int8 Value. | [
"NewInt8",
"builds",
"an",
"Int8",
"Value",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/value.go#L104-L106 |
135,638 | vitessio/vitess | go/sqltypes/value.go | NewInt32 | func NewInt32(v int32) Value {
return MakeTrusted(Int32, strconv.AppendInt(nil, int64(v), 10))
} | go | func NewInt32(v int32) Value {
return MakeTrusted(Int32, strconv.AppendInt(nil, int64(v), 10))
} | [
"func",
"NewInt32",
"(",
"v",
"int32",
")",
"Value",
"{",
"return",
"MakeTrusted",
"(",
"Int32",
",",
"strconv",
".",
"AppendInt",
"(",
"nil",
",",
"int64",
"(",
"v",
")",
",",
"10",
")",
")",
"\n",
"}"
] | // NewInt32 builds an Int64 Value. | [
"NewInt32",
"builds",
"an",
"Int64",
"Value",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/value.go#L109-L111 |
135,639 | vitessio/vitess | go/sqltypes/value.go | NewUint64 | func NewUint64(v uint64) Value {
return MakeTrusted(Uint64, strconv.AppendUint(nil, v, 10))
} | go | func NewUint64(v uint64) Value {
return MakeTrusted(Uint64, strconv.AppendUint(nil, v, 10))
} | [
"func",
"NewUint64",
"(",
"v",
"uint64",
")",
"Value",
"{",
"return",
"MakeTrusted",
"(",
"Uint64",
",",
"strconv",
".",
"AppendUint",
"(",
"nil",
",",
"v",
",",
"10",
")",
")",
"\n",
"}"
] | // NewUint64 builds an Uint64 Value. | [
"NewUint64",
"builds",
"an",
"Uint64",
"Value",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/value.go#L114-L116 |
135,640 | vitessio/vitess | go/sqltypes/value.go | NewUint32 | func NewUint32(v uint32) Value {
return MakeTrusted(Uint32, strconv.AppendUint(nil, uint64(v), 10))
} | go | func NewUint32(v uint32) Value {
return MakeTrusted(Uint32, strconv.AppendUint(nil, uint64(v), 10))
} | [
"func",
"NewUint32",
"(",
"v",
"uint32",
")",
"Value",
"{",
"return",
"MakeTrusted",
"(",
"Uint32",
",",
"strconv",
".",
"AppendUint",
"(",
"nil",
",",
"uint64",
"(",
"v",
")",
",",
"10",
")",
")",
"\n",
"}"
] | // NewUint32 builds an Uint32 Value. | [
"NewUint32",
"builds",
"an",
"Uint32",
"Value",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/value.go#L119-L121 |
135,641 | vitessio/vitess | go/sqltypes/value.go | NewFloat64 | func NewFloat64(v float64) Value {
return MakeTrusted(Float64, strconv.AppendFloat(nil, v, 'g', -1, 64))
} | go | func NewFloat64(v float64) Value {
return MakeTrusted(Float64, strconv.AppendFloat(nil, v, 'g', -1, 64))
} | [
"func",
"NewFloat64",
"(",
"v",
"float64",
")",
"Value",
"{",
"return",
"MakeTrusted",
"(",
"Float64",
",",
"strconv",
".",
"AppendFloat",
"(",
"nil",
",",
"v",
",",
"'g'",
",",
"-",
"1",
",",
"64",
")",
")",
"\n",
"}"
] | // NewFloat64 builds an Float64 Value. | [
"NewFloat64",
"builds",
"an",
"Float64",
"Value",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/value.go#L124-L126 |
135,642 | vitessio/vitess | go/sqltypes/value.go | NewIntegral | func NewIntegral(val string) (n Value, err error) {
signed, err := strconv.ParseInt(val, 0, 64)
if err == nil {
return MakeTrusted(Int64, strconv.AppendInt(nil, signed, 10)), nil
}
unsigned, err := strconv.ParseUint(val, 0, 64)
if err != nil {
return Value{}, err
}
return MakeTrusted(Uint64, strconv.AppendUi... | go | func NewIntegral(val string) (n Value, err error) {
signed, err := strconv.ParseInt(val, 0, 64)
if err == nil {
return MakeTrusted(Int64, strconv.AppendInt(nil, signed, 10)), nil
}
unsigned, err := strconv.ParseUint(val, 0, 64)
if err != nil {
return Value{}, err
}
return MakeTrusted(Uint64, strconv.AppendUi... | [
"func",
"NewIntegral",
"(",
"val",
"string",
")",
"(",
"n",
"Value",
",",
"err",
"error",
")",
"{",
"signed",
",",
"err",
":=",
"strconv",
".",
"ParseInt",
"(",
"val",
",",
"0",
",",
"64",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"Make... | // NewIntegral builds an integral type from a string representation.
// The type will be Int64 or Uint64. Int64 will be preferred where possible. | [
"NewIntegral",
"builds",
"an",
"integral",
"type",
"from",
"a",
"string",
"representation",
".",
"The",
"type",
"will",
"be",
"Int64",
"or",
"Uint64",
".",
"Int64",
"will",
"be",
"preferred",
"where",
"possible",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/value.go#L141-L151 |
135,643 | vitessio/vitess | go/sqltypes/value.go | ToString | func (v Value) ToString() string {
if v.typ == Expression {
return ""
}
return hack.String(v.val)
} | go | func (v Value) ToString() string {
if v.typ == Expression {
return ""
}
return hack.String(v.val)
} | [
"func",
"(",
"v",
"Value",
")",
"ToString",
"(",
")",
"string",
"{",
"if",
"v",
".",
"typ",
"==",
"Expression",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"hack",
".",
"String",
"(",
"v",
".",
"val",
")",
"\n",
"}"
] | // ToString returns the value as MySQL would return it as string.
// If the value is not convertible like in the case of Expression, it returns nil. | [
"ToString",
"returns",
"the",
"value",
"as",
"MySQL",
"would",
"return",
"it",
"as",
"string",
".",
"If",
"the",
"value",
"is",
"not",
"convertible",
"like",
"in",
"the",
"case",
"of",
"Expression",
"it",
"returns",
"nil",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/value.go#L206-L211 |
135,644 | vitessio/vitess | go/sqltypes/value.go | EncodeASCII | func (v Value) EncodeASCII(b BinWriter) {
switch {
case v.typ == Null:
b.Write(nullstr)
case v.IsQuoted() || v.typ == Bit:
encodeBytesASCII(v.val, b)
default:
b.Write(v.val)
}
} | go | func (v Value) EncodeASCII(b BinWriter) {
switch {
case v.typ == Null:
b.Write(nullstr)
case v.IsQuoted() || v.typ == Bit:
encodeBytesASCII(v.val, b)
default:
b.Write(v.val)
}
} | [
"func",
"(",
"v",
"Value",
")",
"EncodeASCII",
"(",
"b",
"BinWriter",
")",
"{",
"switch",
"{",
"case",
"v",
".",
"typ",
"==",
"Null",
":",
"b",
".",
"Write",
"(",
"nullstr",
")",
"\n",
"case",
"v",
".",
"IsQuoted",
"(",
")",
"||",
"v",
".",
"ty... | // EncodeASCII encodes the value using 7-bit clean ascii bytes. | [
"EncodeASCII",
"encodes",
"the",
"value",
"using",
"7",
"-",
"bit",
"clean",
"ascii",
"bytes",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/value.go#L239-L248 |
135,645 | vitessio/vitess | go/sqltypes/value.go | MarshalJSON | func (v Value) MarshalJSON() ([]byte, error) {
switch {
case v.IsQuoted() || v.typ == Bit:
return json.Marshal(v.ToString())
case v.typ == Null:
return nullstr, nil
}
return v.val, nil
} | go | func (v Value) MarshalJSON() ([]byte, error) {
switch {
case v.IsQuoted() || v.typ == Bit:
return json.Marshal(v.ToString())
case v.typ == Null:
return nullstr, nil
}
return v.val, nil
} | [
"func",
"(",
"v",
"Value",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"switch",
"{",
"case",
"v",
".",
"IsQuoted",
"(",
")",
"||",
"v",
".",
"typ",
"==",
"Bit",
":",
"return",
"json",
".",
"Marshal",
"(",
"v",
... | // MarshalJSON should only be used for testing.
// It's not a complete implementation. | [
"MarshalJSON",
"should",
"only",
"be",
"used",
"for",
"testing",
".",
"It",
"s",
"not",
"a",
"complete",
"implementation",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/value.go#L292-L300 |
135,646 | vitessio/vitess | go/sqltypes/value.go | UnmarshalJSON | func (v *Value) UnmarshalJSON(b []byte) error {
if len(b) == 0 {
return fmt.Errorf("error unmarshaling empty bytes")
}
var val interface{}
var err error
switch b[0] {
case '-':
var ival int64
err = json.Unmarshal(b, &ival)
val = ival
case '"':
var bval []byte
err = json.Unmarshal(b, &bval)
val = bv... | go | func (v *Value) UnmarshalJSON(b []byte) error {
if len(b) == 0 {
return fmt.Errorf("error unmarshaling empty bytes")
}
var val interface{}
var err error
switch b[0] {
case '-':
var ival int64
err = json.Unmarshal(b, &ival)
val = ival
case '"':
var bval []byte
err = json.Unmarshal(b, &bval)
val = bv... | [
"func",
"(",
"v",
"*",
"Value",
")",
"UnmarshalJSON",
"(",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"len",
"(",
"b",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"var",
"val",
"interface",
... | // UnmarshalJSON should only be used for testing.
// It's not a complete implementation. | [
"UnmarshalJSON",
"should",
"only",
"be",
"used",
"for",
"testing",
".",
"It",
"s",
"not",
"a",
"complete",
"implementation",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/value.go#L304-L331 |
135,647 | vitessio/vitess | go/vt/worker/fakevtworkerclient/fakevtworkerclient.go | FakeVtworkerClientFactory | func (f *FakeVtworkerClient) FakeVtworkerClientFactory(addr string) (vtworkerclient.Client, error) {
return &perAddrFakeVtworkerClient{f, addr}, nil
} | go | func (f *FakeVtworkerClient) FakeVtworkerClientFactory(addr string) (vtworkerclient.Client, error) {
return &perAddrFakeVtworkerClient{f, addr}, nil
} | [
"func",
"(",
"f",
"*",
"FakeVtworkerClient",
")",
"FakeVtworkerClientFactory",
"(",
"addr",
"string",
")",
"(",
"vtworkerclient",
".",
"Client",
",",
"error",
")",
"{",
"return",
"&",
"perAddrFakeVtworkerClient",
"{",
"f",
",",
"addr",
"}",
",",
"nil",
"\n",... | // FakeVtworkerClientFactory returns the current instance and stores the
// dialed server address in an outer struct. | [
"FakeVtworkerClientFactory",
"returns",
"the",
"current",
"instance",
"and",
"stores",
"the",
"dialed",
"server",
"address",
"in",
"an",
"outer",
"struct",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/fakevtworkerclient/fakevtworkerclient.go#L42-L44 |
135,648 | vitessio/vitess | go/vt/worker/fakevtworkerclient/fakevtworkerclient.go | ExecuteVtworkerCommand | func (c *perAddrFakeVtworkerClient) ExecuteVtworkerCommand(ctx context.Context, args []string) (logutil.EventStream, error) {
return c.FakeLoggerEventStreamingClient.StreamResult(c.addr, args)
} | go | func (c *perAddrFakeVtworkerClient) ExecuteVtworkerCommand(ctx context.Context, args []string) (logutil.EventStream, error) {
return c.FakeLoggerEventStreamingClient.StreamResult(c.addr, args)
} | [
"func",
"(",
"c",
"*",
"perAddrFakeVtworkerClient",
")",
"ExecuteVtworkerCommand",
"(",
"ctx",
"context",
".",
"Context",
",",
"args",
"[",
"]",
"string",
")",
"(",
"logutil",
".",
"EventStream",
",",
"error",
")",
"{",
"return",
"c",
".",
"FakeLoggerEventSt... | // ExecuteVtworkerCommand is part of the vtworkerclient interface. | [
"ExecuteVtworkerCommand",
"is",
"part",
"of",
"the",
"vtworkerclient",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/fakevtworkerclient/fakevtworkerclient.go#L54-L56 |
135,649 | vitessio/vitess | go/cache/lru_cache.go | NewLRUCache | func NewLRUCache(capacity int64) *LRUCache {
return &LRUCache{
list: list.New(),
table: make(map[string]*list.Element),
capacity: capacity,
}
} | go | func NewLRUCache(capacity int64) *LRUCache {
return &LRUCache{
list: list.New(),
table: make(map[string]*list.Element),
capacity: capacity,
}
} | [
"func",
"NewLRUCache",
"(",
"capacity",
"int64",
")",
"*",
"LRUCache",
"{",
"return",
"&",
"LRUCache",
"{",
"list",
":",
"list",
".",
"New",
"(",
")",
",",
"table",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"list",
".",
"Element",
")",
",",... | // NewLRUCache creates a new empty cache with the given capacity. | [
"NewLRUCache",
"creates",
"a",
"new",
"empty",
"cache",
"with",
"the",
"given",
"capacity",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cache/lru_cache.go#L70-L76 |
135,650 | vitessio/vitess | go/cache/lru_cache.go | Get | func (lru *LRUCache) Get(key string) (v Value, ok bool) {
lru.mu.Lock()
defer lru.mu.Unlock()
element := lru.table[key]
if element == nil {
return nil, false
}
lru.moveToFront(element)
return element.Value.(*entry).value, true
} | go | func (lru *LRUCache) Get(key string) (v Value, ok bool) {
lru.mu.Lock()
defer lru.mu.Unlock()
element := lru.table[key]
if element == nil {
return nil, false
}
lru.moveToFront(element)
return element.Value.(*entry).value, true
} | [
"func",
"(",
"lru",
"*",
"LRUCache",
")",
"Get",
"(",
"key",
"string",
")",
"(",
"v",
"Value",
",",
"ok",
"bool",
")",
"{",
"lru",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lru",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"element",
... | // Get returns a value from the cache, and marks the entry as most
// recently used. | [
"Get",
"returns",
"a",
"value",
"from",
"the",
"cache",
"and",
"marks",
"the",
"entry",
"as",
"most",
"recently",
"used",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cache/lru_cache.go#L80-L90 |
135,651 | vitessio/vitess | go/cache/lru_cache.go | Set | func (lru *LRUCache) Set(key string, value Value) {
lru.mu.Lock()
defer lru.mu.Unlock()
if element := lru.table[key]; element != nil {
lru.updateInplace(element, value)
} else {
lru.addNew(key, value)
}
} | go | func (lru *LRUCache) Set(key string, value Value) {
lru.mu.Lock()
defer lru.mu.Unlock()
if element := lru.table[key]; element != nil {
lru.updateInplace(element, value)
} else {
lru.addNew(key, value)
}
} | [
"func",
"(",
"lru",
"*",
"LRUCache",
")",
"Set",
"(",
"key",
"string",
",",
"value",
"Value",
")",
"{",
"lru",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lru",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"element",
":=",
"lru",
"."... | // Set sets a value in the cache. | [
"Set",
"sets",
"a",
"value",
"in",
"the",
"cache",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cache/lru_cache.go#L105-L114 |
135,652 | vitessio/vitess | go/cache/lru_cache.go | SetIfAbsent | func (lru *LRUCache) SetIfAbsent(key string, value Value) {
lru.mu.Lock()
defer lru.mu.Unlock()
if element := lru.table[key]; element != nil {
lru.moveToFront(element)
} else {
lru.addNew(key, value)
}
} | go | func (lru *LRUCache) SetIfAbsent(key string, value Value) {
lru.mu.Lock()
defer lru.mu.Unlock()
if element := lru.table[key]; element != nil {
lru.moveToFront(element)
} else {
lru.addNew(key, value)
}
} | [
"func",
"(",
"lru",
"*",
"LRUCache",
")",
"SetIfAbsent",
"(",
"key",
"string",
",",
"value",
"Value",
")",
"{",
"lru",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lru",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"element",
":=",
"lru... | // SetIfAbsent will set the value in the cache if not present. If the
// value exists in the cache, we don't set it. | [
"SetIfAbsent",
"will",
"set",
"the",
"value",
"in",
"the",
"cache",
"if",
"not",
"present",
".",
"If",
"the",
"value",
"exists",
"in",
"the",
"cache",
"we",
"don",
"t",
"set",
"it",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cache/lru_cache.go#L118-L127 |
135,653 | vitessio/vitess | go/cache/lru_cache.go | Delete | func (lru *LRUCache) Delete(key string) bool {
lru.mu.Lock()
defer lru.mu.Unlock()
element := lru.table[key]
if element == nil {
return false
}
lru.list.Remove(element)
delete(lru.table, key)
lru.size -= element.Value.(*entry).size
return true
} | go | func (lru *LRUCache) Delete(key string) bool {
lru.mu.Lock()
defer lru.mu.Unlock()
element := lru.table[key]
if element == nil {
return false
}
lru.list.Remove(element)
delete(lru.table, key)
lru.size -= element.Value.(*entry).size
return true
} | [
"func",
"(",
"lru",
"*",
"LRUCache",
")",
"Delete",
"(",
"key",
"string",
")",
"bool",
"{",
"lru",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lru",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"element",
":=",
"lru",
".",
"table",
"[",
"k... | // Delete removes an entry from the cache, and returns if the entry existed. | [
"Delete",
"removes",
"an",
"entry",
"from",
"the",
"cache",
"and",
"returns",
"if",
"the",
"entry",
"existed",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cache/lru_cache.go#L130-L143 |
135,654 | vitessio/vitess | go/cache/lru_cache.go | Clear | func (lru *LRUCache) Clear() {
lru.mu.Lock()
defer lru.mu.Unlock()
lru.list.Init()
lru.table = make(map[string]*list.Element)
lru.size = 0
} | go | func (lru *LRUCache) Clear() {
lru.mu.Lock()
defer lru.mu.Unlock()
lru.list.Init()
lru.table = make(map[string]*list.Element)
lru.size = 0
} | [
"func",
"(",
"lru",
"*",
"LRUCache",
")",
"Clear",
"(",
")",
"{",
"lru",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lru",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"lru",
".",
"list",
".",
"Init",
"(",
")",
"\n",
"lru",
".",
"table",... | // Clear will clear the entire cache. | [
"Clear",
"will",
"clear",
"the",
"entire",
"cache",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cache/lru_cache.go#L146-L153 |
135,655 | vitessio/vitess | go/cache/lru_cache.go | SetCapacity | func (lru *LRUCache) SetCapacity(capacity int64) {
lru.mu.Lock()
defer lru.mu.Unlock()
lru.capacity = capacity
lru.checkCapacity()
} | go | func (lru *LRUCache) SetCapacity(capacity int64) {
lru.mu.Lock()
defer lru.mu.Unlock()
lru.capacity = capacity
lru.checkCapacity()
} | [
"func",
"(",
"lru",
"*",
"LRUCache",
")",
"SetCapacity",
"(",
"capacity",
"int64",
")",
"{",
"lru",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lru",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"lru",
".",
"capacity",
"=",
"capacity",
"\n",
... | // SetCapacity will set the capacity of the cache. If the capacity is
// smaller, and the current cache size exceed that capacity, the cache
// will be shrank. | [
"SetCapacity",
"will",
"set",
"the",
"capacity",
"of",
"the",
"cache",
".",
"If",
"the",
"capacity",
"is",
"smaller",
"and",
"the",
"current",
"cache",
"size",
"exceed",
"that",
"capacity",
"the",
"cache",
"will",
"be",
"shrank",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cache/lru_cache.go#L158-L164 |
135,656 | vitessio/vitess | go/cache/lru_cache.go | Stats | func (lru *LRUCache) Stats() (length, size, capacity, evictions int64, oldest time.Time) {
lru.mu.Lock()
defer lru.mu.Unlock()
if lastElem := lru.list.Back(); lastElem != nil {
oldest = lastElem.Value.(*entry).timeAccessed
}
return int64(lru.list.Len()), lru.size, lru.capacity, lru.evictions, oldest
} | go | func (lru *LRUCache) Stats() (length, size, capacity, evictions int64, oldest time.Time) {
lru.mu.Lock()
defer lru.mu.Unlock()
if lastElem := lru.list.Back(); lastElem != nil {
oldest = lastElem.Value.(*entry).timeAccessed
}
return int64(lru.list.Len()), lru.size, lru.capacity, lru.evictions, oldest
} | [
"func",
"(",
"lru",
"*",
"LRUCache",
")",
"Stats",
"(",
")",
"(",
"length",
",",
"size",
",",
"capacity",
",",
"evictions",
"int64",
",",
"oldest",
"time",
".",
"Time",
")",
"{",
"lru",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lru",
".",... | // Stats returns a few stats on the cache. | [
"Stats",
"returns",
"a",
"few",
"stats",
"on",
"the",
"cache",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cache/lru_cache.go#L167-L174 |
135,657 | vitessio/vitess | go/cache/lru_cache.go | StatsJSON | func (lru *LRUCache) StatsJSON() string {
if lru == nil {
return "{}"
}
l, s, c, e, o := lru.Stats()
return fmt.Sprintf("{\"Length\": %v, \"Size\": %v, \"Capacity\": %v, \"Evictions\": %v, \"OldestAccess\": \"%v\"}", l, s, c, e, o)
} | go | func (lru *LRUCache) StatsJSON() string {
if lru == nil {
return "{}"
}
l, s, c, e, o := lru.Stats()
return fmt.Sprintf("{\"Length\": %v, \"Size\": %v, \"Capacity\": %v, \"Evictions\": %v, \"OldestAccess\": \"%v\"}", l, s, c, e, o)
} | [
"func",
"(",
"lru",
"*",
"LRUCache",
")",
"StatsJSON",
"(",
")",
"string",
"{",
"if",
"lru",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"l",
",",
"s",
",",
"c",
",",
"e",
",",
"o",
":=",
"lru",
".",
"Stats",
"(",
")",
"\n",
"r... | // StatsJSON returns stats as a JSON object in a string. | [
"StatsJSON",
"returns",
"stats",
"as",
"a",
"JSON",
"object",
"in",
"a",
"string",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cache/lru_cache.go#L177-L183 |
135,658 | vitessio/vitess | go/cache/lru_cache.go | Length | func (lru *LRUCache) Length() int64 {
lru.mu.Lock()
defer lru.mu.Unlock()
return int64(lru.list.Len())
} | go | func (lru *LRUCache) Length() int64 {
lru.mu.Lock()
defer lru.mu.Unlock()
return int64(lru.list.Len())
} | [
"func",
"(",
"lru",
"*",
"LRUCache",
")",
"Length",
"(",
")",
"int64",
"{",
"lru",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lru",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"int64",
"(",
"lru",
".",
"list",
".",
"Len",
"(",
... | // Length returns how many elements are in the cache | [
"Length",
"returns",
"how",
"many",
"elements",
"are",
"in",
"the",
"cache"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cache/lru_cache.go#L186-L190 |
135,659 | vitessio/vitess | go/cache/lru_cache.go | Capacity | func (lru *LRUCache) Capacity() int64 {
lru.mu.Lock()
defer lru.mu.Unlock()
return lru.capacity
} | go | func (lru *LRUCache) Capacity() int64 {
lru.mu.Lock()
defer lru.mu.Unlock()
return lru.capacity
} | [
"func",
"(",
"lru",
"*",
"LRUCache",
")",
"Capacity",
"(",
")",
"int64",
"{",
"lru",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lru",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"lru",
".",
"capacity",
"\n",
"}"
] | // Capacity returns the cache maximum capacity. | [
"Capacity",
"returns",
"the",
"cache",
"maximum",
"capacity",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cache/lru_cache.go#L200-L204 |
135,660 | vitessio/vitess | go/cache/lru_cache.go | Evictions | func (lru *LRUCache) Evictions() int64 {
lru.mu.Lock()
defer lru.mu.Unlock()
return lru.evictions
} | go | func (lru *LRUCache) Evictions() int64 {
lru.mu.Lock()
defer lru.mu.Unlock()
return lru.evictions
} | [
"func",
"(",
"lru",
"*",
"LRUCache",
")",
"Evictions",
"(",
")",
"int64",
"{",
"lru",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lru",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"lru",
".",
"evictions",
"\n",
"}"
] | // Evictions returns the eviction count. | [
"Evictions",
"returns",
"the",
"eviction",
"count",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cache/lru_cache.go#L207-L211 |
135,661 | vitessio/vitess | go/cache/lru_cache.go | Keys | func (lru *LRUCache) Keys() []string {
lru.mu.Lock()
defer lru.mu.Unlock()
keys := make([]string, 0, lru.list.Len())
for e := lru.list.Front(); e != nil; e = e.Next() {
keys = append(keys, e.Value.(*entry).key)
}
return keys
} | go | func (lru *LRUCache) Keys() []string {
lru.mu.Lock()
defer lru.mu.Unlock()
keys := make([]string, 0, lru.list.Len())
for e := lru.list.Front(); e != nil; e = e.Next() {
keys = append(keys, e.Value.(*entry).key)
}
return keys
} | [
"func",
"(",
"lru",
"*",
"LRUCache",
")",
"Keys",
"(",
")",
"[",
"]",
"string",
"{",
"lru",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lru",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"keys",
":=",
"make",
"(",
"[",
"]",
"string",
","... | // Keys returns all the keys for the cache, ordered from most recently
// used to last recently used. | [
"Keys",
"returns",
"all",
"the",
"keys",
"for",
"the",
"cache",
"ordered",
"from",
"most",
"recently",
"used",
"to",
"last",
"recently",
"used",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cache/lru_cache.go#L226-L235 |
135,662 | vitessio/vitess | go/cache/lru_cache.go | Items | func (lru *LRUCache) Items() []Item {
lru.mu.Lock()
defer lru.mu.Unlock()
items := make([]Item, 0, lru.list.Len())
for e := lru.list.Front(); e != nil; e = e.Next() {
v := e.Value.(*entry)
items = append(items, Item{Key: v.key, Value: v.value})
}
return items
} | go | func (lru *LRUCache) Items() []Item {
lru.mu.Lock()
defer lru.mu.Unlock()
items := make([]Item, 0, lru.list.Len())
for e := lru.list.Front(); e != nil; e = e.Next() {
v := e.Value.(*entry)
items = append(items, Item{Key: v.key, Value: v.value})
}
return items
} | [
"func",
"(",
"lru",
"*",
"LRUCache",
")",
"Items",
"(",
")",
"[",
"]",
"Item",
"{",
"lru",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lru",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"items",
":=",
"make",
"(",
"[",
"]",
"Item",
",",
... | // Items returns all the values for the cache, ordered from most recently
// used to last recently used. | [
"Items",
"returns",
"all",
"the",
"values",
"for",
"the",
"cache",
"ordered",
"from",
"most",
"recently",
"used",
"to",
"last",
"recently",
"used",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/cache/lru_cache.go#L239-L249 |
135,663 | vitessio/vitess | go/vt/throttler/result.go | add | func (rr *resultRing) add(r result) {
rr.mu.Lock()
defer rr.mu.Unlock()
rr.values[rr.position] = r
rr.position++
if rr.position == len(rr.values) {
rr.position = 0
rr.wrapped = true
}
} | go | func (rr *resultRing) add(r result) {
rr.mu.Lock()
defer rr.mu.Unlock()
rr.values[rr.position] = r
rr.position++
if rr.position == len(rr.values) {
rr.position = 0
rr.wrapped = true
}
} | [
"func",
"(",
"rr",
"*",
"resultRing",
")",
"add",
"(",
"r",
"result",
")",
"{",
"rr",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"rr",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"rr",
".",
"values",
"[",
"rr",
".",
"position",
"]",
"="... | // add inserts a new result into the ring buffer. | [
"add",
"inserts",
"a",
"new",
"result",
"into",
"the",
"ring",
"buffer",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/result.go#L137-L147 |
135,664 | vitessio/vitess | go/vt/throttler/replication_lag_cache.go | add | func (c *replicationLagCache) add(r replicationLagRecord) {
if !r.Up {
// Tablet is down. Do no longer track it.
delete(c.entries, r.Key)
delete(c.ignoredSlowReplicasInARow, r.Key)
return
}
entry, ok := c.entries[r.Key]
if !ok {
entry = newReplicationLagHistory(c.historyCapacityPerReplica)
c.entries[r.... | go | func (c *replicationLagCache) add(r replicationLagRecord) {
if !r.Up {
// Tablet is down. Do no longer track it.
delete(c.entries, r.Key)
delete(c.ignoredSlowReplicasInARow, r.Key)
return
}
entry, ok := c.entries[r.Key]
if !ok {
entry = newReplicationLagHistory(c.historyCapacityPerReplica)
c.entries[r.... | [
"func",
"(",
"c",
"*",
"replicationLagCache",
")",
"add",
"(",
"r",
"replicationLagRecord",
")",
"{",
"if",
"!",
"r",
".",
"Up",
"{",
"// Tablet is down. Do no longer track it.",
"delete",
"(",
"c",
".",
"entries",
",",
"r",
".",
"Key",
")",
"\n",
"delete"... | // add inserts or updates "r" in the cache for the replica with the key "r.Key". | [
"add",
"inserts",
"or",
"updates",
"r",
"in",
"the",
"cache",
"for",
"the",
"replica",
"with",
"the",
"key",
"r",
".",
"Key",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/replication_lag_cache.go#L62-L77 |
135,665 | vitessio/vitess | go/vt/throttler/replication_lag_cache.go | sortByLag | func (c *replicationLagCache) sortByLag(ignoreNSlowestReplicas int, minimumReplicationLag int64) {
// Reset the current list of ignored replicas.
c.slowReplicas = make(map[string]bool)
if ignoreNSlowestReplicas >= len(c.entries) {
// Do not ignore slow replicas if all would get ignored.
return
}
// Turn the ... | go | func (c *replicationLagCache) sortByLag(ignoreNSlowestReplicas int, minimumReplicationLag int64) {
// Reset the current list of ignored replicas.
c.slowReplicas = make(map[string]bool)
if ignoreNSlowestReplicas >= len(c.entries) {
// Do not ignore slow replicas if all would get ignored.
return
}
// Turn the ... | [
"func",
"(",
"c",
"*",
"replicationLagCache",
")",
"sortByLag",
"(",
"ignoreNSlowestReplicas",
"int",
",",
"minimumReplicationLag",
"int64",
")",
"{",
"// Reset the current list of ignored replicas.",
"c",
".",
"slowReplicas",
"=",
"make",
"(",
"map",
"[",
"string",
... | // sortByLag sorts all replicas by their latest replication lag value and
// tablet uid and updates the c.slowReplicas set. | [
"sortByLag",
"sorts",
"all",
"replicas",
"by",
"their",
"latest",
"replication",
"lag",
"value",
"and",
"tablet",
"uid",
"and",
"updates",
"the",
"c",
".",
"slowReplicas",
"set",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/replication_lag_cache.go#L102-L127 |
135,666 | vitessio/vitess | go/vt/throttler/replication_lag_cache.go | ignoreSlowReplica | func (c *replicationLagCache) ignoreSlowReplica(key string) bool {
if len(c.slowReplicas) == 0 {
// No slow replicas at all.
return false
}
slow := c.slowReplicas[key]
if slow {
// Record that we're ignoring this replica.
c.ignoredSlowReplicasInARow[key] = true
if len(c.ignoredSlowReplicasInARow) == len... | go | func (c *replicationLagCache) ignoreSlowReplica(key string) bool {
if len(c.slowReplicas) == 0 {
// No slow replicas at all.
return false
}
slow := c.slowReplicas[key]
if slow {
// Record that we're ignoring this replica.
c.ignoredSlowReplicasInARow[key] = true
if len(c.ignoredSlowReplicasInARow) == len... | [
"func",
"(",
"c",
"*",
"replicationLagCache",
")",
"ignoreSlowReplica",
"(",
"key",
"string",
")",
"bool",
"{",
"if",
"len",
"(",
"c",
".",
"slowReplicas",
")",
"==",
"0",
"{",
"// No slow replicas at all.",
"return",
"false",
"\n",
"}",
"\n\n",
"slow",
":... | // ignoreSlowReplica returns true if the MaxReplicationLagModule should ignore
// this slow replica.
// "key" refers to ReplicationLagRecord.TabletStats.Key. | [
"ignoreSlowReplica",
"returns",
"true",
"if",
"the",
"MaxReplicationLagModule",
"should",
"ignore",
"this",
"slow",
"replica",
".",
"key",
"refers",
"to",
"ReplicationLagRecord",
".",
"TabletStats",
".",
"Key",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/throttler/replication_lag_cache.go#L144-L169 |
135,667 | vitessio/vitess | go/vt/tableacl/simpleacl/simpleacl.go | IsMember | func (sacl SimpleACL) IsMember(principal *querypb.VTGateCallerID) bool {
if sacl[principal.Username] {
return true
}
for _, grp := range principal.Groups {
if sacl[grp] {
return true
}
}
return false
} | go | func (sacl SimpleACL) IsMember(principal *querypb.VTGateCallerID) bool {
if sacl[principal.Username] {
return true
}
for _, grp := range principal.Groups {
if sacl[grp] {
return true
}
}
return false
} | [
"func",
"(",
"sacl",
"SimpleACL",
")",
"IsMember",
"(",
"principal",
"*",
"querypb",
".",
"VTGateCallerID",
")",
"bool",
"{",
"if",
"sacl",
"[",
"principal",
".",
"Username",
"]",
"{",
"return",
"true",
"\n",
"}",
"\n",
"for",
"_",
",",
"grp",
":=",
... | // IsMember checks the membership of a principal in this ACL | [
"IsMember",
"checks",
"the",
"membership",
"of",
"a",
"principal",
"in",
"this",
"ACL"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/tableacl/simpleacl/simpleacl.go#L28-L38 |
135,668 | vitessio/vitess | go/vt/tableacl/simpleacl/simpleacl.go | New | func (factory *Factory) New(entries []string) (acl.ACL, error) {
acl := SimpleACL(map[string]bool{})
for _, e := range entries {
acl[e] = true
}
return acl, nil
} | go | func (factory *Factory) New(entries []string) (acl.ACL, error) {
acl := SimpleACL(map[string]bool{})
for _, e := range entries {
acl[e] = true
}
return acl, nil
} | [
"func",
"(",
"factory",
"*",
"Factory",
")",
"New",
"(",
"entries",
"[",
"]",
"string",
")",
"(",
"acl",
".",
"ACL",
",",
"error",
")",
"{",
"acl",
":=",
"SimpleACL",
"(",
"map",
"[",
"string",
"]",
"bool",
"{",
"}",
")",
"\n",
"for",
"_",
",",... | // New creates a new ACL instance. | [
"New",
"creates",
"a",
"new",
"ACL",
"instance",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/tableacl/simpleacl/simpleacl.go#L44-L50 |
135,669 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/schema.go | Done | func (ta *Table) Done() {
if !ta.HasPrimary() {
return
}
pkIndex := ta.Indexes[0]
ta.PKColumns = make([]int, len(pkIndex.Columns))
for i, pkCol := range pkIndex.Columns {
ta.PKColumns[i] = ta.FindColumn(pkCol)
}
} | go | func (ta *Table) Done() {
if !ta.HasPrimary() {
return
}
pkIndex := ta.Indexes[0]
ta.PKColumns = make([]int, len(pkIndex.Columns))
for i, pkCol := range pkIndex.Columns {
ta.PKColumns[i] = ta.FindColumn(pkCol)
}
} | [
"func",
"(",
"ta",
"*",
"Table",
")",
"Done",
"(",
")",
"{",
"if",
"!",
"ta",
".",
"HasPrimary",
"(",
")",
"{",
"return",
"\n",
"}",
"\n",
"pkIndex",
":=",
"ta",
".",
"Indexes",
"[",
"0",
"]",
"\n",
"ta",
".",
"PKColumns",
"=",
"make",
"(",
"... | // Done must be called after columns and indexes are added to
// the table. It will build additional metadata like PKColumns. | [
"Done",
"must",
"be",
"called",
"after",
"columns",
"and",
"indexes",
"are",
"added",
"to",
"the",
"table",
".",
"It",
"will",
"build",
"additional",
"metadata",
"like",
"PKColumns",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/schema.go#L134-L143 |
135,670 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/schema.go | AddColumn | func (ta *Table) AddColumn(name string, columnType querypb.Type, defval sqltypes.Value, extra string) {
index := len(ta.Columns)
ta.Columns = append(ta.Columns, TableColumn{Name: sqlparser.NewColIdent(name)})
ta.Columns[index].Type = columnType
if extra == "auto_increment" {
ta.Columns[index].IsAuto = true
// I... | go | func (ta *Table) AddColumn(name string, columnType querypb.Type, defval sqltypes.Value, extra string) {
index := len(ta.Columns)
ta.Columns = append(ta.Columns, TableColumn{Name: sqlparser.NewColIdent(name)})
ta.Columns[index].Type = columnType
if extra == "auto_increment" {
ta.Columns[index].IsAuto = true
// I... | [
"func",
"(",
"ta",
"*",
"Table",
")",
"AddColumn",
"(",
"name",
"string",
",",
"columnType",
"querypb",
".",
"Type",
",",
"defval",
"sqltypes",
".",
"Value",
",",
"extra",
"string",
")",
"{",
"index",
":=",
"len",
"(",
"ta",
".",
"Columns",
")",
"\n"... | // AddColumn adds a column to the Table. | [
"AddColumn",
"adds",
"a",
"column",
"to",
"the",
"Table",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/schema.go#L146-L160 |
135,671 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/schema.go | FindColumn | func (ta *Table) FindColumn(name sqlparser.ColIdent) int {
for i, col := range ta.Columns {
if col.Name.Equal(name) {
return i
}
}
return -1
} | go | func (ta *Table) FindColumn(name sqlparser.ColIdent) int {
for i, col := range ta.Columns {
if col.Name.Equal(name) {
return i
}
}
return -1
} | [
"func",
"(",
"ta",
"*",
"Table",
")",
"FindColumn",
"(",
"name",
"sqlparser",
".",
"ColIdent",
")",
"int",
"{",
"for",
"i",
",",
"col",
":=",
"range",
"ta",
".",
"Columns",
"{",
"if",
"col",
".",
"Name",
".",
"Equal",
"(",
"name",
")",
"{",
"retu... | // FindColumn finds a column in the table. It returns the index if found.
// Otherwise, it returns -1. | [
"FindColumn",
"finds",
"a",
"column",
"in",
"the",
"table",
".",
"It",
"returns",
"the",
"index",
"if",
"found",
".",
"Otherwise",
"it",
"returns",
"-",
"1",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/schema.go#L164-L171 |
135,672 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/schema.go | GetPKColumn | func (ta *Table) GetPKColumn(index int) *TableColumn {
return &ta.Columns[ta.PKColumns[index]]
} | go | func (ta *Table) GetPKColumn(index int) *TableColumn {
return &ta.Columns[ta.PKColumns[index]]
} | [
"func",
"(",
"ta",
"*",
"Table",
")",
"GetPKColumn",
"(",
"index",
"int",
")",
"*",
"TableColumn",
"{",
"return",
"&",
"ta",
".",
"Columns",
"[",
"ta",
".",
"PKColumns",
"[",
"index",
"]",
"]",
"\n",
"}"
] | // GetPKColumn returns the pk column specified by the index. | [
"GetPKColumn",
"returns",
"the",
"pk",
"column",
"specified",
"by",
"the",
"index",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/schema.go#L174-L176 |
135,673 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/schema.go | AddIndex | func (ta *Table) AddIndex(name string, unique bool) (index *Index) {
index = NewIndex(name, unique)
ta.Indexes = append(ta.Indexes, index)
return index
} | go | func (ta *Table) AddIndex(name string, unique bool) (index *Index) {
index = NewIndex(name, unique)
ta.Indexes = append(ta.Indexes, index)
return index
} | [
"func",
"(",
"ta",
"*",
"Table",
")",
"AddIndex",
"(",
"name",
"string",
",",
"unique",
"bool",
")",
"(",
"index",
"*",
"Index",
")",
"{",
"index",
"=",
"NewIndex",
"(",
"name",
",",
"unique",
")",
"\n",
"ta",
".",
"Indexes",
"=",
"append",
"(",
... | // AddIndex adds an index to the table. | [
"AddIndex",
"adds",
"an",
"index",
"to",
"the",
"table",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/schema.go#L179-L183 |
135,674 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/schema.go | SetMysqlStats | func (ta *Table) SetMysqlStats(tr, dl, il, df, mdl sqltypes.Value) {
v, _ := sqltypes.ToInt64(tr)
ta.TableRows.Set(v)
v, _ = sqltypes.ToInt64(dl)
ta.DataLength.Set(v)
v, _ = sqltypes.ToInt64(il)
ta.IndexLength.Set(v)
v, _ = sqltypes.ToInt64(df)
ta.DataFree.Set(v)
v, _ = sqltypes.ToInt64(mdl)
ta.MaxDataLength.... | go | func (ta *Table) SetMysqlStats(tr, dl, il, df, mdl sqltypes.Value) {
v, _ := sqltypes.ToInt64(tr)
ta.TableRows.Set(v)
v, _ = sqltypes.ToInt64(dl)
ta.DataLength.Set(v)
v, _ = sqltypes.ToInt64(il)
ta.IndexLength.Set(v)
v, _ = sqltypes.ToInt64(df)
ta.DataFree.Set(v)
v, _ = sqltypes.ToInt64(mdl)
ta.MaxDataLength.... | [
"func",
"(",
"ta",
"*",
"Table",
")",
"SetMysqlStats",
"(",
"tr",
",",
"dl",
",",
"il",
",",
"df",
",",
"mdl",
"sqltypes",
".",
"Value",
")",
"{",
"v",
",",
"_",
":=",
"sqltypes",
".",
"ToInt64",
"(",
"tr",
")",
"\n",
"ta",
".",
"TableRows",
".... | // SetMysqlStats receives the values found in the mysql information_schema.tables table | [
"SetMysqlStats",
"receives",
"the",
"values",
"found",
"in",
"the",
"mysql",
"information_schema",
".",
"tables",
"table"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/schema.go#L186-L197 |
135,675 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/schema.go | HasPrimary | func (ta *Table) HasPrimary() bool {
return len(ta.Indexes) != 0 && ta.Indexes[0].Name.EqualString("primary")
} | go | func (ta *Table) HasPrimary() bool {
return len(ta.Indexes) != 0 && ta.Indexes[0].Name.EqualString("primary")
} | [
"func",
"(",
"ta",
"*",
"Table",
")",
"HasPrimary",
"(",
")",
"bool",
"{",
"return",
"len",
"(",
"ta",
".",
"Indexes",
")",
"!=",
"0",
"&&",
"ta",
".",
"Indexes",
"[",
"0",
"]",
".",
"Name",
".",
"EqualString",
"(",
"\"",
"\"",
")",
"\n",
"}"
] | // HasPrimary returns true if the table has a primary key. | [
"HasPrimary",
"returns",
"true",
"if",
"the",
"table",
"has",
"a",
"primary",
"key",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/schema.go#L200-L202 |
135,676 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/schema.go | UniqueIndexes | func (ta *Table) UniqueIndexes() int {
unique := 0
for _, idx := range ta.Indexes {
if idx.Unique {
unique++
}
}
return unique
} | go | func (ta *Table) UniqueIndexes() int {
unique := 0
for _, idx := range ta.Indexes {
if idx.Unique {
unique++
}
}
return unique
} | [
"func",
"(",
"ta",
"*",
"Table",
")",
"UniqueIndexes",
"(",
")",
"int",
"{",
"unique",
":=",
"0",
"\n",
"for",
"_",
",",
"idx",
":=",
"range",
"ta",
".",
"Indexes",
"{",
"if",
"idx",
".",
"Unique",
"{",
"unique",
"++",
"\n",
"}",
"\n",
"}",
"\n... | // UniqueIndexes returns the number of unique indexes on the table | [
"UniqueIndexes",
"returns",
"the",
"number",
"of",
"unique",
"indexes",
"on",
"the",
"table"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/schema.go#L205-L213 |
135,677 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/schema.go | NewIndex | func NewIndex(name string, unique bool) *Index {
return &Index{Name: sqlparser.NewColIdent(name), Unique: unique}
} | go | func NewIndex(name string, unique bool) *Index {
return &Index{Name: sqlparser.NewColIdent(name), Unique: unique}
} | [
"func",
"NewIndex",
"(",
"name",
"string",
",",
"unique",
"bool",
")",
"*",
"Index",
"{",
"return",
"&",
"Index",
"{",
"Name",
":",
"sqlparser",
".",
"NewColIdent",
"(",
"name",
")",
",",
"Unique",
":",
"unique",
"}",
"\n",
"}"
] | // NewIndex creates a new Index. | [
"NewIndex",
"creates",
"a",
"new",
"Index",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/schema.go#L227-L229 |
135,678 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/schema.go | AddColumn | func (idx *Index) AddColumn(name string, cardinality uint64) {
idx.Columns = append(idx.Columns, sqlparser.NewColIdent(name))
if cardinality == 0 {
cardinality = uint64(len(idx.Cardinality) + 1)
}
idx.Cardinality = append(idx.Cardinality, cardinality)
} | go | func (idx *Index) AddColumn(name string, cardinality uint64) {
idx.Columns = append(idx.Columns, sqlparser.NewColIdent(name))
if cardinality == 0 {
cardinality = uint64(len(idx.Cardinality) + 1)
}
idx.Cardinality = append(idx.Cardinality, cardinality)
} | [
"func",
"(",
"idx",
"*",
"Index",
")",
"AddColumn",
"(",
"name",
"string",
",",
"cardinality",
"uint64",
")",
"{",
"idx",
".",
"Columns",
"=",
"append",
"(",
"idx",
".",
"Columns",
",",
"sqlparser",
".",
"NewColIdent",
"(",
"name",
")",
")",
"\n",
"i... | // AddColumn adds a column to the index. | [
"AddColumn",
"adds",
"a",
"column",
"to",
"the",
"index",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/schema.go#L232-L238 |
135,679 | vitessio/vitess | go/vt/vttablet/tabletserver/schema/schema.go | FindColumn | func (idx *Index) FindColumn(name sqlparser.ColIdent) int {
for i, colName := range idx.Columns {
if colName.Equal(name) {
return i
}
}
return -1
} | go | func (idx *Index) FindColumn(name sqlparser.ColIdent) int {
for i, colName := range idx.Columns {
if colName.Equal(name) {
return i
}
}
return -1
} | [
"func",
"(",
"idx",
"*",
"Index",
")",
"FindColumn",
"(",
"name",
"sqlparser",
".",
"ColIdent",
")",
"int",
"{",
"for",
"i",
",",
"colName",
":=",
"range",
"idx",
".",
"Columns",
"{",
"if",
"colName",
".",
"Equal",
"(",
"name",
")",
"{",
"return",
... | // FindColumn finds a column in the index. It returns the index if found.
// Otherwise, it returns -1. | [
"FindColumn",
"finds",
"a",
"column",
"in",
"the",
"index",
".",
"It",
"returns",
"the",
"index",
"if",
"found",
".",
"Otherwise",
"it",
"returns",
"-",
"1",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/schema/schema.go#L242-L249 |
135,680 | vitessio/vitess | go/vt/vttablet/tabletmanager/heartbeat_reporter.go | registerHeartbeatReporter | func registerHeartbeatReporter(controller tabletserver.Controller) {
if !tabletenv.Config.HeartbeatEnable {
return
}
reporter := &Reporter{controller}
health.DefaultAggregator.Register("heartbeat_reporter", reporter)
} | go | func registerHeartbeatReporter(controller tabletserver.Controller) {
if !tabletenv.Config.HeartbeatEnable {
return
}
reporter := &Reporter{controller}
health.DefaultAggregator.Register("heartbeat_reporter", reporter)
} | [
"func",
"registerHeartbeatReporter",
"(",
"controller",
"tabletserver",
".",
"Controller",
")",
"{",
"if",
"!",
"tabletenv",
".",
"Config",
".",
"HeartbeatEnable",
"{",
"return",
"\n",
"}",
"\n\n",
"reporter",
":=",
"&",
"Reporter",
"{",
"controller",
"}",
"\n... | // RegisterReporter registers the heartbeat reader as a healthcheck reporter so that its
// measurements will be picked up in healthchecks. | [
"RegisterReporter",
"registers",
"the",
"heartbeat",
"reader",
"as",
"a",
"healthcheck",
"reporter",
"so",
"that",
"its",
"measurements",
"will",
"be",
"picked",
"up",
"in",
"healthchecks",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/heartbeat_reporter.go#L36-L43 |
135,681 | vitessio/vitess | go/vt/vttablet/tabletmanager/heartbeat_reporter.go | Report | func (r *Reporter) Report(isSlaveType, shouldQueryServiceBeRunning bool) (time.Duration, error) {
if !isSlaveType {
return 0, nil
}
return r.controller.HeartbeatLag()
} | go | func (r *Reporter) Report(isSlaveType, shouldQueryServiceBeRunning bool) (time.Duration, error) {
if !isSlaveType {
return 0, nil
}
return r.controller.HeartbeatLag()
} | [
"func",
"(",
"r",
"*",
"Reporter",
")",
"Report",
"(",
"isSlaveType",
",",
"shouldQueryServiceBeRunning",
"bool",
")",
"(",
"time",
".",
"Duration",
",",
"error",
")",
"{",
"if",
"!",
"isSlaveType",
"{",
"return",
"0",
",",
"nil",
"\n",
"}",
"\n",
"ret... | // Report is part of the health.Reporter interface. It returns the last reported value
// written by the watchHeartbeat goroutine. If we're the master, it just returns 0. | [
"Report",
"is",
"part",
"of",
"the",
"health",
".",
"Reporter",
"interface",
".",
"It",
"returns",
"the",
"last",
"reported",
"value",
"written",
"by",
"the",
"watchHeartbeat",
"goroutine",
".",
"If",
"we",
"re",
"the",
"master",
"it",
"just",
"returns",
"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/heartbeat_reporter.go#L52-L57 |
135,682 | vitessio/vitess | go/vt/wrangler/keyspace.go | SetKeyspaceShardingInfo | func (wr *Wrangler) SetKeyspaceShardingInfo(ctx context.Context, keyspace, shardingColumnName string, shardingColumnType topodatapb.KeyspaceIdType, force bool) (err error) {
// Lock the keyspace
ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, "SetKeyspaceShardingInfo")
if lockErr != nil {
return lockErr
... | go | func (wr *Wrangler) SetKeyspaceShardingInfo(ctx context.Context, keyspace, shardingColumnName string, shardingColumnType topodatapb.KeyspaceIdType, force bool) (err error) {
// Lock the keyspace
ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, "SetKeyspaceShardingInfo")
if lockErr != nil {
return lockErr
... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"SetKeyspaceShardingInfo",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
",",
"shardingColumnName",
"string",
",",
"shardingColumnType",
"topodatapb",
".",
"KeyspaceIdType",
",",
"force",
"bool",
")",
"(",
"err"... | // keyspace related methods for Wrangler
// SetKeyspaceShardingInfo locks a keyspace and sets its ShardingColumnName
// and ShardingColumnType | [
"keyspace",
"related",
"methods",
"for",
"Wrangler",
"SetKeyspaceShardingInfo",
"locks",
"a",
"keyspace",
"and",
"sets",
"its",
"ShardingColumnName",
"and",
"ShardingColumnType"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/keyspace.go#L59-L92 |
135,683 | vitessio/vitess | go/vt/wrangler/keyspace.go | SplitClone | func (wr *Wrangler) SplitClone(ctx context.Context, keyspace string, from, to []string) error {
var fromShards, toShards []*topo.ShardInfo
for _, shard := range from {
si, err := wr.ts.GetShard(ctx, keyspace, shard)
if err != nil {
return vterrors.Wrapf(err, "GetShard(%s) failed", shard)
}
fromShards = app... | go | func (wr *Wrangler) SplitClone(ctx context.Context, keyspace string, from, to []string) error {
var fromShards, toShards []*topo.ShardInfo
for _, shard := range from {
si, err := wr.ts.GetShard(ctx, keyspace, shard)
if err != nil {
return vterrors.Wrapf(err, "GetShard(%s) failed", shard)
}
fromShards = app... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"SplitClone",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
",",
"from",
",",
"to",
"[",
"]",
"string",
")",
"error",
"{",
"var",
"fromShards",
",",
"toShards",
"[",
"]",
"*",
"topo",
".",
... | // SplitClone initiates a SplitClone workflow. | [
"SplitClone",
"initiates",
"a",
"SplitClone",
"workflow",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/keyspace.go#L95-L150 |
135,684 | vitessio/vitess | go/vt/wrangler/keyspace.go | VerticalSplitClone | func (wr *Wrangler) VerticalSplitClone(ctx context.Context, fromKeyspace, toKeyspace string, tables []string) error {
source, err := wr.ts.GetOnlyShard(ctx, fromKeyspace)
if err != nil {
return vterrors.Wrapf(err, "GetOnlyShard(%s) failed", fromKeyspace)
}
dest, err := wr.ts.GetOnlyShard(ctx, toKeyspace)
if err ... | go | func (wr *Wrangler) VerticalSplitClone(ctx context.Context, fromKeyspace, toKeyspace string, tables []string) error {
source, err := wr.ts.GetOnlyShard(ctx, fromKeyspace)
if err != nil {
return vterrors.Wrapf(err, "GetOnlyShard(%s) failed", fromKeyspace)
}
dest, err := wr.ts.GetOnlyShard(ctx, toKeyspace)
if err ... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"VerticalSplitClone",
"(",
"ctx",
"context",
".",
"Context",
",",
"fromKeyspace",
",",
"toKeyspace",
"string",
",",
"tables",
"[",
"]",
"string",
")",
"error",
"{",
"source",
",",
"err",
":=",
"wr",
".",
"ts",
"... | // VerticalSplitClone initiates a VerticalSplitClone workflow. | [
"VerticalSplitClone",
"initiates",
"a",
"VerticalSplitClone",
"workflow",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/keyspace.go#L153-L193 |
135,685 | vitessio/vitess | go/vt/wrangler/keyspace.go | MigrateServedTypes | func (wr *Wrangler) MigrateServedTypes(ctx context.Context, keyspace, shard string, cells []string, servedType topodatapb.TabletType, reverse, skipReFreshState bool, filteredReplicationWaitTime time.Duration, reverseReplication bool) (err error) {
// check input parameters
if servedType == topodatapb.TabletType_MASTE... | go | func (wr *Wrangler) MigrateServedTypes(ctx context.Context, keyspace, shard string, cells []string, servedType topodatapb.TabletType, reverse, skipReFreshState bool, filteredReplicationWaitTime time.Duration, reverseReplication bool) (err error) {
// check input parameters
if servedType == topodatapb.TabletType_MASTE... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"MigrateServedTypes",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
",",
"shard",
"string",
",",
"cells",
"[",
"]",
"string",
",",
"servedType",
"topodatapb",
".",
"TabletType",
",",
"reverse",
",",
"skipR... | // MigrateServedTypes is used during horizontal splits to migrate a
// served type from a list of shards to another. | [
"MigrateServedTypes",
"is",
"used",
"during",
"horizontal",
"splits",
"to",
"migrate",
"a",
"served",
"type",
"from",
"a",
"list",
"of",
"shards",
"to",
"another",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/keyspace.go#L340-L420 |
135,686 | vitessio/vitess | go/vt/wrangler/keyspace.go | findSourceDest | func (wr *Wrangler) findSourceDest(ctx context.Context, os *topotools.OverlappingShards) (sourceShards, destinationShards []*topo.ShardInfo, err error) {
// It's possible that both source and destination have source shards because of reversible replication.
// If so, the Frozen flag in the tablet control record dicta... | go | func (wr *Wrangler) findSourceDest(ctx context.Context, os *topotools.OverlappingShards) (sourceShards, destinationShards []*topo.ShardInfo, err error) {
// It's possible that both source and destination have source shards because of reversible replication.
// If so, the Frozen flag in the tablet control record dicta... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"findSourceDest",
"(",
"ctx",
"context",
".",
"Context",
",",
"os",
"*",
"topotools",
".",
"OverlappingShards",
")",
"(",
"sourceShards",
",",
"destinationShards",
"[",
"]",
"*",
"topo",
".",
"ShardInfo",
",",
"err"... | // findSourceDest derives the source and destination from the overlapping shards.
// Whichever side has SourceShards is a destination. | [
"findSourceDest",
"derives",
"the",
"source",
"and",
"destination",
"from",
"the",
"overlapping",
"shards",
".",
"Whichever",
"side",
"has",
"SourceShards",
"is",
"a",
"destination",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/keyspace.go#L424-L457 |
135,687 | vitessio/vitess | go/vt/wrangler/keyspace.go | refreshMasters | func (wr *Wrangler) refreshMasters(ctx context.Context, shards []*topo.ShardInfo) error {
wg := sync.WaitGroup{}
rec := concurrency.AllErrorRecorder{}
for _, si := range shards {
wg.Add(1)
go func(si *topo.ShardInfo) {
defer wg.Done()
wr.Logger().Infof("RefreshState master %v", topoproto.TabletAliasString(... | go | func (wr *Wrangler) refreshMasters(ctx context.Context, shards []*topo.ShardInfo) error {
wg := sync.WaitGroup{}
rec := concurrency.AllErrorRecorder{}
for _, si := range shards {
wg.Add(1)
go func(si *topo.ShardInfo) {
defer wg.Done()
wr.Logger().Infof("RefreshState master %v", topoproto.TabletAliasString(... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"refreshMasters",
"(",
"ctx",
"context",
".",
"Context",
",",
"shards",
"[",
"]",
"*",
"topo",
".",
"ShardInfo",
")",
"error",
"{",
"wg",
":=",
"sync",
".",
"WaitGroup",
"{",
"}",
"\n",
"rec",
":=",
"concurren... | // refreshMasters will just RPC-ping all the masters with RefreshState | [
"refreshMasters",
"will",
"just",
"RPC",
"-",
"ping",
"all",
"the",
"masters",
"with",
"RefreshState"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/keyspace.go#L537-L560 |
135,688 | vitessio/vitess | go/vt/wrangler/keyspace.go | replicaMigrateServedType | func (wr *Wrangler) replicaMigrateServedType(ctx context.Context, keyspace string, sourceShards, destinationShards []*topo.ShardInfo, cells []string, servedType topodatapb.TabletType, reverse bool) (err error) {
ev := &events.MigrateServedTypes{
KeyspaceName: keyspace,
SourceShards: sourceShards,
Desti... | go | func (wr *Wrangler) replicaMigrateServedType(ctx context.Context, keyspace string, sourceShards, destinationShards []*topo.ShardInfo, cells []string, servedType topodatapb.TabletType, reverse bool) (err error) {
ev := &events.MigrateServedTypes{
KeyspaceName: keyspace,
SourceShards: sourceShards,
Desti... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"replicaMigrateServedType",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
",",
"sourceShards",
",",
"destinationShards",
"[",
"]",
"*",
"topo",
".",
"ShardInfo",
",",
"cells",
"[",
"]",
"string",
... | // replicaMigrateServedType operates with the keyspace locked | [
"replicaMigrateServedType",
"operates",
"with",
"the",
"keyspace",
"locked"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/keyspace.go#L563-L604 |
135,689 | vitessio/vitess | go/vt/wrangler/keyspace.go | updateShardRecords | func (wr *Wrangler) updateShardRecords(ctx context.Context, keyspace string, shards []*topo.ShardInfo, cells []string, servedType topodatapb.TabletType, isFrom bool, clearSourceShards bool) (err error) {
err = wr.ts.UpdateDisableQueryService(ctx, keyspace, shards, servedType, cells, isFrom /* disable */)
if err != ni... | go | func (wr *Wrangler) updateShardRecords(ctx context.Context, keyspace string, shards []*topo.ShardInfo, cells []string, servedType topodatapb.TabletType, isFrom bool, clearSourceShards bool) (err error) {
err = wr.ts.UpdateDisableQueryService(ctx, keyspace, shards, servedType, cells, isFrom /* disable */)
if err != ni... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"updateShardRecords",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
",",
"shards",
"[",
"]",
"*",
"topo",
".",
"ShardInfo",
",",
"cells",
"[",
"]",
"string",
",",
"servedType",
"topodatapb",
".... | // updateShardRecords updates the shard records based on 'from' or 'to' direction. | [
"updateShardRecords",
"updates",
"the",
"shard",
"records",
"based",
"on",
"from",
"or",
"to",
"direction",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/keyspace.go#L850-L877 |
135,690 | vitessio/vitess | go/vt/wrangler/keyspace.go | updateFrozenFlag | func (wr *Wrangler) updateFrozenFlag(ctx context.Context, shards []*topo.ShardInfo, value bool) (err error) {
for i, si := range shards {
updatedShard, err := wr.ts.UpdateShardFields(ctx, si.Keyspace(), si.ShardName(), func(si *topo.ShardInfo) error {
tc := si.GetTabletControl(topodatapb.TabletType_MASTER)
if ... | go | func (wr *Wrangler) updateFrozenFlag(ctx context.Context, shards []*topo.ShardInfo, value bool) (err error) {
for i, si := range shards {
updatedShard, err := wr.ts.UpdateShardFields(ctx, si.Keyspace(), si.ShardName(), func(si *topo.ShardInfo) error {
tc := si.GetTabletControl(topodatapb.TabletType_MASTER)
if ... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"updateFrozenFlag",
"(",
"ctx",
"context",
".",
"Context",
",",
"shards",
"[",
"]",
"*",
"topo",
".",
"ShardInfo",
",",
"value",
"bool",
")",
"(",
"err",
"error",
")",
"{",
"for",
"i",
",",
"si",
":=",
"rang... | // updateFrozenFlag sets or unsets the Frozen flag for master migration. This is performed
// for all master tablet control records. | [
"updateFrozenFlag",
"sets",
"or",
"unsets",
"the",
"Frozen",
"flag",
"for",
"master",
"migration",
".",
"This",
"is",
"performed",
"for",
"all",
"master",
"tablet",
"control",
"records",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/keyspace.go#L881-L904 |
135,691 | vitessio/vitess | go/vt/wrangler/keyspace.go | MigrateServedFrom | func (wr *Wrangler) MigrateServedFrom(ctx context.Context, keyspace, shard string, servedType topodatapb.TabletType, cells []string, reverse bool, filteredReplicationWaitTime time.Duration) (err error) {
// read the destination keyspace, check it
ki, err := wr.ts.GetKeyspace(ctx, keyspace)
if err != nil {
return e... | go | func (wr *Wrangler) MigrateServedFrom(ctx context.Context, keyspace, shard string, servedType topodatapb.TabletType, cells []string, reverse bool, filteredReplicationWaitTime time.Duration) (err error) {
// read the destination keyspace, check it
ki, err := wr.ts.GetKeyspace(ctx, keyspace)
if err != nil {
return e... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"MigrateServedFrom",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
",",
"shard",
"string",
",",
"servedType",
"topodatapb",
".",
"TabletType",
",",
"cells",
"[",
"]",
"string",
",",
"reverse",
"bool",
",",... | // MigrateServedFrom is used during vertical splits to migrate a
// served type from a keyspace to another. | [
"MigrateServedFrom",
"is",
"used",
"during",
"vertical",
"splits",
"to",
"migrate",
"a",
"served",
"type",
"from",
"a",
"keyspace",
"to",
"another",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/keyspace.go#L1083-L1130 |
135,692 | vitessio/vitess | go/vt/wrangler/keyspace.go | SetKeyspaceServedFrom | func (wr *Wrangler) SetKeyspaceServedFrom(ctx context.Context, keyspace string, servedType topodatapb.TabletType, cells []string, sourceKeyspace string, remove bool) (err error) {
// Lock the keyspace
ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, "SetKeyspaceServedFrom")
if lockErr != nil {
return lock... | go | func (wr *Wrangler) SetKeyspaceServedFrom(ctx context.Context, keyspace string, servedType topodatapb.TabletType, cells []string, sourceKeyspace string, remove bool) (err error) {
// Lock the keyspace
ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, "SetKeyspaceServedFrom")
if lockErr != nil {
return lock... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"SetKeyspaceServedFrom",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
",",
"servedType",
"topodatapb",
".",
"TabletType",
",",
"cells",
"[",
"]",
"string",
",",
"sourceKeyspace",
"string",
",",
"r... | // SetKeyspaceServedFrom locks a keyspace and changes its ServerFromMap | [
"SetKeyspaceServedFrom",
"locks",
"a",
"keyspace",
"and",
"changes",
"its",
"ServerFromMap"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/keyspace.go#L1296-L1313 |
135,693 | vitessio/vitess | go/vt/wrangler/keyspace.go | RefreshTabletsByShard | func (wr *Wrangler) RefreshTabletsByShard(ctx context.Context, si *topo.ShardInfo, tabletTypes []topodatapb.TabletType, cells []string) error {
wr.Logger().Infof("RefreshTabletsByShard called on shard %v/%v", si.Keyspace(), si.ShardName())
tabletMap, err := wr.ts.GetTabletMapForShardByCell(ctx, si.Keyspace(), si.Shar... | go | func (wr *Wrangler) RefreshTabletsByShard(ctx context.Context, si *topo.ShardInfo, tabletTypes []topodatapb.TabletType, cells []string) error {
wr.Logger().Infof("RefreshTabletsByShard called on shard %v/%v", si.Keyspace(), si.ShardName())
tabletMap, err := wr.ts.GetTabletMapForShardByCell(ctx, si.Keyspace(), si.Shar... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"RefreshTabletsByShard",
"(",
"ctx",
"context",
".",
"Context",
",",
"si",
"*",
"topo",
".",
"ShardInfo",
",",
"tabletTypes",
"[",
"]",
"topodatapb",
".",
"TabletType",
",",
"cells",
"[",
"]",
"string",
")",
"erro... | // RefreshTabletsByShard calls RefreshState on all the tables of a
// given type in a shard. It would work for the master, but the
// discovery wouldn't be very efficient. | [
"RefreshTabletsByShard",
"calls",
"RefreshState",
"on",
"all",
"the",
"tables",
"of",
"a",
"given",
"type",
"in",
"a",
"shard",
".",
"It",
"would",
"work",
"for",
"the",
"master",
"but",
"the",
"discovery",
"wouldn",
"t",
"be",
"very",
"efficient",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/keyspace.go#L1318-L1360 |
135,694 | vitessio/vitess | go/vt/wrangler/keyspace.go | DeleteKeyspace | func (wr *Wrangler) DeleteKeyspace(ctx context.Context, keyspace string, recursive bool) error {
shards, err := wr.ts.GetShardNames(ctx, keyspace)
if err != nil {
return err
}
if recursive {
wr.Logger().Infof("Deleting all shards (and their tablets) in keyspace %v", keyspace)
for _, shard := range shards {
... | go | func (wr *Wrangler) DeleteKeyspace(ctx context.Context, keyspace string, recursive bool) error {
shards, err := wr.ts.GetShardNames(ctx, keyspace)
if err != nil {
return err
}
if recursive {
wr.Logger().Infof("Deleting all shards (and their tablets) in keyspace %v", keyspace)
for _, shard := range shards {
... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"DeleteKeyspace",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
",",
"recursive",
"bool",
")",
"error",
"{",
"shards",
",",
"err",
":=",
"wr",
".",
"ts",
".",
"GetShardNames",
"(",
"ctx",
","... | // DeleteKeyspace will do all the necessary changes in the topology server
// to entirely remove a keyspace. | [
"DeleteKeyspace",
"will",
"do",
"all",
"the",
"necessary",
"changes",
"in",
"the",
"topology",
"server",
"to",
"entirely",
"remove",
"a",
"keyspace",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/keyspace.go#L1364-L1411 |
135,695 | vitessio/vitess | go/mysql/fakesqldb/server.go | New | func New(t *testing.T) *DB {
// Pick a path for our socket.
socketDir, err := ioutil.TempDir("", "fakesqldb")
if err != nil {
t.Fatalf("ioutil.TempDir failed: %v", err)
}
socketFile := path.Join(socketDir, "fakesqldb.sock")
// Create our DB.
db := &DB{
t: t,
socketFile: socketFile,
name: ... | go | func New(t *testing.T) *DB {
// Pick a path for our socket.
socketDir, err := ioutil.TempDir("", "fakesqldb")
if err != nil {
t.Fatalf("ioutil.TempDir failed: %v", err)
}
socketFile := path.Join(socketDir, "fakesqldb.sock")
// Create our DB.
db := &DB{
t: t,
socketFile: socketFile,
name: ... | [
"func",
"New",
"(",
"t",
"*",
"testing",
".",
"T",
")",
"*",
"DB",
"{",
"// Pick a path for our socket.",
"socketDir",
",",
"err",
":=",
"ioutil",
".",
"TempDir",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"t",
".",... | // New creates a server, and starts listening. | [
"New",
"creates",
"a",
"server",
"and",
"starts",
"listening",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L143-L180 |
135,696 | vitessio/vitess | go/mysql/fakesqldb/server.go | SetName | func (db *DB) SetName(name string) *DB {
db.mu.Lock()
defer db.mu.Unlock()
db.name = name
return db
} | go | func (db *DB) SetName(name string) *DB {
db.mu.Lock()
defer db.mu.Unlock()
db.name = name
return db
} | [
"func",
"(",
"db",
"*",
"DB",
")",
"SetName",
"(",
"name",
"string",
")",
"*",
"DB",
"{",
"db",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"db",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"db",
".",
"name",
"=",
"name",
"\n",
"return",... | // SetName sets the name of the DB. to differentiate them in tests if needed. | [
"SetName",
"sets",
"the",
"name",
"of",
"the",
"DB",
".",
"to",
"differentiate",
"them",
"in",
"tests",
"if",
"needed",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L183-L189 |
135,697 | vitessio/vitess | go/mysql/fakesqldb/server.go | OrderMatters | func (db *DB) OrderMatters() *DB {
db.mu.Lock()
defer db.mu.Unlock()
db.orderMatters = true
return db
} | go | func (db *DB) OrderMatters() *DB {
db.mu.Lock()
defer db.mu.Unlock()
db.orderMatters = true
return db
} | [
"func",
"(",
"db",
"*",
"DB",
")",
"OrderMatters",
"(",
")",
"*",
"DB",
"{",
"db",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"db",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"db",
".",
"orderMatters",
"=",
"true",
"\n",
"return",
"db",
... | // OrderMatters sets the orderMatters flag. | [
"OrderMatters",
"sets",
"the",
"orderMatters",
"flag",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L192-L198 |
135,698 | vitessio/vitess | go/mysql/fakesqldb/server.go | Close | func (db *DB) Close() {
db.listener.Close()
db.acceptWG.Wait()
db.CloseAllConnections()
tmpDir := path.Dir(db.socketFile)
os.RemoveAll(tmpDir)
} | go | func (db *DB) Close() {
db.listener.Close()
db.acceptWG.Wait()
db.CloseAllConnections()
tmpDir := path.Dir(db.socketFile)
os.RemoveAll(tmpDir)
} | [
"func",
"(",
"db",
"*",
"DB",
")",
"Close",
"(",
")",
"{",
"db",
".",
"listener",
".",
"Close",
"(",
")",
"\n",
"db",
".",
"acceptWG",
".",
"Wait",
"(",
")",
"\n\n",
"db",
".",
"CloseAllConnections",
"(",
")",
"\n\n",
"tmpDir",
":=",
"path",
".",... | // Close closes the Listener and waits for it to stop accepting.
// It then closes all connections, and cleans up the temporary directory. | [
"Close",
"closes",
"the",
"Listener",
"and",
"waits",
"for",
"it",
"to",
"stop",
"accepting",
".",
"It",
"then",
"closes",
"all",
"connections",
"and",
"cleans",
"up",
"the",
"temporary",
"directory",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L202-L210 |
135,699 | vitessio/vitess | go/mysql/fakesqldb/server.go | ConnParams | func (db *DB) ConnParams() *mysql.ConnParams {
return &mysql.ConnParams{
UnixSocket: db.socketFile,
Uname: "user1",
Pass: "password1",
Charset: "utf8",
}
} | go | func (db *DB) ConnParams() *mysql.ConnParams {
return &mysql.ConnParams{
UnixSocket: db.socketFile,
Uname: "user1",
Pass: "password1",
Charset: "utf8",
}
} | [
"func",
"(",
"db",
"*",
"DB",
")",
"ConnParams",
"(",
")",
"*",
"mysql",
".",
"ConnParams",
"{",
"return",
"&",
"mysql",
".",
"ConnParams",
"{",
"UnixSocket",
":",
"db",
".",
"socketFile",
",",
"Uname",
":",
"\"",
"\"",
",",
"Pass",
":",
"\"",
"\""... | // ConnParams returns the ConnParams to connect to the DB. | [
"ConnParams",
"returns",
"the",
"ConnParams",
"to",
"connect",
"to",
"the",
"DB",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/fakesqldb/server.go#L257-L264 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.