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
157,800
juju/juju
worker/uniter/runner/factory.go
NewFactory
func NewFactory( state *uniter.State, paths context.Paths, contextFactory context.ContextFactory, ) ( Factory, error, ) { f := &factory{ state: state, paths: paths, contextFactory: contextFactory, } return f, nil }
go
func NewFactory( state *uniter.State, paths context.Paths, contextFactory context.ContextFactory, ) ( Factory, error, ) { f := &factory{ state: state, paths: paths, contextFactory: contextFactory, } return f, nil }
[ "func", "NewFactory", "(", "state", "*", "uniter", ".", "State", ",", "paths", "context", ".", "Paths", ",", "contextFactory", "context", ".", "ContextFactory", ",", ")", "(", "Factory", ",", "error", ",", ")", "{", "f", ":=", "&", "factory", "{", "sta...
// NewFactory returns a Factory capable of creating runners for executing // charm hooks, actions and commands.
[ "NewFactory", "returns", "a", "Factory", "capable", "of", "creating", "runners", "for", "executing", "charm", "hooks", "actions", "and", "commands", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/factory.go#L38-L52
157,801
juju/juju
worker/uniter/runner/factory.go
NewCommandRunner
func (f *factory) NewCommandRunner(commandInfo context.CommandInfo) (Runner, error) { ctx, err := f.contextFactory.CommandContext(commandInfo) if err != nil { return nil, errors.Trace(err) } runner := NewRunner(ctx, f.paths) return runner, nil }
go
func (f *factory) NewCommandRunner(commandInfo context.CommandInfo) (Runner, error) { ctx, err := f.contextFactory.CommandContext(commandInfo) if err != nil { return nil, errors.Trace(err) } runner := NewRunner(ctx, f.paths) return runner, nil }
[ "func", "(", "f", "*", "factory", ")", "NewCommandRunner", "(", "commandInfo", "context", ".", "CommandInfo", ")", "(", "Runner", ",", "error", ")", "{", "ctx", ",", "err", ":=", "f", ".", "contextFactory", ".", "CommandContext", "(", "commandInfo", ")", ...
// NewCommandRunner exists to satisfy the Factory interface.
[ "NewCommandRunner", "exists", "to", "satisfy", "the", "Factory", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/factory.go#L65-L72
157,802
juju/juju
worker/uniter/runner/factory.go
NewHookRunner
func (f *factory) NewHookRunner(hookInfo hook.Info) (Runner, error) { if err := hookInfo.Validate(); err != nil { return nil, errors.Trace(err) } ctx, err := f.contextFactory.HookContext(hookInfo) if err != nil { return nil, errors.Trace(err) } runner := NewRunner(ctx, f.paths) return runner, nil }
go
func (f *factory) NewHookRunner(hookInfo hook.Info) (Runner, error) { if err := hookInfo.Validate(); err != nil { return nil, errors.Trace(err) } ctx, err := f.contextFactory.HookContext(hookInfo) if err != nil { return nil, errors.Trace(err) } runner := NewRunner(ctx, f.paths) return runner, nil }
[ "func", "(", "f", "*", "factory", ")", "NewHookRunner", "(", "hookInfo", "hook", ".", "Info", ")", "(", "Runner", ",", "error", ")", "{", "if", "err", ":=", "hookInfo", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", ...
// NewHookRunner exists to satisfy the Factory interface.
[ "NewHookRunner", "exists", "to", "satisfy", "the", "Factory", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/factory.go#L75-L86
157,803
juju/juju
worker/uniter/runner/factory.go
NewActionRunner
func (f *factory) NewActionRunner(actionId string) (Runner, error) { ch, err := getCharm(f.paths.GetCharmDir()) if err != nil { return nil, errors.Trace(err) } ok := names.IsValidAction(actionId) if !ok { return nil, charmrunner.NewBadActionError(actionId, "not valid actionId") } tag := names.NewActionTag(a...
go
func (f *factory) NewActionRunner(actionId string) (Runner, error) { ch, err := getCharm(f.paths.GetCharmDir()) if err != nil { return nil, errors.Trace(err) } ok := names.IsValidAction(actionId) if !ok { return nil, charmrunner.NewBadActionError(actionId, "not valid actionId") } tag := names.NewActionTag(a...
[ "func", "(", "f", "*", "factory", ")", "NewActionRunner", "(", "actionId", "string", ")", "(", "Runner", ",", "error", ")", "{", "ch", ",", "err", ":=", "getCharm", "(", "f", ".", "paths", ".", "GetCharmDir", "(", ")", ")", "\n", "if", "err", "!=",...
// NewActionRunner exists to satisfy the Factory interface.
[ "NewActionRunner", "exists", "to", "satisfy", "the", "Factory", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/worker/uniter/runner/factory.go#L89-L129
157,804
juju/juju
provider/lxd/environ_instance.go
prefixedInstances
func (env *environ) prefixedInstances(prefix string) ([]*environInstance, error) { containers, err := env.server().AliveContainers(prefix) err = errors.Trace(err) // Turn lxd.Container values into *environInstance values, // whether or not we got an error. var results []*environInstance for _, c := range contain...
go
func (env *environ) prefixedInstances(prefix string) ([]*environInstance, error) { containers, err := env.server().AliveContainers(prefix) err = errors.Trace(err) // Turn lxd.Container values into *environInstance values, // whether or not we got an error. var results []*environInstance for _, c := range contain...
[ "func", "(", "env", "*", "environ", ")", "prefixedInstances", "(", "prefix", "string", ")", "(", "[", "]", "*", "environInstance", ",", "error", ")", "{", "containers", ",", "err", ":=", "env", ".", "server", "(", ")", ".", "AliveContainers", "(", "pre...
// prefixedInstances returns instances with the specified prefix.
[ "prefixedInstances", "returns", "instances", "with", "the", "specified", "prefix", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/lxd/environ_instance.go#L81-L94
157,805
juju/juju
provider/lxd/environ_instance.go
AdoptResources
func (env *environ) AdoptResources(ctx context.ProviderCallContext, controllerUUID string, fromVersion version.Number) error { instances, err := env.AllInstances(ctx) if err != nil { common.HandleCredentialError(IsAuthorisationFailure, err, ctx) return errors.Annotate(err, "all instances") } var failed []insta...
go
func (env *environ) AdoptResources(ctx context.ProviderCallContext, controllerUUID string, fromVersion version.Number) error { instances, err := env.AllInstances(ctx) if err != nil { common.HandleCredentialError(IsAuthorisationFailure, err, ctx) return errors.Annotate(err, "all instances") } var failed []insta...
[ "func", "(", "env", "*", "environ", ")", "AdoptResources", "(", "ctx", "context", ".", "ProviderCallContext", ",", "controllerUUID", "string", ",", "fromVersion", "version", ".", "Number", ")", "error", "{", "instances", ",", "err", ":=", "env", ".", "AllIns...
// AdoptResources updates the controller tags on all instances to have the // new controller id. It's part of the Environ interface.
[ "AdoptResources", "updates", "the", "controller", "tags", "on", "all", "instances", "to", "have", "the", "new", "controller", "id", ".", "It", "s", "part", "of", "the", "Environ", "interface", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/provider/lxd/environ_instance.go#L122-L148
157,806
juju/juju
apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go
NewStateCrossModelRelationsAPI
func NewStateCrossModelRelationsAPI(ctx facade.Context) (*CrossModelRelationsAPI, error) { authCtxt := ctx.Resources().Get("offerAccessAuthContext").(common.ValueResource).Value st := ctx.State() model, err := st.Model() if err != nil { return nil, err } return NewCrossModelRelationsAPI( stateShim{ st: ...
go
func NewStateCrossModelRelationsAPI(ctx facade.Context) (*CrossModelRelationsAPI, error) { authCtxt := ctx.Resources().Get("offerAccessAuthContext").(common.ValueResource).Value st := ctx.State() model, err := st.Model() if err != nil { return nil, err } return NewCrossModelRelationsAPI( stateShim{ st: ...
[ "func", "NewStateCrossModelRelationsAPI", "(", "ctx", "facade", ".", "Context", ")", "(", "*", "CrossModelRelationsAPI", ",", "error", ")", "{", "authCtxt", ":=", "ctx", ".", "Resources", "(", ")", ".", "Get", "(", "\"", "\"", ")", ".", "(", "common", "....
// NewStateCrossModelRelationsAPI creates a new server-side CrossModelRelations API facade // backed by global state.
[ "NewStateCrossModelRelationsAPI", "creates", "a", "new", "server", "-", "side", "CrossModelRelations", "API", "facade", "backed", "by", "global", "state", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go#L49-L68
157,807
juju/juju
apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go
NewCrossModelRelationsAPI
func NewCrossModelRelationsAPI( st CrossModelRelationsState, fw firewall.State, resources facade.Resources, authorizer facade.Authorizer, authCtxt *commoncrossmodel.AuthContext, egressAddressWatcher egressAddressWatcherFunc, relationStatusWatcher relationStatusWatcherFunc, offerStatusWatcher offerStatusWatcherF...
go
func NewCrossModelRelationsAPI( st CrossModelRelationsState, fw firewall.State, resources facade.Resources, authorizer facade.Authorizer, authCtxt *commoncrossmodel.AuthContext, egressAddressWatcher egressAddressWatcherFunc, relationStatusWatcher relationStatusWatcherFunc, offerStatusWatcher offerStatusWatcherF...
[ "func", "NewCrossModelRelationsAPI", "(", "st", "CrossModelRelationsState", ",", "fw", "firewall", ".", "State", ",", "resources", "facade", ".", "Resources", ",", "authorizer", "facade", ".", "Authorizer", ",", "authCtxt", "*", "commoncrossmodel", ".", "AuthContext...
// NewCrossModelRelationsAPI returns a new server-side CrossModelRelationsAPI facade.
[ "NewCrossModelRelationsAPI", "returns", "a", "new", "server", "-", "side", "CrossModelRelationsAPI", "facade", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go#L71-L92
157,808
juju/juju
apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go
PublishRelationChanges
func (api *CrossModelRelationsAPI) PublishRelationChanges( changes params.RemoteRelationsChanges, ) (params.ErrorResults, error) { results := params.ErrorResults{ Results: make([]params.ErrorResult, len(changes.Changes)), } for i, change := range changes.Changes { relationTag, err := api.st.GetRemoteEntity(chan...
go
func (api *CrossModelRelationsAPI) PublishRelationChanges( changes params.RemoteRelationsChanges, ) (params.ErrorResults, error) { results := params.ErrorResults{ Results: make([]params.ErrorResult, len(changes.Changes)), } for i, change := range changes.Changes { relationTag, err := api.st.GetRemoteEntity(chan...
[ "func", "(", "api", "*", "CrossModelRelationsAPI", ")", "PublishRelationChanges", "(", "changes", "params", ".", "RemoteRelationsChanges", ",", ")", "(", "params", ".", "ErrorResults", ",", "error", ")", "{", "results", ":=", "params", ".", "ErrorResults", "{", ...
// PublishRelationChanges publishes relation changes to the // model hosting the remote application involved in the relation.
[ "PublishRelationChanges", "publishes", "relation", "changes", "to", "the", "model", "hosting", "the", "remote", "application", "involved", "in", "the", "relation", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go#L112-L142
157,809
juju/juju
apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go
RegisterRemoteRelations
func (api *CrossModelRelationsAPI) RegisterRemoteRelations( relations params.RegisterRemoteRelationArgs, ) (params.RegisterRemoteRelationResults, error) { results := params.RegisterRemoteRelationResults{ Results: make([]params.RegisterRemoteRelationResult, len(relations.Relations)), } for i, relation := range rel...
go
func (api *CrossModelRelationsAPI) RegisterRemoteRelations( relations params.RegisterRemoteRelationArgs, ) (params.RegisterRemoteRelationResults, error) { results := params.RegisterRemoteRelationResults{ Results: make([]params.RegisterRemoteRelationResult, len(relations.Relations)), } for i, relation := range rel...
[ "func", "(", "api", "*", "CrossModelRelationsAPI", ")", "RegisterRemoteRelations", "(", "relations", "params", ".", "RegisterRemoteRelationArgs", ",", ")", "(", "params", ".", "RegisterRemoteRelationResults", ",", "error", ")", "{", "results", ":=", "params", ".", ...
// RegisterRemoteRelationArgs sets up the model to participate // in the specified relations. This operation is idempotent.
[ "RegisterRemoteRelationArgs", "sets", "up", "the", "model", "to", "participate", "in", "the", "specified", "relations", ".", "This", "operation", "is", "idempotent", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go#L146-L158
157,810
juju/juju
apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go
WatchRelationUnits
func (api *CrossModelRelationsAPI) WatchRelationUnits(remoteRelationArgs params.RemoteEntityArgs) (params.RelationUnitsWatchResults, error) { results := params.RelationUnitsWatchResults{ Results: make([]params.RelationUnitsWatchResult, len(remoteRelationArgs.Args)), } for i, arg := range remoteRelationArgs.Args { ...
go
func (api *CrossModelRelationsAPI) WatchRelationUnits(remoteRelationArgs params.RemoteEntityArgs) (params.RelationUnitsWatchResults, error) { results := params.RelationUnitsWatchResults{ Results: make([]params.RelationUnitsWatchResult, len(remoteRelationArgs.Args)), } for i, arg := range remoteRelationArgs.Args { ...
[ "func", "(", "api", "*", "CrossModelRelationsAPI", ")", "WatchRelationUnits", "(", "remoteRelationArgs", "params", ".", "RemoteEntityArgs", ")", "(", "params", ".", "RelationUnitsWatchResults", ",", "error", ")", "{", "results", ":=", "params", ".", "RelationUnitsWa...
// WatchRelationUnits starts a RelationUnitsWatcher for watching the // relation units involved in each specified relation, and returns the // watcher IDs and initial values, or an error if the relation units could not be watched.
[ "WatchRelationUnits", "starts", "a", "RelationUnitsWatcher", "for", "watching", "the", "relation", "units", "involved", "in", "each", "specified", "relation", "and", "returns", "the", "watcher", "IDs", "and", "initial", "values", "or", "an", "error", "if", "the", ...
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go#L311-L339
157,811
juju/juju
apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go
RelationUnitSettings
func (api *CrossModelRelationsAPI) RelationUnitSettings(relationUnits params.RemoteRelationUnits) (params.SettingsResults, error) { results := params.SettingsResults{ Results: make([]params.SettingsResult, len(relationUnits.RelationUnits)), } for i, arg := range relationUnits.RelationUnits { relationTag, err := ...
go
func (api *CrossModelRelationsAPI) RelationUnitSettings(relationUnits params.RemoteRelationUnits) (params.SettingsResults, error) { results := params.SettingsResults{ Results: make([]params.SettingsResult, len(relationUnits.RelationUnits)), } for i, arg := range relationUnits.RelationUnits { relationTag, err := ...
[ "func", "(", "api", "*", "CrossModelRelationsAPI", ")", "RelationUnitSettings", "(", "relationUnits", "params", ".", "RemoteRelationUnits", ")", "(", "params", ".", "SettingsResults", ",", "error", ")", "{", "results", ":=", "params", ".", "SettingsResults", "{", ...
// RelationUnitSettings returns the relation unit settings for the given relation units.
[ "RelationUnitSettings", "returns", "the", "relation", "unit", "settings", "for", "the", "given", "relation", "units", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go#L342-L369
157,812
juju/juju
apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go
WatchRelationsSuspendedStatus
func (api *CrossModelRelationsAPI) WatchRelationsSuspendedStatus( remoteRelationArgs params.RemoteEntityArgs, ) (params.RelationStatusWatchResults, error) { results := params.RelationStatusWatchResults{ Results: make([]params.RelationLifeSuspendedStatusWatchResult, len(remoteRelationArgs.Args)), } for i, arg := ...
go
func (api *CrossModelRelationsAPI) WatchRelationsSuspendedStatus( remoteRelationArgs params.RemoteEntityArgs, ) (params.RelationStatusWatchResults, error) { results := params.RelationStatusWatchResults{ Results: make([]params.RelationLifeSuspendedStatusWatchResult, len(remoteRelationArgs.Args)), } for i, arg := ...
[ "func", "(", "api", "*", "CrossModelRelationsAPI", ")", "WatchRelationsSuspendedStatus", "(", "remoteRelationArgs", "params", ".", "RemoteEntityArgs", ",", ")", "(", "params", ".", "RelationStatusWatchResults", ",", "error", ")", "{", "results", ":=", "params", ".",...
// WatchRelationsSuspendedStatus starts a RelationStatusWatcher for // watching the life and suspended status of a relation.
[ "WatchRelationsSuspendedStatus", "starts", "a", "RelationStatusWatcher", "for", "watching", "the", "life", "and", "suspended", "status", "of", "a", "relation", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go#L381-L423
157,813
juju/juju
apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go
WatchOfferStatus
func (api *CrossModelRelationsAPI) WatchOfferStatus( offerArgs params.OfferArgs, ) (params.OfferStatusWatchResults, error) { results := params.OfferStatusWatchResults{ Results: make([]params.OfferStatusWatchResult, len(offerArgs.Args)), } for i, arg := range offerArgs.Args { // Ensure the supplied macaroon all...
go
func (api *CrossModelRelationsAPI) WatchOfferStatus( offerArgs params.OfferArgs, ) (params.OfferStatusWatchResults, error) { results := params.OfferStatusWatchResults{ Results: make([]params.OfferStatusWatchResult, len(offerArgs.Args)), } for i, arg := range offerArgs.Args { // Ensure the supplied macaroon all...
[ "func", "(", "api", "*", "CrossModelRelationsAPI", ")", "WatchOfferStatus", "(", "offerArgs", "params", ".", "OfferArgs", ",", ")", "(", "params", ".", "OfferStatusWatchResults", ",", "error", ")", "{", "results", ":=", "params", ".", "OfferStatusWatchResults", ...
// WatchOfferStatus starts an OfferStatusWatcher for // watching the status of an offer.
[ "WatchOfferStatus", "starts", "an", "OfferStatusWatcher", "for", "watching", "the", "status", "of", "an", "offer", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go#L450-L486
157,814
juju/juju
apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go
PublishIngressNetworkChanges
func (api *CrossModelRelationsAPI) PublishIngressNetworkChanges( changes params.IngressNetworksChanges, ) (params.ErrorResults, error) { results := params.ErrorResults{ Results: make([]params.ErrorResult, len(changes.Changes)), } for i, change := range changes.Changes { relationTag, err := api.st.GetRemoteEntit...
go
func (api *CrossModelRelationsAPI) PublishIngressNetworkChanges( changes params.IngressNetworksChanges, ) (params.ErrorResults, error) { results := params.ErrorResults{ Results: make([]params.ErrorResult, len(changes.Changes)), } for i, change := range changes.Changes { relationTag, err := api.st.GetRemoteEntit...
[ "func", "(", "api", "*", "CrossModelRelationsAPI", ")", "PublishIngressNetworkChanges", "(", "changes", "params", ".", "IngressNetworksChanges", ",", ")", "(", "params", ".", "ErrorResults", ",", "error", ")", "{", "results", ":=", "params", ".", "ErrorResults", ...
// PublishIngressNetworkChanges publishes changes to the required // ingress addresses to the model hosting the offer in the relation.
[ "PublishIngressNetworkChanges", "publishes", "changes", "to", "the", "required", "ingress", "addresses", "to", "the", "model", "hosting", "the", "offer", "in", "the", "relation", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/apiserver/facades/controller/crossmodelrelations/crossmodelrelations.go#L490-L514
157,815
juju/juju
api/common/network.go
InterfaceAddresses
func (n *netPackageConfigSource) InterfaceAddresses(name string) ([]net.Addr, error) { iface, err := net.InterfaceByName(name) if err != nil { return nil, errors.Trace(err) } return iface.Addrs() }
go
func (n *netPackageConfigSource) InterfaceAddresses(name string) ([]net.Addr, error) { iface, err := net.InterfaceByName(name) if err != nil { return nil, errors.Trace(err) } return iface.Addrs() }
[ "func", "(", "n", "*", "netPackageConfigSource", ")", "InterfaceAddresses", "(", "name", "string", ")", "(", "[", "]", "net", ".", "Addr", ",", "error", ")", "{", "iface", ",", "err", ":=", "net", ".", "InterfaceByName", "(", "name", ")", "\n", "if", ...
// InterfaceAddresses implements NetworkConfigSource.
[ "InterfaceAddresses", "implements", "NetworkConfigSource", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/common/network.go#L52-L58
157,816
juju/juju
payload/api/client/public.go
ListFull
func (c PublicClient) ListFull(patterns ...string) ([]payload.FullPayloadInfo, error) { var result params.PayloadListResults args := params.PayloadListArgs{ Patterns: patterns, } if err := c.FacadeCall("List", &args, &result); err != nil { return nil, errors.Trace(err) } payloads := make([]payload.FullPaylo...
go
func (c PublicClient) ListFull(patterns ...string) ([]payload.FullPayloadInfo, error) { var result params.PayloadListResults args := params.PayloadListArgs{ Patterns: patterns, } if err := c.FacadeCall("List", &args, &result); err != nil { return nil, errors.Trace(err) } payloads := make([]payload.FullPaylo...
[ "func", "(", "c", "PublicClient", ")", "ListFull", "(", "patterns", "...", "string", ")", "(", "[", "]", "payload", ".", "FullPayloadInfo", ",", "error", ")", "{", "var", "result", "params", ".", "PayloadListResults", "\n\n", "args", ":=", "params", ".", ...
// ListFull calls the List API server method.
[ "ListFull", "calls", "the", "List", "API", "server", "method", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/payload/api/client/public.go#L39-L59
157,817
juju/juju
cmd/juju/commands/run.go
ConvertActionResults
func ConvertActionResults(result params.ActionResult, query actionQuery) map[string]interface{} { values := make(map[string]interface{}) values[query.receiver.receiverType] = query.receiver.tag.Id() if result.Error != nil { values["Error"] = result.Error.Error() values["Action"] = query.actionTag.Id() return v...
go
func ConvertActionResults(result params.ActionResult, query actionQuery) map[string]interface{} { values := make(map[string]interface{}) values[query.receiver.receiverType] = query.receiver.tag.Id() if result.Error != nil { values["Error"] = result.Error.Error() values["Action"] = query.actionTag.Id() return v...
[ "func", "ConvertActionResults", "(", "result", "params", ".", "ActionResult", ",", "query", "actionQuery", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "values", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n...
// ConvertActionResults takes the results from the api and creates a map // suitable for format conversion to YAML or JSON.
[ "ConvertActionResults", "takes", "the", "results", "from", "the", "api", "and", "creates", "a", "map", "suitable", "for", "format", "conversion", "to", "YAML", "or", "JSON", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/run.go#L194-L238
157,818
juju/juju
cmd/juju/commands/run.go
entities
func entities(actions []actionQuery) params.Entities { entities := params.Entities{ Entities: make([]params.Entity, len(actions)), } for i, action := range actions { entities.Entities[i].Tag = action.actionTag.String() } return entities }
go
func entities(actions []actionQuery) params.Entities { entities := params.Entities{ Entities: make([]params.Entity, len(actions)), } for i, action := range actions { entities.Entities[i].Tag = action.actionTag.String() } return entities }
[ "func", "entities", "(", "actions", "[", "]", "actionQuery", ")", "params", ".", "Entities", "{", "entities", ":=", "params", ".", "Entities", "{", "Entities", ":", "make", "(", "[", "]", "params", ".", "Entity", ",", "len", "(", "actions", ")", ")", ...
// entities is a convenience constructor for params.Entities.
[ "entities", "is", "a", "convenience", "constructor", "for", "params", ".", "Entities", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/cmd/juju/commands/run.go#L431-L439
157,819
juju/juju
api/application/client.go
SetMetricCredentials
func (c *Client) SetMetricCredentials(application string, credentials []byte) error { creds := []params.ApplicationMetricCredential{ {application, credentials}, } p := params.ApplicationMetricCredentials{Creds: creds} results := new(params.ErrorResults) err := c.facade.FacadeCall("SetMetricCredentials", p, resul...
go
func (c *Client) SetMetricCredentials(application string, credentials []byte) error { creds := []params.ApplicationMetricCredential{ {application, credentials}, } p := params.ApplicationMetricCredentials{Creds: creds} results := new(params.ErrorResults) err := c.facade.FacadeCall("SetMetricCredentials", p, resul...
[ "func", "(", "c", "*", "Client", ")", "SetMetricCredentials", "(", "application", "string", ",", "credentials", "[", "]", "byte", ")", "error", "{", "creds", ":=", "[", "]", "params", ".", "ApplicationMetricCredential", "{", "{", "application", ",", "credent...
// SetMetricCredentials sets the metric credentials for the application specified.
[ "SetMetricCredentials", "sets", "the", "metric", "credentials", "for", "the", "application", "specified", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/application/client.go#L45-L56
157,820
juju/juju
api/application/client.go
ModelUUID
func (c *Client) ModelUUID() string { tag, ok := c.st.ModelTag() if !ok { logger.Warningf("controller-only API connection has no model tag") } return tag.Id() }
go
func (c *Client) ModelUUID() string { tag, ok := c.st.ModelTag() if !ok { logger.Warningf("controller-only API connection has no model tag") } return tag.Id() }
[ "func", "(", "c", "*", "Client", ")", "ModelUUID", "(", ")", "string", "{", "tag", ",", "ok", ":=", "c", ".", "st", ".", "ModelTag", "(", ")", "\n", "if", "!", "ok", "{", "logger", ".", "Warningf", "(", "\"", "\"", ")", "\n", "}", "\n", "retu...
// ModelUUID returns the model UUID from the client connection.
[ "ModelUUID", "returns", "the", "model", "UUID", "from", "the", "client", "connection", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/application/client.go#L59-L65
157,821
juju/juju
api/application/client.go
Deploy
func (c *Client) Deploy(args DeployArgs) error { if len(args.AttachStorage) > 0 { if args.NumUnits != 1 { return errors.New("cannot attach existing storage when more than one unit is requested") } if c.BestAPIVersion() < 5 { return errors.New("this juju controller does not support AttachStorage") } } a...
go
func (c *Client) Deploy(args DeployArgs) error { if len(args.AttachStorage) > 0 { if args.NumUnits != 1 { return errors.New("cannot attach existing storage when more than one unit is requested") } if c.BestAPIVersion() < 5 { return errors.New("this juju controller does not support AttachStorage") } } a...
[ "func", "(", "c", "*", "Client", ")", "Deploy", "(", "args", "DeployArgs", ")", "error", "{", "if", "len", "(", "args", ".", "AttachStorage", ")", ">", "0", "{", "if", "args", ".", "NumUnits", "!=", "1", "{", "return", "errors", ".", "New", "(", ...
// Deploy obtains the charm, either locally or from the charm store, and deploys // it. Placement directives, if provided, specify the machine on which the charm // is deployed.
[ "Deploy", "obtains", "the", "charm", "either", "locally", "or", "from", "the", "charm", "store", "and", "deploys", "it", ".", "Placement", "directives", "if", "provided", "specify", "the", "machine", "on", "which", "the", "charm", "is", "deployed", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/application/client.go#L121-L162
157,822
juju/juju
api/application/client.go
GetConfig
func (c *Client) GetConfig(branchName string, appNames ...string) ([]map[string]interface{}, error) { v := c.BestAPIVersion() if v < 5 { settings, err := c.getConfigV4(branchName, appNames) return settings, errors.Trace(err) } callName := "CharmConfig" if v < 6 { callName = "GetConfig" } var callArg int...
go
func (c *Client) GetConfig(branchName string, appNames ...string) ([]map[string]interface{}, error) { v := c.BestAPIVersion() if v < 5 { settings, err := c.getConfigV4(branchName, appNames) return settings, errors.Trace(err) } callName := "CharmConfig" if v < 6 { callName = "GetConfig" } var callArg int...
[ "func", "(", "c", "*", "Client", ")", "GetConfig", "(", "branchName", "string", ",", "appNames", "...", "string", ")", "(", "[", "]", "map", "[", "string", "]", "interface", "{", "}", ",", "error", ")", "{", "v", ":=", "c", ".", "BestAPIVersion", "...
// GetConfig returns the charm configuration settings for each of the // applications. If any of the applications are not found, an error is // returned.
[ "GetConfig", "returns", "the", "charm", "configuration", "settings", "for", "each", "of", "the", "applications", ".", "If", "any", "of", "the", "applications", "are", "not", "found", "an", "error", "is", "returned", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/application/client.go#L185-L228
157,823
juju/juju
api/application/client.go
getConfigV4
func (c *Client) getConfigV4(branchName string, appNames []string) ([]map[string]interface{}, error) { var allSettings []map[string]interface{} for _, appName := range appNames { results, err := c.Get(branchName, appName) if err != nil { return nil, errors.Annotatef(err, "unable to get settings for %q", appNam...
go
func (c *Client) getConfigV4(branchName string, appNames []string) ([]map[string]interface{}, error) { var allSettings []map[string]interface{} for _, appName := range appNames { results, err := c.Get(branchName, appName) if err != nil { return nil, errors.Annotatef(err, "unable to get settings for %q", appNam...
[ "func", "(", "c", "*", "Client", ")", "getConfigV4", "(", "branchName", "string", ",", "appNames", "[", "]", "string", ")", "(", "[", "]", "map", "[", "string", "]", "interface", "{", "}", ",", "error", ")", "{", "var", "allSettings", "[", "]", "ma...
// getConfigV4 retrieves application config for versions of the API < 5.
[ "getConfigV4", "retrieves", "application", "config", "for", "versions", "of", "the", "API", "<", "5", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/application/client.go#L231-L245
157,824
juju/juju
api/application/client.go
describeV5
func describeV5(config map[string]interface{}) (map[string]interface{}, error) { for _, value := range config { vMap, ok := value.(map[string]interface{}) if !ok { return nil, errors.Errorf("expected settings map got %v (%T) ", value, value) } if _, found := vMap["default"]; found { v, hasValue := vMap["...
go
func describeV5(config map[string]interface{}) (map[string]interface{}, error) { for _, value := range config { vMap, ok := value.(map[string]interface{}) if !ok { return nil, errors.Errorf("expected settings map got %v (%T) ", value, value) } if _, found := vMap["default"]; found { v, hasValue := vMap["...
[ "func", "describeV5", "(", "config", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "error", ")", "{", "for", "_", ",", "value", ":=", "range", "config", "{", "vMap", ",", "ok", ...
// describeV5 will take the results of describeV4 from the apiserver // and remove the "default" boolean, and add in "source". // Mutates and returns the config map.
[ "describeV5", "will", "take", "the", "results", "of", "describeV4", "from", "the", "apiserver", "and", "remove", "the", "default", "boolean", "and", "add", "in", "source", ".", "Mutates", "and", "returns", "the", "config", "map", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/application/client.go#L250-L273
157,825
juju/juju
api/application/client.go
SetCharm
func (c *Client) SetCharm(branchName string, cfg SetCharmConfig) error { var storageConstraints map[string]params.StorageConstraints if len(cfg.StorageConstraints) > 0 { storageConstraints = make(map[string]params.StorageConstraints) for name, cons := range cfg.StorageConstraints { size, count := cons.Size, co...
go
func (c *Client) SetCharm(branchName string, cfg SetCharmConfig) error { var storageConstraints map[string]params.StorageConstraints if len(cfg.StorageConstraints) > 0 { storageConstraints = make(map[string]params.StorageConstraints) for name, cons := range cfg.StorageConstraints { size, count := cons.Size, co...
[ "func", "(", "c", "*", "Client", ")", "SetCharm", "(", "branchName", "string", ",", "cfg", "SetCharmConfig", ")", "error", "{", "var", "storageConstraints", "map", "[", "string", "]", "params", ".", "StorageConstraints", "\n", "if", "len", "(", "cfg", ".",...
// SetCharm sets the charm for a given application.
[ "SetCharm", "sets", "the", "charm", "for", "a", "given", "application", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/application/client.go#L321-L355
157,826
juju/juju
api/application/client.go
Update
func (c *Client) Update(args params.ApplicationUpdate) error { return c.facade.FacadeCall("Update", args, nil) }
go
func (c *Client) Update(args params.ApplicationUpdate) error { return c.facade.FacadeCall("Update", args, nil) }
[ "func", "(", "c", "*", "Client", ")", "Update", "(", "args", "params", ".", "ApplicationUpdate", ")", "error", "{", "return", "c", ".", "facade", ".", "FacadeCall", "(", "\"", "\"", ",", "args", ",", "nil", ")", "\n", "}" ]
// Update updates the application attributes, including charm URL, // minimum number of units, settings and constraints.
[ "Update", "updates", "the", "application", "attributes", "including", "charm", "URL", "minimum", "number", "of", "units", "settings", "and", "constraints", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/application/client.go#L359-L361
157,827
juju/juju
api/application/client.go
UpdateApplicationSeries
func (c *Client) UpdateApplicationSeries(appName, series string, force bool) error { args := params.UpdateSeriesArgs{ Args: []params.UpdateSeriesArg{{ Entity: params.Entity{Tag: names.NewApplicationTag(appName).String()}, Force: force, Series: series, }}, } results := new(params.ErrorResults) err := ...
go
func (c *Client) UpdateApplicationSeries(appName, series string, force bool) error { args := params.UpdateSeriesArgs{ Args: []params.UpdateSeriesArg{{ Entity: params.Entity{Tag: names.NewApplicationTag(appName).String()}, Force: force, Series: series, }}, } results := new(params.ErrorResults) err := ...
[ "func", "(", "c", "*", "Client", ")", "UpdateApplicationSeries", "(", "appName", ",", "series", "string", ",", "force", "bool", ")", "error", "{", "args", ":=", "params", ".", "UpdateSeriesArgs", "{", "Args", ":", "[", "]", "params", ".", "UpdateSeriesArg"...
// UpdateApplicationSeries updates the application series in the db.
[ "UpdateApplicationSeries", "updates", "the", "application", "series", "in", "the", "db", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/application/client.go#L364-L379
157,828
juju/juju
api/application/client.go
AddUnits
func (c *Client) AddUnits(args AddUnitsParams) ([]string, error) { if len(args.AttachStorage) > 0 { if args.NumUnits != 1 { return nil, errors.New("cannot attach existing storage when more than one unit is requested") } if c.BestAPIVersion() < 5 { return nil, errors.New("this juju controller does not suppo...
go
func (c *Client) AddUnits(args AddUnitsParams) ([]string, error) { if len(args.AttachStorage) > 0 { if args.NumUnits != 1 { return nil, errors.New("cannot attach existing storage when more than one unit is requested") } if c.BestAPIVersion() < 5 { return nil, errors.New("this juju controller does not suppo...
[ "func", "(", "c", "*", "Client", ")", "AddUnits", "(", "args", "AddUnitsParams", ")", "(", "[", "]", "string", ",", "error", ")", "{", "if", "len", "(", "args", ".", "AttachStorage", ")", ">", "0", "{", "if", "args", ".", "NumUnits", "!=", "1", "...
// AddUnits adds a given number of units to an application using the specified // placement directives to assign units to machines.
[ "AddUnits", "adds", "a", "given", "number", "of", "units", "to", "an", "application", "using", "the", "specified", "placement", "directives", "to", "assign", "units", "to", "machines", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/application/client.go#L406-L431
157,829
juju/juju
api/application/client.go
DestroyUnits
func (c *Client) DestroyUnits(in DestroyUnitsParams) ([]params.DestroyUnitResult, error) { argsV5 := params.DestroyUnitsParams{ Units: make([]params.DestroyUnitParams, 0, len(in.Units)), } allResults := make([]params.DestroyUnitResult, len(in.Units)) index := make([]int, 0, len(in.Units)) for i, name := range in...
go
func (c *Client) DestroyUnits(in DestroyUnitsParams) ([]params.DestroyUnitResult, error) { argsV5 := params.DestroyUnitsParams{ Units: make([]params.DestroyUnitParams, 0, len(in.Units)), } allResults := make([]params.DestroyUnitResult, len(in.Units)) index := make([]int, 0, len(in.Units)) for i, name := range in...
[ "func", "(", "c", "*", "Client", ")", "DestroyUnits", "(", "in", "DestroyUnitsParams", ")", "(", "[", "]", "params", ".", "DestroyUnitResult", ",", "error", ")", "{", "argsV5", ":=", "params", ".", "DestroyUnitsParams", "{", "Units", ":", "make", "(", "[...
// DestroyUnits decreases the number of units dedicated to one or more // applications.
[ "DestroyUnits", "decreases", "the", "number", "of", "units", "dedicated", "to", "one", "or", "more", "applications", "." ]
ba728eedb1e44937c7bdc59f374b06400d0c7133
https://github.com/juju/juju/blob/ba728eedb1e44937c7bdc59f374b06400d0c7133/api/application/client.go#L467-L517
157,830
vitessio/vitess
go/vt/vtgate/planbuilder/ordered_aggregate.go
SetGroupBy
func (oa *orderedAggregate) SetGroupBy(groupBy sqlparser.GroupBy) error { colnum := -1 for _, expr := range groupBy { switch node := expr.(type) { case *sqlparser.ColName: c := node.Metadata.(*column) if c.Origin() == oa { return fmt.Errorf("group by expression cannot reference an aggregate function: %v...
go
func (oa *orderedAggregate) SetGroupBy(groupBy sqlparser.GroupBy) error { colnum := -1 for _, expr := range groupBy { switch node := expr.(type) { case *sqlparser.ColName: c := node.Metadata.(*column) if c.Origin() == oa { return fmt.Errorf("group by expression cannot reference an aggregate function: %v...
[ "func", "(", "oa", "*", "orderedAggregate", ")", "SetGroupBy", "(", "groupBy", "sqlparser", ".", "GroupBy", ")", "error", "{", "colnum", ":=", "-", "1", "\n", "for", "_", ",", "expr", ":=", "range", "groupBy", "{", "switch", "node", ":=", "expr", ".", ...
// SetGroupBy satisfies the builder interface.
[ "SetGroupBy", "satisfies", "the", "builder", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/ordered_aggregate.go#L329-L361
157,831
vitessio/vitess
go/vt/vtgate/planbuilder/ordered_aggregate.go
SetUpperLimit
func (oa *orderedAggregate) SetUpperLimit(count *sqlparser.SQLVal) { oa.input.SetUpperLimit(count) }
go
func (oa *orderedAggregate) SetUpperLimit(count *sqlparser.SQLVal) { oa.input.SetUpperLimit(count) }
[ "func", "(", "oa", "*", "orderedAggregate", ")", "SetUpperLimit", "(", "count", "*", "sqlparser", ".", "SQLVal", ")", "{", "oa", ".", "input", ".", "SetUpperLimit", "(", "count", ")", "\n", "}" ]
// SetUpperLimit satisfies the builder interface.
[ "SetUpperLimit", "satisfies", "the", "builder", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/ordered_aggregate.go#L455-L457
157,832
vitessio/vitess
go/vt/vtgate/planbuilder/ordered_aggregate.go
Wireup
func (oa *orderedAggregate) Wireup(bldr builder, jt *jointab) error { for i, colnum := range oa.eaggr.Keys { if sqltypes.IsText(oa.resultColumns[colnum].column.typ) { // len(oa.resultColumns) does not change. No harm using the value multiple times. oa.eaggr.TruncateColumnCount = len(oa.resultColumns) oa.eag...
go
func (oa *orderedAggregate) Wireup(bldr builder, jt *jointab) error { for i, colnum := range oa.eaggr.Keys { if sqltypes.IsText(oa.resultColumns[colnum].column.typ) { // len(oa.resultColumns) does not change. No harm using the value multiple times. oa.eaggr.TruncateColumnCount = len(oa.resultColumns) oa.eag...
[ "func", "(", "oa", "*", "orderedAggregate", ")", "Wireup", "(", "bldr", "builder", ",", "jt", "*", "jointab", ")", "error", "{", "for", "i", ",", "colnum", ":=", "range", "oa", ".", "eaggr", ".", "Keys", "{", "if", "sqltypes", ".", "IsText", "(", "...
// Wireup satisfies the builder interface. // If text columns are detected in the keys, then the function modifies // the primitive to pull a corresponding weight_string from mysql and // compare those instead. This is because we currently don't have the // ability to mimic mysql's collation behavior.
[ "Wireup", "satisfies", "the", "builder", "interface", ".", "If", "text", "columns", "are", "detected", "in", "the", "keys", "then", "the", "function", "modifies", "the", "primitive", "to", "pull", "a", "corresponding", "weight_string", "from", "mysql", "and", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/planbuilder/ordered_aggregate.go#L469-L478
157,833
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_query.go
ExecuteFetchAsDba
func (agent *ActionAgent) ExecuteFetchAsDba(ctx context.Context, query []byte, dbName string, maxrows int, disableBinlogs bool, reloadSchema bool) (*querypb.QueryResult, error) { // get a connection conn, err := agent.MysqlDaemon.GetDbaConnection() if err != nil { return nil, err } defer conn.Close() // disabl...
go
func (agent *ActionAgent) ExecuteFetchAsDba(ctx context.Context, query []byte, dbName string, maxrows int, disableBinlogs bool, reloadSchema bool) (*querypb.QueryResult, error) { // get a connection conn, err := agent.MysqlDaemon.GetDbaConnection() if err != nil { return nil, err } defer conn.Close() // disabl...
[ "func", "(", "agent", "*", "ActionAgent", ")", "ExecuteFetchAsDba", "(", "ctx", "context", ".", "Context", ",", "query", "[", "]", "byte", ",", "dbName", "string", ",", "maxrows", "int", ",", "disableBinlogs", "bool", ",", "reloadSchema", "bool", ")", "(",...
// ExecuteFetchAsDba will execute the given query, possibly disabling binlogs and reload schema.
[ "ExecuteFetchAsDba", "will", "execute", "the", "given", "query", "possibly", "disabling", "binlogs", "and", "reload", "schema", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_query.go#L28-L70
157,834
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_query.go
ExecuteFetchAsAllPrivs
func (agent *ActionAgent) ExecuteFetchAsAllPrivs(ctx context.Context, query []byte, dbName string, maxrows int, reloadSchema bool) (*querypb.QueryResult, error) { // get a connection conn, err := agent.MysqlDaemon.GetAllPrivsConnection() if err != nil { return nil, err } defer conn.Close() if dbName != "" { ...
go
func (agent *ActionAgent) ExecuteFetchAsAllPrivs(ctx context.Context, query []byte, dbName string, maxrows int, reloadSchema bool) (*querypb.QueryResult, error) { // get a connection conn, err := agent.MysqlDaemon.GetAllPrivsConnection() if err != nil { return nil, err } defer conn.Close() if dbName != "" { ...
[ "func", "(", "agent", "*", "ActionAgent", ")", "ExecuteFetchAsAllPrivs", "(", "ctx", "context", ".", "Context", ",", "query", "[", "]", "byte", ",", "dbName", "string", ",", "maxrows", "int", ",", "reloadSchema", "bool", ")", "(", "*", "querypb", ".", "Q...
// ExecuteFetchAsAllPrivs will execute the given query, possibly reloading schema.
[ "ExecuteFetchAsAllPrivs", "will", "execute", "the", "given", "query", "possibly", "reloading", "schema", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_query.go#L73-L97
157,835
vitessio/vitess
go/vt/vttablet/tabletmanager/rpc_query.go
ExecuteFetchAsApp
func (agent *ActionAgent) ExecuteFetchAsApp(ctx context.Context, query []byte, maxrows int) (*querypb.QueryResult, error) { // get a connection conn, err := agent.MysqlDaemon.GetAppConnection(ctx) if err != nil { return nil, err } defer conn.Recycle() result, err := conn.ExecuteFetch(string(query), maxrows, tru...
go
func (agent *ActionAgent) ExecuteFetchAsApp(ctx context.Context, query []byte, maxrows int) (*querypb.QueryResult, error) { // get a connection conn, err := agent.MysqlDaemon.GetAppConnection(ctx) if err != nil { return nil, err } defer conn.Recycle() result, err := conn.ExecuteFetch(string(query), maxrows, tru...
[ "func", "(", "agent", "*", "ActionAgent", ")", "ExecuteFetchAsApp", "(", "ctx", "context", ".", "Context", ",", "query", "[", "]", "byte", ",", "maxrows", "int", ")", "(", "*", "querypb", ".", "QueryResult", ",", "error", ")", "{", "// get a connection", ...
// ExecuteFetchAsApp will execute the given query.
[ "ExecuteFetchAsApp", "will", "execute", "the", "given", "query", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/rpc_query.go#L100-L109
157,836
vitessio/vitess
go/vt/worker/key_resolver.go
newV2Resolver
func newV2Resolver(keyspaceInfo *topo.KeyspaceInfo, td *tabletmanagerdatapb.TableDefinition) (keyspaceIDResolver, error) { if keyspaceInfo.ShardingColumnName == "" { return nil, vterrors.New(vtrpc.Code_FAILED_PRECONDITION, "ShardingColumnName needs to be set for a v2 sharding key") } if keyspaceInfo.ShardingColumn...
go
func newV2Resolver(keyspaceInfo *topo.KeyspaceInfo, td *tabletmanagerdatapb.TableDefinition) (keyspaceIDResolver, error) { if keyspaceInfo.ShardingColumnName == "" { return nil, vterrors.New(vtrpc.Code_FAILED_PRECONDITION, "ShardingColumnName needs to be set for a v2 sharding key") } if keyspaceInfo.ShardingColumn...
[ "func", "newV2Resolver", "(", "keyspaceInfo", "*", "topo", ".", "KeyspaceInfo", ",", "td", "*", "tabletmanagerdatapb", ".", "TableDefinition", ")", "(", "keyspaceIDResolver", ",", "error", ")", "{", "if", "keyspaceInfo", ".", "ShardingColumnName", "==", "\"", "\...
// newV2Resolver returns a keyspaceIDResolver for a v2 table. // V2 keyspaces have a preset sharding column name and type.
[ "newV2Resolver", "returns", "a", "keyspaceIDResolver", "for", "a", "v2", "table", ".", "V2", "keyspaces", "have", "a", "preset", "sharding", "column", "name", "and", "type", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/key_resolver.go#L54-L72
157,837
vitessio/vitess
go/vt/worker/key_resolver.go
newV3ResolverFromTableDefinition
func newV3ResolverFromTableDefinition(keyspaceSchema *vindexes.KeyspaceSchema, td *tabletmanagerdatapb.TableDefinition) (keyspaceIDResolver, error) { if td.Type != tmutils.TableBaseTable { return nil, vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "a keyspaceID resolver can only be created for a base table, got %v", t...
go
func newV3ResolverFromTableDefinition(keyspaceSchema *vindexes.KeyspaceSchema, td *tabletmanagerdatapb.TableDefinition) (keyspaceIDResolver, error) { if td.Type != tmutils.TableBaseTable { return nil, vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "a keyspaceID resolver can only be created for a base table, got %v", t...
[ "func", "newV3ResolverFromTableDefinition", "(", "keyspaceSchema", "*", "vindexes", ".", "KeyspaceSchema", ",", "td", "*", "tabletmanagerdatapb", ".", "TableDefinition", ")", "(", "keyspaceIDResolver", ",", "error", ")", "{", "if", "td", ".", "Type", "!=", "tmutil...
// newV3ResolverFromTableDefinition returns a keyspaceIDResolver for a v3 table.
[ "newV3ResolverFromTableDefinition", "returns", "a", "keyspaceIDResolver", "for", "a", "v3", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/key_resolver.go#L100-L124
157,838
vitessio/vitess
go/vt/worker/key_resolver.go
newV3ResolverFromColumnList
func newV3ResolverFromColumnList(keyspaceSchema *vindexes.KeyspaceSchema, name string, columns []string) (keyspaceIDResolver, error) { tableSchema, ok := keyspaceSchema.Tables[name] if !ok { return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "no vschema definition for table %v", name) } // use the lowest...
go
func newV3ResolverFromColumnList(keyspaceSchema *vindexes.KeyspaceSchema, name string, columns []string) (keyspaceIDResolver, error) { tableSchema, ok := keyspaceSchema.Tables[name] if !ok { return nil, vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "no vschema definition for table %v", name) } // use the lowest...
[ "func", "newV3ResolverFromColumnList", "(", "keyspaceSchema", "*", "vindexes", ".", "KeyspaceSchema", ",", "name", "string", ",", "columns", "[", "]", "string", ")", "(", "keyspaceIDResolver", ",", "error", ")", "{", "tableSchema", ",", "ok", ":=", "keyspaceSche...
// newV3ResolverFromColumnList returns a keyspaceIDResolver for a v3 table.
[ "newV3ResolverFromColumnList", "returns", "a", "keyspaceIDResolver", "for", "a", "v3", "table", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/key_resolver.go#L127-L154
157,839
vitessio/vitess
go/vt/zkctl/zkctl.go
Shutdown
func (zkd *Zkd) Shutdown() error { log.Infof("zkctl.Shutdown") pidData, err := ioutil.ReadFile(zkd.config.PidFile()) if err != nil { return err } pid, err := strconv.Atoi(string(bytes.TrimSpace(pidData))) if err != nil { return err } err = syscall.Kill(pid, syscall.SIGKILL) if err != nil && err != syscall....
go
func (zkd *Zkd) Shutdown() error { log.Infof("zkctl.Shutdown") pidData, err := ioutil.ReadFile(zkd.config.PidFile()) if err != nil { return err } pid, err := strconv.Atoi(string(bytes.TrimSpace(pidData))) if err != nil { return err } err = syscall.Kill(pid, syscall.SIGKILL) if err != nil && err != syscall....
[ "func", "(", "zkd", "*", "Zkd", ")", "Shutdown", "(", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", ")", "\n", "pidData", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "zkd", ".", "config", ".", "PidFile", "(", ")", ")", "\n", "i...
// Shutdown kills a ZooKeeper server, but keeps its data dir intact.
[ "Shutdown", "kills", "a", "ZooKeeper", "server", "but", "keeps", "its", "data", "dir", "intact", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/zkctl/zkctl.go#L127-L148
157,840
vitessio/vitess
go/vt/zkctl/zkctl.go
Init
func (zkd *Zkd) Init() error { if zkd.Inited() { return fmt.Errorf("zk already inited") } log.Infof("zkd.Init") for _, path := range zkd.config.DirectoryList() { if err := os.MkdirAll(path, 0775); err != nil { log.Errorf("%v", err) return err } // FIXME(msolomon) validate permissions? } configData...
go
func (zkd *Zkd) Init() error { if zkd.Inited() { return fmt.Errorf("zk already inited") } log.Infof("zkd.Init") for _, path := range zkd.config.DirectoryList() { if err := os.MkdirAll(path, 0775); err != nil { log.Errorf("%v", err) return err } // FIXME(msolomon) validate permissions? } configData...
[ "func", "(", "zkd", "*", "Zkd", ")", "Init", "(", ")", "error", "{", "if", "zkd", ".", "Inited", "(", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "log", ".", "Infof", "(", "\"", "\"", ")", "\n", "for", ...
// Init generates a new config and then starts ZooKeeper.
[ "Init", "generates", "a", "new", "config", "and", "then", "starts", "ZooKeeper", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/zkctl/zkctl.go#L160-L210
157,841
vitessio/vitess
go/vt/zkctl/zkctl.go
Teardown
func (zkd *Zkd) Teardown() error { log.Infof("zkctl.Teardown") if err := zkd.Shutdown(); err != nil { log.Warningf("failed zookeeper shutdown: %v", err.Error()) } var removalErr error for _, dir := range zkd.config.DirectoryList() { log.V(6).Infof("remove data dir %v", dir) if err := os.RemoveAll(dir); err !...
go
func (zkd *Zkd) Teardown() error { log.Infof("zkctl.Teardown") if err := zkd.Shutdown(); err != nil { log.Warningf("failed zookeeper shutdown: %v", err.Error()) } var removalErr error for _, dir := range zkd.config.DirectoryList() { log.V(6).Infof("remove data dir %v", dir) if err := os.RemoveAll(dir); err !...
[ "func", "(", "zkd", "*", "Zkd", ")", "Teardown", "(", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", ")", "\n", "if", "err", ":=", "zkd", ".", "Shutdown", "(", ")", ";", "err", "!=", "nil", "{", "log", ".", "Warningf", "(", "\"", "\...
// Teardown shuts down the server and removes its data dir.
[ "Teardown", "shuts", "down", "the", "server", "and", "removes", "its", "data", "dir", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/zkctl/zkctl.go#L213-L227
157,842
vitessio/vitess
go/vt/zkctl/zkctl.go
Inited
func (zkd *Zkd) Inited() bool { myidFile := zkd.config.MyidFile() _, statErr := os.Stat(myidFile) if statErr == nil { return true } else if statErr.(*os.PathError).Err != syscall.ENOENT { panic("can't access file " + myidFile + ": " + statErr.Error()) } return false }
go
func (zkd *Zkd) Inited() bool { myidFile := zkd.config.MyidFile() _, statErr := os.Stat(myidFile) if statErr == nil { return true } else if statErr.(*os.PathError).Err != syscall.ENOENT { panic("can't access file " + myidFile + ": " + statErr.Error()) } return false }
[ "func", "(", "zkd", "*", "Zkd", ")", "Inited", "(", ")", "bool", "{", "myidFile", ":=", "zkd", ".", "config", ".", "MyidFile", "(", ")", "\n", "_", ",", "statErr", ":=", "os", ".", "Stat", "(", "myidFile", ")", "\n", "if", "statErr", "==", "nil",...
// Inited returns true if the server config has been initialized.
[ "Inited", "returns", "true", "if", "the", "server", "config", "has", "been", "initialized", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/zkctl/zkctl.go#L230-L239
157,843
vitessio/vitess
go/vt/servenv/servenv.go
Init
func Init() { mu.Lock() defer mu.Unlock() if inited { log.Fatal("servenv.Init called second time") } inited = true // Once you run as root, you pretty much destroy the chances of a // non-privileged user starting the program correctly. if uid := os.Getuid(); uid == 0 { log.Exitf("servenv.Init: running this...
go
func Init() { mu.Lock() defer mu.Unlock() if inited { log.Fatal("servenv.Init called second time") } inited = true // Once you run as root, you pretty much destroy the chances of a // non-privileged user starting the program correctly. if uid := os.Getuid(); uid == 0 { log.Exitf("servenv.Init: running this...
[ "func", "Init", "(", ")", "{", "mu", ".", "Lock", "(", ")", "\n", "defer", "mu", ".", "Unlock", "(", ")", "\n", "if", "inited", "{", "log", ".", "Fatal", "(", "\"", "\"", ")", "\n", "}", "\n", "inited", "=", "true", "\n\n", "// Once you run as ro...
// Init is the first phase of the server startup.
[ "Init", "is", "the", "first", "phase", "of", "the", "server", "startup", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/servenv.go#L77-L111
157,844
vitessio/vitess
go/vt/servenv/servenv.go
fireOnTermSyncHooks
func fireOnTermSyncHooks(timeout time.Duration) bool { log.Infof("Firing synchronous OnTermSync hooks and waiting up to %v for them", timeout) timer := time.NewTimer(timeout) defer timer.Stop() done := make(chan struct{}) go func() { onTermSyncHooks.Fire() close(done) }() select { case <-done: log.Info...
go
func fireOnTermSyncHooks(timeout time.Duration) bool { log.Infof("Firing synchronous OnTermSync hooks and waiting up to %v for them", timeout) timer := time.NewTimer(timeout) defer timer.Stop() done := make(chan struct{}) go func() { onTermSyncHooks.Fire() close(done) }() select { case <-done: log.Info...
[ "func", "fireOnTermSyncHooks", "(", "timeout", "time", ".", "Duration", ")", "bool", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "timeout", ")", "\n\n", "timer", ":=", "time", ".", "NewTimer", "(", "timeout", ")", "\n", "defer", "timer", ".", "Stop...
// fireOnTermSyncHooks returns true iff all the hooks finish before the timeout.
[ "fireOnTermSyncHooks", "returns", "true", "iff", "all", "the", "hooks", "finish", "before", "the", "timeout", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/servenv.go#L157-L177
157,845
vitessio/vitess
go/vt/servenv/servenv.go
ParseFlags
func ParseFlags(cmd string) { flag.Parse() if *Version { AppVersion.Print() os.Exit(0) } args := flag.Args() if len(args) > 0 { flag.Usage() log.Exitf("%s doesn't take any positional arguments, got '%s'", cmd, strings.Join(args, " ")) } }
go
func ParseFlags(cmd string) { flag.Parse() if *Version { AppVersion.Print() os.Exit(0) } args := flag.Args() if len(args) > 0 { flag.Usage() log.Exitf("%s doesn't take any positional arguments, got '%s'", cmd, strings.Join(args, " ")) } }
[ "func", "ParseFlags", "(", "cmd", "string", ")", "{", "flag", ".", "Parse", "(", ")", "\n\n", "if", "*", "Version", "{", "AppVersion", ".", "Print", "(", ")", "\n", "os", ".", "Exit", "(", "0", ")", "\n", "}", "\n\n", "args", ":=", "flag", ".", ...
// ParseFlags initializes flags and handles the common case when no positional // arguments are expected.
[ "ParseFlags", "initializes", "flags", "and", "handles", "the", "common", "case", "when", "no", "positional", "arguments", "are", "expected", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/servenv.go#L206-L219
157,846
vitessio/vitess
go/vt/servenv/servenv.go
ParseFlagsWithArgs
func ParseFlagsWithArgs(cmd string) []string { flag.Parse() if *Version { AppVersion.Print() os.Exit(0) } args := flag.Args() if len(args) == 0 { log.Exitf("%s expected at least one positional argument", cmd) } return args }
go
func ParseFlagsWithArgs(cmd string) []string { flag.Parse() if *Version { AppVersion.Print() os.Exit(0) } args := flag.Args() if len(args) == 0 { log.Exitf("%s expected at least one positional argument", cmd) } return args }
[ "func", "ParseFlagsWithArgs", "(", "cmd", "string", ")", "[", "]", "string", "{", "flag", ".", "Parse", "(", ")", "\n\n", "if", "*", "Version", "{", "AppVersion", ".", "Print", "(", ")", "\n", "os", ".", "Exit", "(", "0", ")", "\n", "}", "\n\n", ...
// ParseFlagsWithArgs initializes flags and returns the positional arguments
[ "ParseFlagsWithArgs", "initializes", "flags", "and", "returns", "the", "positional", "arguments" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/servenv.go#L222-L236
157,847
vitessio/vitess
go/vt/vttablet/tabletserver/tx_engine.go
NewTxEngine
func NewTxEngine(checker connpool.MySQLChecker, config tabletenv.TabletConfig) *TxEngine { te := &TxEngine{ shutdownGracePeriod: time.Duration(config.TxShutDownGracePeriod * 1e9), } limiter := txlimiter.New( config.TransactionCap, config.TransactionLimitPerUser, config.EnableTransactionLimit, config.Enable...
go
func NewTxEngine(checker connpool.MySQLChecker, config tabletenv.TabletConfig) *TxEngine { te := &TxEngine{ shutdownGracePeriod: time.Duration(config.TxShutDownGracePeriod * 1e9), } limiter := txlimiter.New( config.TransactionCap, config.TransactionLimitPerUser, config.EnableTransactionLimit, config.Enable...
[ "func", "NewTxEngine", "(", "checker", "connpool", ".", "MySQLChecker", ",", "config", "tabletenv", ".", "TabletConfig", ")", "*", "TxEngine", "{", "te", ":=", "&", "TxEngine", "{", "shutdownGracePeriod", ":", "time", ".", "Duration", "(", "config", ".", "Tx...
// NewTxEngine creates a new TxEngine.
[ "NewTxEngine", "creates", "a", "new", "TxEngine", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_engine.go#L101-L161
157,848
vitessio/vitess
go/vt/vttablet/tabletserver/tx_engine.go
AcceptReadWrite
func (te *TxEngine) AcceptReadWrite() error { te.beginRequests.Wait() te.stateLock.Lock() switch te.state { case AcceptingReadAndWrite: // Nothing to do te.stateLock.Unlock() return nil case NotServing: te.state = AcceptingReadAndWrite te.open() te.stateLock.Unlock() return nil case Transitioning...
go
func (te *TxEngine) AcceptReadWrite() error { te.beginRequests.Wait() te.stateLock.Lock() switch te.state { case AcceptingReadAndWrite: // Nothing to do te.stateLock.Unlock() return nil case NotServing: te.state = AcceptingReadAndWrite te.open() te.stateLock.Unlock() return nil case Transitioning...
[ "func", "(", "te", "*", "TxEngine", ")", "AcceptReadWrite", "(", ")", "error", "{", "te", ".", "beginRequests", ".", "Wait", "(", ")", "\n", "te", ".", "stateLock", ".", "Lock", "(", ")", "\n\n", "switch", "te", ".", "state", "{", "case", "AcceptingR...
// AcceptReadWrite will start accepting all transactions. // If transitioning from RO mode, transactions might need to be // rolled back before new transactions can be accepts.
[ "AcceptReadWrite", "will", "start", "accepting", "all", "transactions", ".", "If", "transitioning", "from", "RO", "mode", "transactions", "might", "need", "to", "be", "rolled", "back", "before", "new", "transactions", "can", "be", "accepts", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_engine.go#L199-L232
157,849
vitessio/vitess
go/vt/vttablet/tabletserver/tx_engine.go
AcceptReadOnly
func (te *TxEngine) AcceptReadOnly() error { te.beginRequests.Wait() te.stateLock.Lock() switch te.state { case AcceptingReadOnly: // Nothing to do te.stateLock.Unlock() return nil case NotServing: te.state = AcceptingReadOnly te.open() te.stateLock.Unlock() return nil case AcceptingReadAndWrite: ...
go
func (te *TxEngine) AcceptReadOnly() error { te.beginRequests.Wait() te.stateLock.Lock() switch te.state { case AcceptingReadOnly: // Nothing to do te.stateLock.Unlock() return nil case NotServing: te.state = AcceptingReadOnly te.open() te.stateLock.Unlock() return nil case AcceptingReadAndWrite: ...
[ "func", "(", "te", "*", "TxEngine", ")", "AcceptReadOnly", "(", ")", "error", "{", "te", ".", "beginRequests", ".", "Wait", "(", ")", "\n", "te", ".", "stateLock", ".", "Lock", "(", ")", "\n", "switch", "te", ".", "state", "{", "case", "AcceptingRead...
// AcceptReadOnly will start accepting read-only transactions, but not full read and write transactions. // If the engine is currently accepting full read and write transactions, they need to // be rolled back.
[ "AcceptReadOnly", "will", "start", "accepting", "read", "-", "only", "transactions", "but", "not", "full", "read", "and", "write", "transactions", ".", "If", "the", "engine", "is", "currently", "accepting", "full", "read", "and", "write", "transactions", "they",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_engine.go#L237-L265
157,850
vitessio/vitess
go/vt/vttablet/tabletserver/tx_engine.go
Init
func (te *TxEngine) Init() error { if te.twopcEnabled { return te.twoPC.Init(te.dbconfigs.SidecarDBName.Get(), te.dbconfigs.DbaWithDB()) } return nil }
go
func (te *TxEngine) Init() error { if te.twopcEnabled { return te.twoPC.Init(te.dbconfigs.SidecarDBName.Get(), te.dbconfigs.DbaWithDB()) } return nil }
[ "func", "(", "te", "*", "TxEngine", ")", "Init", "(", ")", "error", "{", "if", "te", ".", "twopcEnabled", "{", "return", "te", ".", "twoPC", ".", "Init", "(", "te", ".", "dbconfigs", ".", "SidecarDBName", ".", "Get", "(", ")", ",", "te", ".", "db...
// Init must be called once when vttablet starts for setting // up the metadata tables.
[ "Init", "must", "be", "called", "once", "when", "vttablet", "starts", "for", "setting", "up", "the", "metadata", "tables", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_engine.go#L366-L371
157,851
vitessio/vitess
go/vt/vttablet/tabletserver/tx_engine.go
open
func (te *TxEngine) open() { te.txPool.Open(te.dbconfigs.AppWithDB(), te.dbconfigs.DbaWithDB(), te.dbconfigs.AppDebugWithDB()) if te.twopcEnabled && te.state == AcceptingReadAndWrite { te.twoPC.Open(te.dbconfigs) if err := te.prepareFromRedo(); err != nil { // If this operation fails, we choose to raise an al...
go
func (te *TxEngine) open() { te.txPool.Open(te.dbconfigs.AppWithDB(), te.dbconfigs.DbaWithDB(), te.dbconfigs.AppDebugWithDB()) if te.twopcEnabled && te.state == AcceptingReadAndWrite { te.twoPC.Open(te.dbconfigs) if err := te.prepareFromRedo(); err != nil { // If this operation fails, we choose to raise an al...
[ "func", "(", "te", "*", "TxEngine", ")", "open", "(", ")", "{", "te", ".", "txPool", ".", "Open", "(", "te", ".", "dbconfigs", ".", "AppWithDB", "(", ")", ",", "te", ".", "dbconfigs", ".", "DbaWithDB", "(", ")", ",", "te", ".", "dbconfigs", ".", ...
// open opens the TxEngine. If 2pc is enabled, it restores // all previously prepared transactions from the redo log. // this should only be called when the state is already locked
[ "open", "opens", "the", "TxEngine", ".", "If", "2pc", "is", "enabled", "it", "restores", "all", "previously", "prepared", "transactions", "from", "the", "redo", "log", ".", "this", "should", "only", "be", "called", "when", "the", "state", "is", "already", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_engine.go#L376-L390
157,852
vitessio/vitess
go/vt/vttablet/tabletserver/tx_engine.go
StopGently
func (te *TxEngine) StopGently() { te.stateLock.Lock() defer te.stateLock.Unlock() te.close(false) te.state = NotServing }
go
func (te *TxEngine) StopGently() { te.stateLock.Lock() defer te.stateLock.Unlock() te.close(false) te.state = NotServing }
[ "func", "(", "te", "*", "TxEngine", ")", "StopGently", "(", ")", "{", "te", ".", "stateLock", ".", "Lock", "(", ")", "\n", "defer", "te", ".", "stateLock", ".", "Unlock", "(", ")", "\n", "te", ".", "close", "(", "false", ")", "\n", "te", ".", "...
// StopGently will disregard common rules for when to kill transactions // and wait forever for transactions to wrap up
[ "StopGently", "will", "disregard", "common", "rules", "for", "when", "to", "kill", "transactions", "and", "wait", "forever", "for", "transactions", "to", "wrap", "up" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_engine.go#L394-L399
157,853
vitessio/vitess
go/vt/vttablet/tabletserver/tx_engine.go
close
func (te *TxEngine) close(immediate bool) { // Shut down functions are idempotent. // No need to check if 2pc is enabled. te.stopWatchdog() poolEmpty := make(chan bool) rollbackDone := make(chan bool) // This goroutine decides if transactions have to be // forced to rollback, and if so, when. Once done, // the...
go
func (te *TxEngine) close(immediate bool) { // Shut down functions are idempotent. // No need to check if 2pc is enabled. te.stopWatchdog() poolEmpty := make(chan bool) rollbackDone := make(chan bool) // This goroutine decides if transactions have to be // forced to rollback, and if so, when. Once done, // the...
[ "func", "(", "te", "*", "TxEngine", ")", "close", "(", "immediate", "bool", ")", "{", "// Shut down functions are idempotent.", "// No need to check if 2pc is enabled.", "te", ".", "stopWatchdog", "(", ")", "\n\n", "poolEmpty", ":=", "make", "(", "chan", "bool", "...
// Close closes the TxEngine. If the immediate flag is on, // then all current transactions are immediately rolled back. // Otherwise, the function waits for all current transactions // to conclude. If a shutdown grace period was specified, // the transactions are rolled back if they're not resolved // by that time.
[ "Close", "closes", "the", "TxEngine", ".", "If", "the", "immediate", "flag", "is", "on", "then", "all", "current", "transactions", "are", "immediately", "rolled", "back", ".", "Otherwise", "the", "function", "waits", "for", "all", "current", "transactions", "t...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_engine.go#L407-L454
157,854
vitessio/vitess
go/vt/vttablet/tabletserver/tx_engine.go
prepareFromRedo
func (te *TxEngine) prepareFromRedo() error { ctx := tabletenv.LocalContext() var allErr concurrency.AllErrorRecorder prepared, failed, err := te.twoPC.ReadAllRedo(ctx) if err != nil { return err } maxid := int64(0) outer: for _, tx := range prepared { txid, err := dtids.TransactionID(tx.Dtid) if err != n...
go
func (te *TxEngine) prepareFromRedo() error { ctx := tabletenv.LocalContext() var allErr concurrency.AllErrorRecorder prepared, failed, err := te.twoPC.ReadAllRedo(ctx) if err != nil { return err } maxid := int64(0) outer: for _, tx := range prepared { txid, err := dtids.TransactionID(tx.Dtid) if err != n...
[ "func", "(", "te", "*", "TxEngine", ")", "prepareFromRedo", "(", ")", "error", "{", "ctx", ":=", "tabletenv", ".", "LocalContext", "(", ")", "\n", "var", "allErr", "concurrency", ".", "AllErrorRecorder", "\n", "prepared", ",", "failed", ",", "err", ":=", ...
// prepareFromRedo replays and prepares the transactions // from the redo log, loads previously failed transactions // into the reserved list, and adjusts the txPool LastID // to ensure there are no future collisions.
[ "prepareFromRedo", "replays", "and", "prepares", "the", "transactions", "from", "the", "redo", "log", "loads", "previously", "failed", "transactions", "into", "the", "reserved", "list", "and", "adjusts", "the", "txPool", "LastID", "to", "ensure", "there", "are", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_engine.go#L460-L513
157,855
vitessio/vitess
go/vt/vttablet/tabletserver/tx_engine.go
rollbackTransactions
func (te *TxEngine) rollbackTransactions() { ctx := tabletenv.LocalContext() for _, c := range te.preparedPool.FetchAll() { te.txPool.LocalConclude(ctx, c) } // The order of rollbacks is currently not material because // we don't allow new statements or commits during // this function. In case of any such chang...
go
func (te *TxEngine) rollbackTransactions() { ctx := tabletenv.LocalContext() for _, c := range te.preparedPool.FetchAll() { te.txPool.LocalConclude(ctx, c) } // The order of rollbacks is currently not material because // we don't allow new statements or commits during // this function. In case of any such chang...
[ "func", "(", "te", "*", "TxEngine", ")", "rollbackTransactions", "(", ")", "{", "ctx", ":=", "tabletenv", ".", "LocalContext", "(", ")", "\n", "for", "_", ",", "c", ":=", "range", "te", ".", "preparedPool", ".", "FetchAll", "(", ")", "{", "te", ".", ...
// rollbackTransactions rolls back all open transactions // including the prepared ones. // This is used for transitioning from a master to a non-master // serving type.
[ "rollbackTransactions", "rolls", "back", "all", "open", "transactions", "including", "the", "prepared", "ones", ".", "This", "is", "used", "for", "transitioning", "from", "a", "master", "to", "a", "non", "-", "master", "serving", "type", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_engine.go#L519-L529
157,856
vitessio/vitess
go/vt/vttablet/tabletserver/tx_engine.go
startWatchdog
func (te *TxEngine) startWatchdog() { te.ticks.Start(func() { ctx, cancel := context.WithTimeout(tabletenv.LocalContext(), te.abandonAge/4) defer cancel() // Raise alerts on prepares that have been unresolved for too long. // Use 5x abandonAge to give opportunity for watchdog to resolve these. count, err :=...
go
func (te *TxEngine) startWatchdog() { te.ticks.Start(func() { ctx, cancel := context.WithTimeout(tabletenv.LocalContext(), te.abandonAge/4) defer cancel() // Raise alerts on prepares that have been unresolved for too long. // Use 5x abandonAge to give opportunity for watchdog to resolve these. count, err :=...
[ "func", "(", "te", "*", "TxEngine", ")", "startWatchdog", "(", ")", "{", "te", ".", "ticks", ".", "Start", "(", "func", "(", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "tabletenv", ".", "LocalContext", "(", ")", ",", ...
// startWatchdog starts the watchdog goroutine, which looks for abandoned // transactions and calls the notifier on them.
[ "startWatchdog", "starts", "the", "watchdog", "goroutine", "which", "looks", "for", "abandoned", "transactions", "and", "calls", "the", "notifier", "on", "them", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletserver/tx_engine.go#L540-L586
157,857
vitessio/vitess
go/vt/vtgate/tx_conn.go
NewTxConn
func NewTxConn(gw gateway.Gateway, txMode vtgatepb.TransactionMode) *TxConn { return &TxConn{ gateway: gw, mode: txMode, } }
go
func NewTxConn(gw gateway.Gateway, txMode vtgatepb.TransactionMode) *TxConn { return &TxConn{ gateway: gw, mode: txMode, } }
[ "func", "NewTxConn", "(", "gw", "gateway", ".", "Gateway", ",", "txMode", "vtgatepb", ".", "TransactionMode", ")", "*", "TxConn", "{", "return", "&", "TxConn", "{", "gateway", ":", "gw", ",", "mode", ":", "txMode", ",", "}", "\n", "}" ]
// NewTxConn builds a new TxConn.
[ "NewTxConn", "builds", "a", "new", "TxConn", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/tx_conn.go#L42-L47
157,858
vitessio/vitess
go/vt/vtgate/tx_conn.go
Begin
func (txc *TxConn) Begin(ctx context.Context, session *SafeSession) error { if session.InTransaction() { if err := txc.Commit(ctx, session); err != nil { return err } } // UNSPECIFIED & SINGLE mode are always allowed. switch session.TransactionMode { case vtgatepb.TransactionMode_MULTI: if txc.mode == vtg...
go
func (txc *TxConn) Begin(ctx context.Context, session *SafeSession) error { if session.InTransaction() { if err := txc.Commit(ctx, session); err != nil { return err } } // UNSPECIFIED & SINGLE mode are always allowed. switch session.TransactionMode { case vtgatepb.TransactionMode_MULTI: if txc.mode == vtg...
[ "func", "(", "txc", "*", "TxConn", ")", "Begin", "(", "ctx", "context", ".", "Context", ",", "session", "*", "SafeSession", ")", "error", "{", "if", "session", ".", "InTransaction", "(", ")", "{", "if", "err", ":=", "txc", ".", "Commit", "(", "ctx", ...
// Begin begins a new transaction. If one is already in progress, it commmits it // and starts a new one.
[ "Begin", "begins", "a", "new", "transaction", ".", "If", "one", "is", "already", "in", "progress", "it", "commmits", "it", "and", "starts", "a", "new", "one", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/tx_conn.go#L51-L70
157,859
vitessio/vitess
go/vt/vtgate/tx_conn.go
Commit
func (txc *TxConn) Commit(ctx context.Context, session *SafeSession) error { defer session.Reset() if !session.InTransaction() { return nil } twopc := false switch session.TransactionMode { case vtgatepb.TransactionMode_TWOPC: if txc.mode != vtgatepb.TransactionMode_TWOPC { txc.Rollback(ctx, session) r...
go
func (txc *TxConn) Commit(ctx context.Context, session *SafeSession) error { defer session.Reset() if !session.InTransaction() { return nil } twopc := false switch session.TransactionMode { case vtgatepb.TransactionMode_TWOPC: if txc.mode != vtgatepb.TransactionMode_TWOPC { txc.Rollback(ctx, session) r...
[ "func", "(", "txc", "*", "TxConn", ")", "Commit", "(", "ctx", "context", ".", "Context", ",", "session", "*", "SafeSession", ")", "error", "{", "defer", "session", ".", "Reset", "(", ")", "\n", "if", "!", "session", ".", "InTransaction", "(", ")", "{...
// Commit commits the current transaction. The type of commit can be // best effort or 2pc depending on the session setting.
[ "Commit", "commits", "the", "current", "transaction", ".", "The", "type", "of", "commit", "can", "be", "best", "effort", "or", "2pc", "depending", "on", "the", "session", "setting", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/tx_conn.go#L74-L95
157,860
vitessio/vitess
go/vt/vtgate/tx_conn.go
Rollback
func (txc *TxConn) Rollback(ctx context.Context, session *SafeSession) error { if !session.InTransaction() { return nil } defer session.Reset() return txc.runSessions(session.ShardSessions, func(s *vtgatepb.Session_ShardSession) error { return txc.gateway.Rollback(ctx, s.Target, s.TransactionId) }) }
go
func (txc *TxConn) Rollback(ctx context.Context, session *SafeSession) error { if !session.InTransaction() { return nil } defer session.Reset() return txc.runSessions(session.ShardSessions, func(s *vtgatepb.Session_ShardSession) error { return txc.gateway.Rollback(ctx, s.Target, s.TransactionId) }) }
[ "func", "(", "txc", "*", "TxConn", ")", "Rollback", "(", "ctx", "context", ".", "Context", ",", "session", "*", "SafeSession", ")", "error", "{", "if", "!", "session", ".", "InTransaction", "(", ")", "{", "return", "nil", "\n", "}", "\n", "defer", "s...
// Rollback rolls back the current transaction. There are no retries on this operation.
[ "Rollback", "rolls", "back", "the", "current", "transaction", ".", "There", "are", "no", "retries", "on", "this", "operation", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/tx_conn.go#L160-L169
157,861
vitessio/vitess
go/vt/vtgate/tx_conn.go
Resolve
func (txc *TxConn) Resolve(ctx context.Context, dtid string) error { mmShard, err := dtids.ShardSession(dtid) if err != nil { return err } transaction, err := txc.gateway.ReadTransaction(ctx, mmShard.Target, dtid) if err != nil { return err } if transaction == nil || transaction.Dtid == "" { // It was alr...
go
func (txc *TxConn) Resolve(ctx context.Context, dtid string) error { mmShard, err := dtids.ShardSession(dtid) if err != nil { return err } transaction, err := txc.gateway.ReadTransaction(ctx, mmShard.Target, dtid) if err != nil { return err } if transaction == nil || transaction.Dtid == "" { // It was alr...
[ "func", "(", "txc", "*", "TxConn", ")", "Resolve", "(", "ctx", "context", ".", "Context", ",", "dtid", "string", ")", "error", "{", "mmShard", ",", "err", ":=", "dtids", ".", "ShardSession", "(", "dtid", ")", "\n", "if", "err", "!=", "nil", "{", "r...
// Resolve resolves the specified 2PC transaction.
[ "Resolve", "resolves", "the", "specified", "2PC", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/tx_conn.go#L172-L207
157,862
vitessio/vitess
go/vt/vtgate/tx_conn.go
runSessions
func (txc *TxConn) runSessions(shardSessions []*vtgatepb.Session_ShardSession, action func(*vtgatepb.Session_ShardSession) error) error { // Fastpath. if len(shardSessions) == 1 { return action(shardSessions[0]) } allErrors := new(concurrency.AllErrorRecorder) var wg sync.WaitGroup for _, s := range shardSessi...
go
func (txc *TxConn) runSessions(shardSessions []*vtgatepb.Session_ShardSession, action func(*vtgatepb.Session_ShardSession) error) error { // Fastpath. if len(shardSessions) == 1 { return action(shardSessions[0]) } allErrors := new(concurrency.AllErrorRecorder) var wg sync.WaitGroup for _, s := range shardSessi...
[ "func", "(", "txc", "*", "TxConn", ")", "runSessions", "(", "shardSessions", "[", "]", "*", "vtgatepb", ".", "Session_ShardSession", ",", "action", "func", "(", "*", "vtgatepb", ".", "Session_ShardSession", ")", "error", ")", "error", "{", "// Fastpath.", "i...
// runSessions executes the action for all shardSessions in parallel and returns a consolildated error.
[ "runSessions", "executes", "the", "action", "for", "all", "shardSessions", "in", "parallel", "and", "returns", "a", "consolildated", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/tx_conn.go#L230-L249
157,863
vitessio/vitess
go/vt/vtgate/tx_conn.go
runTargets
func (txc *TxConn) runTargets(targets []*querypb.Target, action func(*querypb.Target) error) error { if len(targets) == 1 { return action(targets[0]) } allErrors := new(concurrency.AllErrorRecorder) var wg sync.WaitGroup for _, t := range targets { wg.Add(1) go func(t *querypb.Target) { defer wg.Done() ...
go
func (txc *TxConn) runTargets(targets []*querypb.Target, action func(*querypb.Target) error) error { if len(targets) == 1 { return action(targets[0]) } allErrors := new(concurrency.AllErrorRecorder) var wg sync.WaitGroup for _, t := range targets { wg.Add(1) go func(t *querypb.Target) { defer wg.Done() ...
[ "func", "(", "txc", "*", "TxConn", ")", "runTargets", "(", "targets", "[", "]", "*", "querypb", ".", "Target", ",", "action", "func", "(", "*", "querypb", ".", "Target", ")", "error", ")", "error", "{", "if", "len", "(", "targets", ")", "==", "1", ...
// runTargets executes the action for all targets in parallel and returns a consolildated error. // Flow is identical to runSessions.
[ "runTargets", "executes", "the", "action", "for", "all", "targets", "in", "parallel", "and", "returns", "a", "consolildated", "error", ".", "Flow", "is", "identical", "to", "runSessions", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/tx_conn.go#L253-L270
157,864
vitessio/vitess
go/vt/vttablet/tabletmanager/action_agent.go
NewComboActionAgent
func NewComboActionAgent(batchCtx context.Context, ts *topo.Server, tabletAlias *topodatapb.TabletAlias, vtPort, grpcPort int32, queryServiceControl tabletserver.Controller, dbcfgs *dbconfigs.DBConfigs, mysqlDaemon mysqlctl.MysqlDaemon, keyspace, shard, dbname, tabletType string) *ActionAgent { agent := &ActionAgent{ ...
go
func NewComboActionAgent(batchCtx context.Context, ts *topo.Server, tabletAlias *topodatapb.TabletAlias, vtPort, grpcPort int32, queryServiceControl tabletserver.Controller, dbcfgs *dbconfigs.DBConfigs, mysqlDaemon mysqlctl.MysqlDaemon, keyspace, shard, dbname, tabletType string) *ActionAgent { agent := &ActionAgent{ ...
[ "func", "NewComboActionAgent", "(", "batchCtx", "context", ".", "Context", ",", "ts", "*", "topo", ".", "Server", ",", "tabletAlias", "*", "topodatapb", ".", "TabletAlias", ",", "vtPort", ",", "grpcPort", "int32", ",", "queryServiceControl", "tabletserver", ".",...
// NewComboActionAgent creates an agent tailored specifically to run // within the vtcombo binary. It cannot be called concurrently, // as it changes the flags.
[ "NewComboActionAgent", "creates", "an", "agent", "tailored", "specifically", "to", "run", "within", "the", "vtcombo", "binary", ".", "It", "cannot", "be", "called", "concurrently", "as", "it", "changes", "the", "flags", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/action_agent.go#L384-L426
157,865
vitessio/vitess
go/vt/vttablet/tabletmanager/action_agent.go
Healthy
func (agent *ActionAgent) Healthy() (time.Duration, error) { agent.mutex.Lock() defer agent.mutex.Unlock() healthy := agent._healthy if healthy == nil { timeSinceLastCheck := time.Since(agent._healthyTime) if timeSinceLastCheck > *healthCheckInterval*3 { healthy = fmt.Errorf("last health check is too old: %...
go
func (agent *ActionAgent) Healthy() (time.Duration, error) { agent.mutex.Lock() defer agent.mutex.Unlock() healthy := agent._healthy if healthy == nil { timeSinceLastCheck := time.Since(agent._healthyTime) if timeSinceLastCheck > *healthCheckInterval*3 { healthy = fmt.Errorf("last health check is too old: %...
[ "func", "(", "agent", "*", "ActionAgent", ")", "Healthy", "(", ")", "(", "time", ".", "Duration", ",", "error", ")", "{", "agent", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "agent", ".", "mutex", ".", "Unlock", "(", ")", "\n\n", "healthy"...
// Healthy reads the result of the latest healthcheck, protected by mutex. // If that status is too old, it means healthcheck hasn't run for a while, // and is probably stuck, this is not good, we're not healthy.
[ "Healthy", "reads", "the", "result", "of", "the", "latest", "healthcheck", "protected", "by", "mutex", ".", "If", "that", "status", "is", "too", "old", "it", "means", "healthcheck", "hasn", "t", "run", "for", "a", "while", "and", "is", "probably", "stuck",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/action_agent.go#L450-L463
157,866
vitessio/vitess
go/vt/vttablet/tabletmanager/action_agent.go
BlacklistedTables
func (agent *ActionAgent) BlacklistedTables() []string { agent.mutex.Lock() defer agent.mutex.Unlock() return agent._blacklistedTables }
go
func (agent *ActionAgent) BlacklistedTables() []string { agent.mutex.Lock() defer agent.mutex.Unlock() return agent._blacklistedTables }
[ "func", "(", "agent", "*", "ActionAgent", ")", "BlacklistedTables", "(", ")", "[", "]", "string", "{", "agent", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "agent", ".", "mutex", ".", "Unlock", "(", ")", "\n", "return", "agent", ".", "_blackl...
// BlacklistedTables returns the list of currently blacklisted tables.
[ "BlacklistedTables", "returns", "the", "list", "of", "currently", "blacklisted", "tables", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/action_agent.go#L466-L470
157,867
vitessio/vitess
go/vt/vttablet/tabletmanager/action_agent.go
DisallowQueryService
func (agent *ActionAgent) DisallowQueryService() string { agent.mutex.Lock() defer agent.mutex.Unlock() return agent._disallowQueryService }
go
func (agent *ActionAgent) DisallowQueryService() string { agent.mutex.Lock() defer agent.mutex.Unlock() return agent._disallowQueryService }
[ "func", "(", "agent", "*", "ActionAgent", ")", "DisallowQueryService", "(", ")", "string", "{", "agent", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "agent", ".", "mutex", ".", "Unlock", "(", ")", "\n", "return", "agent", ".", "_disallowQueryServ...
// DisallowQueryService returns the reason the query service should be // disabled, if any.
[ "DisallowQueryService", "returns", "the", "reason", "the", "query", "service", "should", "be", "disabled", "if", "any", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/action_agent.go#L474-L478
157,868
vitessio/vitess
go/vt/vttablet/tabletmanager/action_agent.go
EnableUpdateStream
func (agent *ActionAgent) EnableUpdateStream() bool { agent.mutex.Lock() defer agent.mutex.Unlock() return agent._enableUpdateStream }
go
func (agent *ActionAgent) EnableUpdateStream() bool { agent.mutex.Lock() defer agent.mutex.Unlock() return agent._enableUpdateStream }
[ "func", "(", "agent", "*", "ActionAgent", ")", "EnableUpdateStream", "(", ")", "bool", "{", "agent", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "agent", ".", "mutex", ".", "Unlock", "(", ")", "\n", "return", "agent", ".", "_enableUpdateStream", ...
// EnableUpdateStream returns if we should enable update stream or not
[ "EnableUpdateStream", "returns", "if", "we", "should", "enable", "update", "stream", "or", "not" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/action_agent.go#L481-L485
157,869
vitessio/vitess
go/vt/vttablet/tabletmanager/action_agent.go
Close
func (agent *ActionAgent) Close() { // cleanup initialized fields in the tablet entry f := func(tablet *topodatapb.Tablet) error { if err := topotools.CheckOwnership(agent.initialTablet, tablet); err != nil { return err } tablet.Hostname = "" tablet.MysqlHostname = "" tablet.PortMap = nil return nil }...
go
func (agent *ActionAgent) Close() { // cleanup initialized fields in the tablet entry f := func(tablet *topodatapb.Tablet) error { if err := topotools.CheckOwnership(agent.initialTablet, tablet); err != nil { return err } tablet.Hostname = "" tablet.MysqlHostname = "" tablet.PortMap = nil return nil }...
[ "func", "(", "agent", "*", "ActionAgent", ")", "Close", "(", ")", "{", "// cleanup initialized fields in the tablet entry", "f", ":=", "func", "(", "tablet", "*", "topodatapb", ".", "Tablet", ")", "error", "{", "if", "err", ":=", "topotools", ".", "CheckOwners...
// Close prepares a tablet for shutdown. First we check our tablet ownership and // then prune the tablet topology entry of all post-init fields. This prevents // stale identifiers from hanging around in topology.
[ "Close", "prepares", "a", "tablet", "for", "shutdown", ".", "First", "we", "check", "our", "tablet", "ownership", "and", "then", "prune", "the", "tablet", "topology", "entry", "of", "all", "post", "-", "init", "fields", ".", "This", "prevents", "stale", "i...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/action_agent.go#L677-L691
157,870
vitessio/vitess
go/vt/vttablet/tabletmanager/action_agent.go
Stop
func (agent *ActionAgent) Stop() { if agent.UpdateStream != nil { agent.UpdateStream.Disable() } agent.VREngine.Close() if agent.MysqlDaemon != nil { agent.MysqlDaemon.Close() } }
go
func (agent *ActionAgent) Stop() { if agent.UpdateStream != nil { agent.UpdateStream.Disable() } agent.VREngine.Close() if agent.MysqlDaemon != nil { agent.MysqlDaemon.Close() } }
[ "func", "(", "agent", "*", "ActionAgent", ")", "Stop", "(", ")", "{", "if", "agent", ".", "UpdateStream", "!=", "nil", "{", "agent", ".", "UpdateStream", ".", "Disable", "(", ")", "\n", "}", "\n", "agent", ".", "VREngine", ".", "Close", "(", ")", "...
// Stop shuts down the agent. Normally this is not necessary, since we use // servenv OnTerm and OnClose hooks to coordinate shutdown automatically, // while taking lameduck into account. However, this may be useful for tests, // when you want to clean up an agent immediately.
[ "Stop", "shuts", "down", "the", "agent", ".", "Normally", "this", "is", "not", "necessary", "since", "we", "use", "servenv", "OnTerm", "and", "OnClose", "hooks", "to", "coordinate", "shutdown", "automatically", "while", "taking", "lameduck", "into", "account", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/action_agent.go#L697-L705
157,871
vitessio/vitess
go/vt/vttablet/tabletmanager/action_agent.go
hookExtraEnv
func (agent *ActionAgent) hookExtraEnv() map[string]string { return map[string]string{"TABLET_ALIAS": topoproto.TabletAliasString(agent.TabletAlias)} }
go
func (agent *ActionAgent) hookExtraEnv() map[string]string { return map[string]string{"TABLET_ALIAS": topoproto.TabletAliasString(agent.TabletAlias)} }
[ "func", "(", "agent", "*", "ActionAgent", ")", "hookExtraEnv", "(", ")", "map", "[", "string", "]", "string", "{", "return", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "topoproto", ".", "TabletAliasString", "(", "agent", ".", "TabletAlias...
// hookExtraEnv returns the map to pass to local hooks
[ "hookExtraEnv", "returns", "the", "map", "to", "pass", "to", "local", "hooks" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/action_agent.go#L708-L710
157,872
vitessio/vitess
go/vt/vttablet/tabletmanager/action_agent.go
checkTabletMysqlPort
func (agent *ActionAgent) checkTabletMysqlPort(ctx context.Context, tablet *topodatapb.Tablet) *topodatapb.Tablet { agent.checkLock() mport, err := agent.MysqlDaemon.GetMysqlPort() if err != nil { // Only log the first time, so we don't spam the logs. if !agent.waitingForMysql { log.Warningf("Cannot get curre...
go
func (agent *ActionAgent) checkTabletMysqlPort(ctx context.Context, tablet *topodatapb.Tablet) *topodatapb.Tablet { agent.checkLock() mport, err := agent.MysqlDaemon.GetMysqlPort() if err != nil { // Only log the first time, so we don't spam the logs. if !agent.waitingForMysql { log.Warningf("Cannot get curre...
[ "func", "(", "agent", "*", "ActionAgent", ")", "checkTabletMysqlPort", "(", "ctx", "context", ".", "Context", ",", "tablet", "*", "topodatapb", ".", "Tablet", ")", "*", "topodatapb", ".", "Tablet", "{", "agent", ".", "checkLock", "(", ")", "\n", "mport", ...
// checkTabletMysqlPort will check the mysql port for the tablet is good, // and if not will try to update it. It returns the modified Tablet record, // if it was updated successfully in the topology server. // // We use the agent.waitingForMysql flag to log only the first // error we get when trying to get the port fr...
[ "checkTabletMysqlPort", "will", "check", "the", "mysql", "port", "for", "the", "tablet", "is", "good", "and", "if", "not", "will", "try", "to", "update", "it", ".", "It", "returns", "the", "modified", "Tablet", "record", "if", "it", "was", "updated", "succ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vttablet/tabletmanager/action_agent.go#L721-L774
157,873
vitessio/vitess
go/sqltypes/proto3.go
ResultToProto3
func ResultToProto3(qr *Result) *querypb.QueryResult { if qr == nil { return nil } return &querypb.QueryResult{ Fields: qr.Fields, RowsAffected: qr.RowsAffected, InsertId: qr.InsertID, Rows: RowsToProto3(qr.Rows), Extras: qr.Extras, } }
go
func ResultToProto3(qr *Result) *querypb.QueryResult { if qr == nil { return nil } return &querypb.QueryResult{ Fields: qr.Fields, RowsAffected: qr.RowsAffected, InsertId: qr.InsertID, Rows: RowsToProto3(qr.Rows), Extras: qr.Extras, } }
[ "func", "ResultToProto3", "(", "qr", "*", "Result", ")", "*", "querypb", ".", "QueryResult", "{", "if", "qr", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "&", "querypb", ".", "QueryResult", "{", "Fields", ":", "qr", ".", "Fields", "...
// ResultToProto3 converts Result to proto3.
[ "ResultToProto3", "converts", "Result", "to", "proto3", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/proto3.go#L85-L96
157,874
vitessio/vitess
go/sqltypes/proto3.go
Proto3ToResult
func Proto3ToResult(qr *querypb.QueryResult) *Result { if qr == nil { return nil } return &Result{ Fields: qr.Fields, RowsAffected: qr.RowsAffected, InsertID: qr.InsertId, Rows: proto3ToRows(qr.Fields, qr.Rows), Extras: qr.Extras, } }
go
func Proto3ToResult(qr *querypb.QueryResult) *Result { if qr == nil { return nil } return &Result{ Fields: qr.Fields, RowsAffected: qr.RowsAffected, InsertID: qr.InsertId, Rows: proto3ToRows(qr.Fields, qr.Rows), Extras: qr.Extras, } }
[ "func", "Proto3ToResult", "(", "qr", "*", "querypb", ".", "QueryResult", ")", "*", "Result", "{", "if", "qr", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "&", "Result", "{", "Fields", ":", "qr", ".", "Fields", ",", "RowsAffected", "...
// Proto3ToResult converts a proto3 Result to an internal data structure. This function // should be used only if the field info is populated in qr.
[ "Proto3ToResult", "converts", "a", "proto3", "Result", "to", "an", "internal", "data", "structure", ".", "This", "function", "should", "be", "used", "only", "if", "the", "field", "info", "is", "populated", "in", "qr", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/proto3.go#L100-L111
157,875
vitessio/vitess
go/sqltypes/proto3.go
CustomProto3ToResult
func CustomProto3ToResult(fields []*querypb.Field, qr *querypb.QueryResult) *Result { if qr == nil { return nil } return &Result{ Fields: qr.Fields, RowsAffected: qr.RowsAffected, InsertID: qr.InsertId, Rows: proto3ToRows(fields, qr.Rows), Extras: qr.Extras, } }
go
func CustomProto3ToResult(fields []*querypb.Field, qr *querypb.QueryResult) *Result { if qr == nil { return nil } return &Result{ Fields: qr.Fields, RowsAffected: qr.RowsAffected, InsertID: qr.InsertId, Rows: proto3ToRows(fields, qr.Rows), Extras: qr.Extras, } }
[ "func", "CustomProto3ToResult", "(", "fields", "[", "]", "*", "querypb", ".", "Field", ",", "qr", "*", "querypb", ".", "QueryResult", ")", "*", "Result", "{", "if", "qr", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "&", "Result", "{...
// CustomProto3ToResult converts a proto3 Result to an internal data structure. This function // takes a separate fields input because not all QueryResults contain the field info. // In particular, only the first packet of streaming queries contain the field info.
[ "CustomProto3ToResult", "converts", "a", "proto3", "Result", "to", "an", "internal", "data", "structure", ".", "This", "function", "takes", "a", "separate", "fields", "input", "because", "not", "all", "QueryResults", "contain", "the", "field", "info", ".", "In",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/proto3.go#L116-L127
157,876
vitessio/vitess
go/sqltypes/proto3.go
Proto3ResultsEqual
func Proto3ResultsEqual(r1, r2 []*querypb.QueryResult) bool { if len(r1) != len(r2) { return false } for i, r := range r1 { if !proto.Equal(r, r2[i]) { return false } } return true }
go
func Proto3ResultsEqual(r1, r2 []*querypb.QueryResult) bool { if len(r1) != len(r2) { return false } for i, r := range r1 { if !proto.Equal(r, r2[i]) { return false } } return true }
[ "func", "Proto3ResultsEqual", "(", "r1", ",", "r2", "[", "]", "*", "querypb", ".", "QueryResult", ")", "bool", "{", "if", "len", "(", "r1", ")", "!=", "len", "(", "r2", ")", "{", "return", "false", "\n", "}", "\n", "for", "i", ",", "r", ":=", "...
// Proto3ResultsEqual compares two arrays of proto3 Result. // reflect.DeepEqual shouldn't be used because of the protos.
[ "Proto3ResultsEqual", "compares", "two", "arrays", "of", "proto3", "Result", ".", "reflect", ".", "DeepEqual", "shouldn", "t", "be", "used", "because", "of", "the", "protos", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/proto3.go#L185-L195
157,877
vitessio/vitess
go/sqltypes/proto3.go
Proto3QueryResponsesEqual
func Proto3QueryResponsesEqual(r1, r2 []*querypb.ResultWithError) bool { if len(r1) != len(r2) { return false } for i, r := range r1 { if !proto.Equal(r, r2[i]) { return false } } return true }
go
func Proto3QueryResponsesEqual(r1, r2 []*querypb.ResultWithError) bool { if len(r1) != len(r2) { return false } for i, r := range r1 { if !proto.Equal(r, r2[i]) { return false } } return true }
[ "func", "Proto3QueryResponsesEqual", "(", "r1", ",", "r2", "[", "]", "*", "querypb", ".", "ResultWithError", ")", "bool", "{", "if", "len", "(", "r1", ")", "!=", "len", "(", "r2", ")", "{", "return", "false", "\n", "}", "\n", "for", "i", ",", "r", ...
// Proto3QueryResponsesEqual compares two arrays of proto3 QueryResponse. // reflect.DeepEqual shouldn't be used because of the protos.
[ "Proto3QueryResponsesEqual", "compares", "two", "arrays", "of", "proto3", "QueryResponse", ".", "reflect", ".", "DeepEqual", "shouldn", "t", "be", "used", "because", "of", "the", "protos", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/proto3.go#L199-L209
157,878
vitessio/vitess
go/sqltypes/proto3.go
Proto3ValuesEqual
func Proto3ValuesEqual(v1, v2 []*querypb.Value) bool { if len(v1) != len(v2) { return false } for i, v := range v1 { if !proto.Equal(v, v2[i]) { return false } } return true }
go
func Proto3ValuesEqual(v1, v2 []*querypb.Value) bool { if len(v1) != len(v2) { return false } for i, v := range v1 { if !proto.Equal(v, v2[i]) { return false } } return true }
[ "func", "Proto3ValuesEqual", "(", "v1", ",", "v2", "[", "]", "*", "querypb", ".", "Value", ")", "bool", "{", "if", "len", "(", "v1", ")", "!=", "len", "(", "v2", ")", "{", "return", "false", "\n", "}", "\n", "for", "i", ",", "v", ":=", "range",...
// Proto3ValuesEqual compares two arrays of proto3 Value.
[ "Proto3ValuesEqual", "compares", "two", "arrays", "of", "proto3", "Value", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/proto3.go#L212-L222
157,879
vitessio/vitess
go/sqltypes/proto3.go
SplitQueryResponsePartsEqual
func SplitQueryResponsePartsEqual(s1, s2 []*vtgatepb.SplitQueryResponse_Part) bool { if len(s1) != len(s2) { return false } for i, s := range s1 { if !proto.Equal(s, s2[i]) { return false } } return true }
go
func SplitQueryResponsePartsEqual(s1, s2 []*vtgatepb.SplitQueryResponse_Part) bool { if len(s1) != len(s2) { return false } for i, s := range s1 { if !proto.Equal(s, s2[i]) { return false } } return true }
[ "func", "SplitQueryResponsePartsEqual", "(", "s1", ",", "s2", "[", "]", "*", "vtgatepb", ".", "SplitQueryResponse_Part", ")", "bool", "{", "if", "len", "(", "s1", ")", "!=", "len", "(", "s2", ")", "{", "return", "false", "\n", "}", "\n", "for", "i", ...
// SplitQueryResponsePartsEqual compares two arrays of SplitQueryResponse_Part.
[ "SplitQueryResponsePartsEqual", "compares", "two", "arrays", "of", "SplitQueryResponse_Part", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sqltypes/proto3.go#L225-L235
157,880
vitessio/vitess
go/vt/sqlparser/ast.go
ParseStrictDDL
func ParseStrictDDL(sql string) (Statement, error) { tokenizer := NewStringTokenizer(sql) if yyParsePooled(tokenizer) != 0 { return nil, tokenizer.LastError } if tokenizer.ParseTree == nil { return nil, ErrEmpty } return tokenizer.ParseTree, nil }
go
func ParseStrictDDL(sql string) (Statement, error) { tokenizer := NewStringTokenizer(sql) if yyParsePooled(tokenizer) != 0 { return nil, tokenizer.LastError } if tokenizer.ParseTree == nil { return nil, ErrEmpty } return tokenizer.ParseTree, nil }
[ "func", "ParseStrictDDL", "(", "sql", "string", ")", "(", "Statement", ",", "error", ")", "{", "tokenizer", ":=", "NewStringTokenizer", "(", "sql", ")", "\n", "if", "yyParsePooled", "(", "tokenizer", ")", "!=", "0", "{", "return", "nil", ",", "tokenizer", ...
// ParseStrictDDL is the same as Parse except it errors on // partially parsed DDL statements.
[ "ParseStrictDDL", "is", "the", "same", "as", "Parse", "except", "it", "errors", "on", "partially", "parsed", "DDL", "statements", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L108-L117
157,881
vitessio/vitess
go/vt/sqlparser/ast.go
SplitStatement
func SplitStatement(blob string) (string, string, error) { tokenizer := NewStringTokenizer(blob) tkn := 0 for { tkn, _ = tokenizer.Scan() if tkn == 0 || tkn == ';' || tkn == eofChar { break } } if tokenizer.LastError != nil { return "", "", tokenizer.LastError } if tkn == ';' { return blob[:tokenize...
go
func SplitStatement(blob string) (string, string, error) { tokenizer := NewStringTokenizer(blob) tkn := 0 for { tkn, _ = tokenizer.Scan() if tkn == 0 || tkn == ';' || tkn == eofChar { break } } if tokenizer.LastError != nil { return "", "", tokenizer.LastError } if tkn == ';' { return blob[:tokenize...
[ "func", "SplitStatement", "(", "blob", "string", ")", "(", "string", ",", "string", ",", "error", ")", "{", "tokenizer", ":=", "NewStringTokenizer", "(", "blob", ")", "\n", "tkn", ":=", "0", "\n", "for", "{", "tkn", ",", "_", "=", "tokenizer", ".", "...
// SplitStatement returns the first sql statement up to either a ; or EOF // and the remainder from the given buffer
[ "SplitStatement", "returns", "the", "first", "sql", "statement", "up", "to", "either", "a", ";", "or", "EOF", "and", "the", "remainder", "from", "the", "given", "buffer" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L169-L185
157,882
vitessio/vitess
go/vt/sqlparser/ast.go
SplitStatementToPieces
func SplitStatementToPieces(blob string) (pieces []string, err error) { pieces = make([]string, 0, 16) tokenizer := NewStringTokenizer(blob) tkn := 0 var stmt string stmtBegin := 0 for { tkn, _ = tokenizer.Scan() if tkn == ';' { stmt = blob[stmtBegin : tokenizer.Position-2] pieces = append(pieces, stmt...
go
func SplitStatementToPieces(blob string) (pieces []string, err error) { pieces = make([]string, 0, 16) tokenizer := NewStringTokenizer(blob) tkn := 0 var stmt string stmtBegin := 0 for { tkn, _ = tokenizer.Scan() if tkn == ';' { stmt = blob[stmtBegin : tokenizer.Position-2] pieces = append(pieces, stmt...
[ "func", "SplitStatementToPieces", "(", "blob", "string", ")", "(", "pieces", "[", "]", "string", ",", "err", "error", ")", "{", "pieces", "=", "make", "(", "[", "]", "string", ",", "0", ",", "16", ")", "\n", "tokenizer", ":=", "NewStringTokenizer", "("...
// SplitStatementToPieces split raw sql statement that may have multi sql pieces to sql pieces // returns the sql pieces blob contains; or error if sql cannot be parsed
[ "SplitStatementToPieces", "split", "raw", "sql", "statement", "that", "may", "have", "multi", "sql", "pieces", "to", "sql", "pieces", "returns", "the", "sql", "pieces", "blob", "contains", ";", "or", "error", "if", "sql", "cannot", "be", "parsed" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L189-L216
157,883
vitessio/vitess
go/vt/sqlparser/ast.go
Walk
func Walk(visit Visit, nodes ...SQLNode) error { for _, node := range nodes { if node == nil { continue } kontinue, err := visit(node) if err != nil { return err } if kontinue { err = node.walkSubtree(visit) if err != nil { return err } } } return nil }
go
func Walk(visit Visit, nodes ...SQLNode) error { for _, node := range nodes { if node == nil { continue } kontinue, err := visit(node) if err != nil { return err } if kontinue { err = node.walkSubtree(visit) if err != nil { return err } } } return nil }
[ "func", "Walk", "(", "visit", "Visit", ",", "nodes", "...", "SQLNode", ")", "error", "{", "for", "_", ",", "node", ":=", "range", "nodes", "{", "if", "node", "==", "nil", "{", "continue", "\n", "}", "\n", "kontinue", ",", "err", ":=", "visit", "(",...
// Walk calls visit on every node. // If visit returns true, the underlying nodes // are also visited. If it returns an error, walking // is interrupted, and the error is returned.
[ "Walk", "calls", "visit", "on", "every", "node", ".", "If", "visit", "returns", "true", "the", "underlying", "nodes", "are", "also", "visited", ".", "If", "it", "returns", "an", "error", "walking", "is", "interrupted", "and", "the", "error", "is", "returne...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L236-L253
157,884
vitessio/vitess
go/vt/sqlparser/ast.go
String
func String(node SQLNode) string { if node == nil { return "<nil>" } buf := NewTrackedBuffer(nil) buf.Myprintf("%v", node) return buf.String() }
go
func String(node SQLNode) string { if node == nil { return "<nil>" } buf := NewTrackedBuffer(nil) buf.Myprintf("%v", node) return buf.String() }
[ "func", "String", "(", "node", "SQLNode", ")", "string", "{", "if", "node", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "buf", ":=", "NewTrackedBuffer", "(", "nil", ")", "\n", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ")"...
// String returns a string representation of an SQLNode.
[ "String", "returns", "a", "string", "representation", "of", "an", "SQLNode", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L256-L264
157,885
vitessio/vitess
go/vt/sqlparser/ast.go
Append
func Append(buf *strings.Builder, node SQLNode) { tbuf := &TrackedBuffer{ Builder: buf, } node.Format(tbuf) }
go
func Append(buf *strings.Builder, node SQLNode) { tbuf := &TrackedBuffer{ Builder: buf, } node.Format(tbuf) }
[ "func", "Append", "(", "buf", "*", "strings", ".", "Builder", ",", "node", "SQLNode", ")", "{", "tbuf", ":=", "&", "TrackedBuffer", "{", "Builder", ":", "buf", ",", "}", "\n", "node", ".", "Format", "(", "tbuf", ")", "\n", "}" ]
// Append appends the SQLNode to the buffer.
[ "Append", "appends", "the", "SQLNode", "to", "the", "buffer", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L267-L272
157,886
vitessio/vitess
go/vt/sqlparser/ast.go
AddWhere
func (node *Select) AddWhere(expr Expr) { if _, ok := expr.(*OrExpr); ok { expr = &ParenExpr{Expr: expr} } if node.Where == nil { node.Where = &Where{ Type: WhereStr, Expr: expr, } return } node.Where.Expr = &AndExpr{ Left: node.Where.Expr, Right: expr, } }
go
func (node *Select) AddWhere(expr Expr) { if _, ok := expr.(*OrExpr); ok { expr = &ParenExpr{Expr: expr} } if node.Where == nil { node.Where = &Where{ Type: WhereStr, Expr: expr, } return } node.Where.Expr = &AndExpr{ Left: node.Where.Expr, Right: expr, } }
[ "func", "(", "node", "*", "Select", ")", "AddWhere", "(", "expr", "Expr", ")", "{", "if", "_", ",", "ok", ":=", "expr", ".", "(", "*", "OrExpr", ")", ";", "ok", "{", "expr", "=", "&", "ParenExpr", "{", "Expr", ":", "expr", "}", "\n", "}", "\n...
// AddWhere adds the boolean expression to the // WHERE clause as an AND condition. If the expression // is an OR clause, it parenthesizes it. Currently, // the OR operator is the only one that's lower precedence // than AND.
[ "AddWhere", "adds", "the", "boolean", "expression", "to", "the", "WHERE", "clause", "as", "an", "AND", "condition", ".", "If", "the", "expression", "is", "an", "OR", "clause", "it", "parenthesizes", "it", ".", "Currently", "the", "OR", "operator", "is", "t...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L391-L406
157,887
vitessio/vitess
go/vt/sqlparser/ast.go
AddHaving
func (node *Select) AddHaving(expr Expr) { if _, ok := expr.(*OrExpr); ok { expr = &ParenExpr{Expr: expr} } if node.Having == nil { node.Having = &Where{ Type: HavingStr, Expr: expr, } return } node.Having.Expr = &AndExpr{ Left: node.Having.Expr, Right: expr, } }
go
func (node *Select) AddHaving(expr Expr) { if _, ok := expr.(*OrExpr); ok { expr = &ParenExpr{Expr: expr} } if node.Having == nil { node.Having = &Where{ Type: HavingStr, Expr: expr, } return } node.Having.Expr = &AndExpr{ Left: node.Having.Expr, Right: expr, } }
[ "func", "(", "node", "*", "Select", ")", "AddHaving", "(", "expr", "Expr", ")", "{", "if", "_", ",", "ok", ":=", "expr", ".", "(", "*", "OrExpr", ")", ";", "ok", "{", "expr", "=", "&", "ParenExpr", "{", "Expr", ":", "expr", "}", "\n", "}", "\...
// AddHaving adds the boolean expression to the // HAVING clause as an AND condition. If the expression // is an OR clause, it parenthesizes it. Currently, // the OR operator is the only one that's lower precedence // than AND.
[ "AddHaving", "adds", "the", "boolean", "expression", "to", "the", "HAVING", "clause", "as", "an", "AND", "condition", ".", "If", "the", "expression", "is", "an", "OR", "clause", "it", "parenthesizes", "it", ".", "Currently", "the", "OR", "operator", "is", ...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L413-L428
157,888
vitessio/vitess
go/vt/sqlparser/ast.go
AffectedTables
func (node *DDL) AffectedTables() TableNames { if node.Action == RenameStr || node.Action == DropStr { list := make(TableNames, 0, len(node.FromTables)+len(node.ToTables)) list = append(list, node.FromTables...) list = append(list, node.ToTables...) return list } return TableNames{node.Table} }
go
func (node *DDL) AffectedTables() TableNames { if node.Action == RenameStr || node.Action == DropStr { list := make(TableNames, 0, len(node.FromTables)+len(node.ToTables)) list = append(list, node.FromTables...) list = append(list, node.ToTables...) return list } return TableNames{node.Table} }
[ "func", "(", "node", "*", "DDL", ")", "AffectedTables", "(", ")", "TableNames", "{", "if", "node", ".", "Action", "==", "RenameStr", "||", "node", ".", "Action", "==", "DropStr", "{", "list", ":=", "make", "(", "TableNames", ",", "0", ",", "len", "("...
// AffectedTables returns the list table names affected by the DDL.
[ "AffectedTables", "returns", "the", "list", "table", "names", "affected", "by", "the", "DDL", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L834-L842
157,889
vitessio/vitess
go/vt/sqlparser/ast.go
AddColumn
func (ts *TableSpec) AddColumn(cd *ColumnDefinition) { ts.Columns = append(ts.Columns, cd) }
go
func (ts *TableSpec) AddColumn(cd *ColumnDefinition) { ts.Columns = append(ts.Columns, cd) }
[ "func", "(", "ts", "*", "TableSpec", ")", "AddColumn", "(", "cd", "*", "ColumnDefinition", ")", "{", "ts", ".", "Columns", "=", "append", "(", "ts", ".", "Columns", ",", "cd", ")", "\n", "}" ]
// AddColumn appends the given column to the list in the spec
[ "AddColumn", "appends", "the", "given", "column", "to", "the", "list", "in", "the", "spec" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L960-L962
157,890
vitessio/vitess
go/vt/sqlparser/ast.go
AddIndex
func (ts *TableSpec) AddIndex(id *IndexDefinition) { ts.Indexes = append(ts.Indexes, id) }
go
func (ts *TableSpec) AddIndex(id *IndexDefinition) { ts.Indexes = append(ts.Indexes, id) }
[ "func", "(", "ts", "*", "TableSpec", ")", "AddIndex", "(", "id", "*", "IndexDefinition", ")", "{", "ts", ".", "Indexes", "=", "append", "(", "ts", ".", "Indexes", ",", "id", ")", "\n", "}" ]
// AddIndex appends the given index to the list in the spec
[ "AddIndex", "appends", "the", "given", "index", "to", "the", "list", "in", "the", "spec" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L965-L967
157,891
vitessio/vitess
go/vt/sqlparser/ast.go
AddConstraint
func (ts *TableSpec) AddConstraint(cd *ConstraintDefinition) { ts.Constraints = append(ts.Constraints, cd) }
go
func (ts *TableSpec) AddConstraint(cd *ConstraintDefinition) { ts.Constraints = append(ts.Constraints, cd) }
[ "func", "(", "ts", "*", "TableSpec", ")", "AddConstraint", "(", "cd", "*", "ConstraintDefinition", ")", "{", "ts", ".", "Constraints", "=", "append", "(", "ts", ".", "Constraints", ",", "cd", ")", "\n", "}" ]
// AddConstraint appends the given index to the list in the spec
[ "AddConstraint", "appends", "the", "given", "index", "to", "the", "list", "in", "the", "spec" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L970-L972
157,892
vitessio/vitess
go/vt/sqlparser/ast.go
Format
func (ct *ColumnType) Format(buf *TrackedBuffer) { buf.Myprintf("%s", ct.Type) if ct.Length != nil && ct.Scale != nil { buf.Myprintf("(%v,%v)", ct.Length, ct.Scale) } else if ct.Length != nil { buf.Myprintf("(%v)", ct.Length) } if ct.EnumValues != nil { buf.Myprintf("(%s)", strings.Join(ct.EnumValues, ", ...
go
func (ct *ColumnType) Format(buf *TrackedBuffer) { buf.Myprintf("%s", ct.Type) if ct.Length != nil && ct.Scale != nil { buf.Myprintf("(%v,%v)", ct.Length, ct.Scale) } else if ct.Length != nil { buf.Myprintf("(%v)", ct.Length) } if ct.EnumValues != nil { buf.Myprintf("(%s)", strings.Join(ct.EnumValues, ", ...
[ "func", "(", "ct", "*", "ColumnType", ")", "Format", "(", "buf", "*", "TrackedBuffer", ")", "{", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "ct", ".", "Type", ")", "\n\n", "if", "ct", ".", "Length", "!=", "nil", "&&", "ct", ".", "Scale", "!=",...
// Format returns a canonical string representation of the type and all relevant options
[ "Format", "returns", "a", "canonical", "string", "representation", "of", "the", "type", "and", "all", "relevant", "options" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L1053-L1114
157,893
vitessio/vitess
go/vt/sqlparser/ast.go
DescribeType
func (ct *ColumnType) DescribeType() string { buf := NewTrackedBuffer(nil) buf.Myprintf("%s", ct.Type) if ct.Length != nil && ct.Scale != nil { buf.Myprintf("(%v,%v)", ct.Length, ct.Scale) } else if ct.Length != nil { buf.Myprintf("(%v)", ct.Length) } opts := make([]string, 0, 16) if ct.Unsigned { opts = ...
go
func (ct *ColumnType) DescribeType() string { buf := NewTrackedBuffer(nil) buf.Myprintf("%s", ct.Type) if ct.Length != nil && ct.Scale != nil { buf.Myprintf("(%v,%v)", ct.Length, ct.Scale) } else if ct.Length != nil { buf.Myprintf("(%v)", ct.Length) } opts := make([]string, 0, 16) if ct.Unsigned { opts = ...
[ "func", "(", "ct", "*", "ColumnType", ")", "DescribeType", "(", ")", "string", "{", "buf", ":=", "NewTrackedBuffer", "(", "nil", ")", "\n", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "ct", ".", "Type", ")", "\n", "if", "ct", ".", "Length", "!=",...
// DescribeType returns the abbreviated type information as required for // describe table
[ "DescribeType", "returns", "the", "abbreviated", "type", "information", "as", "required", "for", "describe", "table" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L1118-L1138
157,894
vitessio/vitess
go/vt/sqlparser/ast.go
ParseParams
func (node *VindexSpec) ParseParams() (string, map[string]string) { var owner string params := map[string]string{} for _, p := range node.Params { if p.Key.Lowered() == VindexOwnerStr { owner = p.Val } else { params[p.Key.String()] = p.Val } } return owner, params }
go
func (node *VindexSpec) ParseParams() (string, map[string]string) { var owner string params := map[string]string{} for _, p := range node.Params { if p.Key.Lowered() == VindexOwnerStr { owner = p.Val } else { params[p.Key.String()] = p.Val } } return owner, params }
[ "func", "(", "node", "*", "VindexSpec", ")", "ParseParams", "(", ")", "(", "string", ",", "map", "[", "string", "]", "string", ")", "{", "var", "owner", "string", "\n", "params", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "for", "_"...
// ParseParams parses the vindex parameter list, pulling out the special-case // "owner" parameter
[ "ParseParams", "parses", "the", "vindex", "parameter", "list", "pulling", "out", "the", "special", "-", "case", "owner", "parameter" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L1357-L1368
157,895
vitessio/vitess
go/vt/sqlparser/ast.go
Format
func (node *VindexSpec) Format(buf *TrackedBuffer) { buf.Myprintf("using %v", node.Type) numParams := len(node.Params) if numParams != 0 { buf.Myprintf(" with ") for i, p := range node.Params { if i != 0 { buf.Myprintf(", ") } buf.Myprintf("%v", p) } } }
go
func (node *VindexSpec) Format(buf *TrackedBuffer) { buf.Myprintf("using %v", node.Type) numParams := len(node.Params) if numParams != 0 { buf.Myprintf(" with ") for i, p := range node.Params { if i != 0 { buf.Myprintf(", ") } buf.Myprintf("%v", p) } } }
[ "func", "(", "node", "*", "VindexSpec", ")", "Format", "(", "buf", "*", "TrackedBuffer", ")", "{", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ".", "Type", ")", "\n\n", "numParams", ":=", "len", "(", "node", ".", "Params", ")", "\n", "if"...
// Format formats the node. The "CREATE VINDEX" preamble was formatted in // the containing DDL node Format, so this just prints the type, any // parameters, and optionally the owner
[ "Format", "formats", "the", "node", ".", "The", "CREATE", "VINDEX", "preamble", "was", "formatted", "in", "the", "containing", "DDL", "node", "Format", "so", "this", "just", "prints", "the", "type", "any", "parameters", "and", "optionally", "the", "owner" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L1373-L1386
157,896
vitessio/vitess
go/vt/sqlparser/ast.go
FindColumn
func (node Columns) FindColumn(col ColIdent) int { for i, colName := range node { if colName.Equal(col) { return i } } return -1 }
go
func (node Columns) FindColumn(col ColIdent) int { for i, colName := range node { if colName.Equal(col) { return i } } return -1 }
[ "func", "(", "node", "Columns", ")", "FindColumn", "(", "col", "ColIdent", ")", "int", "{", "for", "i", ",", "colName", ":=", "range", "node", "{", "if", "colName", ".", "Equal", "(", "col", ")", "{", "return", "i", "\n", "}", "\n", "}", "\n", "r...
// FindColumn finds a column in the column list, returning // the index if it exists or -1 otherwise
[ "FindColumn", "finds", "a", "column", "in", "the", "column", "list", "returning", "the", "index", "if", "it", "exists", "or", "-", "1", "otherwise" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L1817-L1824
157,897
vitessio/vitess
go/vt/sqlparser/ast.go
RemoveHints
func (node *AliasedTableExpr) RemoveHints() *AliasedTableExpr { noHints := *node noHints.Hints = nil return &noHints }
go
func (node *AliasedTableExpr) RemoveHints() *AliasedTableExpr { noHints := *node noHints.Hints = nil return &noHints }
[ "func", "(", "node", "*", "AliasedTableExpr", ")", "RemoveHints", "(", ")", "*", "AliasedTableExpr", "{", "noHints", ":=", "*", "node", "\n", "noHints", ".", "Hints", "=", "nil", "\n", "return", "&", "noHints", "\n", "}" ]
// RemoveHints returns a new AliasedTableExpr with the hints removed.
[ "RemoveHints", "returns", "a", "new", "AliasedTableExpr", "with", "the", "hints", "removed", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L1917-L1921
157,898
vitessio/vitess
go/vt/sqlparser/ast.go
ToViewName
func (node TableName) ToViewName() TableName { return TableName{ Qualifier: node.Qualifier, Name: NewTableIdent(strings.ToLower(node.Name.v)), } }
go
func (node TableName) ToViewName() TableName { return TableName{ Qualifier: node.Qualifier, Name: NewTableIdent(strings.ToLower(node.Name.v)), } }
[ "func", "(", "node", "TableName", ")", "ToViewName", "(", ")", "TableName", "{", "return", "TableName", "{", "Qualifier", ":", "node", ".", "Qualifier", ",", "Name", ":", "NewTableIdent", "(", "strings", ".", "ToLower", "(", "node", ".", "Name", ".", "v"...
// ToViewName returns a TableName acceptable for use as a VIEW. VIEW names are // always lowercase, so ToViewName lowercasese the name. Databases are case-sensitive // so Qualifier is left untouched.
[ "ToViewName", "returns", "a", "TableName", "acceptable", "for", "use", "as", "a", "VIEW", ".", "VIEW", "names", "are", "always", "lowercase", "so", "ToViewName", "lowercasese", "the", "name", ".", "Databases", "are", "case", "-", "sensitive", "so", "Qualifier"...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L1990-L1995
157,899
vitessio/vitess
go/vt/sqlparser/ast.go
ReplaceExpr
func ReplaceExpr(root, from, to Expr) Expr { if root == from { return to } root.replace(from, to) return root }
go
func ReplaceExpr(root, from, to Expr) Expr { if root == from { return to } root.replace(from, to) return root }
[ "func", "ReplaceExpr", "(", "root", ",", "from", ",", "to", "Expr", ")", "Expr", "{", "if", "root", "==", "from", "{", "return", "to", "\n", "}", "\n", "root", ".", "replace", "(", "from", ",", "to", ")", "\n", "return", "root", "\n", "}" ]
// ReplaceExpr finds the from expression from root // and replaces it with to. If from matches root, // then to is returned.
[ "ReplaceExpr", "finds", "the", "from", "expression", "from", "root", "and", "replaces", "it", "with", "to", ".", "If", "from", "matches", "root", "then", "to", "is", "returned", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/sqlparser/ast.go#L2197-L2203