id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
136,600 | vitessio/vitess | go/vt/vttablet/tabletserver/tx_pool.go | LocalBegin | func (axp *TxPool) LocalBegin(ctx context.Context, options *querypb.ExecuteOptions) (*TxConnection, string, error) {
span, ctx := trace.NewSpan(ctx, "TxPool.LocalBegin")
defer span.Finish()
transactionID, beginSQL, err := axp.Begin(ctx, options)
if err != nil {
return nil, "", err
}
conn, err := axp.Get(transa... | go | func (axp *TxPool) LocalBegin(ctx context.Context, options *querypb.ExecuteOptions) (*TxConnection, string, error) {
span, ctx := trace.NewSpan(ctx, "TxPool.LocalBegin")
defer span.Finish()
transactionID, beginSQL, err := axp.Begin(ctx, options)
if err != nil {
return nil, "", err
}
conn, err := axp.Get(transa... | [
"func",
"(",
"axp",
"*",
"TxPool",
")",
"LocalBegin",
"(",
"ctx",
"context",
".",
"Context",
",",
"options",
"*",
"querypb",
".",
"ExecuteOptions",
")",
"(",
"*",
"TxConnection",
",",
"string",
",",
"error",
")",
"{",
"span",
",",
"ctx",
":=",
"trace",... | // LocalBegin is equivalent to Begin->Get.
// It's used for executing transactions within a request. It's safe
// to always call LocalConclude at the end. | [
"LocalBegin",
"is",
"equivalent",
"to",
"Begin",
"-",
">",
"Get",
".",
"It",
"s",
"used",
"for",
"executing",
"transactions",
"within",
"a",
"request",
".",
"It",
"s",
"safe",
"to",
"always",
"call",
"LocalConclude",
"at",
"the",
"end",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L322-L332 |
136,601 | vitessio/vitess | go/vt/vttablet/tabletserver/tx_pool.go | LocalCommit | func (axp *TxPool) LocalCommit(ctx context.Context, conn *TxConnection, mc messageCommitter) (string, error) {
span, ctx := trace.NewSpan(ctx, "TxPool.LocalCommit")
defer span.Finish()
defer conn.conclude(TxCommit, "transaction committed")
defer mc.LockDB(conn.NewMessages, conn.ChangedMessages)()
if conn.Autocomm... | go | func (axp *TxPool) LocalCommit(ctx context.Context, conn *TxConnection, mc messageCommitter) (string, error) {
span, ctx := trace.NewSpan(ctx, "TxPool.LocalCommit")
defer span.Finish()
defer conn.conclude(TxCommit, "transaction committed")
defer mc.LockDB(conn.NewMessages, conn.ChangedMessages)()
if conn.Autocomm... | [
"func",
"(",
"axp",
"*",
"TxPool",
")",
"LocalCommit",
"(",
"ctx",
"context",
".",
"Context",
",",
"conn",
"*",
"TxConnection",
",",
"mc",
"messageCommitter",
")",
"(",
"string",
",",
"error",
")",
"{",
"span",
",",
"ctx",
":=",
"trace",
".",
"NewSpan"... | // LocalCommit is the commit function for LocalBegin. | [
"LocalCommit",
"is",
"the",
"commit",
"function",
"for",
"LocalBegin",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L335-L352 |
136,602 | vitessio/vitess | go/vt/vttablet/tabletserver/tx_pool.go | LocalConclude | func (axp *TxPool) LocalConclude(ctx context.Context, conn *TxConnection) {
span, ctx := trace.NewSpan(ctx, "TxPool.LocalConclude")
defer span.Finish()
if conn.DBConn != nil {
_ = axp.localRollback(ctx, conn)
}
} | go | func (axp *TxPool) LocalConclude(ctx context.Context, conn *TxConnection) {
span, ctx := trace.NewSpan(ctx, "TxPool.LocalConclude")
defer span.Finish()
if conn.DBConn != nil {
_ = axp.localRollback(ctx, conn)
}
} | [
"func",
"(",
"axp",
"*",
"TxPool",
")",
"LocalConclude",
"(",
"ctx",
"context",
".",
"Context",
",",
"conn",
"*",
"TxConnection",
")",
"{",
"span",
",",
"ctx",
":=",
"trace",
".",
"NewSpan",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"defer",
"span",
... | // LocalConclude concludes a transaction started by LocalBegin.
// If the transaction was not previously concluded, it's rolled back. | [
"LocalConclude",
"concludes",
"a",
"transaction",
"started",
"by",
"LocalBegin",
".",
"If",
"the",
"transaction",
"was",
"not",
"previously",
"concluded",
"it",
"s",
"rolled",
"back",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L356-L362 |
136,603 | vitessio/vitess | go/vt/vttablet/tabletserver/tx_pool.go | LogActive | func (axp *TxPool) LogActive() {
axp.logMu.Lock()
defer axp.logMu.Unlock()
if time.Since(axp.lastLog) < txLogInterval {
return
}
axp.lastLog = time.Now()
conns := axp.activePool.GetAll()
for _, c := range conns {
c.(*TxConnection).LogToFile.Set(1)
}
} | go | func (axp *TxPool) LogActive() {
axp.logMu.Lock()
defer axp.logMu.Unlock()
if time.Since(axp.lastLog) < txLogInterval {
return
}
axp.lastLog = time.Now()
conns := axp.activePool.GetAll()
for _, c := range conns {
c.(*TxConnection).LogToFile.Set(1)
}
} | [
"func",
"(",
"axp",
"*",
"TxPool",
")",
"LogActive",
"(",
")",
"{",
"axp",
".",
"logMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"axp",
".",
"logMu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"time",
".",
"Since",
"(",
"axp",
".",
"lastLog",
")",
"<",... | // LogActive causes all existing transactions to be logged when they complete.
// The logging is throttled to no more than once every txLogInterval. | [
"LogActive",
"causes",
"all",
"existing",
"transactions",
"to",
"be",
"logged",
"when",
"they",
"complete",
".",
"The",
"logging",
"is",
"throttled",
"to",
"no",
"more",
"than",
"once",
"every",
"txLogInterval",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L375-L386 |
136,604 | vitessio/vitess | go/vt/vttablet/tabletserver/tx_pool.go | SetTimeout | func (axp *TxPool) SetTimeout(timeout time.Duration) {
axp.timeout.Set(timeout)
axp.ticks.SetInterval(timeout / 10)
} | go | func (axp *TxPool) SetTimeout(timeout time.Duration) {
axp.timeout.Set(timeout)
axp.ticks.SetInterval(timeout / 10)
} | [
"func",
"(",
"axp",
"*",
"TxPool",
")",
"SetTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"{",
"axp",
".",
"timeout",
".",
"Set",
"(",
"timeout",
")",
"\n",
"axp",
".",
"ticks",
".",
"SetInterval",
"(",
"timeout",
"/",
"10",
")",
"\n",
"}... | // SetTimeout sets the transaction timeout. | [
"SetTimeout",
"sets",
"the",
"transaction",
"timeout",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L394-L397 |
136,605 | vitessio/vitess | go/vt/vttablet/tabletserver/tx_pool.go | Exec | func (txc *TxConnection) Exec(ctx context.Context, query string, maxrows int, wantfields bool) (*sqltypes.Result, error) {
r, err := txc.DBConn.ExecOnce(ctx, query, maxrows, wantfields)
if err != nil {
if mysql.IsConnErr(err) {
select {
case <-ctx.Done():
// If the context is done, the query was killed.
... | go | func (txc *TxConnection) Exec(ctx context.Context, query string, maxrows int, wantfields bool) (*sqltypes.Result, error) {
r, err := txc.DBConn.ExecOnce(ctx, query, maxrows, wantfields)
if err != nil {
if mysql.IsConnErr(err) {
select {
case <-ctx.Done():
// If the context is done, the query was killed.
... | [
"func",
"(",
"txc",
"*",
"TxConnection",
")",
"Exec",
"(",
"ctx",
"context",
".",
"Context",
",",
"query",
"string",
",",
"maxrows",
"int",
",",
"wantfields",
"bool",
")",
"(",
"*",
"sqltypes",
".",
"Result",
",",
"error",
")",
"{",
"r",
",",
"err",
... | // Exec executes the statement for the current transaction. | [
"Exec",
"executes",
"the",
"statement",
"for",
"the",
"current",
"transaction",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L433-L448 |
136,606 | vitessio/vitess | go/vt/vttablet/tabletserver/tx_pool.go | BeginAgain | func (txc *TxConnection) BeginAgain(ctx context.Context) error {
if _, err := txc.DBConn.Exec(ctx, "commit", 1, false); err != nil {
return err
}
if _, err := txc.DBConn.Exec(ctx, "begin", 1, false); err != nil {
return err
}
return nil
} | go | func (txc *TxConnection) BeginAgain(ctx context.Context) error {
if _, err := txc.DBConn.Exec(ctx, "commit", 1, false); err != nil {
return err
}
if _, err := txc.DBConn.Exec(ctx, "begin", 1, false); err != nil {
return err
}
return nil
} | [
"func",
"(",
"txc",
"*",
"TxConnection",
")",
"BeginAgain",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"if",
"_",
",",
"err",
":=",
"txc",
".",
"DBConn",
".",
"Exec",
"(",
"ctx",
",",
"\"",
"\"",
",",
"1",
",",
"false",
")",
";",
... | // BeginAgain commits the existing transaction and begins a new one | [
"BeginAgain",
"commits",
"the",
"existing",
"transaction",
"and",
"begins",
"a",
"new",
"one"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L451-L459 |
136,607 | vitessio/vitess | go/vt/vttablet/tabletserver/tx_pool.go | Recycle | func (txc *TxConnection) Recycle() {
if txc.IsClosed() {
txc.conclude(TxClose, "closed")
} else {
txc.pool.activePool.Put(txc.TransactionID)
}
} | go | func (txc *TxConnection) Recycle() {
if txc.IsClosed() {
txc.conclude(TxClose, "closed")
} else {
txc.pool.activePool.Put(txc.TransactionID)
}
} | [
"func",
"(",
"txc",
"*",
"TxConnection",
")",
"Recycle",
"(",
")",
"{",
"if",
"txc",
".",
"IsClosed",
"(",
")",
"{",
"txc",
".",
"conclude",
"(",
"TxClose",
",",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"txc",
".",
"pool",
".",
"activePool",
".",... | // Recycle returns the connection to the pool. The transaction remains
// active. | [
"Recycle",
"returns",
"the",
"connection",
"to",
"the",
"pool",
".",
"The",
"transaction",
"remains",
"active",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L463-L469 |
136,608 | vitessio/vitess | go/vt/vttablet/tabletserver/tx_pool.go | RecordQuery | func (txc *TxConnection) RecordQuery(query string) {
txc.Queries = append(txc.Queries, query)
} | go | func (txc *TxConnection) RecordQuery(query string) {
txc.Queries = append(txc.Queries, query)
} | [
"func",
"(",
"txc",
"*",
"TxConnection",
")",
"RecordQuery",
"(",
"query",
"string",
")",
"{",
"txc",
".",
"Queries",
"=",
"append",
"(",
"txc",
".",
"Queries",
",",
"query",
")",
"\n",
"}"
] | // RecordQuery records the query against this transaction. | [
"RecordQuery",
"records",
"the",
"query",
"against",
"this",
"transaction",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L472-L474 |
136,609 | vitessio/vitess | go/vt/vttablet/tabletserver/tx_pool.go | Format | func (txc *TxConnection) Format(params url.Values) string {
return fmt.Sprintf(
"%v\t'%v'\t'%v'\t%v\t%v\t%.6f\t%v\t%v\t\n",
txc.TransactionID,
callerid.GetPrincipal(txc.EffectiveCallerID),
callerid.GetUsername(txc.ImmediateCallerID),
txc.StartTime.Format(time.StampMicro),
txc.EndTime.Format(time.StampMicro... | go | func (txc *TxConnection) Format(params url.Values) string {
return fmt.Sprintf(
"%v\t'%v'\t'%v'\t%v\t%v\t%.6f\t%v\t%v\t\n",
txc.TransactionID,
callerid.GetPrincipal(txc.EffectiveCallerID),
callerid.GetUsername(txc.ImmediateCallerID),
txc.StartTime.Format(time.StampMicro),
txc.EndTime.Format(time.StampMicro... | [
"func",
"(",
"txc",
"*",
"TxConnection",
")",
"Format",
"(",
"params",
"url",
".",
"Values",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\t",
"\\t",
"\\t",
"\\t",
"\\t",
"\\t",
"\\t",
"\\t",
"\\n",
"\"",
",",
"txc",
".",
"Tran... | // Format returns a printable version of the connection info. | [
"Format",
"returns",
"a",
"printable",
"version",
"of",
"the",
"connection",
"info",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_pool.go#L508-L520 |
136,610 | vitessio/vitess | go/vt/vttablet/tabletmanager/restore.go | RestoreData | func (agent *ActionAgent) RestoreData(ctx context.Context, logger logutil.Logger, deleteBeforeRestore bool) error {
if err := agent.lock(ctx); err != nil {
return err
}
defer agent.unlock()
if agent.Cnf == nil {
return fmt.Errorf("cannot perform restore without my.cnf, please restart vttablet with a my.cnf file... | go | func (agent *ActionAgent) RestoreData(ctx context.Context, logger logutil.Logger, deleteBeforeRestore bool) error {
if err := agent.lock(ctx); err != nil {
return err
}
defer agent.unlock()
if agent.Cnf == nil {
return fmt.Errorf("cannot perform restore without my.cnf, please restart vttablet with a my.cnf file... | [
"func",
"(",
"agent",
"*",
"ActionAgent",
")",
"RestoreData",
"(",
"ctx",
"context",
".",
"Context",
",",
"logger",
"logutil",
".",
"Logger",
",",
"deleteBeforeRestore",
"bool",
")",
"error",
"{",
"if",
"err",
":=",
"agent",
".",
"lock",
"(",
"ctx",
")",... | // RestoreData is the main entry point for backup restore.
// It will either work, fail gracefully, or return
// an error in case of a non-recoverable error.
// It takes the action lock so no RPC interferes. | [
"RestoreData",
"is",
"the",
"main",
"entry",
"point",
"for",
"backup",
"restore",
".",
"It",
"will",
"either",
"work",
"fail",
"gracefully",
"or",
"return",
"an",
"error",
"in",
"case",
"of",
"a",
"non",
"-",
"recoverable",
"error",
".",
"It",
"takes",
"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/restore.go#L48-L57 |
136,611 | vitessio/vitess | go/vt/vtgate/planbuilder/symtab.go | newSymtab | func newSymtab() *symtab {
return &symtab{
tables: make(map[sqlparser.TableName]*table),
uniqueColumns: make(map[string]*column),
}
} | go | func newSymtab() *symtab {
return &symtab{
tables: make(map[sqlparser.TableName]*table),
uniqueColumns: make(map[string]*column),
}
} | [
"func",
"newSymtab",
"(",
")",
"*",
"symtab",
"{",
"return",
"&",
"symtab",
"{",
"tables",
":",
"make",
"(",
"map",
"[",
"sqlparser",
".",
"TableName",
"]",
"*",
"table",
")",
",",
"uniqueColumns",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
... | // newSymtab creates a new symtab. | [
"newSymtab",
"creates",
"a",
"new",
"symtab",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/symtab.go#L70-L75 |
136,612 | vitessio/vitess | go/vt/vtgate/planbuilder/symtab.go | newSymtabWithRoute | func newSymtabWithRoute(rb *route) *symtab {
return &symtab{
tables: make(map[sqlparser.TableName]*table),
uniqueColumns: make(map[string]*column),
singleRoute: rb,
}
} | go | func newSymtabWithRoute(rb *route) *symtab {
return &symtab{
tables: make(map[sqlparser.TableName]*table),
uniqueColumns: make(map[string]*column),
singleRoute: rb,
}
} | [
"func",
"newSymtabWithRoute",
"(",
"rb",
"*",
"route",
")",
"*",
"symtab",
"{",
"return",
"&",
"symtab",
"{",
"tables",
":",
"make",
"(",
"map",
"[",
"sqlparser",
".",
"TableName",
"]",
"*",
"table",
")",
",",
"uniqueColumns",
":",
"make",
"(",
"map",
... | // newSymtab creates a new symtab initialized
// to contain just one route. | [
"newSymtab",
"creates",
"a",
"new",
"symtab",
"initialized",
"to",
"contain",
"just",
"one",
"route",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/symtab.go#L79-L85 |
136,613 | vitessio/vitess | go/vt/vtgate/planbuilder/symtab.go | AddVSchemaTable | func (st *symtab) AddVSchemaTable(alias sqlparser.TableName, vschemaTables []*vindexes.Table, rb *route) (vindexMaps []map[*column]vindexes.Vindex, err error) {
t := &table{
alias: alias,
origin: rb,
}
vindexMaps = make([]map[*column]vindexes.Vindex, len(vschemaTables))
for i, vst := range vschemaTables {
/... | go | func (st *symtab) AddVSchemaTable(alias sqlparser.TableName, vschemaTables []*vindexes.Table, rb *route) (vindexMaps []map[*column]vindexes.Vindex, err error) {
t := &table{
alias: alias,
origin: rb,
}
vindexMaps = make([]map[*column]vindexes.Vindex, len(vschemaTables))
for i, vst := range vschemaTables {
/... | [
"func",
"(",
"st",
"*",
"symtab",
")",
"AddVSchemaTable",
"(",
"alias",
"sqlparser",
".",
"TableName",
",",
"vschemaTables",
"[",
"]",
"*",
"vindexes",
".",
"Table",
",",
"rb",
"*",
"route",
")",
"(",
"vindexMaps",
"[",
"]",
"map",
"[",
"*",
"column",
... | // AddVSchemaTable takes a list of vschema tables as input and
// creates a table with multiple route options. It returns a
// list of vindex maps, one for each input. | [
"AddVSchemaTable",
"takes",
"a",
"list",
"of",
"vschema",
"tables",
"as",
"input",
"and",
"creates",
"a",
"table",
"with",
"multiple",
"route",
"options",
".",
"It",
"returns",
"a",
"list",
"of",
"vindex",
"maps",
"one",
"for",
"each",
"input",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/symtab.go#L90-L148 |
136,614 | vitessio/vitess | go/vt/vtgate/planbuilder/symtab.go | Merge | func (st *symtab) Merge(newsyms *symtab) error {
if st.tableNames == nil || newsyms.tableNames == nil {
// If any side of symtab has anonymous tables,
// we treat the merged symtab as having anonymous tables.
return nil
}
for _, t := range newsyms.tables {
if err := st.AddTable(t); err != nil {
return err... | go | func (st *symtab) Merge(newsyms *symtab) error {
if st.tableNames == nil || newsyms.tableNames == nil {
// If any side of symtab has anonymous tables,
// we treat the merged symtab as having anonymous tables.
return nil
}
for _, t := range newsyms.tables {
if err := st.AddTable(t); err != nil {
return err... | [
"func",
"(",
"st",
"*",
"symtab",
")",
"Merge",
"(",
"newsyms",
"*",
"symtab",
")",
"error",
"{",
"if",
"st",
".",
"tableNames",
"==",
"nil",
"||",
"newsyms",
".",
"tableNames",
"==",
"nil",
"{",
"// If any side of symtab has anonymous tables,",
"// we treat t... | // Merge merges the new symtab into the current one.
// Duplicate table aliases return an error.
// uniqueColumns is updated, but duplicates are removed.
// Merges are only performed during the FROM clause analysis.
// At this point, only tables and uniqueColumns are set.
// All other fields are ignored. | [
"Merge",
"merges",
"the",
"new",
"symtab",
"into",
"the",
"current",
"one",
".",
"Duplicate",
"table",
"aliases",
"return",
"an",
"error",
".",
"uniqueColumns",
"is",
"updated",
"but",
"duplicates",
"are",
"removed",
".",
"Merges",
"are",
"only",
"performed",
... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/symtab.go#L156-L168 |
136,615 | vitessio/vitess | go/vt/vtgate/planbuilder/symtab.go | AddTable | func (st *symtab) AddTable(t *table) error {
if rb, ok := t.origin.(*route); !ok || rb.Resolve() != st.singleRoute {
st.singleRoute = nil
}
if _, ok := st.tables[t.alias]; ok {
return fmt.Errorf("duplicate symbol: %s", sqlparser.String(t.alias))
}
st.tables[t.alias] = t
st.tableNames = append(st.tableNames, t... | go | func (st *symtab) AddTable(t *table) error {
if rb, ok := t.origin.(*route); !ok || rb.Resolve() != st.singleRoute {
st.singleRoute = nil
}
if _, ok := st.tables[t.alias]; ok {
return fmt.Errorf("duplicate symbol: %s", sqlparser.String(t.alias))
}
st.tables[t.alias] = t
st.tableNames = append(st.tableNames, t... | [
"func",
"(",
"st",
"*",
"symtab",
")",
"AddTable",
"(",
"t",
"*",
"table",
")",
"error",
"{",
"if",
"rb",
",",
"ok",
":=",
"t",
".",
"origin",
".",
"(",
"*",
"route",
")",
";",
"!",
"ok",
"||",
"rb",
".",
"Resolve",
"(",
")",
"!=",
"st",
".... | // AddTable adds a table to symtab. | [
"AddTable",
"adds",
"a",
"table",
"to",
"symtab",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/symtab.go#L171-L195 |
136,616 | vitessio/vitess | go/vt/vtgate/planbuilder/symtab.go | AllTables | func (st *symtab) AllTables() []*table {
if len(st.tableNames) == 0 {
return nil
}
tables := make([]*table, 0, len(st.tableNames))
for _, tname := range st.tableNames {
tables = append(tables, st.tables[tname])
}
return tables
} | go | func (st *symtab) AllTables() []*table {
if len(st.tableNames) == 0 {
return nil
}
tables := make([]*table, 0, len(st.tableNames))
for _, tname := range st.tableNames {
tables = append(tables, st.tables[tname])
}
return tables
} | [
"func",
"(",
"st",
"*",
"symtab",
")",
"AllTables",
"(",
")",
"[",
"]",
"*",
"table",
"{",
"if",
"len",
"(",
"st",
".",
"tableNames",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"tables",
":=",
"make",
"(",
"[",
"]",
"*",
"table",
... | // AllTables returns an ordered list of all current tables. | [
"AllTables",
"returns",
"an",
"ordered",
"list",
"of",
"all",
"current",
"tables",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/symtab.go#L198-L207 |
136,617 | vitessio/vitess | go/vt/vtgate/planbuilder/symtab.go | SetResultColumns | func (st *symtab) SetResultColumns(rcs []*resultColumn) {
for _, rc := range rcs {
rc.column.st = st
}
st.ResultColumns = rcs
} | go | func (st *symtab) SetResultColumns(rcs []*resultColumn) {
for _, rc := range rcs {
rc.column.st = st
}
st.ResultColumns = rcs
} | [
"func",
"(",
"st",
"*",
"symtab",
")",
"SetResultColumns",
"(",
"rcs",
"[",
"]",
"*",
"resultColumn",
")",
"{",
"for",
"_",
",",
"rc",
":=",
"range",
"rcs",
"{",
"rc",
".",
"column",
".",
"st",
"=",
"st",
"\n",
"}",
"\n",
"st",
".",
"ResultColumn... | // SetResultColumns sets the result columns. | [
"SetResultColumns",
"sets",
"the",
"result",
"columns",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/symtab.go#L229-L234 |
136,618 | vitessio/vitess | go/vt/vtgate/planbuilder/symtab.go | searchResultColumn | func (st *symtab) searchResultColumn(col *sqlparser.ColName) (c *column, err error) {
var cursym *resultColumn
for _, rc := range st.ResultColumns {
if rc.alias.Equal(col.Name) {
if cursym != nil {
return nil, fmt.Errorf("ambiguous symbol reference: %v", sqlparser.String(col))
}
cursym = rc
}
}
if ... | go | func (st *symtab) searchResultColumn(col *sqlparser.ColName) (c *column, err error) {
var cursym *resultColumn
for _, rc := range st.ResultColumns {
if rc.alias.Equal(col.Name) {
if cursym != nil {
return nil, fmt.Errorf("ambiguous symbol reference: %v", sqlparser.String(col))
}
cursym = rc
}
}
if ... | [
"func",
"(",
"st",
"*",
"symtab",
")",
"searchResultColumn",
"(",
"col",
"*",
"sqlparser",
".",
"ColName",
")",
"(",
"c",
"*",
"column",
",",
"err",
"error",
")",
"{",
"var",
"cursym",
"*",
"resultColumn",
"\n",
"for",
"_",
",",
"rc",
":=",
"range",
... | // searchResultColumn looks for col in the results columns. | [
"searchResultColumn",
"looks",
"for",
"col",
"in",
"the",
"results",
"columns",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/symtab.go#L312-L326 |
136,619 | vitessio/vitess | go/vt/vtgate/planbuilder/symtab.go | searchTables | func (st *symtab) searchTables(col *sqlparser.ColName) (*column, error) {
var t *table
// @@ syntax is only allowed for dual tables, in which case there should be
// only one in the symtab. So, such expressions will be implicitly matched.
if col.Qualifier.IsEmpty() || strings.HasPrefix(col.Qualifier.Name.String(), ... | go | func (st *symtab) searchTables(col *sqlparser.ColName) (*column, error) {
var t *table
// @@ syntax is only allowed for dual tables, in which case there should be
// only one in the symtab. So, such expressions will be implicitly matched.
if col.Qualifier.IsEmpty() || strings.HasPrefix(col.Qualifier.Name.String(), ... | [
"func",
"(",
"st",
"*",
"symtab",
")",
"searchTables",
"(",
"col",
"*",
"sqlparser",
".",
"ColName",
")",
"(",
"*",
"column",
",",
"error",
")",
"{",
"var",
"t",
"*",
"table",
"\n",
"// @@ syntax is only allowed for dual tables, in which case there should be",
"... | // searchTables looks for the column in the tables. The search order
// is as described in Find. | [
"searchTables",
"looks",
"for",
"the",
"column",
"in",
"the",
"tables",
".",
"The",
"search",
"order",
"is",
"as",
"described",
"in",
"Find",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/symtab.go#L330-L379 |
136,620 | vitessio/vitess | go/vt/vtgate/planbuilder/symtab.go | ResultFromNumber | func ResultFromNumber(rcs []*resultColumn, val *sqlparser.SQLVal) (int, error) {
if val.Type != sqlparser.IntVal {
return 0, errors.New("column number is not an int")
}
num, err := strconv.ParseInt(string(val.Val), 0, 64)
if err != nil {
return 0, fmt.Errorf("error parsing column number: %s", sqlparser.String(v... | go | func ResultFromNumber(rcs []*resultColumn, val *sqlparser.SQLVal) (int, error) {
if val.Type != sqlparser.IntVal {
return 0, errors.New("column number is not an int")
}
num, err := strconv.ParseInt(string(val.Val), 0, 64)
if err != nil {
return 0, fmt.Errorf("error parsing column number: %s", sqlparser.String(v... | [
"func",
"ResultFromNumber",
"(",
"rcs",
"[",
"]",
"*",
"resultColumn",
",",
"val",
"*",
"sqlparser",
".",
"SQLVal",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"val",
".",
"Type",
"!=",
"sqlparser",
".",
"IntVal",
"{",
"return",
"0",
",",
"errors"... | // ResultFromNumber returns the result column index based on the column
// order expression. | [
"ResultFromNumber",
"returns",
"the",
"result",
"column",
"index",
"based",
"on",
"the",
"column",
"order",
"expression",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/symtab.go#L383-L395 |
136,621 | vitessio/vitess | go/vt/vtgate/planbuilder/symtab.go | ResolveSymbols | func (st *symtab) ResolveSymbols(node sqlparser.SQLNode) error {
return sqlparser.Walk(func(node sqlparser.SQLNode) (kontinue bool, err error) {
switch node := node.(type) {
case *sqlparser.ColName:
if _, _, err := st.Find(node); err != nil {
return false, err
}
case *sqlparser.Subquery:
return fals... | go | func (st *symtab) ResolveSymbols(node sqlparser.SQLNode) error {
return sqlparser.Walk(func(node sqlparser.SQLNode) (kontinue bool, err error) {
switch node := node.(type) {
case *sqlparser.ColName:
if _, _, err := st.Find(node); err != nil {
return false, err
}
case *sqlparser.Subquery:
return fals... | [
"func",
"(",
"st",
"*",
"symtab",
")",
"ResolveSymbols",
"(",
"node",
"sqlparser",
".",
"SQLNode",
")",
"error",
"{",
"return",
"sqlparser",
".",
"Walk",
"(",
"func",
"(",
"node",
"sqlparser",
".",
"SQLNode",
")",
"(",
"kontinue",
"bool",
",",
"err",
"... | // ResolveSymbols resolves all column references against symtab.
// This makes sure that they all have their Metadata initialized.
// If a symbol cannot be resolved or if the expression contains
// a subquery, an error is returned. | [
"ResolveSymbols",
"resolves",
"all",
"column",
"references",
"against",
"symtab",
".",
"This",
"makes",
"sure",
"that",
"they",
"all",
"have",
"their",
"Metadata",
"initialized",
".",
"If",
"a",
"symbol",
"cannot",
"be",
"resolved",
"or",
"if",
"the",
"express... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/symtab.go#L401-L413 |
136,622 | vitessio/vitess | go/vt/vtgate/planbuilder/symtab.go | Origin | func (t *table) Origin() builder {
// If it's a route, we have to resolve it.
if rb, ok := t.origin.(*route); ok {
return rb.Resolve()
}
return t.origin
} | go | func (t *table) Origin() builder {
// If it's a route, we have to resolve it.
if rb, ok := t.origin.(*route); ok {
return rb.Resolve()
}
return t.origin
} | [
"func",
"(",
"t",
"*",
"table",
")",
"Origin",
"(",
")",
"builder",
"{",
"// If it's a route, we have to resolve it.",
"if",
"rb",
",",
"ok",
":=",
"t",
".",
"origin",
".",
"(",
"*",
"route",
")",
";",
"ok",
"{",
"return",
"rb",
".",
"Resolve",
"(",
... | // Origin returns the route that originates the table. | [
"Origin",
"returns",
"the",
"route",
"that",
"originates",
"the",
"table",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/symtab.go#L440-L446 |
136,623 | vitessio/vitess | go/vt/vtgate/planbuilder/symtab.go | Origin | func (c *column) Origin() builder {
// If it's a route, we have to resolve it.
if rb, ok := c.origin.(*route); ok {
return rb.Resolve()
}
return c.origin
} | go | func (c *column) Origin() builder {
// If it's a route, we have to resolve it.
if rb, ok := c.origin.(*route); ok {
return rb.Resolve()
}
return c.origin
} | [
"func",
"(",
"c",
"*",
"column",
")",
"Origin",
"(",
")",
"builder",
"{",
"// If it's a route, we have to resolve it.",
"if",
"rb",
",",
"ok",
":=",
"c",
".",
"origin",
".",
"(",
"*",
"route",
")",
";",
"ok",
"{",
"return",
"rb",
".",
"Resolve",
"(",
... | // Origin returns the route that originates the column. | [
"Origin",
"returns",
"the",
"route",
"that",
"originates",
"the",
"column",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/symtab.go#L464-L470 |
136,624 | vitessio/vitess | go/vt/vtgate/planbuilder/symtab.go | newResultColumn | func newResultColumn(expr *sqlparser.AliasedExpr, origin builder) *resultColumn {
rc := &resultColumn{
alias: expr.As,
}
if col, ok := expr.Expr.(*sqlparser.ColName); ok {
// If no alias was specified, then the base name
// of the column becomes the alias.
if rc.alias.IsEmpty() {
rc.alias = col.Name
}
... | go | func newResultColumn(expr *sqlparser.AliasedExpr, origin builder) *resultColumn {
rc := &resultColumn{
alias: expr.As,
}
if col, ok := expr.Expr.(*sqlparser.ColName); ok {
// If no alias was specified, then the base name
// of the column becomes the alias.
if rc.alias.IsEmpty() {
rc.alias = col.Name
}
... | [
"func",
"newResultColumn",
"(",
"expr",
"*",
"sqlparser",
".",
"AliasedExpr",
",",
"origin",
"builder",
")",
"*",
"resultColumn",
"{",
"rc",
":=",
"&",
"resultColumn",
"{",
"alias",
":",
"expr",
".",
"As",
",",
"}",
"\n",
"if",
"col",
",",
"ok",
":=",
... | // NewResultColumn creates a new resultColumn based on the supplied expression.
// The created symbol is not remembered until it is later set as ResultColumns
// after all select expressions are analyzed. | [
"NewResultColumn",
"creates",
"a",
"new",
"resultColumn",
"based",
"on",
"the",
"supplied",
"expression",
".",
"The",
"created",
"symbol",
"is",
"not",
"remembered",
"until",
"it",
"is",
"later",
"set",
"as",
"ResultColumns",
"after",
"all",
"select",
"expressio... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/symtab.go#L489-L509 |
136,625 | vitessio/vitess | go/trace/trace.go | NewSpan | func NewSpan(inCtx context.Context, label string) (Span, context.Context) {
parent, _ := spanFactory.FromContext(inCtx)
span := spanFactory.New(parent, label)
outCtx := spanFactory.NewContext(inCtx, span)
return span, outCtx
} | go | func NewSpan(inCtx context.Context, label string) (Span, context.Context) {
parent, _ := spanFactory.FromContext(inCtx)
span := spanFactory.New(parent, label)
outCtx := spanFactory.NewContext(inCtx, span)
return span, outCtx
} | [
"func",
"NewSpan",
"(",
"inCtx",
"context",
".",
"Context",
",",
"label",
"string",
")",
"(",
"Span",
",",
"context",
".",
"Context",
")",
"{",
"parent",
",",
"_",
":=",
"spanFactory",
".",
"FromContext",
"(",
"inCtx",
")",
"\n",
"span",
":=",
"spanFac... | // NewSpan creates a new Span with the currently installed tracing plugin.
// If no tracing plugin is installed, it returns a fake Span that does nothing. | [
"NewSpan",
"creates",
"a",
"new",
"Span",
"with",
"the",
"currently",
"installed",
"tracing",
"plugin",
".",
"If",
"no",
"tracing",
"plugin",
"is",
"installed",
"it",
"returns",
"a",
"fake",
"Span",
"that",
"does",
"nothing",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/trace/trace.go#L47-L53 |
136,626 | vitessio/vitess | go/trace/trace.go | NewContext | func NewContext(parent context.Context, span Span) context.Context {
return spanFactory.NewContext(parent, span)
} | go | func NewContext(parent context.Context, span Span) context.Context {
return spanFactory.NewContext(parent, span)
} | [
"func",
"NewContext",
"(",
"parent",
"context",
".",
"Context",
",",
"span",
"Span",
")",
"context",
".",
"Context",
"{",
"return",
"spanFactory",
".",
"NewContext",
"(",
"parent",
",",
"span",
")",
"\n",
"}"
] | // NewContext returns a context based on parent with a new Span value. | [
"NewContext",
"returns",
"a",
"context",
"based",
"on",
"parent",
"with",
"a",
"new",
"Span",
"value",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/trace/trace.go#L68-L70 |
136,627 | vitessio/vitess | go/trace/trace.go | CopySpan | func CopySpan(parentCtx, spanCtx context.Context) context.Context {
if span, ok := FromContext(spanCtx); ok {
return NewContext(parentCtx, span)
}
return parentCtx
} | go | func CopySpan(parentCtx, spanCtx context.Context) context.Context {
if span, ok := FromContext(spanCtx); ok {
return NewContext(parentCtx, span)
}
return parentCtx
} | [
"func",
"CopySpan",
"(",
"parentCtx",
",",
"spanCtx",
"context",
".",
"Context",
")",
"context",
".",
"Context",
"{",
"if",
"span",
",",
"ok",
":=",
"FromContext",
"(",
"spanCtx",
")",
";",
"ok",
"{",
"return",
"NewContext",
"(",
"parentCtx",
",",
"span"... | // CopySpan creates a new context from parentCtx, with only the trace span
// copied over from spanCtx, if it has any. If not, parentCtx is returned. | [
"CopySpan",
"creates",
"a",
"new",
"context",
"from",
"parentCtx",
"with",
"only",
"the",
"trace",
"span",
"copied",
"over",
"from",
"spanCtx",
"if",
"it",
"has",
"any",
".",
"If",
"not",
"parentCtx",
"is",
"returned",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/trace/trace.go#L74-L79 |
136,628 | vitessio/vitess | go/trace/trace.go | StartTracing | func StartTracing(serviceName string) io.Closer {
factory, ok := tracingBackendFactories[*tracingServer]
if !ok {
return fail(serviceName)
}
tracer, closer, err := factory(serviceName)
if err != nil {
log.Error(vterrors.Wrapf(err, "failed to create a %s tracer", *tracingServer))
return &nilCloser{}
}
spa... | go | func StartTracing(serviceName string) io.Closer {
factory, ok := tracingBackendFactories[*tracingServer]
if !ok {
return fail(serviceName)
}
tracer, closer, err := factory(serviceName)
if err != nil {
log.Error(vterrors.Wrapf(err, "failed to create a %s tracer", *tracingServer))
return &nilCloser{}
}
spa... | [
"func",
"StartTracing",
"(",
"serviceName",
"string",
")",
"io",
".",
"Closer",
"{",
"factory",
",",
"ok",
":=",
"tracingBackendFactories",
"[",
"*",
"tracingServer",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fail",
"(",
"serviceName",
")",
"\n",
"}",
... | // StartTracing enables tracing for a named service | [
"StartTracing",
"enables",
"tracing",
"for",
"a",
"named",
"service"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/trace/trace.go#L119-L136 |
136,629 | vitessio/vitess | go/vt/worker/clone_utils.go | makeValueString | func makeValueString(fields []*querypb.Field, rows [][]sqltypes.Value) string {
buf := bytes.Buffer{}
for i, row := range rows {
if i > 0 {
buf.Write([]byte(",("))
} else {
buf.WriteByte('(')
}
for j, value := range row {
if j > 0 {
buf.WriteByte(',')
}
value.EncodeSQL(&buf)
}
buf.Write... | go | func makeValueString(fields []*querypb.Field, rows [][]sqltypes.Value) string {
buf := bytes.Buffer{}
for i, row := range rows {
if i > 0 {
buf.Write([]byte(",("))
} else {
buf.WriteByte('(')
}
for j, value := range row {
if j > 0 {
buf.WriteByte(',')
}
value.EncodeSQL(&buf)
}
buf.Write... | [
"func",
"makeValueString",
"(",
"fields",
"[",
"]",
"*",
"querypb",
".",
"Field",
",",
"rows",
"[",
"]",
"[",
"]",
"sqltypes",
".",
"Value",
")",
"string",
"{",
"buf",
":=",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"for",
"i",
",",
"row",
":=",
"r... | // makeValueString returns a string that contains all the passed-in rows
// as an insert SQL command's parameters. | [
"makeValueString",
"returns",
"a",
"string",
"that",
"contains",
"all",
"the",
"passed",
"-",
"in",
"rows",
"as",
"an",
"insert",
"SQL",
"command",
"s",
"parameters",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/clone_utils.go#L37-L54 |
136,630 | vitessio/vitess | go/vt/vttablet/grpctmclient/client.go | dial | func (client *Client) dial(tablet *topodatapb.Tablet) (*grpc.ClientConn, tabletmanagerservicepb.TabletManagerClient, error) {
addr := netutil.JoinHostPort(tablet.Hostname, int32(tablet.PortMap["grpc"]))
opt, err := grpcclient.SecureDialOption(*cert, *key, *ca, *name)
if err != nil {
return nil, nil, err
}
cc, er... | go | func (client *Client) dial(tablet *topodatapb.Tablet) (*grpc.ClientConn, tabletmanagerservicepb.TabletManagerClient, error) {
addr := netutil.JoinHostPort(tablet.Hostname, int32(tablet.PortMap["grpc"]))
opt, err := grpcclient.SecureDialOption(*cert, *key, *ca, *name)
if err != nil {
return nil, nil, err
}
cc, er... | [
"func",
"(",
"client",
"*",
"Client",
")",
"dial",
"(",
"tablet",
"*",
"topodatapb",
".",
"Tablet",
")",
"(",
"*",
"grpc",
".",
"ClientConn",
",",
"tabletmanagerservicepb",
".",
"TabletManagerClient",
",",
"error",
")",
"{",
"addr",
":=",
"netutil",
".",
... | // dial returns a client to use | [
"dial",
"returns",
"a",
"client",
"to",
"use"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctmclient/client.go#L80-L91 |
136,631 | vitessio/vitess | go/vt/vttablet/grpctmclient/client.go | Ping | func (client *Client) Ping(ctx context.Context, tablet *topodatapb.Tablet) error {
cc, c, err := client.dial(tablet)
if err != nil {
return err
}
defer cc.Close()
result, err := c.Ping(ctx, &tabletmanagerdatapb.PingRequest{
Payload: "payload",
})
if err != nil {
return err
}
if result.Payload != "payload... | go | func (client *Client) Ping(ctx context.Context, tablet *topodatapb.Tablet) error {
cc, c, err := client.dial(tablet)
if err != nil {
return err
}
defer cc.Close()
result, err := c.Ping(ctx, &tabletmanagerdatapb.PingRequest{
Payload: "payload",
})
if err != nil {
return err
}
if result.Payload != "payload... | [
"func",
"(",
"client",
"*",
"Client",
")",
"Ping",
"(",
"ctx",
"context",
".",
"Context",
",",
"tablet",
"*",
"topodatapb",
".",
"Tablet",
")",
"error",
"{",
"cc",
",",
"c",
",",
"err",
":=",
"client",
".",
"dial",
"(",
"tablet",
")",
"\n",
"if",
... | //
// Various read-only methods
//
// Ping is part of the tmclient.TabletManagerClient interface. | [
"Various",
"read",
"-",
"only",
"methods",
"Ping",
"is",
"part",
"of",
"the",
"tmclient",
".",
"TabletManagerClient",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctmclient/client.go#L134-L150 |
136,632 | vitessio/vitess | go/vt/vttablet/grpctmclient/client.go | ExecuteFetchAsDba | func (client *Client) ExecuteFetchAsDba(ctx context.Context, tablet *topodatapb.Tablet, usePool bool, query []byte, maxRows int, disableBinlogs, reloadSchema bool) (*querypb.QueryResult, error) {
var c tabletmanagerservicepb.TabletManagerClient
var err error
if usePool {
c, err = client.dialPool(tablet)
if err !... | go | func (client *Client) ExecuteFetchAsDba(ctx context.Context, tablet *topodatapb.Tablet, usePool bool, query []byte, maxRows int, disableBinlogs, reloadSchema bool) (*querypb.QueryResult, error) {
var c tabletmanagerservicepb.TabletManagerClient
var err error
if usePool {
c, err = client.dialPool(tablet)
if err !... | [
"func",
"(",
"client",
"*",
"Client",
")",
"ExecuteFetchAsDba",
"(",
"ctx",
"context",
".",
"Context",
",",
"tablet",
"*",
"topodatapb",
".",
"Tablet",
",",
"usePool",
"bool",
",",
"query",
"[",
"]",
"byte",
",",
"maxRows",
"int",
",",
"disableBinlogs",
... | // ExecuteFetchAsDba is part of the tmclient.TabletManagerClient interface. | [
"ExecuteFetchAsDba",
"is",
"part",
"of",
"the",
"tmclient",
".",
"TabletManagerClient",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctmclient/client.go#L372-L400 |
136,633 | vitessio/vitess | go/vt/vttablet/grpctmclient/client.go | MasterPosition | func (client *Client) MasterPosition(ctx context.Context, tablet *topodatapb.Tablet) (string, error) {
cc, c, err := client.dial(tablet)
if err != nil {
return "", err
}
defer cc.Close()
response, err := c.MasterPosition(ctx, &tabletmanagerdatapb.MasterPositionRequest{})
if err != nil {
return "", err
}
ret... | go | func (client *Client) MasterPosition(ctx context.Context, tablet *topodatapb.Tablet) (string, error) {
cc, c, err := client.dial(tablet)
if err != nil {
return "", err
}
defer cc.Close()
response, err := c.MasterPosition(ctx, &tabletmanagerdatapb.MasterPositionRequest{})
if err != nil {
return "", err
}
ret... | [
"func",
"(",
"client",
"*",
"Client",
")",
"MasterPosition",
"(",
"ctx",
"context",
".",
"Context",
",",
"tablet",
"*",
"topodatapb",
".",
"Tablet",
")",
"(",
"string",
",",
"error",
")",
"{",
"cc",
",",
"c",
",",
"err",
":=",
"client",
".",
"dial",
... | // MasterPosition is part of the tmclient.TabletManagerClient interface. | [
"MasterPosition",
"is",
"part",
"of",
"the",
"tmclient",
".",
"TabletManagerClient",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctmclient/client.go#L472-L483 |
136,634 | vitessio/vitess | go/vt/vttablet/grpctmclient/client.go | Close | func (client *Client) Close() {
client.mu.Lock()
defer client.mu.Unlock()
for _, c := range client.rpcClientMap {
close(c)
for ch := range c {
ch.cc.Close()
}
}
client.rpcClientMap = nil
} | go | func (client *Client) Close() {
client.mu.Lock()
defer client.mu.Unlock()
for _, c := range client.rpcClientMap {
close(c)
for ch := range c {
ch.cc.Close()
}
}
client.rpcClientMap = nil
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"Close",
"(",
")",
"{",
"client",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"client",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"client",
".",
"rpcClientMap",
... | // Close is part of the tmclient.TabletManagerClient interface. | [
"Close",
"is",
"part",
"of",
"the",
"tmclient",
".",
"TabletManagerClient",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/grpctmclient/client.go#L831-L841 |
136,635 | vitessio/vitess | go/netutil/conn.go | NewConnWithTimeouts | func NewConnWithTimeouts(conn net.Conn, readTimeout time.Duration, writeTimeout time.Duration) ConnWithTimeouts {
return ConnWithTimeouts{Conn: conn, readTimeout: readTimeout, writeTimeout: writeTimeout}
} | go | func NewConnWithTimeouts(conn net.Conn, readTimeout time.Duration, writeTimeout time.Duration) ConnWithTimeouts {
return ConnWithTimeouts{Conn: conn, readTimeout: readTimeout, writeTimeout: writeTimeout}
} | [
"func",
"NewConnWithTimeouts",
"(",
"conn",
"net",
".",
"Conn",
",",
"readTimeout",
"time",
".",
"Duration",
",",
"writeTimeout",
"time",
".",
"Duration",
")",
"ConnWithTimeouts",
"{",
"return",
"ConnWithTimeouts",
"{",
"Conn",
":",
"conn",
",",
"readTimeout",
... | // NewConnWithTimeouts wraps a net.Conn with read and write deadilnes. | [
"NewConnWithTimeouts",
"wraps",
"a",
"net",
".",
"Conn",
"with",
"read",
"and",
"write",
"deadilnes",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/netutil/conn.go#L31-L33 |
136,636 | vitessio/vitess | go/netutil/conn.go | Read | func (c ConnWithTimeouts) Read(b []byte) (int, error) {
if c.readTimeout == 0 {
return c.Conn.Read(b)
}
if err := c.Conn.SetReadDeadline(time.Now().Add(c.readTimeout)); err != nil {
return 0, err
}
return c.Conn.Read(b)
} | go | func (c ConnWithTimeouts) Read(b []byte) (int, error) {
if c.readTimeout == 0 {
return c.Conn.Read(b)
}
if err := c.Conn.SetReadDeadline(time.Now().Add(c.readTimeout)); err != nil {
return 0, err
}
return c.Conn.Read(b)
} | [
"func",
"(",
"c",
"ConnWithTimeouts",
")",
"Read",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"c",
".",
"readTimeout",
"==",
"0",
"{",
"return",
"c",
".",
"Conn",
".",
"Read",
"(",
"b",
")",
"\n",
"}",
"\n",
"i... | // Implementation of the Conn interface.
// Read sets a read deadilne and delegates to conn.Read. | [
"Implementation",
"of",
"the",
"Conn",
"interface",
".",
"Read",
"sets",
"a",
"read",
"deadilne",
"and",
"delegates",
"to",
"conn",
".",
"Read",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/netutil/conn.go#L38-L46 |
136,637 | vitessio/vitess | go/netutil/conn.go | Write | func (c ConnWithTimeouts) Write(b []byte) (int, error) {
if c.writeTimeout == 0 {
return c.Conn.Write(b)
}
if err := c.Conn.SetWriteDeadline(time.Now().Add(c.writeTimeout)); err != nil {
return 0, err
}
return c.Conn.Write(b)
} | go | func (c ConnWithTimeouts) Write(b []byte) (int, error) {
if c.writeTimeout == 0 {
return c.Conn.Write(b)
}
if err := c.Conn.SetWriteDeadline(time.Now().Add(c.writeTimeout)); err != nil {
return 0, err
}
return c.Conn.Write(b)
} | [
"func",
"(",
"c",
"ConnWithTimeouts",
")",
"Write",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"c",
".",
"writeTimeout",
"==",
"0",
"{",
"return",
"c",
".",
"Conn",
".",
"Write",
"(",
"b",
")",
"\n",
"}",
"\n",
... | // Write sets a write deadline and delagates to conn.Write | [
"Write",
"sets",
"a",
"write",
"deadline",
"and",
"delagates",
"to",
"conn",
".",
"Write"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/netutil/conn.go#L49-L57 |
136,638 | vitessio/vitess | go/vt/wrangler/rebuild.go | RebuildKeyspaceGraph | func (wr *Wrangler) RebuildKeyspaceGraph(ctx context.Context, keyspace string, cells []string) error {
return topotools.RebuildKeyspace(ctx, wr.logger, wr.ts, keyspace, cells)
} | go | func (wr *Wrangler) RebuildKeyspaceGraph(ctx context.Context, keyspace string, cells []string) error {
return topotools.RebuildKeyspace(ctx, wr.logger, wr.ts, keyspace, cells)
} | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"RebuildKeyspaceGraph",
"(",
"ctx",
"context",
".",
"Context",
",",
"keyspace",
"string",
",",
"cells",
"[",
"]",
"string",
")",
"error",
"{",
"return",
"topotools",
".",
"RebuildKeyspace",
"(",
"ctx",
",",
"wr",
... | // RebuildKeyspaceGraph rebuilds the serving graph data while locking out other changes. | [
"RebuildKeyspaceGraph",
"rebuilds",
"the",
"serving",
"graph",
"data",
"while",
"locking",
"out",
"other",
"changes",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/rebuild.go#L25-L27 |
136,639 | vitessio/vitess | go/vt/vttls/vttls.go | ClientConfig | func ClientConfig(cert, key, ca, name string) (*tls.Config, error) {
config := newTLSConfig()
// Load the client-side cert & key if any.
if cert != "" && key != "" {
crt, err := tls.LoadX509KeyPair(cert, key)
if err != nil {
return nil, fmt.Errorf("failed to load cert/key: %v", err)
}
config.Certificates... | go | func ClientConfig(cert, key, ca, name string) (*tls.Config, error) {
config := newTLSConfig()
// Load the client-side cert & key if any.
if cert != "" && key != "" {
crt, err := tls.LoadX509KeyPair(cert, key)
if err != nil {
return nil, fmt.Errorf("failed to load cert/key: %v", err)
}
config.Certificates... | [
"func",
"ClientConfig",
"(",
"cert",
",",
"key",
",",
"ca",
",",
"name",
"string",
")",
"(",
"*",
"tls",
".",
"Config",
",",
"error",
")",
"{",
"config",
":=",
"newTLSConfig",
"(",
")",
"\n\n",
"// Load the client-side cert & key if any.",
"if",
"cert",
"!... | // ClientConfig returns the TLS config to use for a client to
// connect to a server with the provided parameters. | [
"ClientConfig",
"returns",
"the",
"TLS",
"config",
"to",
"use",
"for",
"a",
"client",
"to",
"connect",
"to",
"a",
"server",
"with",
"the",
"provided",
"parameters",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttls/vttls.go#L56-L87 |
136,640 | vitessio/vitess | go/vt/vttls/vttls.go | ServerConfig | func ServerConfig(cert, key, ca string) (*tls.Config, error) {
config := newTLSConfig()
// Load the server cert and key.
crt, err := tls.LoadX509KeyPair(cert, key)
if err != nil {
return nil, fmt.Errorf("failed to load cert/key: %v", err)
}
config.Certificates = []tls.Certificate{crt}
// if specified, load c... | go | func ServerConfig(cert, key, ca string) (*tls.Config, error) {
config := newTLSConfig()
// Load the server cert and key.
crt, err := tls.LoadX509KeyPair(cert, key)
if err != nil {
return nil, fmt.Errorf("failed to load cert/key: %v", err)
}
config.Certificates = []tls.Certificate{crt}
// if specified, load c... | [
"func",
"ServerConfig",
"(",
"cert",
",",
"key",
",",
"ca",
"string",
")",
"(",
"*",
"tls",
".",
"Config",
",",
"error",
")",
"{",
"config",
":=",
"newTLSConfig",
"(",
")",
"\n\n",
"// Load the server cert and key.",
"crt",
",",
"err",
":=",
"tls",
".",
... | // ServerConfig returns the TLS config to use for a server to
// accept client connections. | [
"ServerConfig",
"returns",
"the",
"TLS",
"config",
"to",
"use",
"for",
"a",
"server",
"to",
"accept",
"client",
"connections",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttls/vttls.go#L91-L117 |
136,641 | vitessio/vitess | go/vt/wrangler/permissions.go | GetPermissions | func (wr *Wrangler) GetPermissions(ctx context.Context, tabletAlias *topodatapb.TabletAlias) (*tabletmanagerdatapb.Permissions, error) {
ti, err := wr.ts.GetTablet(ctx, tabletAlias)
if err != nil {
return nil, err
}
return wr.tmc.GetPermissions(ctx, ti.Tablet)
} | go | func (wr *Wrangler) GetPermissions(ctx context.Context, tabletAlias *topodatapb.TabletAlias) (*tabletmanagerdatapb.Permissions, error) {
ti, err := wr.ts.GetTablet(ctx, tabletAlias)
if err != nil {
return nil, err
}
return wr.tmc.GetPermissions(ctx, ti.Tablet)
} | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"GetPermissions",
"(",
"ctx",
"context",
".",
"Context",
",",
"tabletAlias",
"*",
"topodatapb",
".",
"TabletAlias",
")",
"(",
"*",
"tabletmanagerdatapb",
".",
"Permissions",
",",
"error",
")",
"{",
"ti",
",",
"err",... | // GetPermissions returns the permissions set on a remote tablet | [
"GetPermissions",
"returns",
"the",
"permissions",
"set",
"on",
"a",
"remote",
"tablet"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/permissions.go#L35-L42 |
136,642 | vitessio/vitess | go/vt/wrangler/permissions.go | diffPermissions | func (wr *Wrangler) diffPermissions(ctx context.Context, masterPermissions *tabletmanagerdatapb.Permissions, masterAlias *topodatapb.TabletAlias, alias *topodatapb.TabletAlias, wg *sync.WaitGroup, er concurrency.ErrorRecorder) {
defer wg.Done()
log.Infof("Gathering permissions for %v", topoproto.TabletAliasString(ali... | go | func (wr *Wrangler) diffPermissions(ctx context.Context, masterPermissions *tabletmanagerdatapb.Permissions, masterAlias *topodatapb.TabletAlias, alias *topodatapb.TabletAlias, wg *sync.WaitGroup, er concurrency.ErrorRecorder) {
defer wg.Done()
log.Infof("Gathering permissions for %v", topoproto.TabletAliasString(ali... | [
"func",
"(",
"wr",
"*",
"Wrangler",
")",
"diffPermissions",
"(",
"ctx",
"context",
".",
"Context",
",",
"masterPermissions",
"*",
"tabletmanagerdatapb",
".",
"Permissions",
",",
"masterAlias",
"*",
"topodatapb",
".",
"TabletAlias",
",",
"alias",
"*",
"topodatapb... | // diffPermissions is a helper method to asynchronously diff a permissions | [
"diffPermissions",
"is",
"a",
"helper",
"method",
"to",
"asynchronously",
"diff",
"a",
"permissions"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/wrangler/permissions.go#L45-L56 |
136,643 | vitessio/vitess | go/vt/vtgate/vcursor_impl.go | newVCursorImpl | func newVCursorImpl(ctx context.Context, safeSession *SafeSession, keyspace string, tabletType topodatapb.TabletType, marginComments sqlparser.MarginComments, executor *Executor, logStats *LogStats) *vcursorImpl {
return &vcursorImpl{
ctx: ctx,
safeSession: safeSession,
keyspace: keyspace,
... | go | func newVCursorImpl(ctx context.Context, safeSession *SafeSession, keyspace string, tabletType topodatapb.TabletType, marginComments sqlparser.MarginComments, executor *Executor, logStats *LogStats) *vcursorImpl {
return &vcursorImpl{
ctx: ctx,
safeSession: safeSession,
keyspace: keyspace,
... | [
"func",
"newVCursorImpl",
"(",
"ctx",
"context",
".",
"Context",
",",
"safeSession",
"*",
"SafeSession",
",",
"keyspace",
"string",
",",
"tabletType",
"topodatapb",
".",
"TabletType",
",",
"marginComments",
"sqlparser",
".",
"MarginComments",
",",
"executor",
"*",... | // newVcursorImpl creates a vcursorImpl. Before creating this object, you have to separate out any marginComments that came with
// the query and supply it here. Trailing comments are typically sent by the application for various reasons,
// including as identifying markers. So, they have to be added back to all querie... | [
"newVcursorImpl",
"creates",
"a",
"vcursorImpl",
".",
"Before",
"creating",
"this",
"object",
"you",
"have",
"to",
"separate",
"out",
"any",
"marginComments",
"that",
"came",
"with",
"the",
"query",
"and",
"supply",
"it",
"here",
".",
"Trailing",
"comments",
"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vcursor_impl.go#L60-L70 |
136,644 | vitessio/vitess | go/vt/vtgate/vcursor_impl.go | SetContextTimeout | func (vc *vcursorImpl) SetContextTimeout(timeout time.Duration) context.CancelFunc {
ctx, cancel := context.WithTimeout(vc.ctx, timeout)
vc.ctx = ctx
return cancel
} | go | func (vc *vcursorImpl) SetContextTimeout(timeout time.Duration) context.CancelFunc {
ctx, cancel := context.WithTimeout(vc.ctx, timeout)
vc.ctx = ctx
return cancel
} | [
"func",
"(",
"vc",
"*",
"vcursorImpl",
")",
"SetContextTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"context",
".",
"CancelFunc",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"vc",
".",
"ctx",
",",
"timeout",
")",
"\n",... | // SetContextTimeout updates context and sets a timeout. | [
"SetContextTimeout",
"updates",
"context",
"and",
"sets",
"a",
"timeout",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vcursor_impl.go#L78-L82 |
136,645 | vitessio/vitess | go/vt/vtgate/vcursor_impl.go | RecordWarning | func (vc *vcursorImpl) RecordWarning(warning *querypb.QueryWarning) {
vc.safeSession.RecordWarning(warning)
} | go | func (vc *vcursorImpl) RecordWarning(warning *querypb.QueryWarning) {
vc.safeSession.RecordWarning(warning)
} | [
"func",
"(",
"vc",
"*",
"vcursorImpl",
")",
"RecordWarning",
"(",
"warning",
"*",
"querypb",
".",
"QueryWarning",
")",
"{",
"vc",
".",
"safeSession",
".",
"RecordWarning",
"(",
"warning",
")",
"\n",
"}"
] | // RecordWarning stores the given warning in the current session | [
"RecordWarning",
"stores",
"the",
"given",
"warning",
"in",
"the",
"current",
"session"
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vcursor_impl.go#L85-L87 |
136,646 | vitessio/vitess | go/vt/vtgate/vcursor_impl.go | FindTable | func (vc *vcursorImpl) FindTable(name sqlparser.TableName) (*vindexes.Table, string, topodatapb.TabletType, key.Destination, error) {
destKeyspace, destTabletType, dest, err := vc.executor.ParseDestinationTarget(name.Qualifier.String())
if err != nil {
return nil, "", destTabletType, nil, err
}
if destKeyspace ==... | go | func (vc *vcursorImpl) FindTable(name sqlparser.TableName) (*vindexes.Table, string, topodatapb.TabletType, key.Destination, error) {
destKeyspace, destTabletType, dest, err := vc.executor.ParseDestinationTarget(name.Qualifier.String())
if err != nil {
return nil, "", destTabletType, nil, err
}
if destKeyspace ==... | [
"func",
"(",
"vc",
"*",
"vcursorImpl",
")",
"FindTable",
"(",
"name",
"sqlparser",
".",
"TableName",
")",
"(",
"*",
"vindexes",
".",
"Table",
",",
"string",
",",
"topodatapb",
".",
"TabletType",
",",
"key",
".",
"Destination",
",",
"error",
")",
"{",
"... | // FindTable finds the specified table. If the keyspace what specified in the input, it gets used as qualifier.
// Otherwise, the keyspace from the request is used, if one was provided. | [
"FindTable",
"finds",
"the",
"specified",
"table",
".",
"If",
"the",
"keyspace",
"what",
"specified",
"in",
"the",
"input",
"it",
"gets",
"used",
"as",
"qualifier",
".",
"Otherwise",
"the",
"keyspace",
"from",
"the",
"request",
"is",
"used",
"if",
"one",
"... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vcursor_impl.go#L91-L104 |
136,647 | vitessio/vitess | go/vt/vtgate/vcursor_impl.go | FindTablesOrVindex | func (vc *vcursorImpl) FindTablesOrVindex(name sqlparser.TableName) ([]*vindexes.Table, vindexes.Vindex, string, topodatapb.TabletType, key.Destination, error) {
destKeyspace, destTabletType, dest, err := vc.executor.ParseDestinationTarget(name.Qualifier.String())
if err != nil {
return nil, nil, "", destTabletType... | go | func (vc *vcursorImpl) FindTablesOrVindex(name sqlparser.TableName) ([]*vindexes.Table, vindexes.Vindex, string, topodatapb.TabletType, key.Destination, error) {
destKeyspace, destTabletType, dest, err := vc.executor.ParseDestinationTarget(name.Qualifier.String())
if err != nil {
return nil, nil, "", destTabletType... | [
"func",
"(",
"vc",
"*",
"vcursorImpl",
")",
"FindTablesOrVindex",
"(",
"name",
"sqlparser",
".",
"TableName",
")",
"(",
"[",
"]",
"*",
"vindexes",
".",
"Table",
",",
"vindexes",
".",
"Vindex",
",",
"string",
",",
"topodatapb",
".",
"TabletType",
",",
"ke... | // FindTablesOrVindex finds the specified table or vindex. | [
"FindTablesOrVindex",
"finds",
"the",
"specified",
"table",
"or",
"vindex",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vcursor_impl.go#L107-L120 |
136,648 | vitessio/vitess | go/vt/vtgate/vcursor_impl.go | DefaultKeyspace | func (vc *vcursorImpl) DefaultKeyspace() (*vindexes.Keyspace, error) {
if vc.keyspace == "" {
return nil, errNoKeyspace
}
ks, ok := vc.executor.VSchema().Keyspaces[vc.keyspace]
if !ok {
return nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "keyspace %s not found in vschema", vc.keyspace)
}
return ks.Keys... | go | func (vc *vcursorImpl) DefaultKeyspace() (*vindexes.Keyspace, error) {
if vc.keyspace == "" {
return nil, errNoKeyspace
}
ks, ok := vc.executor.VSchema().Keyspaces[vc.keyspace]
if !ok {
return nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "keyspace %s not found in vschema", vc.keyspace)
}
return ks.Keys... | [
"func",
"(",
"vc",
"*",
"vcursorImpl",
")",
"DefaultKeyspace",
"(",
")",
"(",
"*",
"vindexes",
".",
"Keyspace",
",",
"error",
")",
"{",
"if",
"vc",
".",
"keyspace",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errNoKeyspace",
"\n",
"}",
"\n",
"ks",
... | // DefaultKeyspace returns the default keyspace of the current request
// if there is one. If the keyspace specified in the target cannot be
// identified, it returns an error. | [
"DefaultKeyspace",
"returns",
"the",
"default",
"keyspace",
"of",
"the",
"current",
"request",
"if",
"there",
"is",
"one",
".",
"If",
"the",
"keyspace",
"specified",
"in",
"the",
"target",
"cannot",
"be",
"identified",
"it",
"returns",
"an",
"error",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vcursor_impl.go#L125-L134 |
136,649 | vitessio/vitess | go/vt/vtgate/vcursor_impl.go | Execute | func (vc *vcursorImpl) Execute(method string, query string, BindVars map[string]*querypb.BindVariable, isDML bool) (*sqltypes.Result, error) {
qr, err := vc.executor.Execute(vc.ctx, method, vc.safeSession, vc.marginComments.Leading+query+vc.marginComments.Trailing, BindVars)
if err == nil {
vc.hasPartialDML = true
... | go | func (vc *vcursorImpl) Execute(method string, query string, BindVars map[string]*querypb.BindVariable, isDML bool) (*sqltypes.Result, error) {
qr, err := vc.executor.Execute(vc.ctx, method, vc.safeSession, vc.marginComments.Leading+query+vc.marginComments.Trailing, BindVars)
if err == nil {
vc.hasPartialDML = true
... | [
"func",
"(",
"vc",
"*",
"vcursorImpl",
")",
"Execute",
"(",
"method",
"string",
",",
"query",
"string",
",",
"BindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
",",
"isDML",
"bool",
")",
"(",
"*",
"sqltypes",
".",
"Result",
","... | // Execute performs a V3 level execution of the query. | [
"Execute",
"performs",
"a",
"V3",
"level",
"execution",
"of",
"the",
"query",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vcursor_impl.go#L142-L148 |
136,650 | vitessio/vitess | go/vt/vtgate/vcursor_impl.go | ExecuteMultiShard | func (vc *vcursorImpl) ExecuteMultiShard(rss []*srvtopo.ResolvedShard, queries []*querypb.BoundQuery, isDML, autocommit bool) (*sqltypes.Result, []error) {
atomic.AddUint32(&vc.logStats.ShardQueries, uint32(len(queries)))
qr, errs := vc.executor.scatterConn.ExecuteMultiShard(vc.ctx, rss, commentedShardQueries(queries... | go | func (vc *vcursorImpl) ExecuteMultiShard(rss []*srvtopo.ResolvedShard, queries []*querypb.BoundQuery, isDML, autocommit bool) (*sqltypes.Result, []error) {
atomic.AddUint32(&vc.logStats.ShardQueries, uint32(len(queries)))
qr, errs := vc.executor.scatterConn.ExecuteMultiShard(vc.ctx, rss, commentedShardQueries(queries... | [
"func",
"(",
"vc",
"*",
"vcursorImpl",
")",
"ExecuteMultiShard",
"(",
"rss",
"[",
"]",
"*",
"srvtopo",
".",
"ResolvedShard",
",",
"queries",
"[",
"]",
"*",
"querypb",
".",
"BoundQuery",
",",
"isDML",
",",
"autocommit",
"bool",
")",
"(",
"*",
"sqltypes",
... | // ExecuteMultiShard is part of the engine.VCursor interface. | [
"ExecuteMultiShard",
"is",
"part",
"of",
"the",
"engine",
".",
"VCursor",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vcursor_impl.go#L160-L168 |
136,651 | vitessio/vitess | go/vt/vtgate/vcursor_impl.go | ExecuteStandalone | func (vc *vcursorImpl) ExecuteStandalone(query string, bindVars map[string]*querypb.BindVariable, rs *srvtopo.ResolvedShard) (*sqltypes.Result, error) {
rss := []*srvtopo.ResolvedShard{rs}
bqs := []*querypb.BoundQuery{
{
Sql: vc.marginComments.Leading + query + vc.marginComments.Trailing,
BindVariab... | go | func (vc *vcursorImpl) ExecuteStandalone(query string, bindVars map[string]*querypb.BindVariable, rs *srvtopo.ResolvedShard) (*sqltypes.Result, error) {
rss := []*srvtopo.ResolvedShard{rs}
bqs := []*querypb.BoundQuery{
{
Sql: vc.marginComments.Leading + query + vc.marginComments.Trailing,
BindVariab... | [
"func",
"(",
"vc",
"*",
"vcursorImpl",
")",
"ExecuteStandalone",
"(",
"query",
"string",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
",",
"rs",
"*",
"srvtopo",
".",
"ResolvedShard",
")",
"(",
"*",
"sqltypes",
".",
"Re... | // ExecuteStandalone is part of the engine.VCursor interface. | [
"ExecuteStandalone",
"is",
"part",
"of",
"the",
"engine",
".",
"VCursor",
"interface",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vcursor_impl.go#L176-L188 |
136,652 | vitessio/vitess | go/vt/vtgate/vcursor_impl.go | StreamExecuteMulti | func (vc *vcursorImpl) StreamExecuteMulti(query string, rss []*srvtopo.ResolvedShard, bindVars []map[string]*querypb.BindVariable, callback func(reply *sqltypes.Result) error) error {
atomic.AddUint32(&vc.logStats.ShardQueries, uint32(len(rss)))
return vc.executor.scatterConn.StreamExecuteMulti(vc.ctx, vc.marginComme... | go | func (vc *vcursorImpl) StreamExecuteMulti(query string, rss []*srvtopo.ResolvedShard, bindVars []map[string]*querypb.BindVariable, callback func(reply *sqltypes.Result) error) error {
atomic.AddUint32(&vc.logStats.ShardQueries, uint32(len(rss)))
return vc.executor.scatterConn.StreamExecuteMulti(vc.ctx, vc.marginComme... | [
"func",
"(",
"vc",
"*",
"vcursorImpl",
")",
"StreamExecuteMulti",
"(",
"query",
"string",
",",
"rss",
"[",
"]",
"*",
"srvtopo",
".",
"ResolvedShard",
",",
"bindVars",
"[",
"]",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
",",
"callbac... | // StreamExeculteMulti is the streaming version of ExecuteMultiShard. | [
"StreamExeculteMulti",
"is",
"the",
"streaming",
"version",
"of",
"ExecuteMultiShard",
"."
] | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/vcursor_impl.go#L191-L194 |
136,653 | vitessio/vitess | go/vt/vtgate/planbuilder/ordered_aggregate.go | checkAggregates | func (pb *primitiveBuilder) checkAggregates(sel *sqlparser.Select) (groupByHandler, error) {
rb, isRoute := pb.bldr.(*route)
if isRoute && rb.removeMultishardOptions() {
return rb, nil
}
// Check if we can allow aggregates.
hasAggregates := false
if sel.Distinct != "" {
hasAggregates = true
} else {
hasAg... | go | func (pb *primitiveBuilder) checkAggregates(sel *sqlparser.Select) (groupByHandler, error) {
rb, isRoute := pb.bldr.(*route)
if isRoute && rb.removeMultishardOptions() {
return rb, nil
}
// Check if we can allow aggregates.
hasAggregates := false
if sel.Distinct != "" {
hasAggregates = true
} else {
hasAg... | [
"func",
"(",
"pb",
"*",
"primitiveBuilder",
")",
"checkAggregates",
"(",
"sel",
"*",
"sqlparser",
".",
"Select",
")",
"(",
"groupByHandler",
",",
"error",
")",
"{",
"rb",
",",
"isRoute",
":=",
"pb",
".",
"bldr",
".",
"(",
"*",
"route",
")",
"\n",
"if... | // checkAggregates analyzes the select expression for aggregates. If it determines
// that a primitive is needed to handle the aggregation, it builds an orderedAggregate
// primitive and returns it. It returns a groupByHandler if there is aggregation it
// can handle. | [
"checkAggregates",
"analyzes",
"the",
"select",
"expression",
"for",
"aggregates",
".",
"If",
"it",
"determines",
"that",
"a",
"primitive",
"is",
"needed",
"to",
"handle",
"the",
"aggregation",
"it",
"builds",
"an",
"orderedAggregate",
"primitive",
"and",
"returns... | d568817542a413611801aa17a1c213aa95592182 | https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/ordered_aggregate.go#L67-L141 |
136,654 | zenhotels/astranet | route/secondary_btree.go | Seek | func (t *SecondaryTree) Seek(k RouteInfo) (e *SecondaryEnumerator, ok bool) {
q := t.r
if q == nil {
e = btEPool2.get(nil, false, 0, k, nil, t, atomic.LoadUint64(&t.ver))
return
}
for {
var i int
if i, ok = t.find(q, k); ok {
switch x := q.(type) {
case *x2:
q = x.x[i+1].ch
continue
case *... | go | func (t *SecondaryTree) Seek(k RouteInfo) (e *SecondaryEnumerator, ok bool) {
q := t.r
if q == nil {
e = btEPool2.get(nil, false, 0, k, nil, t, atomic.LoadUint64(&t.ver))
return
}
for {
var i int
if i, ok = t.find(q, k); ok {
switch x := q.(type) {
case *x2:
q = x.x[i+1].ch
continue
case *... | [
"func",
"(",
"t",
"*",
"SecondaryTree",
")",
"Seek",
"(",
"k",
"RouteInfo",
")",
"(",
"e",
"*",
"SecondaryEnumerator",
",",
"ok",
"bool",
")",
"{",
"q",
":=",
"t",
".",
"r",
"\n",
"if",
"q",
"==",
"nil",
"{",
"e",
"=",
"btEPool2",
".",
"get",
"... | // Seek returns an SecondaryEnumerator positioned on an item such that k >= item's key.
// ok reports if k == item.key The SecondaryEnumerator's position is possibly after the
// last item in the tree. | [
"Seek",
"returns",
"an",
"SecondaryEnumerator",
"positioned",
"on",
"an",
"item",
"such",
"that",
"k",
">",
"=",
"item",
"s",
"key",
".",
"ok",
"reports",
"if",
"k",
"==",
"item",
".",
"key",
"The",
"SecondaryEnumerator",
"s",
"position",
"is",
"possibly",... | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/route/secondary_btree.go#L474-L500 |
136,655 | zenhotels/astranet | skykiss/ring_buf.go | Get | func (rb *RingBuffer) Get() (interface{}, error) {
var n *node
pos := atomic.LoadUint64(&rb.dequeue)
i := 0
L:
for {
if atomic.LoadUint64(&rb.disposed) == 1 {
return nil, ErrDisposed
}
n = rb.nodes[pos&rb.mask]
seq := atomic.LoadUint64(&n.position)
switch dif := seq - (pos + 1); {
case dif == 0:
... | go | func (rb *RingBuffer) Get() (interface{}, error) {
var n *node
pos := atomic.LoadUint64(&rb.dequeue)
i := 0
L:
for {
if atomic.LoadUint64(&rb.disposed) == 1 {
return nil, ErrDisposed
}
n = rb.nodes[pos&rb.mask]
seq := atomic.LoadUint64(&n.position)
switch dif := seq - (pos + 1); {
case dif == 0:
... | [
"func",
"(",
"rb",
"*",
"RingBuffer",
")",
"Get",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"var",
"n",
"*",
"node",
"\n",
"pos",
":=",
"atomic",
".",
"LoadUint64",
"(",
"&",
"rb",
".",
"dequeue",
")",
"\n",
"i",
":=",
"0",
... | // Get will return the next item in the queue. This call will block
// if the queue is empty. This call will unblock when an item is added
// to the queue or Dispose is called on the queue. An error will be returned
// if the queue is disposed. | [
"Get",
"will",
"return",
"the",
"next",
"item",
"in",
"the",
"queue",
".",
"This",
"call",
"will",
"block",
"if",
"the",
"queue",
"is",
"empty",
".",
"This",
"call",
"will",
"unblock",
"when",
"an",
"item",
"is",
"added",
"to",
"the",
"queue",
"or",
... | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/skykiss/ring_buf.go#L132-L166 |
136,656 | zenhotels/astranet | route/primary.go | Drop | func (l PrimaryLayer) Drop(k uint64) (ok bool) {
l.lock.Lock()
v, found := l.store.Get(k)
if found {
ok = l.store.Delete(k)
}
l.lock.Unlock()
if found {
v.Finalize()
v.close()
}
return
} | go | func (l PrimaryLayer) Drop(k uint64) (ok bool) {
l.lock.Lock()
v, found := l.store.Get(k)
if found {
ok = l.store.Delete(k)
}
l.lock.Unlock()
if found {
v.Finalize()
v.close()
}
return
} | [
"func",
"(",
"l",
"PrimaryLayer",
")",
"Drop",
"(",
"k",
"uint64",
")",
"(",
"ok",
"bool",
")",
"{",
"l",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"v",
",",
"found",
":=",
"l",
".",
"store",
".",
"Get",
"(",
"k",
")",
"\n",
"if",
"found",
... | // Drop removes the whole secondary layer associated with the key,
// invokes all the finalizers associated with elements of this secondary layer. | [
"Drop",
"removes",
"the",
"whole",
"secondary",
"layer",
"associated",
"with",
"the",
"key",
"invokes",
"all",
"the",
"finalizers",
"associated",
"with",
"elements",
"of",
"this",
"secondary",
"layer",
"."
] | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/route/primary.go#L111-L123 |
136,657 | matryer/respond | encoding/encoding.go | New | func New() *Encoders {
return &Encoders{
encoders: make(map[string]respond.Encoder),
Default: respond.JSON,
}
} | go | func New() *Encoders {
return &Encoders{
encoders: make(map[string]respond.Encoder),
Default: respond.JSON,
}
} | [
"func",
"New",
"(",
")",
"*",
"Encoders",
"{",
"return",
"&",
"Encoders",
"{",
"encoders",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"respond",
".",
"Encoder",
")",
",",
"Default",
":",
"respond",
".",
"JSON",
",",
"}",
"\n",
"}"
] | // New makes a new Encoders set. | [
"New",
"makes",
"a",
"new",
"Encoders",
"set",
"."
] | 7ca2372f541a6f714cc7f2a7118b679795b3952c | https://github.com/matryer/respond/blob/7ca2372f541a6f714cc7f2a7118b679795b3952c/encoding/encoding.go#L19-L24 |
136,658 | matryer/respond | encoding/encoding.go | EncoderFunc | func (m *Encoders) EncoderFunc(_ http.ResponseWriter, r *http.Request) respond.Encoder {
encoder, ok := m.Match(r.Header.Get("Accept"))
if !ok {
return m.Default
}
return encoder
} | go | func (m *Encoders) EncoderFunc(_ http.ResponseWriter, r *http.Request) respond.Encoder {
encoder, ok := m.Match(r.Header.Get("Accept"))
if !ok {
return m.Default
}
return encoder
} | [
"func",
"(",
"m",
"*",
"Encoders",
")",
"EncoderFunc",
"(",
"_",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"respond",
".",
"Encoder",
"{",
"encoder",
",",
"ok",
":=",
"m",
".",
"Match",
"(",
"r",
".",
"Header",
".",... | // EncoderFunc is the Options.Encoder function field that will get the
// appropriate encoder for responding. | [
"EncoderFunc",
"is",
"the",
"Options",
".",
"Encoder",
"function",
"field",
"that",
"will",
"get",
"the",
"appropriate",
"encoder",
"for",
"responding",
"."
] | 7ca2372f541a6f714cc7f2a7118b679795b3952c | https://github.com/matryer/respond/blob/7ca2372f541a6f714cc7f2a7118b679795b3952c/encoding/encoding.go#L28-L34 |
136,659 | matryer/respond | encoding/encoding.go | Add | func (m *Encoders) Add(match string, e respond.Encoder) {
m.lock.Lock()
m.encoders[match] = e
m.lock.Unlock()
} | go | func (m *Encoders) Add(match string, e respond.Encoder) {
m.lock.Lock()
m.encoders[match] = e
m.lock.Unlock()
} | [
"func",
"(",
"m",
"*",
"Encoders",
")",
"Add",
"(",
"match",
"string",
",",
"e",
"respond",
".",
"Encoder",
")",
"{",
"m",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"m",
".",
"encoders",
"[",
"match",
"]",
"=",
"e",
"\n",
"m",
".",
"lock",
".... | // Add adds an Encoder. | [
"Add",
"adds",
"an",
"Encoder",
"."
] | 7ca2372f541a6f714cc7f2a7118b679795b3952c | https://github.com/matryer/respond/blob/7ca2372f541a6f714cc7f2a7118b679795b3952c/encoding/encoding.go#L37-L41 |
136,660 | matryer/respond | encoding/encoding.go | Del | func (m *Encoders) Del(e respond.Encoder) {
m.lock.Lock()
defer m.lock.Unlock()
found := false
for k, v := range m.encoders {
if v == e {
delete(m.encoders, k)
found = true
}
}
if !found {
panic("respond: encoder not found")
}
} | go | func (m *Encoders) Del(e respond.Encoder) {
m.lock.Lock()
defer m.lock.Unlock()
found := false
for k, v := range m.encoders {
if v == e {
delete(m.encoders, k)
found = true
}
}
if !found {
panic("respond: encoder not found")
}
} | [
"func",
"(",
"m",
"*",
"Encoders",
")",
"Del",
"(",
"e",
"respond",
".",
"Encoder",
")",
"{",
"m",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"found",
":=",
"false",
"\n",
"for",
"k",
"... | // Del removes an Encoder. | [
"Del",
"removes",
"an",
"Encoder",
"."
] | 7ca2372f541a6f714cc7f2a7118b679795b3952c | https://github.com/matryer/respond/blob/7ca2372f541a6f714cc7f2a7118b679795b3952c/encoding/encoding.go#L44-L57 |
136,661 | matryer/respond | encoding/encoding.go | Match | func (m *Encoders) Match(s string) (respond.Encoder, bool) {
m.lock.RLock()
defer m.lock.RUnlock()
for k, v := range m.encoders {
if strings.Contains(strings.ToLower(s), strings.ToLower(k)) {
// match
return v, true
}
}
return nil, false
} | go | func (m *Encoders) Match(s string) (respond.Encoder, bool) {
m.lock.RLock()
defer m.lock.RUnlock()
for k, v := range m.encoders {
if strings.Contains(strings.ToLower(s), strings.ToLower(k)) {
// match
return v, true
}
}
return nil, false
} | [
"func",
"(",
"m",
"*",
"Encoders",
")",
"Match",
"(",
"s",
"string",
")",
"(",
"respond",
".",
"Encoder",
",",
"bool",
")",
"{",
"m",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"m",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n",
"for",
... | // Match uses the string to find a matching Encoder. | [
"Match",
"uses",
"the",
"string",
"to",
"find",
"a",
"matching",
"Encoder",
"."
] | 7ca2372f541a6f714cc7f2a7118b679795b3952c | https://github.com/matryer/respond/blob/7ca2372f541a6f714cc7f2a7118b679795b3952c/encoding/encoding.go#L60-L70 |
136,662 | matryer/respond | respond.go | With | func With(w http.ResponseWriter, r *http.Request, status int, data interface{}) {
mutex.RLock()
opts := options[r]
multiple := responded[r]
mutex.RUnlock()
with(w, r, status, data, opts, multiple)
} | go | func With(w http.ResponseWriter, r *http.Request, status int, data interface{}) {
mutex.RLock()
opts := options[r]
multiple := responded[r]
mutex.RUnlock()
with(w, r, status, data, opts, multiple)
} | [
"func",
"With",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"status",
"int",
",",
"data",
"interface",
"{",
"}",
")",
"{",
"mutex",
".",
"RLock",
"(",
")",
"\n",
"opts",
":=",
"options",
"[",
"r",
"]",
"\n... | // With responds to the client. | [
"With",
"responds",
"to",
"the",
"client",
"."
] | 7ca2372f541a6f714cc7f2a7118b679795b3952c | https://github.com/matryer/respond/blob/7ca2372f541a6f714cc7f2a7118b679795b3952c/respond.go#L49-L55 |
136,663 | matryer/respond | respond.go | Handler | func (o *Options) Handler(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
initOnce.Do(func() {
options = make(map[*http.Request]*Options)
responded = make(map[*http.Request]bool)
})
mutex.Lock()
options[r] = o
mutex.Unlock()
defer func() {
... | go | func (o *Options) Handler(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
initOnce.Do(func() {
options = make(map[*http.Request]*Options)
responded = make(map[*http.Request]bool)
})
mutex.Lock()
options[r] = o
mutex.Unlock()
defer func() {
... | [
"func",
"(",
"o",
"*",
"Options",
")",
"Handler",
"(",
"handler",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Reque... | // Handler wraps an HTTP handler becoming the source of options for all
// containing With calls. | [
"Handler",
"wraps",
"an",
"HTTP",
"handler",
"becoming",
"the",
"source",
"of",
"options",
"for",
"all",
"containing",
"With",
"calls",
"."
] | 7ca2372f541a6f714cc7f2a7118b679795b3952c | https://github.com/matryer/respond/blob/7ca2372f541a6f714cc7f2a7118b679795b3952c/respond.go#L123-L140 |
136,664 | netrack/openflow | ofputil/bitmap.go | Bitmap128 | func Bitmap128(q1, q2, q3, q4 uint32) [4]uint32 {
return [4]uint32{q1, q2, q3, q4}
} | go | func Bitmap128(q1, q2, q3, q4 uint32) [4]uint32 {
return [4]uint32{q1, q2, q3, q4}
} | [
"func",
"Bitmap128",
"(",
"q1",
",",
"q2",
",",
"q3",
",",
"q4",
"uint32",
")",
"[",
"4",
"]",
"uint32",
"{",
"return",
"[",
"4",
"]",
"uint32",
"{",
"q1",
",",
"q2",
",",
"q3",
",",
"q4",
"}",
"\n",
"}"
] | // Bitmap128 returns a conjunction of four specified quartets. | [
"Bitmap128",
"returns",
"a",
"conjunction",
"of",
"four",
"specified",
"quartets",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofputil/bitmap.go#L13-L15 |
136,665 | netrack/openflow | ofputil/bitmap.go | PacketInReasonBitmap | func PacketInReasonBitmap(reasons ...ofp.PacketInReason) (bits uint32) {
for _, reason := range reasons {
bits = shl(bits, uint32(reason))
}
return
} | go | func PacketInReasonBitmap(reasons ...ofp.PacketInReason) (bits uint32) {
for _, reason := range reasons {
bits = shl(bits, uint32(reason))
}
return
} | [
"func",
"PacketInReasonBitmap",
"(",
"reasons",
"...",
"ofp",
".",
"PacketInReason",
")",
"(",
"bits",
"uint32",
")",
"{",
"for",
"_",
",",
"reason",
":=",
"range",
"reasons",
"{",
"bits",
"=",
"shl",
"(",
"bits",
",",
"uint32",
"(",
"reason",
")",
")"... | // PacketInReasonBitmap returns the bitmap of packet-in reasons. The
// result could be used in the asynchronous configuration message. | [
"PacketInReasonBitmap",
"returns",
"the",
"bitmap",
"of",
"packet",
"-",
"in",
"reasons",
".",
"The",
"result",
"could",
"be",
"used",
"in",
"the",
"asynchronous",
"configuration",
"message",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofputil/bitmap.go#L23-L29 |
136,666 | netrack/openflow | ofputil/bitmap.go | PortReasonBitmap | func PortReasonBitmap(reasons ...ofp.PortReason) (bits uint32) {
for _, reason := range reasons {
bits = shl(bits, uint32(reason))
}
return
} | go | func PortReasonBitmap(reasons ...ofp.PortReason) (bits uint32) {
for _, reason := range reasons {
bits = shl(bits, uint32(reason))
}
return
} | [
"func",
"PortReasonBitmap",
"(",
"reasons",
"...",
"ofp",
".",
"PortReason",
")",
"(",
"bits",
"uint32",
")",
"{",
"for",
"_",
",",
"reason",
":=",
"range",
"reasons",
"{",
"bits",
"=",
"shl",
"(",
"bits",
",",
"uint32",
"(",
"reason",
")",
")",
"\n"... | // PortReasonBitmap returns the bitmap of port reasons. The result
// can be used in the asynchronous configuration message. | [
"PortReasonBitmap",
"returns",
"the",
"bitmap",
"of",
"port",
"reasons",
".",
"The",
"result",
"can",
"be",
"used",
"in",
"the",
"asynchronous",
"configuration",
"message",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofputil/bitmap.go#L33-L39 |
136,667 | netrack/openflow | ofputil/bitmap.go | FlowReasonBitmap | func FlowReasonBitmap(reasons ...ofp.FlowRemovedReason) (bits uint32) {
for _, reason := range reasons {
bits = shl(bits, uint32(reason))
}
return
} | go | func FlowReasonBitmap(reasons ...ofp.FlowRemovedReason) (bits uint32) {
for _, reason := range reasons {
bits = shl(bits, uint32(reason))
}
return
} | [
"func",
"FlowReasonBitmap",
"(",
"reasons",
"...",
"ofp",
".",
"FlowRemovedReason",
")",
"(",
"bits",
"uint32",
")",
"{",
"for",
"_",
",",
"reason",
":=",
"range",
"reasons",
"{",
"bits",
"=",
"shl",
"(",
"bits",
",",
"uint32",
"(",
"reason",
")",
")",... | // FlowReasonBitmap returns the bitmap of port reasons. The result
// can be used in the asynchronous configuration message. | [
"FlowReasonBitmap",
"returns",
"the",
"bitmap",
"of",
"port",
"reasons",
".",
"The",
"result",
"can",
"be",
"used",
"in",
"the",
"asynchronous",
"configuration",
"message",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofputil/bitmap.go#L43-L49 |
136,668 | netrack/openflow | ofputil/bitmap.go | GroupBitmap | func GroupBitmap(groups ...ofp.GroupType) (bits uint32) {
for _, group := range groups {
bits = shl(bits, uint32(group))
}
return
} | go | func GroupBitmap(groups ...ofp.GroupType) (bits uint32) {
for _, group := range groups {
bits = shl(bits, uint32(group))
}
return
} | [
"func",
"GroupBitmap",
"(",
"groups",
"...",
"ofp",
".",
"GroupType",
")",
"(",
"bits",
"uint32",
")",
"{",
"for",
"_",
",",
"group",
":=",
"range",
"groups",
"{",
"bits",
"=",
"shl",
"(",
"bits",
",",
"uint32",
"(",
"group",
")",
")",
"\n",
"}",
... | // GroupBitmap returns the bitmap of group types. The result can be
// used in the group features message. | [
"GroupBitmap",
"returns",
"the",
"bitmap",
"of",
"group",
"types",
".",
"The",
"result",
"can",
"be",
"used",
"in",
"the",
"group",
"features",
"message",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofputil/bitmap.go#L53-L59 |
136,669 | netrack/openflow | ofputil/bitmap.go | ActionBitmap | func ActionBitmap(actions ...ofp.ActionType) (bits uint32) {
for _, action := range actions {
bits = shl(bits, uint32(action))
}
return
} | go | func ActionBitmap(actions ...ofp.ActionType) (bits uint32) {
for _, action := range actions {
bits = shl(bits, uint32(action))
}
return
} | [
"func",
"ActionBitmap",
"(",
"actions",
"...",
"ofp",
".",
"ActionType",
")",
"(",
"bits",
"uint32",
")",
"{",
"for",
"_",
",",
"action",
":=",
"range",
"actions",
"{",
"bits",
"=",
"shl",
"(",
"bits",
",",
"uint32",
"(",
"action",
")",
")",
"\n",
... | // ActionBitmap returns the bitmap of action types. The result can
// be used in the group features message. | [
"ActionBitmap",
"returns",
"the",
"bitmap",
"of",
"action",
"types",
".",
"The",
"result",
"can",
"be",
"used",
"in",
"the",
"group",
"features",
"message",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofputil/bitmap.go#L63-L69 |
136,670 | netrack/openflow | ofp/group.go | WriteTo | func (g *GroupMod) WriteTo(w io.Writer) (int64, error) {
n, err := encoding.WriteTo(w, g.Command, g.Type, pad1{}, g.Group)
if err != nil {
return n, err
}
nn, err := encoding.WriteSliceTo(w, g.Buckets)
return n + nn, err
} | go | func (g *GroupMod) WriteTo(w io.Writer) (int64, error) {
n, err := encoding.WriteTo(w, g.Command, g.Type, pad1{}, g.Group)
if err != nil {
return n, err
}
nn, err := encoding.WriteSliceTo(w, g.Buckets)
return n + nn, err
} | [
"func",
"(",
"g",
"*",
"GroupMod",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"n",
",",
"err",
":=",
"encoding",
".",
"WriteTo",
"(",
"w",
",",
"g",
".",
"Command",
",",
"g",
".",
"Type",
",",
"p... | // WriteTo implements io.WriterTo interface. It serializes the group
// modification message into the wire format. | [
"WriteTo",
"implements",
"io",
".",
"WriterTo",
"interface",
".",
"It",
"serializes",
"the",
"group",
"modification",
"message",
"into",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/group.go#L96-L104 |
136,671 | netrack/openflow | ofp/group.go | ReadFrom | func (g *GroupMod) ReadFrom(r io.Reader) (int64, error) {
n, err := encoding.ReadFrom(r, &g.Command, &g.Type,
&defaultPad1, &g.Group)
if err != nil {
return n, err
}
bucketMaker := encoding.ReaderMakerOf(Bucket{})
nn, err := encoding.ReadSliceFrom(r, bucketMaker, g.Buckets)
return n + nn, err
} | go | func (g *GroupMod) ReadFrom(r io.Reader) (int64, error) {
n, err := encoding.ReadFrom(r, &g.Command, &g.Type,
&defaultPad1, &g.Group)
if err != nil {
return n, err
}
bucketMaker := encoding.ReaderMakerOf(Bucket{})
nn, err := encoding.ReadSliceFrom(r, bucketMaker, g.Buckets)
return n + nn, err
} | [
"func",
"(",
"g",
"*",
"GroupMod",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"n",
",",
"err",
":=",
"encoding",
".",
"ReadFrom",
"(",
"r",
",",
"&",
"g",
".",
"Command",
",",
"&",
"g",
".",
"Ty... | // ReadFrom implements io.ReaderFrom interface. It deserializes the
// groups modification message from the wire format. | [
"ReadFrom",
"implements",
"io",
".",
"ReaderFrom",
"interface",
".",
"It",
"deserializes",
"the",
"groups",
"modification",
"message",
"from",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/group.go#L108-L118 |
136,672 | netrack/openflow | ofp/group.go | WriteTo | func (b *Bucket) WriteTo(w io.Writer) (int64, error) {
// Serialize the list of actions first, to set the
// valid length into the bucket header.
actions, err := b.Actions.bytes()
if err != nil {
return 0, err
}
// The length of the bucket header consist of the
// header length itself and the length of action... | go | func (b *Bucket) WriteTo(w io.Writer) (int64, error) {
// Serialize the list of actions first, to set the
// valid length into the bucket header.
actions, err := b.Actions.bytes()
if err != nil {
return 0, err
}
// The length of the bucket header consist of the
// header length itself and the length of action... | [
"func",
"(",
"b",
"*",
"Bucket",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"// Serialize the list of actions first, to set the",
"// valid length into the bucket header.",
"actions",
",",
"err",
":=",
"b",
".",
"Ac... | // WriteTo implements io.WriterTo interface. It serializes the bucket
// into the wire format. | [
"WriteTo",
"implements",
"io",
".",
"WriterTo",
"interface",
".",
"It",
"serializes",
"the",
"bucket",
"into",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/group.go#L148-L160 |
136,673 | netrack/openflow | ofp/group.go | ReadFrom | func (b *Bucket) ReadFrom(r io.Reader) (int64, error) {
// Read the header of the bucket to limit the count
// of bytes used to unmarshal the list of actions.
var length uint16
n, err := encoding.ReadFrom(r, &length, &b.Weight,
&b.WatchPort, &b.WatchGroup, &defaultPad4)
if err != nil {
return n, err
}
// Cr... | go | func (b *Bucket) ReadFrom(r io.Reader) (int64, error) {
// Read the header of the bucket to limit the count
// of bytes used to unmarshal the list of actions.
var length uint16
n, err := encoding.ReadFrom(r, &length, &b.Weight,
&b.WatchPort, &b.WatchGroup, &defaultPad4)
if err != nil {
return n, err
}
// Cr... | [
"func",
"(",
"b",
"*",
"Bucket",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"// Read the header of the bucket to limit the count",
"// of bytes used to unmarshal the list of actions.",
"var",
"length",
"uint16",
"\n",
... | // ReadFrom implements io.ReaderFrom interface. It deserializes the
// bucket from the wire format. | [
"ReadFrom",
"implements",
"io",
".",
"ReaderFrom",
"interface",
".",
"It",
"deserializes",
"the",
"bucket",
"from",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/group.go#L164-L181 |
136,674 | netrack/openflow | ofp/group.go | WriteTo | func (g *GroupStatsRequest) WriteTo(w io.Writer) (int64, error) {
return encoding.WriteTo(w, g.Group, pad4{})
} | go | func (g *GroupStatsRequest) WriteTo(w io.Writer) (int64, error) {
return encoding.WriteTo(w, g.Group, pad4{})
} | [
"func",
"(",
"g",
"*",
"GroupStatsRequest",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"encoding",
".",
"WriteTo",
"(",
"w",
",",
"g",
".",
"Group",
",",
"pad4",
"{",
"}",
")",
"\n",
"}"
] | // WriteTo implements io.WriterTo interface. It serializes the group
// statistics request into the wire format. | [
"WriteTo",
"implements",
"io",
".",
"WriterTo",
"interface",
".",
"It",
"serializes",
"the",
"group",
"statistics",
"request",
"into",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/group.go#L200-L202 |
136,675 | netrack/openflow | ofp/group.go | ReadFrom | func (g *GroupStatsRequest) ReadFrom(r io.Reader) (int64, error) {
return encoding.ReadFrom(r, &g.Group, &defaultPad4)
} | go | func (g *GroupStatsRequest) ReadFrom(r io.Reader) (int64, error) {
return encoding.ReadFrom(r, &g.Group, &defaultPad4)
} | [
"func",
"(",
"g",
"*",
"GroupStatsRequest",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"encoding",
".",
"ReadFrom",
"(",
"r",
",",
"&",
"g",
".",
"Group",
",",
"&",
"defaultPad4",
")",
"\n",... | // ReadFrom implements io.ReaderFrom interface. It deserializes the
// groups statistics from the wire format. | [
"ReadFrom",
"implements",
"io",
".",
"ReaderFrom",
"interface",
".",
"It",
"deserializes",
"the",
"groups",
"statistics",
"from",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/group.go#L206-L208 |
136,676 | netrack/openflow | ofp/group.go | WriteTo | func (g *GroupStats) WriteTo(w io.Writer) (int64, error) {
var buf bytes.Buffer
_, err := encoding.WriteSliceTo(&buf, g.BucketStats)
if err != nil {
return 0, err
}
return encoding.WriteTo(w, uint16(groupStatsLen+buf.Len()), pad2{},
g.Group, g.RefCount, pad4{}, g.PacketCount, g.ByteCount,
g.DurationSec, g.... | go | func (g *GroupStats) WriteTo(w io.Writer) (int64, error) {
var buf bytes.Buffer
_, err := encoding.WriteSliceTo(&buf, g.BucketStats)
if err != nil {
return 0, err
}
return encoding.WriteTo(w, uint16(groupStatsLen+buf.Len()), pad2{},
g.Group, g.RefCount, pad4{}, g.PacketCount, g.ByteCount,
g.DurationSec, g.... | [
"func",
"(",
"g",
"*",
"GroupStats",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n\n",
"_",
",",
"err",
":=",
"encoding",
".",
"WriteSliceTo",
"(",
"&",
"buf",
... | // WriteTo implements io.WriterTo interface. It serializes the
// group statistics into the wire format. | [
"WriteTo",
"implements",
"io",
".",
"WriterTo",
"interface",
".",
"It",
"serializes",
"the",
"group",
"statistics",
"into",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/group.go#L243-L254 |
136,677 | netrack/openflow | ofp/group.go | ReadFrom | func (g *GroupStats) ReadFrom(r io.Reader) (int64, error) {
var length uint16
n, err := encoding.ReadFrom(r, &length, &defaultPad2,
&g.Group, &g.RefCount, &defaultPad4, &g.PacketCount, &g.ByteCount,
&g.DurationSec, &g.DurationNSec)
if err != nil {
return n, err
}
limrd := io.LimitReader(r, int64(length-gr... | go | func (g *GroupStats) ReadFrom(r io.Reader) (int64, error) {
var length uint16
n, err := encoding.ReadFrom(r, &length, &defaultPad2,
&g.Group, &g.RefCount, &defaultPad4, &g.PacketCount, &g.ByteCount,
&g.DurationSec, &g.DurationNSec)
if err != nil {
return n, err
}
limrd := io.LimitReader(r, int64(length-gr... | [
"func",
"(",
"g",
"*",
"GroupStats",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"var",
"length",
"uint16",
"\n\n",
"n",
",",
"err",
":=",
"encoding",
".",
"ReadFrom",
"(",
"r",
",",
"&",
"length",
"... | // ReadFrom implements io.ReaderFrom interface. It deserializes
// the group statistics from the wire format. | [
"ReadFrom",
"implements",
"io",
".",
"ReaderFrom",
"interface",
".",
"It",
"deserializes",
"the",
"group",
"statistics",
"from",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/group.go#L258-L274 |
136,678 | netrack/openflow | ofp/group.go | WriteTo | func (b *BucketCounter) WriteTo(w io.Writer) (int64, error) {
return encoding.WriteTo(w, b.PacketCount, b.ByteCount)
} | go | func (b *BucketCounter) WriteTo(w io.Writer) (int64, error) {
return encoding.WriteTo(w, b.PacketCount, b.ByteCount)
} | [
"func",
"(",
"b",
"*",
"BucketCounter",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"encoding",
".",
"WriteTo",
"(",
"w",
",",
"b",
".",
"PacketCount",
",",
"b",
".",
"ByteCount",
")",
"\n",
... | // WriteTo implements io.WriterTo interface. It serializes the bucket
// counter into the wire format. | [
"WriteTo",
"implements",
"io",
".",
"WriterTo",
"interface",
".",
"It",
"serializes",
"the",
"bucket",
"counter",
"into",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/group.go#L287-L289 |
136,679 | netrack/openflow | ofp/group.go | ReadFrom | func (b *BucketCounter) ReadFrom(r io.Reader) (int64, error) {
return encoding.ReadFrom(r, &b.PacketCount, &b.ByteCount)
} | go | func (b *BucketCounter) ReadFrom(r io.Reader) (int64, error) {
return encoding.ReadFrom(r, &b.PacketCount, &b.ByteCount)
} | [
"func",
"(",
"b",
"*",
"BucketCounter",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"encoding",
".",
"ReadFrom",
"(",
"r",
",",
"&",
"b",
".",
"PacketCount",
",",
"&",
"b",
".",
"ByteCount",
... | // ReadFrom implements io.ReaderFrom interface. It deserializes the
// bucket counter from the wire format. | [
"ReadFrom",
"implements",
"io",
".",
"ReaderFrom",
"interface",
".",
"It",
"deserializes",
"the",
"bucket",
"counter",
"from",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/group.go#L293-L295 |
136,680 | netrack/openflow | ofp/group.go | WriteTo | func (g *GroupDescStats) WriteTo(w io.Writer) (int64, error) {
var buf bytes.Buffer
// Write the list of buckets to the temporary buffer,
// so we could set an appropriate length of the message.
_, err := encoding.WriteSliceTo(&buf, g.Buckets)
if err != nil {
return 0, err
}
length := uint16(groupDescStatsLe... | go | func (g *GroupDescStats) WriteTo(w io.Writer) (int64, error) {
var buf bytes.Buffer
// Write the list of buckets to the temporary buffer,
// so we could set an appropriate length of the message.
_, err := encoding.WriteSliceTo(&buf, g.Buckets)
if err != nil {
return 0, err
}
length := uint16(groupDescStatsLe... | [
"func",
"(",
"g",
"*",
"GroupDescStats",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n\n",
"// Write the list of buckets to the temporary buffer,",
"// so we could set an appropr... | // WriteTo implements io.WriterTo interface. It serialiezes the
// groups description statistics into the wire format. | [
"WriteTo",
"implements",
"io",
".",
"WriterTo",
"interface",
".",
"It",
"serialiezes",
"the",
"groups",
"description",
"statistics",
"into",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/group.go#L320-L333 |
136,681 | netrack/openflow | ofp/group.go | ReadFrom | func (g *GroupDescStats) ReadFrom(r io.Reader) (int64, error) {
var length uint16
// Read the header of the messages to retrieve the
// length of the buckets list.
n, err := encoding.ReadFrom(r, &length, &g.Type,
&defaultPad1, &g.Group)
limrd := io.LimitReader(r, int64(length-groupDescStatsLen))
bucketMaker :... | go | func (g *GroupDescStats) ReadFrom(r io.Reader) (int64, error) {
var length uint16
// Read the header of the messages to retrieve the
// length of the buckets list.
n, err := encoding.ReadFrom(r, &length, &g.Type,
&defaultPad1, &g.Group)
limrd := io.LimitReader(r, int64(length-groupDescStatsLen))
bucketMaker :... | [
"func",
"(",
"g",
"*",
"GroupDescStats",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"var",
"length",
"uint16",
"\n\n",
"// Read the header of the messages to retrieve the",
"// length of the buckets list.",
"n",
",",... | // ReadFrom implements io.ReaderFrom interface. It deserializes
// the group description statistics from the wire format. | [
"ReadFrom",
"implements",
"io",
".",
"ReaderFrom",
"interface",
".",
"It",
"deserializes",
"the",
"group",
"description",
"statistics",
"from",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/group.go#L337-L350 |
136,682 | netrack/openflow | ofp/group.go | WriteTo | func (g *GroupFeatures) WriteTo(w io.Writer) (int64, error) {
return encoding.WriteTo(w, g.Types, g.Capabilities,
g.MaxGroups, g.Actions)
} | go | func (g *GroupFeatures) WriteTo(w io.Writer) (int64, error) {
return encoding.WriteTo(w, g.Types, g.Capabilities,
g.MaxGroups, g.Actions)
} | [
"func",
"(",
"g",
"*",
"GroupFeatures",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"encoding",
".",
"WriteTo",
"(",
"w",
",",
"g",
".",
"Types",
",",
"g",
".",
"Capabilities",
",",
"g",
"."... | // WriteTo implemenst io.WriterTo interface. It serializes the
// group features message into the wire format. | [
"WriteTo",
"implemenst",
"io",
".",
"WriterTo",
"interface",
".",
"It",
"serializes",
"the",
"group",
"features",
"message",
"into",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/group.go#L437-L440 |
136,683 | netrack/openflow | ofp/group.go | ReadFrom | func (g *GroupFeatures) ReadFrom(r io.Reader) (int64, error) {
return encoding.ReadFrom(r, &g.Types, &g.Capabilities,
&g.MaxGroups, &g.Actions)
} | go | func (g *GroupFeatures) ReadFrom(r io.Reader) (int64, error) {
return encoding.ReadFrom(r, &g.Types, &g.Capabilities,
&g.MaxGroups, &g.Actions)
} | [
"func",
"(",
"g",
"*",
"GroupFeatures",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"encoding",
".",
"ReadFrom",
"(",
"r",
",",
"&",
"g",
".",
"Types",
",",
"&",
"g",
".",
"Capabilities",
"... | // ReadFrom implements io.ReaderFrom interface. It deserializes
// the group features message from the wire format. | [
"ReadFrom",
"implements",
"io",
".",
"ReaderFrom",
"interface",
".",
"It",
"deserializes",
"the",
"group",
"features",
"message",
"from",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/group.go#L444-L447 |
136,684 | netrack/openflow | ofp/instruction.go | String | func (it InstructionType) String() string {
text, ok := instructionTypeText[it]
if !ok {
return fmt.Sprintf("InstructionType(%d)", it)
}
return text
} | go | func (it InstructionType) String() string {
text, ok := instructionTypeText[it]
if !ok {
return fmt.Sprintf("InstructionType(%d)", it)
}
return text
} | [
"func",
"(",
"it",
"InstructionType",
")",
"String",
"(",
")",
"string",
"{",
"text",
",",
"ok",
":=",
"instructionTypeText",
"[",
"it",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"it",
")",
"\n",
"}",
... | // String returns a string representation of instruction type. | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"instruction",
"type",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/instruction.go#L43-L49 |
136,685 | netrack/openflow | ofp/instruction.go | WriteTo | func (i *Instructions) WriteTo(w io.Writer) (n int64, err error) {
var buf bytes.Buffer
for _, inst := range *i {
_, err = inst.WriteTo(&buf)
if err != nil {
return
}
}
return encoding.WriteTo(w, buf.Bytes())
} | go | func (i *Instructions) WriteTo(w io.Writer) (n int64, err error) {
var buf bytes.Buffer
for _, inst := range *i {
_, err = inst.WriteTo(&buf)
if err != nil {
return
}
}
return encoding.WriteTo(w, buf.Bytes())
} | [
"func",
"(",
"i",
"*",
"Instructions",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"n",
"int64",
",",
"err",
"error",
")",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n\n",
"for",
"_",
",",
"inst",
":=",
"range",
"*",
"i",
"{",
"_... | // WriteTo implements io.WriterTo interface. It serializes the set of
// instructions into the wire format. | [
"WriteTo",
"implements",
"io",
".",
"WriterTo",
"interface",
".",
"It",
"serializes",
"the",
"set",
"of",
"instructions",
"into",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/instruction.go#L108-L119 |
136,686 | netrack/openflow | ofp/instruction.go | ReadFrom | func (i *Instructions) ReadFrom(r io.Reader) (n int64, err error) {
var instType InstructionType
rm := func() (io.ReaderFrom, error) {
if rm, ok := instructionMap[instType]; ok {
rd, err := rm.MakeReader()
*i = append(*i, rd.(Instruction))
return rd, err
}
return nil, fmt.Errorf("ofp: unknown instruc... | go | func (i *Instructions) ReadFrom(r io.Reader) (n int64, err error) {
var instType InstructionType
rm := func() (io.ReaderFrom, error) {
if rm, ok := instructionMap[instType]; ok {
rd, err := rm.MakeReader()
*i = append(*i, rd.(Instruction))
return rd, err
}
return nil, fmt.Errorf("ofp: unknown instruc... | [
"func",
"(",
"i",
"*",
"Instructions",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"n",
"int64",
",",
"err",
"error",
")",
"{",
"var",
"instType",
"InstructionType",
"\n\n",
"rm",
":=",
"func",
"(",
")",
"(",
"io",
".",
"ReaderFrom",
... | // ReadFrom implements io.ReaderFrom interface. It deserializes the set
// of actions from the wire format. | [
"ReadFrom",
"implements",
"io",
".",
"ReaderFrom",
"interface",
".",
"It",
"deserializes",
"the",
"set",
"of",
"actions",
"from",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/instruction.go#L123-L138 |
136,687 | netrack/openflow | ofp/instruction.go | WriteTo | func (i *InstructionGotoTable) WriteTo(w io.Writer) (int64, error) {
return encoding.WriteTo(w, instruction{i.Type(), 8}, i.Table, pad3{})
} | go | func (i *InstructionGotoTable) WriteTo(w io.Writer) (int64, error) {
return encoding.WriteTo(w, instruction{i.Type(), 8}, i.Table, pad3{})
} | [
"func",
"(",
"i",
"*",
"InstructionGotoTable",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"encoding",
".",
"WriteTo",
"(",
"w",
",",
"instruction",
"{",
"i",
".",
"Type",
"(",
")",
",",
"8",
... | // WriteTo implements io.WriterTo interface. It serializes the
// instruction used to redirect the processing pipeline into the
// wire format. | [
"WriteTo",
"implements",
"io",
".",
"WriterTo",
"interface",
".",
"It",
"serializes",
"the",
"instruction",
"used",
"to",
"redirect",
"the",
"processing",
"pipeline",
"into",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/instruction.go#L157-L159 |
136,688 | netrack/openflow | ofp/instruction.go | ReadFrom | func (i *InstructionGotoTable) ReadFrom(r io.Reader) (int64, error) {
return encoding.ReadFrom(r, &instruction{}, &i.Table, &defaultPad3)
} | go | func (i *InstructionGotoTable) ReadFrom(r io.Reader) (int64, error) {
return encoding.ReadFrom(r, &instruction{}, &i.Table, &defaultPad3)
} | [
"func",
"(",
"i",
"*",
"InstructionGotoTable",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"encoding",
".",
"ReadFrom",
"(",
"r",
",",
"&",
"instruction",
"{",
"}",
",",
"&",
"i",
".",
"Table... | // ReadFrom implements io.ReadFrom interface. It deserializes the
// instruction used to redirect the processing pipeline from the wire
// format. | [
"ReadFrom",
"implements",
"io",
".",
"ReadFrom",
"interface",
".",
"It",
"deserializes",
"the",
"instruction",
"used",
"to",
"redirect",
"the",
"processing",
"pipeline",
"from",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/instruction.go#L164-L166 |
136,689 | netrack/openflow | ofp/instruction.go | WriteTo | func (i *InstructionWriteMetadata) WriteTo(w io.Writer) (int64, error) {
return encoding.WriteTo(w, instruction{i.Type(), 24},
pad4{}, i.Metadata, i.MetadataMask)
} | go | func (i *InstructionWriteMetadata) WriteTo(w io.Writer) (int64, error) {
return encoding.WriteTo(w, instruction{i.Type(), 24},
pad4{}, i.Metadata, i.MetadataMask)
} | [
"func",
"(",
"i",
"*",
"InstructionWriteMetadata",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"encoding",
".",
"WriteTo",
"(",
"w",
",",
"instruction",
"{",
"i",
".",
"Type",
"(",
")",
",",
"... | // WriteTo implements io.WriterTo interface. It serializes instruction
// used to write metadata into the wire format. | [
"WriteTo",
"implements",
"io",
".",
"WriterTo",
"interface",
".",
"It",
"serializes",
"instruction",
"used",
"to",
"write",
"metadata",
"into",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/instruction.go#L191-L194 |
136,690 | netrack/openflow | ofp/instruction.go | ReadFrom | func (i *InstructionWriteMetadata) ReadFrom(r io.Reader) (int64, error) {
return encoding.ReadFrom(r, &instruction{},
&defaultPad4, &i.Metadata, &i.MetadataMask)
} | go | func (i *InstructionWriteMetadata) ReadFrom(r io.Reader) (int64, error) {
return encoding.ReadFrom(r, &instruction{},
&defaultPad4, &i.Metadata, &i.MetadataMask)
} | [
"func",
"(",
"i",
"*",
"InstructionWriteMetadata",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"encoding",
".",
"ReadFrom",
"(",
"r",
",",
"&",
"instruction",
"{",
"}",
",",
"&",
"defaultPad4",
... | // ReadFrom implements io.ReaderFrom interface. It deserializes instruction
// used to write metadata from the wire format. | [
"ReadFrom",
"implements",
"io",
".",
"ReaderFrom",
"interface",
".",
"It",
"deserializes",
"instruction",
"used",
"to",
"write",
"metadata",
"from",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/instruction.go#L198-L201 |
136,691 | netrack/openflow | ofp/instruction.go | WriteTo | func (i *InstructionWriteActions) WriteTo(w io.Writer) (int64, error) {
return writeInstructionActions(w, i.Type(), i.Actions)
} | go | func (i *InstructionWriteActions) WriteTo(w io.Writer) (int64, error) {
return writeInstructionActions(w, i.Type(), i.Actions)
} | [
"func",
"(",
"i",
"*",
"InstructionWriteActions",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"writeInstructionActions",
"(",
"w",
",",
"i",
".",
"Type",
"(",
")",
",",
"i",
".",
"Actions",
")",... | // WriteTo implements io.WriterTo interface. It serializes instruction
// used to write actions into the wire format. | [
"WriteTo",
"implements",
"io",
".",
"WriterTo",
"interface",
".",
"It",
"serializes",
"instruction",
"used",
"to",
"write",
"actions",
"into",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/instruction.go#L286-L288 |
136,692 | netrack/openflow | ofp/instruction.go | ReadFrom | func (i *InstructionWriteActions) ReadFrom(r io.Reader) (int64, error) {
return readInstructionActions(r, &i.Actions)
} | go | func (i *InstructionWriteActions) ReadFrom(r io.Reader) (int64, error) {
return readInstructionActions(r, &i.Actions)
} | [
"func",
"(",
"i",
"*",
"InstructionWriteActions",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"readInstructionActions",
"(",
"r",
",",
"&",
"i",
".",
"Actions",
")",
"\n",
"}"
] | // ReadFrom implements io.ReadFrom interface. It serializes instruction
// used to write actions from the wire format. | [
"ReadFrom",
"implements",
"io",
".",
"ReadFrom",
"interface",
".",
"It",
"serializes",
"instruction",
"used",
"to",
"write",
"actions",
"from",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/instruction.go#L292-L294 |
136,693 | netrack/openflow | ofp/instruction.go | WriteTo | func (i *InstructionClearActions) WriteTo(w io.Writer) (int64, error) {
return writeInstructionActions(w, i.Type(), nil)
} | go | func (i *InstructionClearActions) WriteTo(w io.Writer) (int64, error) {
return writeInstructionActions(w, i.Type(), nil)
} | [
"func",
"(",
"i",
"*",
"InstructionClearActions",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"writeInstructionActions",
"(",
"w",
",",
"i",
".",
"Type",
"(",
")",
",",
"nil",
")",
"\n",
"}"
] | // WriteTo implements io.WriterTo interface. It serializes the
// instruction used to clear actions into the wire format. | [
"WriteTo",
"implements",
"io",
".",
"WriterTo",
"interface",
".",
"It",
"serializes",
"the",
"instruction",
"used",
"to",
"clear",
"actions",
"into",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/instruction.go#L308-L310 |
136,694 | netrack/openflow | ofp/instruction.go | ReadFrom | func (i *InstructionClearActions) ReadFrom(r io.Reader) (int64, error) {
return encoding.ReadFrom(r, &defaultPad8)
} | go | func (i *InstructionClearActions) ReadFrom(r io.Reader) (int64, error) {
return encoding.ReadFrom(r, &defaultPad8)
} | [
"func",
"(",
"i",
"*",
"InstructionClearActions",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"encoding",
".",
"ReadFrom",
"(",
"r",
",",
"&",
"defaultPad8",
")",
"\n",
"}"
] | // ReadFrom implements io.ReadFrom interface. It deserializes the
// instruction used to clear actions from the wire format. | [
"ReadFrom",
"implements",
"io",
".",
"ReadFrom",
"interface",
".",
"It",
"deserializes",
"the",
"instruction",
"used",
"to",
"clear",
"actions",
"from",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/instruction.go#L314-L316 |
136,695 | netrack/openflow | ofp/instruction.go | WriteTo | func (i *InstructionMeter) WriteTo(w io.Writer) (int64, error) {
return encoding.WriteTo(w, instruction{i.Type(), 8}, i.Meter)
} | go | func (i *InstructionMeter) WriteTo(w io.Writer) (int64, error) {
return encoding.WriteTo(w, instruction{i.Type(), 8}, i.Meter)
} | [
"func",
"(",
"i",
"*",
"InstructionMeter",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"encoding",
".",
"WriteTo",
"(",
"w",
",",
"instruction",
"{",
"i",
".",
"Type",
"(",
")",
",",
"8",
"}... | // WriteTo implements io.WriterTo interface. It serializes the
// instruction used to apply meter into the wire format. | [
"WriteTo",
"implements",
"io",
".",
"WriterTo",
"interface",
".",
"It",
"serializes",
"the",
"instruction",
"used",
"to",
"apply",
"meter",
"into",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/instruction.go#L333-L335 |
136,696 | netrack/openflow | ofp/instruction.go | ReadFrom | func (i *InstructionMeter) ReadFrom(r io.Reader) (int64, error) {
return encoding.ReadFrom(r, &instruction{}, &i.Meter)
} | go | func (i *InstructionMeter) ReadFrom(r io.Reader) (int64, error) {
return encoding.ReadFrom(r, &instruction{}, &i.Meter)
} | [
"func",
"(",
"i",
"*",
"InstructionMeter",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"encoding",
".",
"ReadFrom",
"(",
"r",
",",
"&",
"instruction",
"{",
"}",
",",
"&",
"i",
".",
"Meter",
... | // ReadFrom implements io.ReadFrom interface. It deserializes the
// instruction used to apply meter from the wire format. | [
"ReadFrom",
"implements",
"io",
".",
"ReadFrom",
"interface",
".",
"It",
"deserializes",
"the",
"instruction",
"used",
"to",
"apply",
"meter",
"from",
"the",
"wire",
"format",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/instruction.go#L339-L341 |
136,697 | netrack/openflow | net.go | String | func (c ConnState) String() string {
text, ok := connStateText[c]
if !ok {
return fmt.Sprintf("ConnState(%d)", c)
}
return text
} | go | func (c ConnState) String() string {
text, ok := connStateText[c]
if !ok {
return fmt.Sprintf("ConnState(%d)", c)
}
return text
} | [
"func",
"(",
"c",
"ConnState",
")",
"String",
"(",
")",
"string",
"{",
"text",
",",
"ok",
":=",
"connStateText",
"[",
"c",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
")",
"\n",
"}",
"\n",
"retur... | // String returns the string presentation of the ConnState. | [
"String",
"returns",
"the",
"string",
"presentation",
"of",
"the",
"ConnState",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/net.go#L46-L52 |
136,698 | netrack/openflow | net.go | newConn | func newConn(c net.Conn) *conn {
br := bufio.NewReader(c)
bw := bufio.NewWriter(c)
brw := bufio.NewReadWriter(br, bw)
return &conn{rwc: c, buf: brw}
} | go | func newConn(c net.Conn) *conn {
br := bufio.NewReader(c)
bw := bufio.NewWriter(c)
brw := bufio.NewReadWriter(br, bw)
return &conn{rwc: c, buf: brw}
} | [
"func",
"newConn",
"(",
"c",
"net",
".",
"Conn",
")",
"*",
"conn",
"{",
"br",
":=",
"bufio",
".",
"NewReader",
"(",
"c",
")",
"\n",
"bw",
":=",
"bufio",
".",
"NewWriter",
"(",
"c",
")",
"\n\n",
"brw",
":=",
"bufio",
".",
"NewReadWriter",
"(",
"br... | // newConn creates a new OpenFlow protocol connection from the
// given one. | [
"newConn",
"creates",
"a",
"new",
"OpenFlow",
"protocol",
"connection",
"from",
"the",
"given",
"one",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/net.go#L122-L128 |
136,699 | netrack/openflow | net.go | Receive | func (c *conn) Receive() (*Request, error) {
if d := c.ReadTimeout; d != 0 {
c.SetReadDeadline(time.Now().Add(d))
}
r := &Request{Addr: c.rwc.RemoteAddr(), conn: c}
_, err := r.ReadFrom(c)
if err != nil {
return nil, err
}
return r, nil
} | go | func (c *conn) Receive() (*Request, error) {
if d := c.ReadTimeout; d != 0 {
c.SetReadDeadline(time.Now().Add(d))
}
r := &Request{Addr: c.rwc.RemoteAddr(), conn: c}
_, err := r.ReadFrom(c)
if err != nil {
return nil, err
}
return r, nil
} | [
"func",
"(",
"c",
"*",
"conn",
")",
"Receive",
"(",
")",
"(",
"*",
"Request",
",",
"error",
")",
"{",
"if",
"d",
":=",
"c",
".",
"ReadTimeout",
";",
"d",
"!=",
"0",
"{",
"c",
".",
"SetReadDeadline",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Ad... | // Receive reads OpenFlow data from the connection. | [
"Receive",
"reads",
"OpenFlow",
"data",
"from",
"the",
"connection",
"."
] | 9304e84a549fd9332c278eac544f5efff47c9ab8 | https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/net.go#L136-L148 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.