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
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
126,300
uber-go/dosa
range.go
Lt
func (r *RangeOp) Lt(fieldName string, value interface{}) *RangeOp { r.appendOp(Lt, fieldName, value) return r }
go
func (r *RangeOp) Lt(fieldName string, value interface{}) *RangeOp { r.appendOp(Lt, fieldName, value) return r }
[ "func", "(", "r", "*", "RangeOp", ")", "Lt", "(", "fieldName", "string", ",", "value", "interface", "{", "}", ")", "*", "RangeOp", "{", "r", ".", "appendOp", "(", "Lt", ",", "fieldName", ",", "value", ")", "\n", "return", "r", "\n", "}" ]
// Lt is used to express a "less than" constraint for a range query
[ "Lt", "is", "used", "to", "express", "a", "less", "than", "constraint", "for", "a", "range", "query" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/range.go#L126-L129
126,301
uber-go/dosa
range.go
LtOrEq
func (r *RangeOp) LtOrEq(fieldName string, value interface{}) *RangeOp { r.appendOp(LtOrEq, fieldName, value) return r }
go
func (r *RangeOp) LtOrEq(fieldName string, value interface{}) *RangeOp { r.appendOp(LtOrEq, fieldName, value) return r }
[ "func", "(", "r", "*", "RangeOp", ")", "LtOrEq", "(", "fieldName", "string", ",", "value", "interface", "{", "}", ")", "*", "RangeOp", "{", "r", ".", "appendOp", "(", "LtOrEq", ",", "fieldName", ",", "value", ")", "\n", "return", "r", "\n", "}" ]
// LtOrEq is used to express a "less than or equal" constraint for a // range query
[ "LtOrEq", "is", "used", "to", "express", "a", "less", "than", "or", "equal", "constraint", "for", "a", "range", "query" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/range.go#L133-L136
126,302
uber-go/dosa
range.go
IndexFromConditions
func (ei *EntityInfo) IndexFromConditions(conditions map[string][]*Condition, searchIndexes bool) (name string, key *PrimaryKey, err error) { identityFunc := func(s string) string { return s } // see if we match the primary key for this table var baseTableError error if baseTableError = EnsureValidRangeConditions(e...
go
func (ei *EntityInfo) IndexFromConditions(conditions map[string][]*Condition, searchIndexes bool) (name string, key *PrimaryKey, err error) { identityFunc := func(s string) string { return s } // see if we match the primary key for this table var baseTableError error if baseTableError = EnsureValidRangeConditions(e...
[ "func", "(", "ei", "*", "EntityInfo", ")", "IndexFromConditions", "(", "conditions", "map", "[", "string", "]", "[", "]", "*", "Condition", ",", "searchIndexes", "bool", ")", "(", "name", "string", ",", "key", "*", "PrimaryKey", ",", "err", "error", ")",...
// IndexFromConditions returns the name of the index or the base table to use, along with the key info // for that index. If no suitable index could be found, an error is returned
[ "IndexFromConditions", "returns", "the", "name", "of", "the", "index", "or", "the", "base", "table", "to", "use", "along", "with", "the", "key", "info", "for", "that", "index", ".", "If", "no", "suitable", "index", "could", "be", "found", "an", "error", ...
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/range.go#L150-L171
126,303
uber-go/dosa
cmd/dosa/read.go
Read
func (c *shellQueryClient) Read(ctx context.Context, ops []*queryObj, fields []string, limit int) ([]map[string]dosa.FieldValue, error) { // look up entity in the registry re, _ := c.registrar.Find(&dosa.Entity{}) // build arguments for read with expressions fvs, err := buildReadArgs(ops) if err != nil { return...
go
func (c *shellQueryClient) Read(ctx context.Context, ops []*queryObj, fields []string, limit int) ([]map[string]dosa.FieldValue, error) { // look up entity in the registry re, _ := c.registrar.Find(&dosa.Entity{}) // build arguments for read with expressions fvs, err := buildReadArgs(ops) if err != nil { return...
[ "func", "(", "c", "*", "shellQueryClient", ")", "Read", "(", "ctx", "context", ".", "Context", ",", "ops", "[", "]", "*", "queryObj", ",", "fields", "[", "]", "string", ",", "limit", "int", ")", "(", "[", "]", "map", "[", "string", "]", "dosa", "...
// Read fetches a row by primary key.
[ "Read", "fetches", "a", "row", "by", "primary", "key", "." ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/read.go#L31-L50
126,304
uber-go/dosa
connectors/routing/connector.go
NewConnector
func NewConnector(cfg Config, connectorMap map[string]dosa.Connector) *Connector { return &Connector{ connectors: connectorMap, config: cfg, } }
go
func NewConnector(cfg Config, connectorMap map[string]dosa.Connector) *Connector { return &Connector{ connectors: connectorMap, config: cfg, } }
[ "func", "NewConnector", "(", "cfg", "Config", ",", "connectorMap", "map", "[", "string", "]", "dosa", ".", "Connector", ")", "*", "Connector", "{", "return", "&", "Connector", "{", "connectors", ":", "connectorMap", ",", "config", ":", "cfg", ",", "}", "...
// NewConnector initializes the Connector // connectorMap has a key of connectorName, and the value is a dosa.connector instance
[ "NewConnector", "initializes", "the", "Connector", "connectorMap", "has", "a", "key", "of", "connectorName", "and", "the", "value", "is", "a", "dosa", ".", "connector", "instance" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/connector.go#L43-L48
126,305
uber-go/dosa
connectors/routing/connector.go
getConnector
func (rc *Connector) getConnector(scope, namePrefix string) (dosa.Connector, error) { router := rc.config.FindRouter(scope, namePrefix) c, ok := rc.connectors[router.Connector] if !ok { return nil, fmt.Errorf("can't find %q connector", router.Connector) } return c, nil }
go
func (rc *Connector) getConnector(scope, namePrefix string) (dosa.Connector, error) { router := rc.config.FindRouter(scope, namePrefix) c, ok := rc.connectors[router.Connector] if !ok { return nil, fmt.Errorf("can't find %q connector", router.Connector) } return c, nil }
[ "func", "(", "rc", "*", "Connector", ")", "getConnector", "(", "scope", ",", "namePrefix", "string", ")", "(", "dosa", ".", "Connector", ",", "error", ")", "{", "router", ":=", "rc", ".", "config", ".", "FindRouter", "(", "scope", ",", "namePrefix", ")...
// get connector by scope an namePrefix
[ "get", "connector", "by", "scope", "an", "namePrefix" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/connector.go#L51-L60
126,306
uber-go/dosa
connectors/routing/connector.go
CreateIfNotExists
func (rc *Connector) CreateIfNotExists(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error { connector, err := rc.getConnector(ei.Ref.Scope, ei.Ref.NamePrefix) if err != nil { return err } return connector.CreateIfNotExists(ctx, ei, values) }
go
func (rc *Connector) CreateIfNotExists(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error { connector, err := rc.getConnector(ei.Ref.Scope, ei.Ref.NamePrefix) if err != nil { return err } return connector.CreateIfNotExists(ctx, ei, values) }
[ "func", "(", "rc", "*", "Connector", ")", "CreateIfNotExists", "(", "ctx", "context", ".", "Context", ",", "ei", "*", "dosa", ".", "EntityInfo", ",", "values", "map", "[", "string", "]", "dosa", ".", "FieldValue", ")", "error", "{", "connector", ",", "...
// CreateIfNotExists selects corresponding connector
[ "CreateIfNotExists", "selects", "corresponding", "connector" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/connector.go#L63-L69
126,307
uber-go/dosa
connectors/routing/connector.go
RemoveRange
func (rc *Connector) RemoveRange(ctx context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition) error { connector, err := rc.getConnector(ei.Ref.Scope, ei.Ref.NamePrefix) if err != nil { return err } return connector.RemoveRange(ctx, ei, columnConditions) }
go
func (rc *Connector) RemoveRange(ctx context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition) error { connector, err := rc.getConnector(ei.Ref.Scope, ei.Ref.NamePrefix) if err != nil { return err } return connector.RemoveRange(ctx, ei, columnConditions) }
[ "func", "(", "rc", "*", "Connector", ")", "RemoveRange", "(", "ctx", "context", ".", "Context", ",", "ei", "*", "dosa", ".", "EntityInfo", ",", "columnConditions", "map", "[", "string", "]", "[", "]", "*", "dosa", ".", "Condition", ")", "error", "{", ...
// RemoveRange selects corresponding connector
[ "RemoveRange", "selects", "corresponding", "connector" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/connector.go#L119-L125
126,308
uber-go/dosa
connectors/routing/connector.go
Range
func (rc *Connector) Range(ctx context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error) { connector, err := rc.getConnector(ei.Ref.Scope, ei.Ref.NamePrefix) if err != nil { return nil, "", err ...
go
func (rc *Connector) Range(ctx context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error) { connector, err := rc.getConnector(ei.Ref.Scope, ei.Ref.NamePrefix) if err != nil { return nil, "", err ...
[ "func", "(", "rc", "*", "Connector", ")", "Range", "(", "ctx", "context", ".", "Context", ",", "ei", "*", "dosa", ".", "EntityInfo", ",", "columnConditions", "map", "[", "string", "]", "[", "]", "*", "dosa", ".", "Condition", ",", "minimumFields", "[",...
// Range selects corresponding connector
[ "Range", "selects", "corresponding", "connector" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/connector.go#L137-L143
126,309
uber-go/dosa
connectors/routing/connector.go
UpsertSchema
func (rc *Connector) UpsertSchema(ctx context.Context, scope, namePrefix string, ed []*dosa.EntityDefinition) (*dosa.SchemaStatus, error) { connector, err := rc.getConnector(scope, namePrefix) if err != nil { return nil, err } return connector.UpsertSchema(ctx, scope, namePrefix, ed) }
go
func (rc *Connector) UpsertSchema(ctx context.Context, scope, namePrefix string, ed []*dosa.EntityDefinition) (*dosa.SchemaStatus, error) { connector, err := rc.getConnector(scope, namePrefix) if err != nil { return nil, err } return connector.UpsertSchema(ctx, scope, namePrefix, ed) }
[ "func", "(", "rc", "*", "Connector", ")", "UpsertSchema", "(", "ctx", "context", ".", "Context", ",", "scope", ",", "namePrefix", "string", ",", "ed", "[", "]", "*", "dosa", ".", "EntityDefinition", ")", "(", "*", "dosa", ".", "SchemaStatus", ",", "err...
// UpsertSchema calls selected connector
[ "UpsertSchema", "calls", "selected", "connector" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/connector.go#L164-L170
126,310
uber-go/dosa
connectors/routing/connector.go
CanUpsertSchema
func (rc *Connector) CanUpsertSchema(ctx context.Context, scope, namePrefix string, ed []*dosa.EntityDefinition) (int32, error) { connector, err := rc.getConnector(scope, namePrefix) if err != nil { return dosa.InvalidVersion, err } return connector.CanUpsertSchema(ctx, scope, namePrefix, ed) }
go
func (rc *Connector) CanUpsertSchema(ctx context.Context, scope, namePrefix string, ed []*dosa.EntityDefinition) (int32, error) { connector, err := rc.getConnector(scope, namePrefix) if err != nil { return dosa.InvalidVersion, err } return connector.CanUpsertSchema(ctx, scope, namePrefix, ed) }
[ "func", "(", "rc", "*", "Connector", ")", "CanUpsertSchema", "(", "ctx", "context", ".", "Context", ",", "scope", ",", "namePrefix", "string", ",", "ed", "[", "]", "*", "dosa", ".", "EntityDefinition", ")", "(", "int32", ",", "error", ")", "{", "connec...
// CanUpsertSchema calls selected connector
[ "CanUpsertSchema", "calls", "selected", "connector" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/connector.go#L173-L179
126,311
uber-go/dosa
connectors/routing/connector.go
CheckSchemaStatus
func (rc *Connector) CheckSchemaStatus(ctx context.Context, scope string, namePrefix string, version int32) (*dosa.SchemaStatus, error) { connector, err := rc.getConnector(scope, namePrefix) if err != nil { return nil, err } return connector.CheckSchemaStatus(ctx, scope, namePrefix, version) }
go
func (rc *Connector) CheckSchemaStatus(ctx context.Context, scope string, namePrefix string, version int32) (*dosa.SchemaStatus, error) { connector, err := rc.getConnector(scope, namePrefix) if err != nil { return nil, err } return connector.CheckSchemaStatus(ctx, scope, namePrefix, version) }
[ "func", "(", "rc", "*", "Connector", ")", "CheckSchemaStatus", "(", "ctx", "context", ".", "Context", ",", "scope", "string", ",", "namePrefix", "string", ",", "version", "int32", ")", "(", "*", "dosa", ".", "SchemaStatus", ",", "error", ")", "{", "conne...
// CheckSchemaStatus calls selected connector
[ "CheckSchemaStatus", "calls", "selected", "connector" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/connector.go#L182-L188
126,312
uber-go/dosa
connectors/routing/connector.go
GetEntitySchema
func (rc *Connector) GetEntitySchema(ctx context.Context, scope, namePrefix, entityName string, version int32) (*dosa.EntityDefinition, error) { connector, err := rc.getConnector(scope, namePrefix) if err != nil { return nil, err } return connector.GetEntitySchema(ctx, scope, namePrefix, entityName, version) }
go
func (rc *Connector) GetEntitySchema(ctx context.Context, scope, namePrefix, entityName string, version int32) (*dosa.EntityDefinition, error) { connector, err := rc.getConnector(scope, namePrefix) if err != nil { return nil, err } return connector.GetEntitySchema(ctx, scope, namePrefix, entityName, version) }
[ "func", "(", "rc", "*", "Connector", ")", "GetEntitySchema", "(", "ctx", "context", ".", "Context", ",", "scope", ",", "namePrefix", ",", "entityName", "string", ",", "version", "int32", ")", "(", "*", "dosa", ".", "EntityDefinition", ",", "error", ")", ...
// GetEntitySchema calls the selected connector
[ "GetEntitySchema", "calls", "the", "selected", "connector" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/connector.go#L191-L197
126,313
uber-go/dosa
connectors/routing/connector.go
CreateScope
func (rc *Connector) CreateScope(ctx context.Context, md *dosa.ScopeMetadata) error { // will fall to default connector connector, err := rc.getConnector(md.Name, "") if err != nil { return err } return connector.CreateScope(ctx, md) }
go
func (rc *Connector) CreateScope(ctx context.Context, md *dosa.ScopeMetadata) error { // will fall to default connector connector, err := rc.getConnector(md.Name, "") if err != nil { return err } return connector.CreateScope(ctx, md) }
[ "func", "(", "rc", "*", "Connector", ")", "CreateScope", "(", "ctx", "context", ".", "Context", ",", "md", "*", "dosa", ".", "ScopeMetadata", ")", "error", "{", "// will fall to default connector", "connector", ",", "err", ":=", "rc", ".", "getConnector", "(...
// CreateScope calls selected connector
[ "CreateScope", "calls", "selected", "connector" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/connector.go#L200-L207
126,314
uber-go/dosa
connectors/routing/connector.go
TruncateScope
func (rc *Connector) TruncateScope(ctx context.Context, scope string) error { // will fall to default connector connector, err := rc.getConnector(scope, "") if err != nil { return err } return connector.TruncateScope(ctx, scope) }
go
func (rc *Connector) TruncateScope(ctx context.Context, scope string) error { // will fall to default connector connector, err := rc.getConnector(scope, "") if err != nil { return err } return connector.TruncateScope(ctx, scope) }
[ "func", "(", "rc", "*", "Connector", ")", "TruncateScope", "(", "ctx", "context", ".", "Context", ",", "scope", "string", ")", "error", "{", "// will fall to default connector", "connector", ",", "err", ":=", "rc", ".", "getConnector", "(", "scope", ",", "\"...
// TruncateScope calls selected connector
[ "TruncateScope", "calls", "selected", "connector" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/connector.go#L210-L217
126,315
uber-go/dosa
connectors/routing/connector.go
ScopeExists
func (rc *Connector) ScopeExists(ctx context.Context, scope string) (bool, error) { // will fall to default connector connector, err := rc.getConnector(scope, "") if err != nil { return false, err } return connector.ScopeExists(ctx, scope) }
go
func (rc *Connector) ScopeExists(ctx context.Context, scope string) (bool, error) { // will fall to default connector connector, err := rc.getConnector(scope, "") if err != nil { return false, err } return connector.ScopeExists(ctx, scope) }
[ "func", "(", "rc", "*", "Connector", ")", "ScopeExists", "(", "ctx", "context", ".", "Context", ",", "scope", "string", ")", "(", "bool", ",", "error", ")", "{", "// will fall to default connector", "connector", ",", "err", ":=", "rc", ".", "getConnector", ...
// ScopeExists calls selected connector
[ "ScopeExists", "calls", "selected", "connector" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/connector.go#L230-L237
126,316
uber-go/dosa
connectors/routing/connector.go
Shutdown
func (rc *Connector) Shutdown() error { hasError := false rConnErr := errors.New("failed to shutdown") for _, c := range rc.connectors { err := c.Shutdown() if err != nil { // save errors here, continue to shut down other connectors hasError = true err = errors.Wrap(rConnErr, err.Error()) continue ...
go
func (rc *Connector) Shutdown() error { hasError := false rConnErr := errors.New("failed to shutdown") for _, c := range rc.connectors { err := c.Shutdown() if err != nil { // save errors here, continue to shut down other connectors hasError = true err = errors.Wrap(rConnErr, err.Error()) continue ...
[ "func", "(", "rc", "*", "Connector", ")", "Shutdown", "(", ")", "error", "{", "hasError", ":=", "false", "\n", "rConnErr", ":=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "for", "_", ",", "c", ":=", "range", "rc", ".", "connectors", "{", ...
// Shutdown shut down all connectors that routing connector talks to
[ "Shutdown", "shut", "down", "all", "connectors", "that", "routing", "connector", "talks", "to" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/connector.go#L240-L257
126,317
uber-go/dosa
mocks/metrics.go
Counter
func (m *MockScope) Counter(name string) metrics.Counter { ret := m.ctrl.Call(m, "Counter", name) ret0, _ := ret[0].(metrics.Counter) return ret0 }
go
func (m *MockScope) Counter(name string) metrics.Counter { ret := m.ctrl.Call(m, "Counter", name) ret0, _ := ret[0].(metrics.Counter) return ret0 }
[ "func", "(", "m", "*", "MockScope", ")", "Counter", "(", "name", "string", ")", "metrics", ".", "Counter", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "name", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", ...
// Counter mocks base method
[ "Counter", "mocks", "base", "method" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/mocks/metrics.go#L59-L63
126,318
uber-go/dosa
mocks/metrics.go
Tagged
func (m *MockScope) Tagged(tags map[string]string) metrics.Scope { ret := m.ctrl.Call(m, "Tagged", tags) ret0, _ := ret[0].(metrics.Scope) return ret0 }
go
func (m *MockScope) Tagged(tags map[string]string) metrics.Scope { ret := m.ctrl.Call(m, "Tagged", tags) ret0, _ := ret[0].(metrics.Scope) return ret0 }
[ "func", "(", "m", "*", "MockScope", ")", "Tagged", "(", "tags", "map", "[", "string", "]", "string", ")", "metrics", ".", "Scope", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "tags", ")", "\n", "ret0", ",", ...
// Tagged mocks base method
[ "Tagged", "mocks", "base", "method" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/mocks/metrics.go#L71-L75
126,319
uber-go/dosa
mocks/metrics.go
Tagged
func (mr *MockScopeMockRecorder) Tagged(tags interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tagged", reflect.TypeOf((*MockScope)(nil).Tagged), tags) }
go
func (mr *MockScopeMockRecorder) Tagged(tags interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tagged", reflect.TypeOf((*MockScope)(nil).Tagged), tags) }
[ "func", "(", "mr", "*", "MockScopeMockRecorder", ")", "Tagged", "(", "tags", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\""...
// Tagged indicates an expected call of Tagged
[ "Tagged", "indicates", "an", "expected", "call", "of", "Tagged" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/mocks/metrics.go#L78-L80
126,320
uber-go/dosa
mocks/metrics.go
SubScope
func (m *MockScope) SubScope(name string) metrics.Scope { ret := m.ctrl.Call(m, "SubScope", name) ret0, _ := ret[0].(metrics.Scope) return ret0 }
go
func (m *MockScope) SubScope(name string) metrics.Scope { ret := m.ctrl.Call(m, "SubScope", name) ret0, _ := ret[0].(metrics.Scope) return ret0 }
[ "func", "(", "m", "*", "MockScope", ")", "SubScope", "(", "name", "string", ")", "metrics", ".", "Scope", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "name", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", ...
// SubScope mocks base method
[ "SubScope", "mocks", "base", "method" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/mocks/metrics.go#L83-L87
126,321
uber-go/dosa
mocks/metrics.go
Timer
func (mr *MockScopeMockRecorder) Timer(name interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Timer", reflect.TypeOf((*MockScope)(nil).Timer), name) }
go
func (mr *MockScopeMockRecorder) Timer(name interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Timer", reflect.TypeOf((*MockScope)(nil).Timer), name) }
[ "func", "(", "mr", "*", "MockScopeMockRecorder", ")", "Timer", "(", "name", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"",...
// Timer indicates an expected call of Timer
[ "Timer", "indicates", "an", "expected", "call", "of", "Timer" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/mocks/metrics.go#L102-L104
126,322
uber-go/dosa
mocks/metrics.go
Inc
func (m *MockCounter) Inc(delta int64) { m.ctrl.Call(m, "Inc", delta) }
go
func (m *MockCounter) Inc(delta int64) { m.ctrl.Call(m, "Inc", delta) }
[ "func", "(", "m", "*", "MockCounter", ")", "Inc", "(", "delta", "int64", ")", "{", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "delta", ")", "\n", "}" ]
// Inc mocks base method
[ "Inc", "mocks", "base", "method" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/mocks/metrics.go#L130-L132
126,323
uber-go/dosa
cmd/dosa/scope.go
Execute
func (c *ScopeCreate) Execute(args []string) error { typ, err := parseType(c.Type) if err != nil { return err } if len(c.Owner) == 0 { return errors.New("the owning ublame-group must be specified") } return c.doScopeOp("create", func(client dosa.AdminClient, ctx context.Context, scope string) error { ret...
go
func (c *ScopeCreate) Execute(args []string) error { typ, err := parseType(c.Type) if err != nil { return err } if len(c.Owner) == 0 { return errors.New("the owning ublame-group must be specified") } return c.doScopeOp("create", func(client dosa.AdminClient, ctx context.Context, scope string) error { ret...
[ "func", "(", "c", "*", "ScopeCreate", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "typ", ",", "err", ":=", "parseType", "(", "c", ".", "Type", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "...
// Execute executes a scope create command
[ "Execute", "executes", "a", "scope", "create", "command" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/scope.go#L86-L106
126,324
uber-go/dosa
cmd/dosa/scope.go
Execute
func (c *ScopeDrop) Execute(args []string) error { return c.doScopeOp("drop", dosa.AdminClient.DropScope, c.Args.Scopes) }
go
func (c *ScopeDrop) Execute(args []string) error { return c.doScopeOp("drop", dosa.AdminClient.DropScope, c.Args.Scopes) }
[ "func", "(", "c", "*", "ScopeDrop", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "return", "c", ".", "doScopeOp", "(", "\"", "\"", ",", "dosa", ".", "AdminClient", ".", "DropScope", ",", "c", ".", "Args", ".", "Scopes", ")", ...
// Execute executes a scope drop command
[ "Execute", "executes", "a", "scope", "drop", "command" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/scope.go#L125-L127
126,325
uber-go/dosa
cmd/dosa/scope.go
Execute
func (c *ScopeTruncate) Execute(args []string) error { return c.doScopeOp("truncate", dosa.AdminClient.TruncateScope, c.Args.Scopes) }
go
func (c *ScopeTruncate) Execute(args []string) error { return c.doScopeOp("truncate", dosa.AdminClient.TruncateScope, c.Args.Scopes) }
[ "func", "(", "c", "*", "ScopeTruncate", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "return", "c", ".", "doScopeOp", "(", "\"", "\"", ",", "dosa", ".", "AdminClient", ".", "TruncateScope", ",", "c", ".", "Args", ".", "Scopes",...
// Execute executes a scope truncate command
[ "Execute", "executes", "a", "scope", "truncate", "command" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/scope.go#L146-L148
126,326
uber-go/dosa
cmd/dosa/scope.go
parseType
func parseType(t string) (dosa.ScopeType, error) { if len(t) == 0 { return dosa.Development, nil } lt := strings.ToLower(t) if strings.HasPrefix("production", lt) { return dosa.Production, nil } if strings.HasPrefix("staging", lt) { return dosa.Staging, nil } if strings.HasPrefix("development", lt) { re...
go
func parseType(t string) (dosa.ScopeType, error) { if len(t) == 0 { return dosa.Development, nil } lt := strings.ToLower(t) if strings.HasPrefix("production", lt) { return dosa.Production, nil } if strings.HasPrefix("staging", lt) { return dosa.Staging, nil } if strings.HasPrefix("development", lt) { re...
[ "func", "parseType", "(", "t", "string", ")", "(", "dosa", ".", "ScopeType", ",", "error", ")", "{", "if", "len", "(", "t", ")", "==", "0", "{", "return", "dosa", ".", "Development", ",", "nil", "\n", "}", "\n", "lt", ":=", "strings", ".", "ToLow...
// Parse a string into a scope type.
[ "Parse", "a", "string", "into", "a", "scope", "type", "." ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/scope.go#L151-L166
126,327
uber-go/dosa
finder.go
FindEntityByName
func FindEntityByName(path string, structName string) (*Table, error) { // find all entites in the given path entities, _, err := findEntities([]string{path}, []string{}) if err != nil { return nil, err } // filter entites with the given struct name entitiesFilteredByName := []*Table{} for _, table := range e...
go
func FindEntityByName(path string, structName string) (*Table, error) { // find all entites in the given path entities, _, err := findEntities([]string{path}, []string{}) if err != nil { return nil, err } // filter entites with the given struct name entitiesFilteredByName := []*Table{} for _, table := range e...
[ "func", "FindEntityByName", "(", "path", "string", ",", "structName", "string", ")", "(", "*", "Table", ",", "error", ")", "{", "// find all entites in the given path", "entities", ",", "_", ",", "err", ":=", "findEntities", "(", "[", "]", "string", "{", "pa...
// FindEntityByName returns the entity with given name in the path.
[ "FindEntityByName", "returns", "the", "entity", "with", "given", "name", "in", "the", "path", "." ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/finder.go#L81-L105
126,328
uber-go/dosa
finder.go
Visit
func (f *entityRecordingVisitor) Visit(n ast.Node) ast.Visitor { switch n := n.(type) { case *ast.File, *ast.Package, *ast.BlockStmt, *ast.DeclStmt, *ast.FuncDecl, *ast.GenDecl: return f case *ast.TypeSpec: if structType, ok := n.Type.(*ast.StructType); ok { // look for a Entity with a dosa annotation if i...
go
func (f *entityRecordingVisitor) Visit(n ast.Node) ast.Visitor { switch n := n.(type) { case *ast.File, *ast.Package, *ast.BlockStmt, *ast.DeclStmt, *ast.FuncDecl, *ast.GenDecl: return f case *ast.TypeSpec: if structType, ok := n.Type.(*ast.StructType); ok { // look for a Entity with a dosa annotation if i...
[ "func", "(", "f", "*", "entityRecordingVisitor", ")", "Visit", "(", "n", "ast", ".", "Node", ")", "ast", ".", "Visitor", "{", "switch", "n", ":=", "n", ".", "(", "type", ")", "{", "case", "*", "ast", ".", "File", ",", "*", "ast", ".", "Package", ...
// Visit records all the entities seen into the entityRecordingVisitor structure
[ "Visit", "records", "all", "the", "entities", "seen", "into", "the", "entityRecordingVisitor", "structure" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/finder.go#L141-L159
126,329
uber-go/dosa
cmd/dosa/registrar.go
newSimpleRegistrar
func newSimpleRegistrar(scope, namePrefix string, table *dosa.Table) (dosa.Registrar, error) { if err := dosa.IsValidNamePrefix(namePrefix); err != nil { return nil, errors.Wrap(err, "failed to construct Registrar") } re := dosa.NewRegisteredEntity(scope, namePrefix, table) return &simpleRegistrar{ scope: ...
go
func newSimpleRegistrar(scope, namePrefix string, table *dosa.Table) (dosa.Registrar, error) { if err := dosa.IsValidNamePrefix(namePrefix); err != nil { return nil, errors.Wrap(err, "failed to construct Registrar") } re := dosa.NewRegisteredEntity(scope, namePrefix, table) return &simpleRegistrar{ scope: ...
[ "func", "newSimpleRegistrar", "(", "scope", ",", "namePrefix", "string", ",", "table", "*", "dosa", ".", "Table", ")", "(", "dosa", ".", "Registrar", ",", "error", ")", "{", "if", "err", ":=", "dosa", ".", "IsValidNamePrefix", "(", "namePrefix", ")", ";"...
// newSimpleRegistrar creates a new simpleRegistrar
[ "newSimpleRegistrar", "creates", "a", "new", "simpleRegistrar" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/registrar.go#L36-L48
126,330
uber-go/dosa
cmd/dosa/registrar.go
Find
func (r *simpleRegistrar) Find(entity dosa.DomainObject) (*dosa.RegisteredEntity, error) { if r.entity == nil { return nil, errors.New("no entity found in registrar") } return r.entity, nil }
go
func (r *simpleRegistrar) Find(entity dosa.DomainObject) (*dosa.RegisteredEntity, error) { if r.entity == nil { return nil, errors.New("no entity found in registrar") } return r.entity, nil }
[ "func", "(", "r", "*", "simpleRegistrar", ")", "Find", "(", "entity", "dosa", ".", "DomainObject", ")", "(", "*", "dosa", ".", "RegisteredEntity", ",", "error", ")", "{", "if", "r", ".", "entity", "==", "nil", "{", "return", "nil", ",", "errors", "."...
// Find returns the embedded entity
[ "Find", "returns", "the", "embedded", "entity" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/cmd/dosa/registrar.go#L61-L67
126,331
uber-go/dosa
connectors/routing/config.go
UnmarshalYAML
func (r *Routers) UnmarshalYAML(unmarshal func(interface{}) error) error { routers := make(Routers, 0) scopes := make([]map[string]interface{}, 0) if err := unmarshal(&scopes); err != nil { return err } defaultRouterExist := false for _, scopeMap := range scopes { for scope, namePrefixes := range scopeMap { ...
go
func (r *Routers) UnmarshalYAML(unmarshal func(interface{}) error) error { routers := make(Routers, 0) scopes := make([]map[string]interface{}, 0) if err := unmarshal(&scopes); err != nil { return err } defaultRouterExist := false for _, scopeMap := range scopes { for scope, namePrefixes := range scopeMap { ...
[ "func", "(", "r", "*", "Routers", ")", "UnmarshalYAML", "(", "unmarshal", "func", "(", "interface", "{", "}", ")", "error", ")", "error", "{", "routers", ":=", "make", "(", "Routers", ",", "0", ")", "\n", "scopes", ":=", "make", "(", "[", "]", "map...
// UnmarshalYAML unmarshals the config into gocql cluster config
[ "UnmarshalYAML", "unmarshals", "the", "config", "into", "gocql", "cluster", "config" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/config.go#L51-L90
126,332
uber-go/dosa
connectors/routing/config.go
FindRouter
func (c *Config) FindRouter(scope, namePrefix string) *Rule { for _, router := range c.Routers { if router.RouteTo(scope, namePrefix) { return router } } return c.findDefaultRouter() }
go
func (c *Config) FindRouter(scope, namePrefix string) *Rule { for _, router := range c.Routers { if router.RouteTo(scope, namePrefix) { return router } } return c.findDefaultRouter() }
[ "func", "(", "c", "*", "Config", ")", "FindRouter", "(", "scope", ",", "namePrefix", "string", ")", "*", "Rule", "{", "for", "_", ",", "router", ":=", "range", "c", ".", "Routers", "{", "if", "router", ".", "RouteTo", "(", "scope", ",", "namePrefix",...
// FindRouter finds the router information based on scope and namePrefix.
[ "FindRouter", "finds", "the", "router", "information", "based", "on", "scope", "and", "namePrefix", "." ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/config.go#L103-L111
126,333
uber-go/dosa
connectors/routing/config.go
findDefaultRouter
func (c *Config) findDefaultRouter() *Rule { for _, router := range c.Routers { if router.Scope == DefaultScope { return router } } return nil }
go
func (c *Config) findDefaultRouter() *Rule { for _, router := range c.Routers { if router.Scope == DefaultScope { return router } } return nil }
[ "func", "(", "c", "*", "Config", ")", "findDefaultRouter", "(", ")", "*", "Rule", "{", "for", "_", ",", "router", ":=", "range", "c", ".", "Routers", "{", "if", "router", ".", "Scope", "==", "DefaultScope", "{", "return", "router", "\n", "}", "\n", ...
// findDefaultRouter finds the default router information.
[ "findDefaultRouter", "finds", "the", "default", "router", "information", "." ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/routing/config.go#L114-L121
126,334
uber-go/dosa
remove_range.go
NewRemoveRangeOp
func NewRemoveRangeOp(object DomainObject) *RemoveRangeOp { rop := &RemoveRangeOp{ conditioner: conditioner{ object: object, conditions: map[string][]*Condition{}, }, } return rop }
go
func NewRemoveRangeOp(object DomainObject) *RemoveRangeOp { rop := &RemoveRangeOp{ conditioner: conditioner{ object: object, conditions: map[string][]*Condition{}, }, } return rop }
[ "func", "NewRemoveRangeOp", "(", "object", "DomainObject", ")", "*", "RemoveRangeOp", "{", "rop", ":=", "&", "RemoveRangeOp", "{", "conditioner", ":", "conditioner", "{", "object", ":", "object", ",", "conditions", ":", "map", "[", "string", "]", "[", "]", ...
// NewRemoveRangeOp returns a new RangeOp instance
[ "NewRemoveRangeOp", "returns", "a", "new", "RangeOp", "instance" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/remove_range.go#L29-L37
126,335
uber-go/dosa
remove_range.go
Eq
func (r *RemoveRangeOp) Eq(fieldName string, value interface{}) *RemoveRangeOp { r.appendOp(Eq, fieldName, value) return r }
go
func (r *RemoveRangeOp) Eq(fieldName string, value interface{}) *RemoveRangeOp { r.appendOp(Eq, fieldName, value) return r }
[ "func", "(", "r", "*", "RemoveRangeOp", ")", "Eq", "(", "fieldName", "string", ",", "value", "interface", "{", "}", ")", "*", "RemoveRangeOp", "{", "r", ".", "appendOp", "(", "Eq", ",", "fieldName", ",", "value", ")", "\n", "return", "r", "\n", "}" ]
// Eq is used to express an equality constraint for a remove range operation
[ "Eq", "is", "used", "to", "express", "an", "equality", "constraint", "for", "a", "remove", "range", "operation" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/remove_range.go#L40-L43
126,336
uber-go/dosa
remove_range.go
Gt
func (r *RemoveRangeOp) Gt(fieldName string, value interface{}) *RemoveRangeOp { r.appendOp(Gt, fieldName, value) return r }
go
func (r *RemoveRangeOp) Gt(fieldName string, value interface{}) *RemoveRangeOp { r.appendOp(Gt, fieldName, value) return r }
[ "func", "(", "r", "*", "RemoveRangeOp", ")", "Gt", "(", "fieldName", "string", ",", "value", "interface", "{", "}", ")", "*", "RemoveRangeOp", "{", "r", ".", "appendOp", "(", "Gt", ",", "fieldName", ",", "value", ")", "\n", "return", "r", "\n", "}" ]
// Gt is used to express an "greater than" constraint for a remove range operation
[ "Gt", "is", "used", "to", "express", "an", "greater", "than", "constraint", "for", "a", "remove", "range", "operation" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/remove_range.go#L46-L49
126,337
uber-go/dosa
remove_range.go
GtOrEq
func (r *RemoveRangeOp) GtOrEq(fieldName string, value interface{}) *RemoveRangeOp { r.appendOp(GtOrEq, fieldName, value) return r }
go
func (r *RemoveRangeOp) GtOrEq(fieldName string, value interface{}) *RemoveRangeOp { r.appendOp(GtOrEq, fieldName, value) return r }
[ "func", "(", "r", "*", "RemoveRangeOp", ")", "GtOrEq", "(", "fieldName", "string", ",", "value", "interface", "{", "}", ")", "*", "RemoveRangeOp", "{", "r", ".", "appendOp", "(", "GtOrEq", ",", "fieldName", ",", "value", ")", "\n", "return", "r", "\n",...
// GtOrEq is used to express an "greater than or equal" constraint for a // remove range operation
[ "GtOrEq", "is", "used", "to", "express", "an", "greater", "than", "or", "equal", "constraint", "for", "a", "remove", "range", "operation" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/remove_range.go#L53-L56
126,338
uber-go/dosa
remove_range.go
Lt
func (r *RemoveRangeOp) Lt(fieldName string, value interface{}) *RemoveRangeOp { r.appendOp(Lt, fieldName, value) return r }
go
func (r *RemoveRangeOp) Lt(fieldName string, value interface{}) *RemoveRangeOp { r.appendOp(Lt, fieldName, value) return r }
[ "func", "(", "r", "*", "RemoveRangeOp", ")", "Lt", "(", "fieldName", "string", ",", "value", "interface", "{", "}", ")", "*", "RemoveRangeOp", "{", "r", ".", "appendOp", "(", "Lt", ",", "fieldName", ",", "value", ")", "\n", "return", "r", "\n", "}" ]
// Lt is used to express a "less than" constraint for a remove range operation
[ "Lt", "is", "used", "to", "express", "a", "less", "than", "constraint", "for", "a", "remove", "range", "operation" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/remove_range.go#L59-L62
126,339
uber-go/dosa
remove_range.go
LtOrEq
func (r *RemoveRangeOp) LtOrEq(fieldName string, value interface{}) *RemoveRangeOp { r.appendOp(LtOrEq, fieldName, value) return r }
go
func (r *RemoveRangeOp) LtOrEq(fieldName string, value interface{}) *RemoveRangeOp { r.appendOp(LtOrEq, fieldName, value) return r }
[ "func", "(", "r", "*", "RemoveRangeOp", ")", "LtOrEq", "(", "fieldName", "string", ",", "value", "interface", "{", "}", ")", "*", "RemoveRangeOp", "{", "r", ".", "appendOp", "(", "LtOrEq", ",", "fieldName", ",", "value", ")", "\n", "return", "r", "\n",...
// LtOrEq is used to express a "less than or equal" constraint for a // remove range operation
[ "LtOrEq", "is", "used", "to", "express", "a", "less", "than", "or", "equal", "constraint", "for", "a", "remove", "range", "operation" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/remove_range.go#L66-L69
126,340
uber-go/dosa
connectors/yarpc/helpers.go
RawValueAsInterface
func RawValueAsInterface(val dosarpc.RawValue, typ dosa.Type) interface{} { switch typ { case dosa.Blob: return val.BinaryValue case dosa.TUUID: if len(val.BinaryValue) == 0 { return (*dosa.UUID)(nil) } uuid, _ := dosa.BytesToUUID(val.BinaryValue) // TODO: should we handle this error? return &uuid case...
go
func RawValueAsInterface(val dosarpc.RawValue, typ dosa.Type) interface{} { switch typ { case dosa.Blob: return val.BinaryValue case dosa.TUUID: if len(val.BinaryValue) == 0 { return (*dosa.UUID)(nil) } uuid, _ := dosa.BytesToUUID(val.BinaryValue) // TODO: should we handle this error? return &uuid case...
[ "func", "RawValueAsInterface", "(", "val", "dosarpc", ".", "RawValue", ",", "typ", "dosa", ".", "Type", ")", "interface", "{", "}", "{", "switch", "typ", "{", "case", "dosa", ".", "Blob", ":", "return", "val", ".", "BinaryValue", "\n", "case", "dosa", ...
// RawValueAsInterface converts a value from the wire to an object implementing the interface // based on the dosa type. For example, a TUUID type will get a dosa.UUID object
[ "RawValueAsInterface", "converts", "a", "value", "from", "the", "wire", "to", "an", "object", "implementing", "the", "interface", "based", "on", "the", "dosa", "type", ".", "For", "example", "a", "TUUID", "type", "will", "get", "a", "dosa", ".", "UUID", "o...
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/yarpc/helpers.go#L35-L63
126,341
uber-go/dosa
connectors/yarpc/helpers.go
RawValueFromInterface
func RawValueFromInterface(i interface{}) (*dosarpc.RawValue, error) { // TODO: Do we do type compatibility checks here? We should know the schema, // but the callers are all well known and should match the types switch v := i.(type) { case string: return &dosarpc.RawValue{StringValue: &v}, nil case bool: retu...
go
func RawValueFromInterface(i interface{}) (*dosarpc.RawValue, error) { // TODO: Do we do type compatibility checks here? We should know the schema, // but the callers are all well known and should match the types switch v := i.(type) { case string: return &dosarpc.RawValue{StringValue: &v}, nil case bool: retu...
[ "func", "RawValueFromInterface", "(", "i", "interface", "{", "}", ")", "(", "*", "dosarpc", ".", "RawValue", ",", "error", ")", "{", "// TODO: Do we do type compatibility checks here? We should know the schema,", "// but the callers are all well known and should match the types",...
// RawValueFromInterface takes an interface, introspects the type, and then // returns a RawValue object that represents this. It panics if the type // is not in the list, which should be a dosa bug
[ "RawValueFromInterface", "takes", "an", "interface", "introspects", "the", "type", "and", "then", "returns", "a", "RawValue", "object", "that", "represents", "this", ".", "It", "panics", "if", "the", "type", "is", "not", "in", "the", "list", "which", "should",...
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/yarpc/helpers.go#L68-L140
126,342
uber-go/dosa
connectors/yarpc/helpers.go
RPCTypeFromClientType
func RPCTypeFromClientType(t dosa.Type) dosarpc.ElemType { switch t { case dosa.Bool: return dosarpc.ElemTypeBool case dosa.Blob: return dosarpc.ElemTypeBlob case dosa.String: return dosarpc.ElemTypeString case dosa.Int32: return dosarpc.ElemTypeInt32 case dosa.Int64: return dosarpc.ElemTypeInt64 case ...
go
func RPCTypeFromClientType(t dosa.Type) dosarpc.ElemType { switch t { case dosa.Bool: return dosarpc.ElemTypeBool case dosa.Blob: return dosarpc.ElemTypeBlob case dosa.String: return dosarpc.ElemTypeString case dosa.Int32: return dosarpc.ElemTypeInt32 case dosa.Int64: return dosarpc.ElemTypeInt64 case ...
[ "func", "RPCTypeFromClientType", "(", "t", "dosa", ".", "Type", ")", "dosarpc", ".", "ElemType", "{", "switch", "t", "{", "case", "dosa", ".", "Bool", ":", "return", "dosarpc", ".", "ElemTypeBool", "\n", "case", "dosa", ".", "Blob", ":", "return", "dosar...
// RPCTypeFromClientType returns the RPC ElemType from a DOSA Type
[ "RPCTypeFromClientType", "returns", "the", "RPC", "ElemType", "from", "a", "DOSA", "Type" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/yarpc/helpers.go#L143-L163
126,343
uber-go/dosa
connectors/yarpc/helpers.go
PrimaryKeyToThrift
func PrimaryKeyToThrift(key *dosa.PrimaryKey) *dosarpc.PrimaryKey { ck := make([]*dosarpc.ClusteringKey, len(key.ClusteringKeys)) for ckinx, clusteringKey := range key.ClusteringKeys { // TODO: The client uses 'descending' but the RPC uses 'ascending'? Fix this insanity! ascending := !clusteringKey.Descending n...
go
func PrimaryKeyToThrift(key *dosa.PrimaryKey) *dosarpc.PrimaryKey { ck := make([]*dosarpc.ClusteringKey, len(key.ClusteringKeys)) for ckinx, clusteringKey := range key.ClusteringKeys { // TODO: The client uses 'descending' but the RPC uses 'ascending'? Fix this insanity! ascending := !clusteringKey.Descending n...
[ "func", "PrimaryKeyToThrift", "(", "key", "*", "dosa", ".", "PrimaryKey", ")", "*", "dosarpc", ".", "PrimaryKey", "{", "ck", ":=", "make", "(", "[", "]", "*", "dosarpc", ".", "ClusteringKey", ",", "len", "(", "key", ".", "ClusteringKeys", ")", ")", "\n...
// PrimaryKeyToThrift converts the dosa primary key to the thrift primary key type
[ "PrimaryKeyToThrift", "converts", "the", "dosa", "primary", "key", "to", "the", "thrift", "primary", "key", "type" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/yarpc/helpers.go#L189-L198
126,344
uber-go/dosa
connectors/yarpc/helpers.go
ETLStateToThrift
func ETLStateToThrift(etl dosa.ETLState) dosarpc.ETLState { switch etl { case dosa.EtlOn: return dosarpc.ETLStateOn case dosa.EtlOff: return dosarpc.ETLStateOff default: panic(fmt.Sprintf("bad ETL state: %v", etl)) } }
go
func ETLStateToThrift(etl dosa.ETLState) dosarpc.ETLState { switch etl { case dosa.EtlOn: return dosarpc.ETLStateOn case dosa.EtlOff: return dosarpc.ETLStateOff default: panic(fmt.Sprintf("bad ETL state: %v", etl)) } }
[ "func", "ETLStateToThrift", "(", "etl", "dosa", ".", "ETLState", ")", "dosarpc", ".", "ETLState", "{", "switch", "etl", "{", "case", "dosa", ".", "EtlOn", ":", "return", "dosarpc", ".", "ETLStateOn", "\n", "case", "dosa", ".", "EtlOff", ":", "return", "d...
// ETLStateToThrift convert the dosa ETLState to the thrift ETLState enum type
[ "ETLStateToThrift", "convert", "the", "dosa", "ETLState", "to", "the", "thrift", "ETLState", "enum", "type" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/yarpc/helpers.go#L201-L210
126,345
uber-go/dosa
connectors/yarpc/helpers.go
EntityDefsToThrift
func EntityDefsToThrift(eds []*dosa.EntityDefinition) []*dosarpc.EntityDefinition { rpcEntityDefs := make([]*dosarpc.EntityDefinition, len(eds)) for i, ed := range eds { rpcEntityDefs[i] = entityDefToThrift(ed) } return rpcEntityDefs }
go
func EntityDefsToThrift(eds []*dosa.EntityDefinition) []*dosarpc.EntityDefinition { rpcEntityDefs := make([]*dosarpc.EntityDefinition, len(eds)) for i, ed := range eds { rpcEntityDefs[i] = entityDefToThrift(ed) } return rpcEntityDefs }
[ "func", "EntityDefsToThrift", "(", "eds", "[", "]", "*", "dosa", ".", "EntityDefinition", ")", "[", "]", "*", "dosarpc", ".", "EntityDefinition", "{", "rpcEntityDefs", ":=", "make", "(", "[", "]", "*", "dosarpc", ".", "EntityDefinition", ",", "len", "(", ...
// EntityDefsToThrift coverts a set of client EntityDefinition to the corresponding RPC EntityDefinitions
[ "EntityDefsToThrift", "coverts", "a", "set", "of", "client", "EntityDefinition", "to", "the", "corresponding", "RPC", "EntityDefinitions" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/yarpc/helpers.go#L224-L230
126,346
uber-go/dosa
connectors/yarpc/helpers.go
FromThriftToPrimaryKey
func FromThriftToPrimaryKey(key *dosarpc.PrimaryKey) *dosa.PrimaryKey { pk := key.PartitionKeys ck := make([]*dosa.ClusteringKey, len(key.ClusteringKeys)) for i, v := range key.ClusteringKeys { ck[i] = &dosa.ClusteringKey{ Name: *v.Name, Descending: !*v.Asc, } } return &dosa.PrimaryKey{ Partitio...
go
func FromThriftToPrimaryKey(key *dosarpc.PrimaryKey) *dosa.PrimaryKey { pk := key.PartitionKeys ck := make([]*dosa.ClusteringKey, len(key.ClusteringKeys)) for i, v := range key.ClusteringKeys { ck[i] = &dosa.ClusteringKey{ Name: *v.Name, Descending: !*v.Asc, } } return &dosa.PrimaryKey{ Partitio...
[ "func", "FromThriftToPrimaryKey", "(", "key", "*", "dosarpc", ".", "PrimaryKey", ")", "*", "dosa", ".", "PrimaryKey", "{", "pk", ":=", "key", ".", "PartitionKeys", "\n", "ck", ":=", "make", "(", "[", "]", "*", "dosa", ".", "ClusteringKey", ",", "len", ...
// FromThriftToPrimaryKey converts thrift primary key type to dosa primary key type
[ "FromThriftToPrimaryKey", "converts", "thrift", "primary", "key", "type", "to", "dosa", "primary", "key", "type" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/yarpc/helpers.go#L257-L271
126,347
uber-go/dosa
connectors/yarpc/helpers.go
FromThriftToEntityDefinition
func FromThriftToEntityDefinition(ed *dosarpc.EntityDefinition) *dosa.EntityDefinition { fields := make([]*dosa.ColumnDefinition, len(ed.FieldDescs)) i := 0 for k, v := range ed.FieldDescs { fields[i] = &dosa.ColumnDefinition{ Name: k, Type: RPCTypeToClientType(*v.Type), // TODO Tag } i++ } indexes...
go
func FromThriftToEntityDefinition(ed *dosarpc.EntityDefinition) *dosa.EntityDefinition { fields := make([]*dosa.ColumnDefinition, len(ed.FieldDescs)) i := 0 for k, v := range ed.FieldDescs { fields[i] = &dosa.ColumnDefinition{ Name: k, Type: RPCTypeToClientType(*v.Type), // TODO Tag } i++ } indexes...
[ "func", "FromThriftToEntityDefinition", "(", "ed", "*", "dosarpc", ".", "EntityDefinition", ")", "*", "dosa", ".", "EntityDefinition", "{", "fields", ":=", "make", "(", "[", "]", "*", "dosa", ".", "ColumnDefinition", ",", "len", "(", "ed", ".", "FieldDescs",...
// FromThriftToEntityDefinition converts the RPC EntityDefinition to client EntityDefinition
[ "FromThriftToEntityDefinition", "converts", "the", "RPC", "EntityDefinition", "to", "client", "EntityDefinition" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/yarpc/helpers.go#L274-L305
126,348
uber-go/dosa
connectors/yarpc/helpers.go
getHeaders
func getHeaders(headers map[string]string) []rpc.CallOption { hdrs := make([]rpc.CallOption, 0, len(headers)+1) hdrs = append(hdrs, rpc.WithHeader(_version, dosa.VERSION)) for h, v := range headers { hdrs = append(hdrs, rpc.WithHeader(h, v)) } return hdrs }
go
func getHeaders(headers map[string]string) []rpc.CallOption { hdrs := make([]rpc.CallOption, 0, len(headers)+1) hdrs = append(hdrs, rpc.WithHeader(_version, dosa.VERSION)) for h, v := range headers { hdrs = append(hdrs, rpc.WithHeader(h, v)) } return hdrs }
[ "func", "getHeaders", "(", "headers", "map", "[", "string", "]", "string", ")", "[", "]", "rpc", ".", "CallOption", "{", "hdrs", ":=", "make", "(", "[", "]", "rpc", ".", "CallOption", ",", "0", ",", "len", "(", "headers", ")", "+", "1", ")", "\n"...
// getHeaders converts the provided headers into rpc.CallOption values. A header for Version is also added.
[ "getHeaders", "converts", "the", "provided", "headers", "into", "rpc", ".", "CallOption", "values", ".", "A", "header", "for", "Version", "is", "also", "added", "." ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/yarpc/helpers.go#L419-L426
126,349
uber-go/dosa
registrar.go
NewRegisteredEntity
func NewRegisteredEntity(scope, namePrefix string, table *Table) *RegisteredEntity { return &RegisteredEntity{ table: table, schemaRef: &SchemaRef{ Scope: scope, NamePrefix: namePrefix, EntityName: table.Name, }, } }
go
func NewRegisteredEntity(scope, namePrefix string, table *Table) *RegisteredEntity { return &RegisteredEntity{ table: table, schemaRef: &SchemaRef{ Scope: scope, NamePrefix: namePrefix, EntityName: table.Name, }, } }
[ "func", "NewRegisteredEntity", "(", "scope", ",", "namePrefix", "string", ",", "table", "*", "Table", ")", "*", "RegisteredEntity", "{", "return", "&", "RegisteredEntity", "{", "table", ":", "table", ",", "schemaRef", ":", "&", "SchemaRef", "{", "Scope", ":"...
// NewRegisteredEntity is a constructor for creating a RegisteredEntity
[ "NewRegisteredEntity", "is", "a", "constructor", "for", "creating", "a", "RegisteredEntity" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/registrar.go#L38-L47
126,350
uber-go/dosa
registrar.go
EntityInfo
func (e *RegisteredEntity) EntityInfo() *EntityInfo { return &EntityInfo{ Ref: e.schemaRef, Def: &e.table.EntityDefinition, TTL: &e.table.TTL, } }
go
func (e *RegisteredEntity) EntityInfo() *EntityInfo { return &EntityInfo{ Ref: e.schemaRef, Def: &e.table.EntityDefinition, TTL: &e.table.TTL, } }
[ "func", "(", "e", "*", "RegisteredEntity", ")", "EntityInfo", "(", ")", "*", "EntityInfo", "{", "return", "&", "EntityInfo", "{", "Ref", ":", "e", ".", "schemaRef", ",", "Def", ":", "&", "e", ".", "table", ".", "EntityDefinition", ",", "TTL", ":", "&...
// EntityInfo is a helper for accessing the registered entity's EntityInfo // instance which is required by clients to call connector methods.
[ "EntityInfo", "is", "a", "helper", "for", "accessing", "the", "registered", "entity", "s", "EntityInfo", "instance", "which", "is", "required", "by", "clients", "to", "call", "connector", "methods", "." ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/registrar.go#L56-L62
126,351
uber-go/dosa
registrar.go
KeyFieldValues
func (e *RegisteredEntity) KeyFieldValues(entity DomainObject) map[string]FieldValue { v := reflect.ValueOf(entity).Elem() fieldValues := make(map[string]FieldValue) // populate partition key values for _, pk := range e.table.Key.PartitionKeys { fieldName := e.table.ColToField[pk] value := v.FieldByName(fieldN...
go
func (e *RegisteredEntity) KeyFieldValues(entity DomainObject) map[string]FieldValue { v := reflect.ValueOf(entity).Elem() fieldValues := make(map[string]FieldValue) // populate partition key values for _, pk := range e.table.Key.PartitionKeys { fieldName := e.table.ColToField[pk] value := v.FieldByName(fieldN...
[ "func", "(", "e", "*", "RegisteredEntity", ")", "KeyFieldValues", "(", "entity", "DomainObject", ")", "map", "[", "string", "]", "FieldValue", "{", "v", ":=", "reflect", ".", "ValueOf", "(", "entity", ")", ".", "Elem", "(", ")", "\n", "fieldValues", ":="...
// KeyFieldValues is a helper for generating a map of field values to be used in a query.
[ "KeyFieldValues", "is", "a", "helper", "for", "generating", "a", "map", "of", "field", "values", "to", "be", "used", "in", "a", "query", "." ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/registrar.go#L83-L106
126,352
uber-go/dosa
registrar.go
OnlyFieldValues
func (e *RegisteredEntity) OnlyFieldValues(entity DomainObject, fieldNames []string) (map[string]FieldValue, error) { if fieldNames == nil || len(fieldNames) == 0 { for _, field := range e.table.ColToField { fieldNames = append(fieldNames, field) } } v := reflect.ValueOf(entity).Elem() fieldValues := make(ma...
go
func (e *RegisteredEntity) OnlyFieldValues(entity DomainObject, fieldNames []string) (map[string]FieldValue, error) { if fieldNames == nil || len(fieldNames) == 0 { for _, field := range e.table.ColToField { fieldNames = append(fieldNames, field) } } v := reflect.ValueOf(entity).Elem() fieldValues := make(ma...
[ "func", "(", "e", "*", "RegisteredEntity", ")", "OnlyFieldValues", "(", "entity", "DomainObject", ",", "fieldNames", "[", "]", "string", ")", "(", "map", "[", "string", "]", "FieldValue", ",", "error", ")", "{", "if", "fieldNames", "==", "nil", "||", "le...
// OnlyFieldValues is a helper for generating a map of field values for a // a subset of fields. If a field name provided does not map to an entity // field, an error will be returned.
[ "OnlyFieldValues", "is", "a", "helper", "for", "generating", "a", "map", "of", "field", "values", "for", "a", "a", "subset", "of", "fields", ".", "If", "a", "field", "name", "provided", "does", "not", "map", "to", "an", "entity", "field", "an", "error", ...
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/registrar.go#L111-L133
126,353
uber-go/dosa
registrar.go
ColumnNames
func (e *RegisteredEntity) ColumnNames(fieldNames []string) ([]string, error) { if fieldNames == nil || len(fieldNames) == 0 { for _, field := range e.table.ColToField { fieldNames = append(fieldNames, field) } } columnNames := make([]string, len(fieldNames)) for i, fieldName := range fieldNames { columnNa...
go
func (e *RegisteredEntity) ColumnNames(fieldNames []string) ([]string, error) { if fieldNames == nil || len(fieldNames) == 0 { for _, field := range e.table.ColToField { fieldNames = append(fieldNames, field) } } columnNames := make([]string, len(fieldNames)) for i, fieldName := range fieldNames { columnNa...
[ "func", "(", "e", "*", "RegisteredEntity", ")", "ColumnNames", "(", "fieldNames", "[", "]", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "if", "fieldNames", "==", "nil", "||", "len", "(", "fieldNames", ")", "==", "0", "{", "for", ...
// ColumnNames translates field names to column names.
[ "ColumnNames", "translates", "field", "names", "to", "column", "names", "." ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/registrar.go#L136-L151
126,354
uber-go/dosa
registrar.go
SetFieldValues
func (e *RegisteredEntity) SetFieldValues(entity DomainObject, fieldValues map[string]FieldValue, fieldsToRead []string) { r := reflect.ValueOf(entity).Elem() if fieldsToRead == nil { for columnName := range fieldValues { fieldsToRead = append(fieldsToRead, columnName) } } //for columnName, fieldValue := ran...
go
func (e *RegisteredEntity) SetFieldValues(entity DomainObject, fieldValues map[string]FieldValue, fieldsToRead []string) { r := reflect.ValueOf(entity).Elem() if fieldsToRead == nil { for columnName := range fieldValues { fieldsToRead = append(fieldsToRead, columnName) } } //for columnName, fieldValue := ran...
[ "func", "(", "e", "*", "RegisteredEntity", ")", "SetFieldValues", "(", "entity", "DomainObject", ",", "fieldValues", "map", "[", "string", "]", "FieldValue", ",", "fieldsToRead", "[", "]", "string", ")", "{", "r", ":=", "reflect", ".", "ValueOf", "(", "ent...
// SetFieldValues is a helper for populating a DOSA entity with the given // fieldName->value map
[ "SetFieldValues", "is", "a", "helper", "for", "populating", "a", "DOSA", "entity", "with", "the", "given", "fieldName", "-", ">", "value", "map" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/registrar.go#L155-L197
126,355
uber-go/dosa
registrar.go
NewRegistrar
func NewRegistrar(scope, namePrefix string, entities ...DomainObject) (Registrar, error) { if err := IsValidNamePrefix(namePrefix); err != nil { return nil, errors.Wrap(err, "failed to construct Registrar") } typeIndex := make(map[reflect.Type]*RegisteredEntity) for _, e := range entities { table, err := Table...
go
func NewRegistrar(scope, namePrefix string, entities ...DomainObject) (Registrar, error) { if err := IsValidNamePrefix(namePrefix); err != nil { return nil, errors.Wrap(err, "failed to construct Registrar") } typeIndex := make(map[reflect.Type]*RegisteredEntity) for _, e := range entities { table, err := Table...
[ "func", "NewRegistrar", "(", "scope", ",", "namePrefix", "string", ",", "entities", "...", "DomainObject", ")", "(", "Registrar", ",", "error", ")", "{", "if", "err", ":=", "IsValidNamePrefix", "(", "namePrefix", ")", ";", "err", "!=", "nil", "{", "return"...
// NewRegistrar returns a new Registrar for the scope, name prefix and // entities provided. `dosa.Client` implementations are intended to use scope // and prefix to uniquely identify where entities should live but the // registrar itself is only responsible for basic accounting of entities.
[ "NewRegistrar", "returns", "a", "new", "Registrar", "for", "the", "scope", "name", "prefix", "and", "entities", "provided", ".", "dosa", ".", "Client", "implementations", "are", "intended", "to", "use", "scope", "and", "prefix", "to", "uniquely", "identify", "...
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/registrar.go#L221-L246
126,356
uber-go/dosa
registrar.go
Find
func (r *prefixedRegistrar) Find(entity DomainObject) (*RegisteredEntity, error) { t := reflect.TypeOf(entity).Elem() re, ok := r.typeIndex[t] if !ok { return nil, errors.Errorf("failed to find registration for entity %q", t.Name()) } return re, nil }
go
func (r *prefixedRegistrar) Find(entity DomainObject) (*RegisteredEntity, error) { t := reflect.TypeOf(entity).Elem() re, ok := r.typeIndex[t] if !ok { return nil, errors.Errorf("failed to find registration for entity %q", t.Name()) } return re, nil }
[ "func", "(", "r", "*", "prefixedRegistrar", ")", "Find", "(", "entity", "DomainObject", ")", "(", "*", "RegisteredEntity", ",", "error", ")", "{", "t", ":=", "reflect", ".", "TypeOf", "(", "entity", ")", ".", "Elem", "(", ")", "\n", "re", ",", "ok", ...
// Find looks at its internal index to find a registration that matches the // entity instance provided. Return an error when not found.
[ "Find", "looks", "at", "its", "internal", "index", "to", "find", "a", "registration", "that", "matches", "the", "entity", "instance", "provided", ".", "Return", "an", "error", "when", "not", "found", "." ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/registrar.go#L260-L267
126,357
uber-go/dosa
registrar.go
FindAll
func (r *prefixedRegistrar) FindAll() []*RegisteredEntity { res := []*RegisteredEntity{} for _, re := range r.typeIndex { res = append(res, re) } return res }
go
func (r *prefixedRegistrar) FindAll() []*RegisteredEntity { res := []*RegisteredEntity{} for _, re := range r.typeIndex { res = append(res, re) } return res }
[ "func", "(", "r", "*", "prefixedRegistrar", ")", "FindAll", "(", ")", "[", "]", "*", "RegisteredEntity", "{", "res", ":=", "[", "]", "*", "RegisteredEntity", "{", "}", "\n", "for", "_", ",", "re", ":=", "range", "r", ".", "typeIndex", "{", "res", "...
// FindAll returns all registered entities from its internal index.
[ "FindAll", "returns", "all", "registered", "entities", "from", "its", "internal", "index", "." ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/registrar.go#L270-L276
126,358
uber-go/dosa
connectors/redis/redigo.go
NewRedigoClient
func NewRedigoClient(config ServerConfig, scope metrics.Scope) SimpleRedis { c := &simpleRedis{config: config, stats: metrics.CheckIfNilStats(scope)} c.pool = &redis.Pool{ MaxActive: config.MaxActive, MaxIdle: config.MaxIdle, IdleTimeout: config.IdleTimeout, Dial: func() (redis.Conn, error) { c, err ...
go
func NewRedigoClient(config ServerConfig, scope metrics.Scope) SimpleRedis { c := &simpleRedis{config: config, stats: metrics.CheckIfNilStats(scope)} c.pool = &redis.Pool{ MaxActive: config.MaxActive, MaxIdle: config.MaxIdle, IdleTimeout: config.IdleTimeout, Dial: func() (redis.Conn, error) { c, err ...
[ "func", "NewRedigoClient", "(", "config", "ServerConfig", ",", "scope", "metrics", ".", "Scope", ")", "SimpleRedis", "{", "c", ":=", "&", "simpleRedis", "{", "config", ":", "config", ",", "stats", ":", "metrics", ".", "CheckIfNilStats", "(", "scope", ")", ...
// NewRedigoClient returns a redigo implementation of SimpleRedis
[ "NewRedigoClient", "returns", "a", "redigo", "implementation", "of", "SimpleRedis" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/redis/redigo.go#L33-L54
126,359
uber-go/dosa
connectors/redis/redigo.go
Get
func (c *simpleRedis) Get(key string) ([]byte, error) { bytes, err := redis.Bytes(c.do("GET", key)) if err == redis.ErrNil { err = &dosa.ErrNotFound{} } return bytes, err }
go
func (c *simpleRedis) Get(key string) ([]byte, error) { bytes, err := redis.Bytes(c.do("GET", key)) if err == redis.ErrNil { err = &dosa.ErrNotFound{} } return bytes, err }
[ "func", "(", "c", "*", "simpleRedis", ")", "Get", "(", "key", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "bytes", ",", "err", ":=", "redis", ".", "Bytes", "(", "c", ".", "do", "(", "\"", "\"", ",", "key", ")", ")", "\n", ...
// Get returns an error if the key is not found in cache
[ "Get", "returns", "an", "error", "if", "the", "key", "is", "not", "found", "in", "cache" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/redis/redigo.go#L67-L73
126,360
uber-go/dosa
connectors/redis/redigo.go
do
func (c *simpleRedis) do(commandName string, args ...interface{}) (interface{}, error) { t := c.stats.SubScope("redis").SubScope("latency").Timer(commandName) t.Start() defer t.Stop() conn := c.pool.Get() defer func() { _ = conn.Close() }() return conn.Do(commandName, args...) }
go
func (c *simpleRedis) do(commandName string, args ...interface{}) (interface{}, error) { t := c.stats.SubScope("redis").SubScope("latency").Timer(commandName) t.Start() defer t.Stop() conn := c.pool.Get() defer func() { _ = conn.Close() }() return conn.Do(commandName, args...) }
[ "func", "(", "c", "*", "simpleRedis", ")", "do", "(", "commandName", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "t", ":=", "c", ".", "stats", ".", "SubScope", "(", "\"", "\"", ")"...
// Do is a proxy method that calls Redigo's `Do` method and returns its output. It remembers // to close connections taken from the pool
[ "Do", "is", "a", "proxy", "method", "that", "calls", "Redigo", "s", "Do", "method", "and", "returns", "its", "output", ".", "It", "remembers", "to", "close", "connections", "taken", "from", "the", "pool" ]
18f7766015f97d726635fc75b21c93ec270e5ac5
https://github.com/uber-go/dosa/blob/18f7766015f97d726635fc75b21c93ec270e5ac5/connectors/redis/redigo.go#L92-L100
126,361
ligato/cn-infra
messaging/chan.go
ToProtoMsgChan
func ToProtoMsgChan(ch chan ProtoMessage, opts ...interface{}) func(ProtoMessage) { timeout, logger := ParseOpts(opts...) return func(msg ProtoMessage) { select { case ch <- msg: case <-time.After(timeout): logger.Warn("Unable to deliver message") } } }
go
func ToProtoMsgChan(ch chan ProtoMessage, opts ...interface{}) func(ProtoMessage) { timeout, logger := ParseOpts(opts...) return func(msg ProtoMessage) { select { case ch <- msg: case <-time.After(timeout): logger.Warn("Unable to deliver message") } } }
[ "func", "ToProtoMsgChan", "(", "ch", "chan", "ProtoMessage", ",", "opts", "...", "interface", "{", "}", ")", "func", "(", "ProtoMessage", ")", "{", "timeout", ",", "logger", ":=", "ParseOpts", "(", "opts", "...", ")", "\n\n", "return", "func", "(", "msg"...
// ToProtoMsgChan allows to receive messages through channel instead of callback.
[ "ToProtoMsgChan", "allows", "to", "receive", "messages", "through", "channel", "instead", "of", "callback", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/chan.go#L28-L39
126,362
ligato/cn-infra
messaging/chan.go
ToProtoMsgErrChan
func ToProtoMsgErrChan(ch chan ProtoMessageErr, opts ...interface{}) func(ProtoMessageErr) { timeout, logger := ParseOpts(opts...) return func(msg ProtoMessageErr) { select { case ch <- msg: case <-time.After(timeout): logger.Warn("Unable to deliver message") } } }
go
func ToProtoMsgErrChan(ch chan ProtoMessageErr, opts ...interface{}) func(ProtoMessageErr) { timeout, logger := ParseOpts(opts...) return func(msg ProtoMessageErr) { select { case ch <- msg: case <-time.After(timeout): logger.Warn("Unable to deliver message") } } }
[ "func", "ToProtoMsgErrChan", "(", "ch", "chan", "ProtoMessageErr", ",", "opts", "...", "interface", "{", "}", ")", "func", "(", "ProtoMessageErr", ")", "{", "timeout", ",", "logger", ":=", "ParseOpts", "(", "opts", "...", ")", "\n\n", "return", "func", "("...
// ToProtoMsgErrChan allows to receive error messages through channel instead // of callback.
[ "ToProtoMsgErrChan", "allows", "to", "receive", "error", "messages", "through", "channel", "instead", "of", "callback", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/chan.go#L43-L54
126,363
ligato/cn-infra
messaging/chan.go
ParseOpts
func ParseOpts(opts ...interface{}) (time.Duration, logging.Logger) { timeout := DefaultMsgTimeout var logger logging.Logger = logrus.DefaultLogger() for _, opt := range opts { switch opt.(type) { case *WithLoggerOpt: logger = opt.(*WithLoggerOpt).logger case *WithTimeoutOpt: timeout = opt.(*WithTimeout...
go
func ParseOpts(opts ...interface{}) (time.Duration, logging.Logger) { timeout := DefaultMsgTimeout var logger logging.Logger = logrus.DefaultLogger() for _, opt := range opts { switch opt.(type) { case *WithLoggerOpt: logger = opt.(*WithLoggerOpt).logger case *WithTimeoutOpt: timeout = opt.(*WithTimeout...
[ "func", "ParseOpts", "(", "opts", "...", "interface", "{", "}", ")", "(", "time", ".", "Duration", ",", "logging", ".", "Logger", ")", "{", "timeout", ":=", "DefaultMsgTimeout", "\n", "var", "logger", "logging", ".", "Logger", "=", "logrus", ".", "Defaul...
// ParseOpts returns timeout and logger to be used based on the given options.
[ "ParseOpts", "returns", "timeout", "and", "logger", "to", "be", "used", "based", "on", "the", "given", "options", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/chan.go#L57-L71
126,364
ligato/cn-infra
processmanager/plugin.go
Init
func (p *Plugin) Init() error { p.Log.Debugf("Initializing process manager plugin") templatePath, err := p.getPMConfig() if err != nil { return err } if templatePath != "" { if p.tReader, err = template.NewTemplateReader(templatePath, p.Log); err != nil { return nil } templates, err := p.tReader.GetAl...
go
func (p *Plugin) Init() error { p.Log.Debugf("Initializing process manager plugin") templatePath, err := p.getPMConfig() if err != nil { return err } if templatePath != "" { if p.tReader, err = template.NewTemplateReader(templatePath, p.Log); err != nil { return nil } templates, err := p.tReader.GetAl...
[ "func", "(", "p", "*", "Plugin", ")", "Init", "(", ")", "error", "{", "p", ".", "Log", ".", "Debugf", "(", "\"", "\"", ")", "\n\n", "templatePath", ",", "err", ":=", "p", ".", "getPMConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", "retur...
// Init reads plugin config file for process template path. If exists, plugin initializes template reader, reads // all existing templates and initializes them. Those marked as 'run on startup' are immediately started
[ "Init", "reads", "plugin", "config", "file", "for", "process", "template", "path", ".", "If", "exists", "plugin", "initializes", "template", "reader", "reads", "all", "existing", "templates", "and", "initializes", "them", ".", "Those", "marked", "as", "run", "...
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/plugin.go#L80-L111
126,365
ligato/cn-infra
processmanager/plugin.go
AttachProcess
func (p *Plugin) AttachProcess(name string, cmd string, pid int, options ...POption) (ProcessInstance, error) { pr, err := os.FindProcess(pid) if err != nil { return nil, errors.Errorf("cannot attach to process with PID %d: %v", pid, err) } attachedPr := &Process{ log: p.Log, name: name, cmd: ...
go
func (p *Plugin) AttachProcess(name string, cmd string, pid int, options ...POption) (ProcessInstance, error) { pr, err := os.FindProcess(pid) if err != nil { return nil, errors.Errorf("cannot attach to process with PID %d: %v", pid, err) } attachedPr := &Process{ log: p.Log, name: name, cmd: ...
[ "func", "(", "p", "*", "Plugin", ")", "AttachProcess", "(", "name", "string", ",", "cmd", "string", ",", "pid", "int", ",", "options", "...", "POption", ")", "(", "ProcessInstance", ",", "error", ")", "{", "pr", ",", "err", ":=", "os", ".", "FindProc...
// AttachProcess attaches to existing process, reads its status and starts process status watcher
[ "AttachProcess", "attaches", "to", "existing", "process", "reads", "its", "status", "and", "starts", "process", "status", "watcher" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/plugin.go#L130-L161
126,366
ligato/cn-infra
processmanager/plugin.go
NewProcess
func (p *Plugin) NewProcess(name, cmd string, options ...POption) ProcessInstance { newPr := &Process{ log: p.Log, name: name, cmd: cmd, options: &POptions{}, sh: &status.Reader{Log: p.Log}, status: &status.File{ State: status.Initial, }, cancelChan: make(chan struct{}), } for _, o...
go
func (p *Plugin) NewProcess(name, cmd string, options ...POption) ProcessInstance { newPr := &Process{ log: p.Log, name: name, cmd: cmd, options: &POptions{}, sh: &status.Reader{Log: p.Log}, status: &status.File{ State: status.Initial, }, cancelChan: make(chan struct{}), } for _, o...
[ "func", "(", "p", "*", "Plugin", ")", "NewProcess", "(", "name", ",", "cmd", "string", ",", "options", "...", "POption", ")", "ProcessInstance", "{", "newPr", ":=", "&", "Process", "{", "log", ":", "p", ".", "Log", ",", "name", ":", "name", ",", "c...
// NewProcess creates a new process and saves its template if required
[ "NewProcess", "creates", "a", "new", "process", "and", "saves", "its", "template", "if", "required" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/plugin.go#L164-L186
126,367
ligato/cn-infra
processmanager/plugin.go
NewProcessFromTemplate
func (p *Plugin) NewProcessFromTemplate(tmp *process.Template) ProcessInstance { newTmpPr, err := p.templateToProcess(tmp) if err != nil { p.Log.Errorf("cannot create a process from template: %v", err) return nil } p.processes = append(p.processes, newTmpPr) go newTmpPr.watch() return newTmpPr }
go
func (p *Plugin) NewProcessFromTemplate(tmp *process.Template) ProcessInstance { newTmpPr, err := p.templateToProcess(tmp) if err != nil { p.Log.Errorf("cannot create a process from template: %v", err) return nil } p.processes = append(p.processes, newTmpPr) go newTmpPr.watch() return newTmpPr }
[ "func", "(", "p", "*", "Plugin", ")", "NewProcessFromTemplate", "(", "tmp", "*", "process", ".", "Template", ")", "ProcessInstance", "{", "newTmpPr", ",", "err", ":=", "p", ".", "templateToProcess", "(", "tmp", ")", "\n", "if", "err", "!=", "nil", "{", ...
// NewProcessFromTemplate creates a new process from template file
[ "NewProcessFromTemplate", "creates", "a", "new", "process", "from", "template", "file" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/plugin.go#L189-L200
126,368
ligato/cn-infra
processmanager/plugin.go
GetProcessByName
func (p *Plugin) GetProcessByName(name string) ProcessInstance { for _, pr := range p.processes { if pr.name == name { return pr } } return nil }
go
func (p *Plugin) GetProcessByName(name string) ProcessInstance { for _, pr := range p.processes { if pr.name == name { return pr } } return nil }
[ "func", "(", "p", "*", "Plugin", ")", "GetProcessByName", "(", "name", "string", ")", "ProcessInstance", "{", "for", "_", ",", "pr", ":=", "range", "p", ".", "processes", "{", "if", "pr", ".", "name", "==", "name", "{", "return", "pr", "\n", "}", "...
// GetProcessByName uses process name to find a desired instance
[ "GetProcessByName", "uses", "process", "name", "to", "find", "a", "desired", "instance" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/plugin.go#L203-L210
126,369
ligato/cn-infra
processmanager/plugin.go
GetProcessByPID
func (p *Plugin) GetProcessByPID(pid int) ProcessInstance { for _, pr := range p.processes { if pr.status.Pid == pid { return pr } } return nil }
go
func (p *Plugin) GetProcessByPID(pid int) ProcessInstance { for _, pr := range p.processes { if pr.status.Pid == pid { return pr } } return nil }
[ "func", "(", "p", "*", "Plugin", ")", "GetProcessByPID", "(", "pid", "int", ")", "ProcessInstance", "{", "for", "_", ",", "pr", ":=", "range", "p", ".", "processes", "{", "if", "pr", ".", "status", ".", "Pid", "==", "pid", "{", "return", "pr", "\n"...
// GetProcessByPID uses process ID to find a desired instance
[ "GetProcessByPID", "uses", "process", "ID", "to", "find", "a", "desired", "instance" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/plugin.go#L213-L220
126,370
ligato/cn-infra
processmanager/plugin.go
GetAllProcesses
func (p *Plugin) GetAllProcesses() []ProcessInstance { var processes []ProcessInstance for _, pr := range p.processes { processes = append(processes, pr) } return processes }
go
func (p *Plugin) GetAllProcesses() []ProcessInstance { var processes []ProcessInstance for _, pr := range p.processes { processes = append(processes, pr) } return processes }
[ "func", "(", "p", "*", "Plugin", ")", "GetAllProcesses", "(", ")", "[", "]", "ProcessInstance", "{", "var", "processes", "[", "]", "ProcessInstance", "\n", "for", "_", ",", "pr", ":=", "range", "p", ".", "processes", "{", "processes", "=", "append", "(...
// GetAllProcesses returns all processes known to plugin
[ "GetAllProcesses", "returns", "all", "processes", "known", "to", "plugin" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/plugin.go#L223-L229
126,371
ligato/cn-infra
processmanager/plugin.go
Delete
func (p *Plugin) Delete(name string) error { var updated []*Process for _, pr := range p.processes { if pr.name == name { if err := pr.deleteProcess(); err != nil { return err } } else { updated = append(updated, pr) } } p.processes = updated return nil }
go
func (p *Plugin) Delete(name string) error { var updated []*Process for _, pr := range p.processes { if pr.name == name { if err := pr.deleteProcess(); err != nil { return err } } else { updated = append(updated, pr) } } p.processes = updated return nil }
[ "func", "(", "p", "*", "Plugin", ")", "Delete", "(", "name", "string", ")", "error", "{", "var", "updated", "[", "]", "*", "Process", "\n", "for", "_", ",", "pr", ":=", "range", "p", ".", "processes", "{", "if", "pr", ".", "name", "==", "name", ...
// Delete releases the process resources and removes it from the plugin cache
[ "Delete", "releases", "the", "process", "resources", "and", "removes", "it", "from", "the", "plugin", "cache" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/plugin.go#L232-L247
126,372
ligato/cn-infra
processmanager/plugin.go
GetTemplate
func (p *Plugin) GetTemplate(name string) (*process.Template, error) { if p.tReader == nil { return nil, errors.Errorf("cannot read process template %s: reader is nil (no path was defined)", name) } templates, err := p.tReader.GetAllTemplates() if err != nil { return nil, err } for _, tmp := range templates {...
go
func (p *Plugin) GetTemplate(name string) (*process.Template, error) { if p.tReader == nil { return nil, errors.Errorf("cannot read process template %s: reader is nil (no path was defined)", name) } templates, err := p.tReader.GetAllTemplates() if err != nil { return nil, err } for _, tmp := range templates {...
[ "func", "(", "p", "*", "Plugin", ")", "GetTemplate", "(", "name", "string", ")", "(", "*", "process", ".", "Template", ",", "error", ")", "{", "if", "p", ".", "tReader", "==", "nil", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", ...
// GetTemplate returns template with given name
[ "GetTemplate", "returns", "template", "with", "given", "name" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/plugin.go#L250-L264
126,373
ligato/cn-infra
processmanager/plugin.go
GetAllTemplates
func (p *Plugin) GetAllTemplates() ([]*process.Template, error) { if p.tReader == nil { return nil, errors.Errorf("cannot read process templates: reader is nil (no path was defined)") } return p.tReader.GetAllTemplates() }
go
func (p *Plugin) GetAllTemplates() ([]*process.Template, error) { if p.tReader == nil { return nil, errors.Errorf("cannot read process templates: reader is nil (no path was defined)") } return p.tReader.GetAllTemplates() }
[ "func", "(", "p", "*", "Plugin", ")", "GetAllTemplates", "(", ")", "(", "[", "]", "*", "process", ".", "Template", ",", "error", ")", "{", "if", "p", ".", "tReader", "==", "nil", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\""...
// GetAllTemplates returns all templates
[ "GetAllTemplates", "returns", "all", "templates" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/plugin.go#L267-L272
126,374
ligato/cn-infra
processmanager/plugin.go
getPMConfig
func (p *Plugin) getPMConfig() (path string, err error) { var pmConfig Config found, err := p.Cfg.LoadValue(&pmConfig) if err != nil { return path, errors.Errorf("failed to read process manager config file: %v", err) } if found { return pmConfig.TemplatePath, nil } return path, nil }
go
func (p *Plugin) getPMConfig() (path string, err error) { var pmConfig Config found, err := p.Cfg.LoadValue(&pmConfig) if err != nil { return path, errors.Errorf("failed to read process manager config file: %v", err) } if found { return pmConfig.TemplatePath, nil } return path, nil }
[ "func", "(", "p", "*", "Plugin", ")", "getPMConfig", "(", ")", "(", "path", "string", ",", "err", "error", ")", "{", "var", "pmConfig", "Config", "\n", "found", ",", "err", ":=", "p", ".", "Cfg", ".", "LoadValue", "(", "&", "pmConfig", ")", "\n", ...
// Reads plugin config file
[ "Reads", "plugin", "config", "file" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/plugin.go#L275-L285
126,375
ligato/cn-infra
processmanager/plugin.go
writeAsTemplate
func (p *Plugin) writeAsTemplate(pr *Process) { tmp, err := p.processToTemplate(pr) if err != nil { p.Log.Errorf("cannot create a template from process: %v", err) return } if p.tReader == nil { p.Log.Warnf("process %s should write a new template, but reader (template path) is not defined", pr.name) retur...
go
func (p *Plugin) writeAsTemplate(pr *Process) { tmp, err := p.processToTemplate(pr) if err != nil { p.Log.Errorf("cannot create a template from process: %v", err) return } if p.tReader == nil { p.Log.Warnf("process %s should write a new template, but reader (template path) is not defined", pr.name) retur...
[ "func", "(", "p", "*", "Plugin", ")", "writeAsTemplate", "(", "pr", "*", "Process", ")", "{", "tmp", ",", "err", ":=", "p", ".", "processToTemplate", "(", "pr", ")", "\n", "if", "err", "!=", "nil", "{", "p", ".", "Log", ".", "Errorf", "(", "\"", ...
// Writes process as template to the filesystem. Errors are logged but not returned
[ "Writes", "process", "as", "template", "to", "the", "filesystem", ".", "Errors", "are", "logged", "but", "not", "returned" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/plugin.go#L288-L303
126,376
ligato/cn-infra
processmanager/plugin.go
processToTemplate
func (p *Plugin) processToTemplate(pr *Process) (*process.Template, error) { if pr.name == "" { return nil, errors.Errorf("cannot create template from process, missing name") } if pr.cmd == "" { return nil, errors.Errorf("cannot create template from process, missing command") } pOptions := &process.TemplatePO...
go
func (p *Plugin) processToTemplate(pr *Process) (*process.Template, error) { if pr.name == "" { return nil, errors.Errorf("cannot create template from process, missing name") } if pr.cmd == "" { return nil, errors.Errorf("cannot create template from process, missing command") } pOptions := &process.TemplatePO...
[ "func", "(", "p", "*", "Plugin", ")", "processToTemplate", "(", "pr", "*", "Process", ")", "(", "*", "process", ".", "Template", ",", "error", ")", "{", "if", "pr", ".", "name", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "Errorf", ...
// Create a template object from process. A name and a command are mandatory
[ "Create", "a", "template", "object", "from", "process", ".", "A", "name", "and", "a", "command", "are", "mandatory" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/plugin.go#L306-L339
126,377
ligato/cn-infra
processmanager/plugin.go
templateToProcess
func (p *Plugin) templateToProcess(tmp *process.Template) (*Process, error) { if tmp.Name == "" { return nil, errors.Errorf("cannot create process from template, missing name") } if tmp.Cmd == "" { return nil, errors.Errorf("cannot create process from template, missing command") } pOptions := &POptions{} if ...
go
func (p *Plugin) templateToProcess(tmp *process.Template) (*Process, error) { if tmp.Name == "" { return nil, errors.Errorf("cannot create process from template, missing name") } if tmp.Cmd == "" { return nil, errors.Errorf("cannot create process from template, missing command") } pOptions := &POptions{} if ...
[ "func", "(", "p", "*", "Plugin", ")", "templateToProcess", "(", "tmp", "*", "process", ".", "Template", ")", "(", "*", "Process", ",", "error", ")", "{", "if", "tmp", ".", "Name", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "Errorf"...
// Create a process object from template. A name and a command are mandatory
[ "Create", "a", "process", "object", "from", "template", ".", "A", "name", "and", "a", "command", "are", "mandatory" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/processmanager/plugin.go#L342-L388
126,378
ligato/cn-infra
db/keyval/bolt/plugin.go
OnConnect
func (p *Plugin) OnConnect(callback func() error) { if err := callback(); err != nil { p.Log.Error(err) } }
go
func (p *Plugin) OnConnect(callback func() error) { if err := callback(); err != nil { p.Log.Error(err) } }
[ "func", "(", "p", "*", "Plugin", ")", "OnConnect", "(", "callback", "func", "(", ")", "error", ")", "{", "if", "err", ":=", "callback", "(", ")", ";", "err", "!=", "nil", "{", "p", ".", "Log", ".", "Error", "(", "err", ")", "\n", "}", "\n", "...
// OnConnect executes callback from datasync
[ "OnConnect", "executes", "callback", "from", "datasync" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/bolt/plugin.go#L59-L63
126,379
ligato/cn-infra
db/keyval/bolt/plugin.go
Init
func (p *Plugin) Init() (err error) { if p.Config == nil { p.Config, err = p.getConfig() if err != nil || p.disabled { return err } } p.boltClient, err = NewClient(p.Config) if err != nil { p.Log.Errorf("Err: %v", err) return err } p.protoWrapper = kvproto.NewProtoWrapper(p.boltClient, &keyval.Seri...
go
func (p *Plugin) Init() (err error) { if p.Config == nil { p.Config, err = p.getConfig() if err != nil || p.disabled { return err } } p.boltClient, err = NewClient(p.Config) if err != nil { p.Log.Errorf("Err: %v", err) return err } p.protoWrapper = kvproto.NewProtoWrapper(p.boltClient, &keyval.Seri...
[ "func", "(", "p", "*", "Plugin", ")", "Init", "(", ")", "(", "err", "error", ")", "{", "if", "p", ".", "Config", "==", "nil", "{", "p", ".", "Config", ",", "err", "=", "p", ".", "getConfig", "(", ")", "\n", "if", "err", "!=", "nil", "||", "...
// Init initializes Bolt plugin.
[ "Init", "initializes", "Bolt", "plugin", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/bolt/plugin.go#L66-L85
126,380
ligato/cn-infra
db/keyval/bolt/plugin.go
Close
func (p *Plugin) Close() error { if p.boltClient != nil { return p.boltClient.Close() } return nil }
go
func (p *Plugin) Close() error { if p.boltClient != nil { return p.boltClient.Close() } return nil }
[ "func", "(", "p", "*", "Plugin", ")", "Close", "(", ")", "error", "{", "if", "p", ".", "boltClient", "!=", "nil", "{", "return", "p", ".", "boltClient", ".", "Close", "(", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Close closes the Bolt client.
[ "Close", "closes", "the", "Bolt", "client", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/bolt/plugin.go#L88-L93
126,381
ligato/cn-infra
db/keyval/bolt/plugin.go
NewBroker
func (p *Plugin) NewBroker(keyPrefix string) keyval.ProtoBroker { return p.protoWrapper.NewBroker(keyPrefix) }
go
func (p *Plugin) NewBroker(keyPrefix string) keyval.ProtoBroker { return p.protoWrapper.NewBroker(keyPrefix) }
[ "func", "(", "p", "*", "Plugin", ")", "NewBroker", "(", "keyPrefix", "string", ")", "keyval", ".", "ProtoBroker", "{", "return", "p", ".", "protoWrapper", ".", "NewBroker", "(", "keyPrefix", ")", "\n", "}" ]
// NewBroker creates new instance of prefixed broker that provides API with arguments of type proto.Message.
[ "NewBroker", "creates", "new", "instance", "of", "prefixed", "broker", "that", "provides", "API", "with", "arguments", "of", "type", "proto", ".", "Message", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/bolt/plugin.go#L96-L98
126,382
ligato/cn-infra
db/keyval/bolt/plugin.go
NewWatcher
func (p *Plugin) NewWatcher(keyPrefix string) keyval.ProtoWatcher { return p.protoWrapper.NewWatcher(keyPrefix) }
go
func (p *Plugin) NewWatcher(keyPrefix string) keyval.ProtoWatcher { return p.protoWrapper.NewWatcher(keyPrefix) }
[ "func", "(", "p", "*", "Plugin", ")", "NewWatcher", "(", "keyPrefix", "string", ")", "keyval", ".", "ProtoWatcher", "{", "return", "p", ".", "protoWrapper", ".", "NewWatcher", "(", "keyPrefix", ")", "\n", "}" ]
// NewWatcher creates new instance of prefixed broker that provides API with arguments of type proto.Message.
[ "NewWatcher", "creates", "new", "instance", "of", "prefixed", "broker", "that", "provides", "API", "with", "arguments", "of", "type", "proto", ".", "Message", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/bolt/plugin.go#L101-L103
126,383
ligato/cn-infra
examples/etcd-lib/editor/editor.go
processArgs
func processArgs() (cfg *etcd.ClientConfig, op int, data []string, err error) { var task []string // default args fileConfig := &etcd.Config{} op = Put if len(os.Args) > 2 { if os.Args[1] == "--cfg" { err = config.ParseConfigFromYamlFile(os.Args[2], fileConfig) if err != nil { return } cfg, err...
go
func processArgs() (cfg *etcd.ClientConfig, op int, data []string, err error) { var task []string // default args fileConfig := &etcd.Config{} op = Put if len(os.Args) > 2 { if os.Args[1] == "--cfg" { err = config.ParseConfigFromYamlFile(os.Args[2], fileConfig) if err != nil { return } cfg, err...
[ "func", "processArgs", "(", ")", "(", "cfg", "*", "etcd", ".", "ClientConfig", ",", "op", "int", ",", "data", "[", "]", "string", ",", "err", "error", ")", "{", "var", "task", "[", "]", "string", "\n\n", "// default args", "fileConfig", ":=", "&", "e...
// processArgs processes input arguments.
[ "processArgs", "processes", "input", "arguments", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/examples/etcd-lib/editor/editor.go#L27-L64
126,384
ligato/cn-infra
db/keyval/redis/bytes_broker_impl.go
Close
func (db *BytesConnectionRedis) Close() error { if db.closed { db.Debug("Close() called on a closed connection") return nil } db.Debug("Close()") db.closed = true safeclose.Close(db.closeCh) if db.client != nil { err := safeclose.Close(db.client) if err != nil { return fmt.Errorf("Close() encountered e...
go
func (db *BytesConnectionRedis) Close() error { if db.closed { db.Debug("Close() called on a closed connection") return nil } db.Debug("Close()") db.closed = true safeclose.Close(db.closeCh) if db.client != nil { err := safeclose.Close(db.client) if err != nil { return fmt.Errorf("Close() encountered e...
[ "func", "(", "db", "*", "BytesConnectionRedis", ")", "Close", "(", ")", "error", "{", "if", "db", ".", "closed", "{", "db", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n", "db", ".", "Debug", "(", "\"", "\"", ")", "\...
// Close closes the connection to redis.
[ "Close", "closes", "the", "connection", "to", "redis", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/redis/bytes_broker_impl.go#L72-L87
126,385
ligato/cn-infra
db/keyval/redis/bytes_broker_impl.go
GetValue
func (db *BytesConnectionRedis) GetValue(key string) (data []byte, found bool, revision int64, err error) { if db.closed { return nil, false, 0, fmt.Errorf("GetValue(%s) called on a closed connection", key) } db.Debugf("GetValue(%s)", key) statusCmd := db.client.Get(key) data, err = statusCmd.Bytes() if err !=...
go
func (db *BytesConnectionRedis) GetValue(key string) (data []byte, found bool, revision int64, err error) { if db.closed { return nil, false, 0, fmt.Errorf("GetValue(%s) called on a closed connection", key) } db.Debugf("GetValue(%s)", key) statusCmd := db.client.Get(key) data, err = statusCmd.Bytes() if err !=...
[ "func", "(", "db", "*", "BytesConnectionRedis", ")", "GetValue", "(", "key", "string", ")", "(", "data", "[", "]", "byte", ",", "found", "bool", ",", "revision", "int64", ",", "err", "error", ")", "{", "if", "db", ".", "closed", "{", "return", "nil",...
// GetValue retrieves the value of the key from Redis.
[ "GetValue", "retrieves", "the", "value", "of", "the", "key", "from", "Redis", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/redis/bytes_broker_impl.go#L121-L136
126,386
ligato/cn-infra
db/keyval/redis/bytes_broker_impl.go
Delete
func (db *BytesConnectionRedis) Delete(key string, opts ...datasync.DelOption) (found bool, err error) { if db.closed { return false, fmt.Errorf("Delete(%s) called on a closed connection", key) } db.Debugf("Delete(%s)", key) keysToDelete := []string{} var keyIsPrefix bool for _, o := range opts { if _, ok :...
go
func (db *BytesConnectionRedis) Delete(key string, opts ...datasync.DelOption) (found bool, err error) { if db.closed { return false, fmt.Errorf("Delete(%s) called on a closed connection", key) } db.Debugf("Delete(%s)", key) keysToDelete := []string{} var keyIsPrefix bool for _, o := range opts { if _, ok :...
[ "func", "(", "db", "*", "BytesConnectionRedis", ")", "Delete", "(", "key", "string", ",", "opts", "...", "datasync", ".", "DelOption", ")", "(", "found", "bool", ",", "err", "error", ")", "{", "if", "db", ".", "closed", "{", "return", "false", ",", "...
// Delete deletes all the keys that start with the given match string.
[ "Delete", "deletes", "all", "the", "keys", "that", "start", "with", "the", "given", "match", "string", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/redis/bytes_broker_impl.go#L157-L196
126,387
ligato/cn-infra
db/keyval/redis/bytes_broker_impl.go
NewTxn
func (pdb *BytesBrokerWatcherRedis) NewTxn() keyval.BytesTxn { if pdb.delegate.closed { pdb.Error("NewTxn() called on a closed connection") return nil } pdb.Debug("NewTxn()") return &Txn{db: pdb.delegate, ops: []op{}, addPrefix: pdb.addPrefix} }
go
func (pdb *BytesBrokerWatcherRedis) NewTxn() keyval.BytesTxn { if pdb.delegate.closed { pdb.Error("NewTxn() called on a closed connection") return nil } pdb.Debug("NewTxn()") return &Txn{db: pdb.delegate, ops: []op{}, addPrefix: pdb.addPrefix} }
[ "func", "(", "pdb", "*", "BytesBrokerWatcherRedis", ")", "NewTxn", "(", ")", "keyval", ".", "BytesTxn", "{", "if", "pdb", ".", "delegate", ".", "closed", "{", "pdb", ".", "Error", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n", "pdb", ...
// NewTxn creates new transaction. Prefix will be prepended to the key argument.
[ "NewTxn", "creates", "new", "transaction", ".", "Prefix", "will", "be", "prepended", "to", "the", "key", "argument", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/redis/bytes_broker_impl.go#L450-L458
126,388
ligato/cn-infra
db/keyval/redis/bytes_broker_impl.go
Put
func (pdb *BytesBrokerWatcherRedis) Put(key string, data []byte, opts ...datasync.PutOption) error { if pdb.delegate.closed { return fmt.Errorf("Put(%s) called on a closed connection", key) } pdb.Debugf("Put(%s)", key) return pdb.delegate.Put(pdb.addPrefix(key), data, opts...) }
go
func (pdb *BytesBrokerWatcherRedis) Put(key string, data []byte, opts ...datasync.PutOption) error { if pdb.delegate.closed { return fmt.Errorf("Put(%s) called on a closed connection", key) } pdb.Debugf("Put(%s)", key) return pdb.delegate.Put(pdb.addPrefix(key), data, opts...) }
[ "func", "(", "pdb", "*", "BytesBrokerWatcherRedis", ")", "Put", "(", "key", "string", ",", "data", "[", "]", "byte", ",", "opts", "...", "datasync", ".", "PutOption", ")", "error", "{", "if", "pdb", ".", "delegate", ".", "closed", "{", "return", "fmt",...
// Put calls Put function of BytesConnectionRedis. Prefix will be prepended to the key argument.
[ "Put", "calls", "Put", "function", "of", "BytesConnectionRedis", ".", "Prefix", "will", "be", "prepended", "to", "the", "key", "argument", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/redis/bytes_broker_impl.go#L461-L468
126,389
ligato/cn-infra
db/keyval/redis/bytes_broker_impl.go
GetValue
func (pdb *BytesBrokerWatcherRedis) GetValue(key string) (data []byte, found bool, revision int64, err error) { if pdb.delegate.closed { return nil, false, 0, fmt.Errorf("GetValue(%s) called on a closed connection", key) } pdb.Debugf("GetValue(%s)", key) return pdb.delegate.GetValue(pdb.addPrefix(key)) }
go
func (pdb *BytesBrokerWatcherRedis) GetValue(key string) (data []byte, found bool, revision int64, err error) { if pdb.delegate.closed { return nil, false, 0, fmt.Errorf("GetValue(%s) called on a closed connection", key) } pdb.Debugf("GetValue(%s)", key) return pdb.delegate.GetValue(pdb.addPrefix(key)) }
[ "func", "(", "pdb", "*", "BytesBrokerWatcherRedis", ")", "GetValue", "(", "key", "string", ")", "(", "data", "[", "]", "byte", ",", "found", "bool", ",", "revision", "int64", ",", "err", "error", ")", "{", "if", "pdb", ".", "delegate", ".", "closed", ...
// GetValue calls GetValue function of BytesConnectionRedis. // Prefix will be prepended to the key argument when searching.
[ "GetValue", "calls", "GetValue", "function", "of", "BytesConnectionRedis", ".", "Prefix", "will", "be", "prepended", "to", "the", "key", "argument", "when", "searching", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/redis/bytes_broker_impl.go#L472-L479
126,390
ligato/cn-infra
db/keyval/redis/bytes_broker_impl.go
Delete
func (pdb *BytesBrokerWatcherRedis) Delete(match string, opts ...datasync.DelOption) (found bool, err error) { if pdb.delegate.closed { return false, fmt.Errorf("Delete(%s) called on a closed connection", match) } pdb.Debugf("Delete(%s)", match) return pdb.delegate.Delete(pdb.addPrefix(match), opts...) }
go
func (pdb *BytesBrokerWatcherRedis) Delete(match string, opts ...datasync.DelOption) (found bool, err error) { if pdb.delegate.closed { return false, fmt.Errorf("Delete(%s) called on a closed connection", match) } pdb.Debugf("Delete(%s)", match) return pdb.delegate.Delete(pdb.addPrefix(match), opts...) }
[ "func", "(", "pdb", "*", "BytesBrokerWatcherRedis", ")", "Delete", "(", "match", "string", ",", "opts", "...", "datasync", ".", "DelOption", ")", "(", "found", "bool", ",", "err", "error", ")", "{", "if", "pdb", ".", "delegate", ".", "closed", "{", "re...
// Delete calls Delete function of BytesConnectionRedis. // Prefix will be prepended to key argument when searching.
[ "Delete", "calls", "Delete", "function", "of", "BytesConnectionRedis", ".", "Prefix", "will", "be", "prepended", "to", "key", "argument", "when", "searching", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/redis/bytes_broker_impl.go#L505-L512
126,391
ligato/cn-infra
datasync/resync/plugin_impl_resync.go
Init
func (p *Plugin) Init() error { p.registrations = make(map[string]*registration) return nil }
go
func (p *Plugin) Init() error { p.registrations = make(map[string]*registration) return nil }
[ "func", "(", "p", "*", "Plugin", ")", "Init", "(", ")", "error", "{", "p", ".", "registrations", "=", "make", "(", "map", "[", "string", "]", "*", "registration", ")", "\n", "return", "nil", "\n", "}" ]
// Init initializes variables.
[ "Init", "initializes", "variables", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/datasync/resync/plugin_impl_resync.go#L50-L53
126,392
ligato/cn-infra
examples/redis-plugin/main.go
AfterInit
func (plugin *ExamplePlugin) AfterInit() (err error) { db := plugin.DB.NewBroker(keyval.Root) db.ListKeys(keyval.Root) return nil }
go
func (plugin *ExamplePlugin) AfterInit() (err error) { db := plugin.DB.NewBroker(keyval.Root) db.ListKeys(keyval.Root) return nil }
[ "func", "(", "plugin", "*", "ExamplePlugin", ")", "AfterInit", "(", ")", "(", "err", "error", ")", "{", "db", ":=", "plugin", ".", "DB", ".", "NewBroker", "(", "keyval", ".", "Root", ")", "\n", "db", ".", "ListKeys", "(", "keyval", ".", "Root", ")"...
// AfterInit is meant to use DB if needed
[ "AfterInit", "is", "meant", "to", "use", "DB", "if", "needed" ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/examples/redis-plugin/main.go#L75-L80
126,393
ligato/cn-infra
messaging/kafka/mux/chan.go
ToBytesMsgChan
func ToBytesMsgChan(ch chan *client.ConsumerMessage, opts ...interface{}) func(*client.ConsumerMessage) { timeout, logger := messaging.ParseOpts(opts...) return func(msg *client.ConsumerMessage) { select { case ch <- msg: case <-time.After(timeout): logger.Warn("Unable to deliver message") } } }
go
func ToBytesMsgChan(ch chan *client.ConsumerMessage, opts ...interface{}) func(*client.ConsumerMessage) { timeout, logger := messaging.ParseOpts(opts...) return func(msg *client.ConsumerMessage) { select { case ch <- msg: case <-time.After(timeout): logger.Warn("Unable to deliver message") } } }
[ "func", "ToBytesMsgChan", "(", "ch", "chan", "*", "client", ".", "ConsumerMessage", ",", "opts", "...", "interface", "{", "}", ")", "func", "(", "*", "client", ".", "ConsumerMessage", ")", "{", "timeout", ",", "logger", ":=", "messaging", ".", "ParseOpts",...
// ToBytesMsgChan allows to receive ConsumerMessage through channel. This function can be used as an argument for // ConsumeTopic call.
[ "ToBytesMsgChan", "allows", "to", "receive", "ConsumerMessage", "through", "channel", ".", "This", "function", "can", "be", "used", "as", "an", "argument", "for", "ConsumeTopic", "call", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/chan.go#L25-L36
126,394
ligato/cn-infra
messaging/kafka/mux/chan.go
ToBytesProducerChan
func ToBytesProducerChan(ch chan *client.ProducerMessage, opts ...interface{}) func(*client.ProducerMessage) { timeout, logger := messaging.ParseOpts(opts...) return func(msg *client.ProducerMessage) { select { case ch <- msg: case <-time.After(timeout): logger.Warn("Unable to deliver message") } } }
go
func ToBytesProducerChan(ch chan *client.ProducerMessage, opts ...interface{}) func(*client.ProducerMessage) { timeout, logger := messaging.ParseOpts(opts...) return func(msg *client.ProducerMessage) { select { case ch <- msg: case <-time.After(timeout): logger.Warn("Unable to deliver message") } } }
[ "func", "ToBytesProducerChan", "(", "ch", "chan", "*", "client", ".", "ProducerMessage", ",", "opts", "...", "interface", "{", "}", ")", "func", "(", "*", "client", ".", "ProducerMessage", ")", "{", "timeout", ",", "logger", ":=", "messaging", ".", "ParseO...
// ToBytesProducerChan allows to receive ProducerMessage through channel. This function can be used as an argument for // methods publishing using async API.
[ "ToBytesProducerChan", "allows", "to", "receive", "ProducerMessage", "through", "channel", ".", "This", "function", "can", "be", "used", "as", "an", "argument", "for", "methods", "publishing", "using", "async", "API", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/chan.go#L40-L51
126,395
ligato/cn-infra
messaging/kafka/mux/chan.go
ToBytesProducerErrChan
func ToBytesProducerErrChan(ch chan *client.ProducerError, opts ...interface{}) func(*client.ProducerError) { timeout, logger := messaging.ParseOpts(opts...) return func(msg *client.ProducerError) { select { case ch <- msg: case <-time.After(timeout): logger.Warn("Unable to deliver message") } } }
go
func ToBytesProducerErrChan(ch chan *client.ProducerError, opts ...interface{}) func(*client.ProducerError) { timeout, logger := messaging.ParseOpts(opts...) return func(msg *client.ProducerError) { select { case ch <- msg: case <-time.After(timeout): logger.Warn("Unable to deliver message") } } }
[ "func", "ToBytesProducerErrChan", "(", "ch", "chan", "*", "client", ".", "ProducerError", ",", "opts", "...", "interface", "{", "}", ")", "func", "(", "*", "client", ".", "ProducerError", ")", "{", "timeout", ",", "logger", ":=", "messaging", ".", "ParseOp...
// ToBytesProducerErrChan allows to receive ProducerMessage through channel. This function can be used as an argument for // methods publishing using async API.
[ "ToBytesProducerErrChan", "allows", "to", "receive", "ProducerMessage", "through", "channel", ".", "This", "function", "can", "be", "used", "as", "an", "argument", "for", "methods", "publishing", "using", "async", "API", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/messaging/kafka/mux/chan.go#L55-L66
126,396
ligato/cn-infra
rpc/rest/security/password-hasher/main.go
main
func main() { // Read args args := os.Args if len(args) != 3 { usage() return } pass := args[1] cost, err := strconv.Atoi(args[2]) if err != nil { logrus.DefaultLogger().Errorf("invalid cost format: %v", err) os.Exit(1) } if cost < 4 || cost > 31 { logrus.DefaultLogger().Errorf("invalid cost value %...
go
func main() { // Read args args := os.Args if len(args) != 3 { usage() return } pass := args[1] cost, err := strconv.Atoi(args[2]) if err != nil { logrus.DefaultLogger().Errorf("invalid cost format: %v", err) os.Exit(1) } if cost < 4 || cost > 31 { logrus.DefaultLogger().Errorf("invalid cost value %...
[ "func", "main", "(", ")", "{", "// Read args", "args", ":=", "os", ".", "Args", "\n", "if", "len", "(", "args", ")", "!=", "3", "{", "usage", "(", ")", "\n", "return", "\n", "}", "\n\n", "pass", ":=", "args", "[", "1", "]", "\n", "cost", ",", ...
// A simple utility to help with password hashing. Hashed password can be stored as // user password in config file. Always provide two parameters; password and cost.
[ "A", "simple", "utility", "to", "help", "with", "password", "hashing", ".", "Hashed", "password", "can", "be", "stored", "as", "user", "password", "in", "config", "file", ".", "Always", "provide", "two", "parameters", ";", "password", "and", "cost", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/rpc/rest/security/password-hasher/main.go#L32-L57
126,397
ligato/cn-infra
db/keyval/bytes_watcher_api.go
ToChan
func ToChan(respCh chan BytesWatchResp, opts ...interface{}) func(dto BytesWatchResp) { return func(dto BytesWatchResp) { select { case respCh <- dto: // success case <-time.After(datasync.DefaultNotifTimeout): logging.DefaultLogger.Warn("Unable to deliver notification") } } }
go
func ToChan(respCh chan BytesWatchResp, opts ...interface{}) func(dto BytesWatchResp) { return func(dto BytesWatchResp) { select { case respCh <- dto: // success case <-time.After(datasync.DefaultNotifTimeout): logging.DefaultLogger.Warn("Unable to deliver notification") } } }
[ "func", "ToChan", "(", "respCh", "chan", "BytesWatchResp", ",", "opts", "...", "interface", "{", "}", ")", "func", "(", "dto", "BytesWatchResp", ")", "{", "return", "func", "(", "dto", "BytesWatchResp", ")", "{", "select", "{", "case", "respCh", "<-", "d...
// ToChan creates a callback that can be passed to the Watch function in order // to receive notifications through a channel. If the notification cannot be // delivered until timeout, it is dropped.
[ "ToChan", "creates", "a", "callback", "that", "can", "be", "passed", "to", "the", "Watch", "function", "in", "order", "to", "receive", "notifications", "through", "a", "channel", ".", "If", "the", "notification", "cannot", "be", "delivered", "until", "timeout"...
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/db/keyval/bytes_watcher_api.go#L43-L52
126,398
ligato/cn-infra
examples/kafka-lib/asyncproducer/asyncproducer.go
sendMessage
func sendMessage(producer *client.AsyncProducer, msg utils.Message) error { var ( msgKey []byte msgMeta []byte msgValue []byte ) // init message if msg.Key != "" { msgKey = []byte(msg.Key) } if msg.Metadata != "" { msgMeta = []byte(msg.Metadata) } msgValue = []byte(msg.Text) // send message pro...
go
func sendMessage(producer *client.AsyncProducer, msg utils.Message) error { var ( msgKey []byte msgMeta []byte msgValue []byte ) // init message if msg.Key != "" { msgKey = []byte(msg.Key) } if msg.Metadata != "" { msgMeta = []byte(msg.Metadata) } msgValue = []byte(msg.Text) // send message pro...
[ "func", "sendMessage", "(", "producer", "*", "client", ".", "AsyncProducer", ",", "msg", "utils", ".", "Message", ")", "error", "{", "var", "(", "msgKey", "[", "]", "byte", "\n", "msgMeta", "[", "]", "byte", "\n", "msgValue", "[", "]", "byte", "\n", ...
// sendMessage demonstrates AsyncProducer.SendMsgByte API to publish a single // message to a Kafka topic.
[ "sendMessage", "demonstrates", "AsyncProducer", ".", "SendMsgByte", "API", "to", "publish", "a", "single", "message", "to", "a", "Kafka", "topic", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/examples/kafka-lib/asyncproducer/asyncproducer.go#L134-L155
126,399
ligato/cn-infra
datasync/syncbase/events.go
NewResyncEventDB
func NewResyncEventDB(ctx context.Context, its map[string]datasync.KeyValIterator) *ResyncEventDB { return &ResyncEventDB{ ctx: ctx, its: its, DoneChannel: &DoneChannel{make(chan error, 1)}, } }
go
func NewResyncEventDB(ctx context.Context, its map[string]datasync.KeyValIterator) *ResyncEventDB { return &ResyncEventDB{ ctx: ctx, its: its, DoneChannel: &DoneChannel{make(chan error, 1)}, } }
[ "func", "NewResyncEventDB", "(", "ctx", "context", ".", "Context", ",", "its", "map", "[", "string", "]", "datasync", ".", "KeyValIterator", ")", "*", "ResyncEventDB", "{", "return", "&", "ResyncEventDB", "{", "ctx", ":", "ctx", ",", "its", ":", "its", "...
// NewResyncEventDB creates a new instance of ResyncEventDB using the given map of iterators.
[ "NewResyncEventDB", "creates", "a", "new", "instance", "of", "ResyncEventDB", "using", "the", "given", "map", "of", "iterators", "." ]
6552f4407e293b0986ec353eb0f01968cbecb928
https://github.com/ligato/cn-infra/blob/6552f4407e293b0986ec353eb0f01968cbecb928/datasync/syncbase/events.go#L26-L32