id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
134,800
argoproj/argo
util/unstructured/unstructured.go
NewFilteredUnstructuredInformer
func NewFilteredUnstructuredInformer(resource schema.GroupVersionResource, client dynamic.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ L...
go
func NewFilteredUnstructuredInformer(resource schema.GroupVersionResource, client dynamic.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ L...
[ "func", "NewFilteredUnstructuredInformer", "(", "resource", "schema", ".", "GroupVersionResource", ",", "client", "dynamic", ".", "Interface", ",", "namespace", "string", ",", "resyncPeriod", "time", ".", "Duration", ",", "indexers", "cache", ".", "Indexers", ",", ...
// NewFilteredUnstructuredInformer constructs a new informer for Unstructured type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server.
[ "NewFilteredUnstructuredInformer", "constructs", "a", "new", "informer", "for", "Unstructured", "type", ".", "Always", "prefer", "using", "an", "informer", "factory", "to", "get", "a", "shared", "informer", "instead", "of", "getting", "an", "independent", "one", "...
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/util/unstructured/unstructured.go#L26-L46
134,801
argoproj/argo
pkg/client/informers/externalversions/workflow/v1alpha1/workflow.go
NewWorkflowInformer
func NewWorkflowInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredWorkflowInformer(client, namespace, resyncPeriod, indexers, nil) }
go
func NewWorkflowInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredWorkflowInformer(client, namespace, resyncPeriod, indexers, nil) }
[ "func", "NewWorkflowInformer", "(", "client", "versioned", ".", "Interface", ",", "namespace", "string", ",", "resyncPeriod", "time", ".", "Duration", ",", "indexers", "cache", ".", "Indexers", ")", "cache", ".", "SharedIndexInformer", "{", "return", "NewFilteredW...
// NewWorkflowInformer constructs a new informer for Workflow type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server.
[ "NewWorkflowInformer", "constructs", "a", "new", "informer", "for", "Workflow", "type", ".", "Always", "prefer", "using", "an", "informer", "factory", "to", "get", "a", "shared", "informer", "instead", "of", "getting", "an", "independent", "one", ".", "This", ...
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/client/informers/externalversions/workflow/v1alpha1/workflow.go#L34-L36
134,802
argoproj/argo
pkg/client/informers/externalversions/workflow/v1alpha1/workflow.go
NewFilteredWorkflowInformer
func NewFilteredWorkflowInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (r...
go
func NewFilteredWorkflowInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (r...
[ "func", "NewFilteredWorkflowInformer", "(", "client", "versioned", ".", "Interface", ",", "namespace", "string", ",", "resyncPeriod", "time", ".", "Duration", ",", "indexers", "cache", ".", "Indexers", ",", "tweakListOptions", "internalinterfaces", ".", "TweakListOpti...
// NewFilteredWorkflowInformer constructs a new informer for Workflow type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server.
[ "NewFilteredWorkflowInformer", "constructs", "a", "new", "informer", "for", "Workflow", "type", ".", "Always", "prefer", "using", "an", "informer", "factory", "to", "get", "a", "shared", "informer", "instead", "of", "getting", "an", "independent", "one", ".", "T...
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/client/informers/externalversions/workflow/v1alpha1/workflow.go#L41-L61
134,803
argoproj/argo
pkg/client/informers/externalversions/workflow/v1alpha1/interface.go
Workflows
func (v *version) Workflows() WorkflowInformer { return &workflowInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} }
go
func (v *version) Workflows() WorkflowInformer { return &workflowInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} }
[ "func", "(", "v", "*", "version", ")", "Workflows", "(", ")", "WorkflowInformer", "{", "return", "&", "workflowInformer", "{", "factory", ":", "v", ".", "factory", ",", "namespace", ":", "v", ".", "namespace", ",", "tweakListOptions", ":", "v", ".", "twe...
// Workflows returns a WorkflowInformer.
[ "Workflows", "returns", "a", "WorkflowInformer", "." ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/client/informers/externalversions/workflow/v1alpha1/interface.go#L27-L29
134,804
argoproj/argo
workflow/metrics/collector.go
NewWorkflowRegistry
func NewWorkflowRegistry(informer cache.SharedIndexInformer) *prometheus.Registry { workflowLister := util.NewWorkflowLister(informer) registry := prometheus.NewRegistry() registry.MustRegister(&workflowCollector{store: workflowLister}) return registry }
go
func NewWorkflowRegistry(informer cache.SharedIndexInformer) *prometheus.Registry { workflowLister := util.NewWorkflowLister(informer) registry := prometheus.NewRegistry() registry.MustRegister(&workflowCollector{store: workflowLister}) return registry }
[ "func", "NewWorkflowRegistry", "(", "informer", "cache", ".", "SharedIndexInformer", ")", "*", "prometheus", ".", "Registry", "{", "workflowLister", ":=", "util", ".", "NewWorkflowLister", "(", "informer", ")", "\n", "registry", ":=", "prometheus", ".", "NewRegist...
// NewWorkflowRegistry creates a new prometheus registry that collects workflows
[ "NewWorkflowRegistry", "creates", "a", "new", "prometheus", "registry", "that", "collects", "workflows" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/metrics/collector.go#L62-L67
134,805
argoproj/argo
workflow/metrics/collector.go
NewTelemetryRegistry
func NewTelemetryRegistry() *prometheus.Registry { registry := prometheus.NewRegistry() registry.MustRegister(prometheus.NewProcessCollector(os.Getpid(), "")) registry.MustRegister(prometheus.NewGoCollector()) return registry }
go
func NewTelemetryRegistry() *prometheus.Registry { registry := prometheus.NewRegistry() registry.MustRegister(prometheus.NewProcessCollector(os.Getpid(), "")) registry.MustRegister(prometheus.NewGoCollector()) return registry }
[ "func", "NewTelemetryRegistry", "(", ")", "*", "prometheus", ".", "Registry", "{", "registry", ":=", "prometheus", ".", "NewRegistry", "(", ")", "\n", "registry", ".", "MustRegister", "(", "prometheus", ".", "NewProcessCollector", "(", "os", ".", "Getpid", "("...
// NewTelemetryRegistry creates a new prometheus registry that collects telemetry
[ "NewTelemetryRegistry", "creates", "a", "new", "prometheus", "registry", "that", "collects", "telemetry" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/metrics/collector.go#L70-L75
134,806
argoproj/argo
hack/gen-openapi-spec/main.go
main
func main() { if len(os.Args) <= 1 { log.Fatal("Supply a version") } version := os.Args[1] if !strings.HasPrefix(version, "v") { version = "v" + version } oAPIDefs := wfv1.GetOpenAPIDefinitions(func(name string) spec.Ref { return spec.MustCreateRef("#/definitions/" + common.EscapeJsonPointer(swaggify(name))...
go
func main() { if len(os.Args) <= 1 { log.Fatal("Supply a version") } version := os.Args[1] if !strings.HasPrefix(version, "v") { version = "v" + version } oAPIDefs := wfv1.GetOpenAPIDefinitions(func(name string) spec.Ref { return spec.MustCreateRef("#/definitions/" + common.EscapeJsonPointer(swaggify(name))...
[ "func", "main", "(", ")", "{", "if", "len", "(", "os", ".", "Args", ")", "<=", "1", "{", "log", ".", "Fatal", "(", "\"", "\"", ")", "\n", "}", "\n", "version", ":=", "os", ".", "Args", "[", "1", "]", "\n", "if", "!", "strings", ".", "HasPre...
// Generate OpenAPI spec definitions for Workflow Resource
[ "Generate", "OpenAPI", "spec", "definitions", "for", "Workflow", "Resource" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/hack/gen-openapi-spec/main.go#L16-L49
134,807
argoproj/argo
workflow/controller/operator.go
newWorkflowOperationCtx
func newWorkflowOperationCtx(wf *wfv1.Workflow, wfc *WorkflowController) *wfOperationCtx { // NEVER modify objects from the store. It's a read-only, local cache. // You can use DeepCopy() to make a deep copy of original object and modify this copy // Or create a copy manually for better performance woc := wfOperati...
go
func newWorkflowOperationCtx(wf *wfv1.Workflow, wfc *WorkflowController) *wfOperationCtx { // NEVER modify objects from the store. It's a read-only, local cache. // You can use DeepCopy() to make a deep copy of original object and modify this copy // Or create a copy manually for better performance woc := wfOperati...
[ "func", "newWorkflowOperationCtx", "(", "wf", "*", "wfv1", ".", "Workflow", ",", "wfc", "*", "WorkflowController", ")", "*", "wfOperationCtx", "{", "// NEVER modify objects from the store. It's a read-only, local cache.", "// You can use DeepCopy() to make a deep copy of original o...
// newWorkflowOperationCtx creates and initializes a new wfOperationCtx object.
[ "newWorkflowOperationCtx", "creates", "and", "initializes", "a", "new", "wfOperationCtx", "object", "." ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L85-L109
134,808
argoproj/argo
workflow/controller/operator.go
setGlobalParameters
func (woc *wfOperationCtx) setGlobalParameters() { woc.globalParams[common.GlobalVarWorkflowName] = woc.wf.ObjectMeta.Name woc.globalParams[common.GlobalVarWorkflowNamespace] = woc.wf.ObjectMeta.Namespace woc.globalParams[common.GlobalVarWorkflowUID] = string(woc.wf.ObjectMeta.UID) woc.globalParams[common.GlobalVar...
go
func (woc *wfOperationCtx) setGlobalParameters() { woc.globalParams[common.GlobalVarWorkflowName] = woc.wf.ObjectMeta.Name woc.globalParams[common.GlobalVarWorkflowNamespace] = woc.wf.ObjectMeta.Namespace woc.globalParams[common.GlobalVarWorkflowUID] = string(woc.wf.ObjectMeta.UID) woc.globalParams[common.GlobalVar...
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "setGlobalParameters", "(", ")", "{", "woc", ".", "globalParams", "[", "common", ".", "GlobalVarWorkflowName", "]", "=", "woc", ".", "wf", ".", "ObjectMeta", ".", "Name", "\n", "woc", ".", "globalParams", "["...
// setGlobalParameters sets the globalParam map with global parameters
[ "setGlobalParameters", "sets", "the", "globalParam", "map", "with", "global", "parameters" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L261-L284
134,809
argoproj/argo
workflow/controller/operator.go
requeue
func (woc *wfOperationCtx) requeue() { key, err := cache.MetaNamespaceKeyFunc(woc.wf) if err != nil { woc.log.Errorf("Failed to requeue workflow %s: %v", woc.wf.ObjectMeta.Name, err) return } woc.controller.wfQueue.Add(key) }
go
func (woc *wfOperationCtx) requeue() { key, err := cache.MetaNamespaceKeyFunc(woc.wf) if err != nil { woc.log.Errorf("Failed to requeue workflow %s: %v", woc.wf.ObjectMeta.Name, err) return } woc.controller.wfQueue.Add(key) }
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "requeue", "(", ")", "{", "key", ",", "err", ":=", "cache", ".", "MetaNamespaceKeyFunc", "(", "woc", ".", "wf", ")", "\n", "if", "err", "!=", "nil", "{", "woc", ".", "log", ".", "Errorf", "(", "\"", ...
// requeue this workflow onto the workqueue for later processing
[ "requeue", "this", "workflow", "onto", "the", "workqueue", "for", "later", "processing" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L409-L416
134,810
argoproj/argo
workflow/controller/operator.go
podReconciliation
func (woc *wfOperationCtx) podReconciliation() error { podList, err := woc.getAllWorkflowPods() if err != nil { return err } seenPods := make(map[string]bool) seenPodLock := &sync.Mutex{} wfNodesLock := &sync.RWMutex{} performAssessment := func(pod *apiv1.Pod) { if pod == nil { return } nodeNameForPo...
go
func (woc *wfOperationCtx) podReconciliation() error { podList, err := woc.getAllWorkflowPods() if err != nil { return err } seenPods := make(map[string]bool) seenPodLock := &sync.Mutex{} wfNodesLock := &sync.RWMutex{} performAssessment := func(pod *apiv1.Pod) { if pod == nil { return } nodeNameForPo...
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "podReconciliation", "(", ")", "error", "{", "podList", ",", "err", ":=", "woc", ".", "getAllWorkflowPods", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "seenPods", ":=...
// podReconciliation is the process by which a workflow will examine all its related // pods and update the node state before continuing the evaluation of the workflow. // Records all pods which were observed completed, which will be labeled completed=true // after successful persist of the workflow.
[ "podReconciliation", "is", "the", "process", "by", "which", "a", "workflow", "will", "examine", "all", "its", "related", "pods", "and", "update", "the", "node", "state", "before", "continuing", "the", "evaluation", "of", "the", "workflow", ".", "Records", "all...
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L463-L540
134,811
argoproj/argo
workflow/controller/operator.go
getAllWorkflowPods
func (woc *wfOperationCtx) getAllWorkflowPods() (*apiv1.PodList, error) { options := metav1.ListOptions{ LabelSelector: fmt.Sprintf("%s=%s", common.LabelKeyWorkflow, woc.wf.ObjectMeta.Name), } podList, err := woc.controller.kubeclientset.CoreV1().Pods(woc.wf.Namespace).List(options) if err != nil { return...
go
func (woc *wfOperationCtx) getAllWorkflowPods() (*apiv1.PodList, error) { options := metav1.ListOptions{ LabelSelector: fmt.Sprintf("%s=%s", common.LabelKeyWorkflow, woc.wf.ObjectMeta.Name), } podList, err := woc.controller.kubeclientset.CoreV1().Pods(woc.wf.Namespace).List(options) if err != nil { return...
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "getAllWorkflowPods", "(", ")", "(", "*", "apiv1", ".", "PodList", ",", "error", ")", "{", "options", ":=", "metav1", ".", "ListOptions", "{", "LabelSelector", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ...
// getAllWorkflowPods returns all pods related to the current workflow
[ "getAllWorkflowPods", "returns", "all", "pods", "related", "to", "the", "current", "workflow" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L592-L603
134,812
argoproj/argo
workflow/controller/operator.go
markWorkflowPhase
func (woc *wfOperationCtx) markWorkflowPhase(phase wfv1.NodePhase, markCompleted bool, message ...string) { if woc.wf.Status.Phase != phase { woc.log.Infof("Updated phase %s -> %s", woc.wf.Status.Phase, phase) woc.updated = true woc.wf.Status.Phase = phase if woc.wf.ObjectMeta.Labels == nil { woc.wf.ObjectM...
go
func (woc *wfOperationCtx) markWorkflowPhase(phase wfv1.NodePhase, markCompleted bool, message ...string) { if woc.wf.Status.Phase != phase { woc.log.Infof("Updated phase %s -> %s", woc.wf.Status.Phase, phase) woc.updated = true woc.wf.Status.Phase = phase if woc.wf.ObjectMeta.Labels == nil { woc.wf.ObjectM...
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "markWorkflowPhase", "(", "phase", "wfv1", ".", "NodePhase", ",", "markCompleted", "bool", ",", "message", "...", "string", ")", "{", "if", "woc", ".", "wf", ".", "Status", ".", "Phase", "!=", "phase", "{",...
// markWorkflowPhase is a convenience method to set the phase of the workflow with optional message // optionally marks the workflow completed, which sets the finishedAt timestamp and completed label
[ "markWorkflowPhase", "is", "a", "convenience", "method", "to", "set", "the", "phase", "of", "the", "workflow", "with", "optional", "message", "optionally", "marks", "the", "workflow", "completed", "which", "sets", "the", "finishedAt", "timestamp", "and", "complete...
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L1072-L1105
134,813
argoproj/argo
workflow/controller/operator.go
markNodePhase
func (woc *wfOperationCtx) markNodePhase(nodeName string, phase wfv1.NodePhase, message ...string) *wfv1.NodeStatus { node := woc.getNodeByName(nodeName) if node == nil { panic(fmt.Sprintf("node %s uninitialized", nodeName)) } if node.Phase != phase { woc.log.Infof("node %s phase %s -> %s", node, node.Phase, ph...
go
func (woc *wfOperationCtx) markNodePhase(nodeName string, phase wfv1.NodePhase, message ...string) *wfv1.NodeStatus { node := woc.getNodeByName(nodeName) if node == nil { panic(fmt.Sprintf("node %s uninitialized", nodeName)) } if node.Phase != phase { woc.log.Infof("node %s phase %s -> %s", node, node.Phase, ph...
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "markNodePhase", "(", "nodeName", "string", ",", "phase", "wfv1", ".", "NodePhase", ",", "message", "...", "string", ")", "*", "wfv1", ".", "NodeStatus", "{", "node", ":=", "woc", ".", "getNodeByName", "(", ...
// markNodePhase marks a node with the given phase, creating the node if necessary and handles timestamps
[ "markNodePhase", "marks", "a", "node", "with", "the", "given", "phase", "creating", "the", "node", "if", "necessary", "and", "handles", "timestamps" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L1175-L1199
134,814
argoproj/argo
workflow/controller/operator.go
markNodeErrorClearOuput
func (woc *wfOperationCtx) markNodeErrorClearOuput(nodeName string, err error) *wfv1.NodeStatus { nodeStatus := woc.markNodeError(nodeName, err) nodeStatus.Outputs = nil woc.wf.Status.Nodes[nodeStatus.ID] = *nodeStatus return nodeStatus }
go
func (woc *wfOperationCtx) markNodeErrorClearOuput(nodeName string, err error) *wfv1.NodeStatus { nodeStatus := woc.markNodeError(nodeName, err) nodeStatus.Outputs = nil woc.wf.Status.Nodes[nodeStatus.ID] = *nodeStatus return nodeStatus }
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "markNodeErrorClearOuput", "(", "nodeName", "string", ",", "err", "error", ")", "*", "wfv1", ".", "NodeStatus", "{", "nodeStatus", ":=", "woc", ".", "markNodeError", "(", "nodeName", ",", "err", ")", "\n", "n...
// markNodeErrorClearOuput is a convenience method to mark a node with an error and clear the output
[ "markNodeErrorClearOuput", "is", "a", "convenience", "method", "to", "mark", "a", "node", "with", "an", "error", "and", "clear", "the", "output" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L1202-L1207
134,815
argoproj/argo
workflow/controller/operator.go
markNodeError
func (woc *wfOperationCtx) markNodeError(nodeName string, err error) *wfv1.NodeStatus { return woc.markNodePhase(nodeName, wfv1.NodeError, err.Error()) }
go
func (woc *wfOperationCtx) markNodeError(nodeName string, err error) *wfv1.NodeStatus { return woc.markNodePhase(nodeName, wfv1.NodeError, err.Error()) }
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "markNodeError", "(", "nodeName", "string", ",", "err", "error", ")", "*", "wfv1", ".", "NodeStatus", "{", "return", "woc", ".", "markNodePhase", "(", "nodeName", ",", "wfv1", ".", "NodeError", ",", "err", ...
// markNodeError is a convenience method to mark a node with an error and set the message from the error
[ "markNodeError", "is", "a", "convenience", "method", "to", "mark", "a", "node", "with", "an", "error", "and", "set", "the", "message", "from", "the", "error" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L1210-L1212
134,816
argoproj/argo
workflow/controller/operator.go
getTemplateOutputsFromScope
func getTemplateOutputsFromScope(tmpl *wfv1.Template, scope *wfScope) (*wfv1.Outputs, error) { if !tmpl.Outputs.HasOutputs() { return nil, nil } var outputs wfv1.Outputs if len(tmpl.Outputs.Parameters) > 0 { outputs.Parameters = make([]wfv1.Parameter, 0) for _, param := range tmpl.Outputs.Parameters { val,...
go
func getTemplateOutputsFromScope(tmpl *wfv1.Template, scope *wfScope) (*wfv1.Outputs, error) { if !tmpl.Outputs.HasOutputs() { return nil, nil } var outputs wfv1.Outputs if len(tmpl.Outputs.Parameters) > 0 { outputs.Parameters = make([]wfv1.Parameter, 0) for _, param := range tmpl.Outputs.Parameters { val,...
[ "func", "getTemplateOutputsFromScope", "(", "tmpl", "*", "wfv1", ".", "Template", ",", "scope", "*", "wfScope", ")", "(", "*", "wfv1", ".", "Outputs", ",", "error", ")", "{", "if", "!", "tmpl", ".", "Outputs", ".", "HasOutputs", "(", ")", "{", "return"...
// getTemplateOutputsFromScope resolves a template's outputs from the scope of the template
[ "getTemplateOutputsFromScope", "resolves", "a", "template", "s", "outputs", "from", "the", "scope", "of", "the", "template" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L1300-L1329
134,817
argoproj/argo
workflow/controller/operator.go
processNodeOutputs
func (woc *wfOperationCtx) processNodeOutputs(scope *wfScope, prefix string, node *wfv1.NodeStatus) { if node.PodIP != "" { key := fmt.Sprintf("%s.ip", prefix) scope.addParamToScope(key, node.PodIP) } woc.addOutputsToScope(prefix, node.Outputs, scope) }
go
func (woc *wfOperationCtx) processNodeOutputs(scope *wfScope, prefix string, node *wfv1.NodeStatus) { if node.PodIP != "" { key := fmt.Sprintf("%s.ip", prefix) scope.addParamToScope(key, node.PodIP) } woc.addOutputsToScope(prefix, node.Outputs, scope) }
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "processNodeOutputs", "(", "scope", "*", "wfScope", ",", "prefix", "string", ",", "node", "*", "wfv1", ".", "NodeStatus", ")", "{", "if", "node", ".", "PodIP", "!=", "\"", "\"", "{", "key", ":=", "fmt", ...
// processNodeOutputs adds all of a nodes outputs to the local scope with the given prefix, as well // as the global scope, if specified with a globalName
[ "processNodeOutputs", "adds", "all", "of", "a", "nodes", "outputs", "to", "the", "local", "scope", "with", "the", "given", "prefix", "as", "well", "as", "the", "global", "scope", "if", "specified", "with", "a", "globalName" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L1347-L1353
134,818
argoproj/argo
workflow/controller/operator.go
addParamToGlobalScope
func (woc *wfOperationCtx) addParamToGlobalScope(param wfv1.Parameter) { if param.GlobalName == "" { return } index := -1 if woc.wf.Status.Outputs != nil { for i, gParam := range woc.wf.Status.Outputs.Parameters { if gParam.Name == param.GlobalName { index = i break } } } else { woc.wf.Status...
go
func (woc *wfOperationCtx) addParamToGlobalScope(param wfv1.Parameter) { if param.GlobalName == "" { return } index := -1 if woc.wf.Status.Outputs != nil { for i, gParam := range woc.wf.Status.Outputs.Parameters { if gParam.Name == param.GlobalName { index = i break } } } else { woc.wf.Status...
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "addParamToGlobalScope", "(", "param", "wfv1", ".", "Parameter", ")", "{", "if", "param", ".", "GlobalName", "==", "\"", "\"", "{", "return", "\n", "}", "\n", "index", ":=", "-", "1", "\n", "if", "woc", ...
// addParamToGlobalScope exports any desired node outputs to the global scope, and adds it to the global outputs.
[ "addParamToGlobalScope", "exports", "any", "desired", "node", "outputs", "to", "the", "global", "scope", "and", "adds", "it", "to", "the", "global", "outputs", "." ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L1450-L1480
134,819
argoproj/argo
workflow/controller/operator.go
addArtifactToGlobalScope
func (woc *wfOperationCtx) addArtifactToGlobalScope(art wfv1.Artifact, scope *wfScope) { if art.GlobalName == "" { return } globalArtName := fmt.Sprintf("workflow.outputs.artifacts.%s", art.GlobalName) if woc.wf.Status.Outputs != nil { for i, gArt := range woc.wf.Status.Outputs.Artifacts { if gArt.Name == ar...
go
func (woc *wfOperationCtx) addArtifactToGlobalScope(art wfv1.Artifact, scope *wfScope) { if art.GlobalName == "" { return } globalArtName := fmt.Sprintf("workflow.outputs.artifacts.%s", art.GlobalName) if woc.wf.Status.Outputs != nil { for i, gArt := range woc.wf.Status.Outputs.Artifacts { if gArt.Name == ar...
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "addArtifactToGlobalScope", "(", "art", "wfv1", ".", "Artifact", ",", "scope", "*", "wfScope", ")", "{", "if", "art", ".", "GlobalName", "==", "\"", "\"", "{", "return", "\n", "}", "\n", "globalArtName", ":...
// addArtifactToGlobalScope exports any desired node outputs to the global scope // Optionally adds to a local scope if supplied
[ "addArtifactToGlobalScope", "exports", "any", "desired", "node", "outputs", "to", "the", "global", "scope", "Optionally", "adds", "to", "a", "local", "scope", "if", "supplied" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L1484-L1520
134,820
argoproj/argo
workflow/controller/operator.go
addChildNode
func (woc *wfOperationCtx) addChildNode(parent string, child string) { parentID := woc.wf.NodeID(parent) childID := woc.wf.NodeID(child) node, ok := woc.wf.Status.Nodes[parentID] if !ok { panic(fmt.Sprintf("parent node %s not initialized", parent)) } for _, nodeID := range node.Children { if childID == nodeID...
go
func (woc *wfOperationCtx) addChildNode(parent string, child string) { parentID := woc.wf.NodeID(parent) childID := woc.wf.NodeID(child) node, ok := woc.wf.Status.Nodes[parentID] if !ok { panic(fmt.Sprintf("parent node %s not initialized", parent)) } for _, nodeID := range node.Children { if childID == nodeID...
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "addChildNode", "(", "parent", "string", ",", "child", "string", ")", "{", "parentID", ":=", "woc", ".", "wf", ".", "NodeID", "(", "parent", ")", "\n", "childID", ":=", "woc", ".", "wf", ".", "NodeID", ...
// addChildNode adds a nodeID as a child to a parent // parent and child are both node names
[ "addChildNode", "adds", "a", "nodeID", "as", "a", "child", "to", "a", "parent", "parent", "and", "child", "are", "both", "node", "names" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L1524-L1540
134,821
argoproj/argo
workflow/controller/operator.go
executeResource
func (woc *wfOperationCtx) executeResource(nodeName string, tmpl *wfv1.Template, boundaryID string) *wfv1.NodeStatus { node := woc.getNodeByName(nodeName) if node != nil { return node } mainCtr := woc.newExecContainer(common.MainContainerName) mainCtr.Command = []string{"argoexec", "resource", tmpl.Resource.Acti...
go
func (woc *wfOperationCtx) executeResource(nodeName string, tmpl *wfv1.Template, boundaryID string) *wfv1.NodeStatus { node := woc.getNodeByName(nodeName) if node != nil { return node } mainCtr := woc.newExecContainer(common.MainContainerName) mainCtr.Command = []string{"argoexec", "resource", tmpl.Resource.Acti...
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "executeResource", "(", "nodeName", "string", ",", "tmpl", "*", "wfv1", ".", "Template", ",", "boundaryID", "string", ")", "*", "wfv1", ".", "NodeStatus", "{", "node", ":=", "woc", ".", "getNodeByName", "(", ...
// executeResource is runs a kubectl command against a manifest
[ "executeResource", "is", "runs", "a", "kubectl", "command", "against", "a", "manifest" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L1543-L1558
134,822
argoproj/argo
workflow/controller/operator.go
getSize
func (woc *wfOperationCtx) getSize() int { nodeContent, err := json.Marshal(woc.wf) if err != nil { return -1 } compressNodeSize := len(woc.wf.Status.CompressedNodes) if compressNodeSize > 0 { nodeStatus, err := json.Marshal(woc.wf.Status.Nodes) if err != nil { return -1 } return len(nodeContent) - ...
go
func (woc *wfOperationCtx) getSize() int { nodeContent, err := json.Marshal(woc.wf) if err != nil { return -1 } compressNodeSize := len(woc.wf.Status.CompressedNodes) if compressNodeSize > 0 { nodeStatus, err := json.Marshal(woc.wf.Status.Nodes) if err != nil { return -1 } return len(nodeContent) - ...
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "getSize", "(", ")", "int", "{", "nodeContent", ",", "err", ":=", "json", ".", "Marshal", "(", "woc", ".", "wf", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", "\n", "}", "\n\n", "com...
// getSize return the entire workflow json string size
[ "getSize", "return", "the", "entire", "workflow", "json", "string", "size" ]
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L1644-L1660
134,823
argoproj/argo
workflow/controller/operator.go
checkAndCompress
func (woc *wfOperationCtx) checkAndCompress() error { if woc.wf.Status.CompressedNodes != "" || (woc.wf.Status.CompressedNodes == "" && woc.getSize() >= maxWorkflowSize) { nodeContent, err := json.Marshal(woc.wf.Status.Nodes) if err != nil { return errors.InternalWrapError(err) } buff := string(nodeContent...
go
func (woc *wfOperationCtx) checkAndCompress() error { if woc.wf.Status.CompressedNodes != "" || (woc.wf.Status.CompressedNodes == "" && woc.getSize() >= maxWorkflowSize) { nodeContent, err := json.Marshal(woc.wf.Status.Nodes) if err != nil { return errors.InternalWrapError(err) } buff := string(nodeContent...
[ "func", "(", "woc", "*", "wfOperationCtx", ")", "checkAndCompress", "(", ")", "error", "{", "if", "woc", ".", "wf", ".", "Status", ".", "CompressedNodes", "!=", "\"", "\"", "||", "(", "woc", ".", "wf", ".", "Status", ".", "CompressedNodes", "==", "\"",...
// checkAndCompress will check the workflow size and compress node status if total workflow size is more than maxWorkflowSize. // The compressed content will be assign to compressedNodes element and clear the nodestatus map.
[ "checkAndCompress", "will", "check", "the", "workflow", "size", "and", "compress", "node", "status", "if", "total", "workflow", "size", "is", "more", "than", "maxWorkflowSize", ".", "The", "compressed", "content", "will", "be", "assign", "to", "compressedNodes", ...
4e37a444bde2a034885d0db35f7b38684505063e
https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/operator.go#L1664-L1680
134,824
vitessio/vitess
go/vt/mysqlctl/tmutils/permissions.go
NewUserPermission
func NewUserPermission(fields []*querypb.Field, values []sqltypes.Value) *tabletmanagerdatapb.UserPermission { up := &tabletmanagerdatapb.UserPermission{ Privileges: make(map[string]string), } for i, field := range fields { switch strings.ToLower(field.Name) { case "host": up.Host = values[i].ToString() c...
go
func NewUserPermission(fields []*querypb.Field, values []sqltypes.Value) *tabletmanagerdatapb.UserPermission { up := &tabletmanagerdatapb.UserPermission{ Privileges: make(map[string]string), } for i, field := range fields { switch strings.ToLower(field.Name) { case "host": up.Host = values[i].ToString() c...
[ "func", "NewUserPermission", "(", "fields", "[", "]", "*", "querypb", ".", "Field", ",", "values", "[", "]", "sqltypes", ".", "Value", ")", "*", "tabletmanagerdatapb", ".", "UserPermission", "{", "up", ":=", "&", "tabletmanagerdatapb", ".", "UserPermission", ...
// NewUserPermission is a helper method to create a tabletmanagerdatapb.UserPermission
[ "NewUserPermission", "is", "a", "helper", "method", "to", "create", "a", "tabletmanagerdatapb", ".", "UserPermission" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/tmutils/permissions.go#L60-L80
134,825
vitessio/vitess
go/vt/mysqlctl/tmutils/permissions.go
UserPermissionString
func UserPermissionString(up *tabletmanagerdatapb.UserPermission) string { var passwd string if up.PasswordChecksum == 0 { passwd = "NoPassword" } else { passwd = fmt.Sprintf("PasswordChecksum(%v)", up.PasswordChecksum) } return "UserPermission " + passwd + printPrivileges(up.Privileges) }
go
func UserPermissionString(up *tabletmanagerdatapb.UserPermission) string { var passwd string if up.PasswordChecksum == 0 { passwd = "NoPassword" } else { passwd = fmt.Sprintf("PasswordChecksum(%v)", up.PasswordChecksum) } return "UserPermission " + passwd + printPrivileges(up.Privileges) }
[ "func", "UserPermissionString", "(", "up", "*", "tabletmanagerdatapb", ".", "UserPermission", ")", "string", "{", "var", "passwd", "string", "\n", "if", "up", ".", "PasswordChecksum", "==", "0", "{", "passwd", "=", "\"", "\"", "\n", "}", "else", "{", "pass...
// UserPermissionString pretty-prints a UserPermission
[ "UserPermissionString", "pretty", "-", "prints", "a", "UserPermission" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/tmutils/permissions.go#L88-L96
134,826
vitessio/vitess
go/vt/mysqlctl/tmutils/permissions.go
NewDbPermission
func NewDbPermission(fields []*querypb.Field, values []sqltypes.Value) *tabletmanagerdatapb.DbPermission { up := &tabletmanagerdatapb.DbPermission{ Privileges: make(map[string]string), } for i, field := range fields { switch field.Name { case "Host": up.Host = values[i].ToString() case "Db": up.Db = va...
go
func NewDbPermission(fields []*querypb.Field, values []sqltypes.Value) *tabletmanagerdatapb.DbPermission { up := &tabletmanagerdatapb.DbPermission{ Privileges: make(map[string]string), } for i, field := range fields { switch field.Name { case "Host": up.Host = values[i].ToString() case "Db": up.Db = va...
[ "func", "NewDbPermission", "(", "fields", "[", "]", "*", "querypb", ".", "Field", ",", "values", "[", "]", "sqltypes", ".", "Value", ")", "*", "tabletmanagerdatapb", ".", "DbPermission", "{", "up", ":=", "&", "tabletmanagerdatapb", ".", "DbPermission", "{", ...
// NewDbPermission is a helper method to create a tabletmanagerdatapb.DbPermission
[ "NewDbPermission", "is", "a", "helper", "method", "to", "create", "a", "tabletmanagerdatapb", ".", "DbPermission" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/tmutils/permissions.go#L109-L126
134,827
vitessio/vitess
go/vt/mysqlctl/tmutils/permissions.go
DbPermissionPrimaryKey
func DbPermissionPrimaryKey(dp *tabletmanagerdatapb.DbPermission) string { return dp.Host + ":" + dp.Db + ":" + dp.User }
go
func DbPermissionPrimaryKey(dp *tabletmanagerdatapb.DbPermission) string { return dp.Host + ":" + dp.Db + ":" + dp.User }
[ "func", "DbPermissionPrimaryKey", "(", "dp", "*", "tabletmanagerdatapb", ".", "DbPermission", ")", "string", "{", "return", "dp", ".", "Host", "+", "\"", "\"", "+", "dp", ".", "Db", "+", "\"", "\"", "+", "dp", ".", "User", "\n", "}" ]
// DbPermissionPrimaryKey returns the sorting key for a DbPermission
[ "DbPermissionPrimaryKey", "returns", "the", "sorting", "key", "for", "a", "DbPermission" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/tmutils/permissions.go#L129-L131
134,828
vitessio/vitess
go/vt/mysqlctl/tmutils/permissions.go
PermissionsString
func PermissionsString(permissions *tabletmanagerdatapb.Permissions) string { return printPermissions("User", userPermissionList(permissions.UserPermissions)) + printPermissions("Db", dbPermissionList(permissions.DbPermissions)) }
go
func PermissionsString(permissions *tabletmanagerdatapb.Permissions) string { return printPermissions("User", userPermissionList(permissions.UserPermissions)) + printPermissions("Db", dbPermissionList(permissions.DbPermissions)) }
[ "func", "PermissionsString", "(", "permissions", "*", "tabletmanagerdatapb", ".", "Permissions", ")", "string", "{", "return", "printPermissions", "(", "\"", "\"", ",", "userPermissionList", "(", "permissions", ".", "UserPermissions", ")", ")", "+", "printPermission...
// PermissionsString pretty-prints Permissions
[ "PermissionsString", "pretty", "-", "prints", "Permissions" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/tmutils/permissions.go#L158-L161
134,829
vitessio/vitess
go/vt/mysqlctl/tmutils/permissions.go
DiffPermissions
func DiffPermissions(leftName string, left *tabletmanagerdatapb.Permissions, rightName string, right *tabletmanagerdatapb.Permissions, er concurrency.ErrorRecorder) { diffPermissions("user", leftName, userPermissionList(left.UserPermissions), rightName, userPermissionList(right.UserPermissions), er) diffPermissions("...
go
func DiffPermissions(leftName string, left *tabletmanagerdatapb.Permissions, rightName string, right *tabletmanagerdatapb.Permissions, er concurrency.ErrorRecorder) { diffPermissions("user", leftName, userPermissionList(left.UserPermissions), rightName, userPermissionList(right.UserPermissions), er) diffPermissions("...
[ "func", "DiffPermissions", "(", "leftName", "string", ",", "left", "*", "tabletmanagerdatapb", ".", "Permissions", ",", "rightName", "string", ",", "right", "*", "tabletmanagerdatapb", ".", "Permissions", ",", "er", "concurrency", ".", "ErrorRecorder", ")", "{", ...
// DiffPermissions records the errors between two permission sets
[ "DiffPermissions", "records", "the", "errors", "between", "two", "permission", "sets" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/tmutils/permissions.go#L205-L208
134,830
vitessio/vitess
go/vt/mysqlctl/tmutils/permissions.go
DiffPermissionsToArray
func DiffPermissionsToArray(leftName string, left *tabletmanagerdatapb.Permissions, rightName string, right *tabletmanagerdatapb.Permissions) (result []string) { er := concurrency.AllErrorRecorder{} DiffPermissions(leftName, left, rightName, right, &er) if er.HasErrors() { return er.ErrorStrings() } return nil }
go
func DiffPermissionsToArray(leftName string, left *tabletmanagerdatapb.Permissions, rightName string, right *tabletmanagerdatapb.Permissions) (result []string) { er := concurrency.AllErrorRecorder{} DiffPermissions(leftName, left, rightName, right, &er) if er.HasErrors() { return er.ErrorStrings() } return nil }
[ "func", "DiffPermissionsToArray", "(", "leftName", "string", ",", "left", "*", "tabletmanagerdatapb", ".", "Permissions", ",", "rightName", "string", ",", "right", "*", "tabletmanagerdatapb", ".", "Permissions", ")", "(", "result", "[", "]", "string", ")", "{", ...
// DiffPermissionsToArray difs two sets of permissions, and returns the difference
[ "DiffPermissionsToArray", "difs", "two", "sets", "of", "permissions", "and", "returns", "the", "difference" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/mysqlctl/tmutils/permissions.go#L211-L218
134,831
vitessio/vitess
go/vt/vitessdriver/rows.go
newRows
func newRows(qr *sqltypes.Result, c *converter) driver.Rows { return &rows{qr: qr, convert: c} }
go
func newRows(qr *sqltypes.Result, c *converter) driver.Rows { return &rows{qr: qr, convert: c} }
[ "func", "newRows", "(", "qr", "*", "sqltypes", ".", "Result", ",", "c", "*", "converter", ")", "driver", ".", "Rows", "{", "return", "&", "rows", "{", "qr", ":", "qr", ",", "convert", ":", "c", "}", "\n", "}" ]
// newRows creates a new rows from qr.
[ "newRows", "creates", "a", "new", "rows", "from", "qr", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vitessdriver/rows.go#L35-L37
134,832
vitessio/vitess
go/vt/servenv/unix_socket.go
serveSocketFile
func serveSocketFile() { if SocketFile == nil || *SocketFile == "" { log.Infof("Not listening on socket file") return } name := *SocketFile // try to delete if file exists if _, err := os.Stat(name); err == nil { err = os.Remove(name) if err != nil { log.Exitf("Cannot remove socket file %v: %v", name, ...
go
func serveSocketFile() { if SocketFile == nil || *SocketFile == "" { log.Infof("Not listening on socket file") return } name := *SocketFile // try to delete if file exists if _, err := os.Stat(name); err == nil { err = os.Remove(name) if err != nil { log.Exitf("Cannot remove socket file %v: %v", name, ...
[ "func", "serveSocketFile", "(", ")", "{", "if", "SocketFile", "==", "nil", "||", "*", "SocketFile", "==", "\"", "\"", "{", "log", ".", "Infof", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "name", ":=", "*", "SocketFile", "\n\n", "// try to...
// serveSocketFile listen to the named socket and serves RPCs on it.
[ "serveSocketFile", "listen", "to", "the", "named", "socket", "and", "serves", "RPCs", "on", "it", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/servenv/unix_socket.go#L34-L55
134,833
vitessio/vitess
go/vt/vtgate/safe_session.go
NewAutocommitSession
func NewAutocommitSession(sessn *vtgatepb.Session) *SafeSession { newSession := proto.Clone(sessn).(*vtgatepb.Session) newSession.InTransaction = false newSession.ShardSessions = nil newSession.Autocommit = true return NewSafeSession(newSession) }
go
func NewAutocommitSession(sessn *vtgatepb.Session) *SafeSession { newSession := proto.Clone(sessn).(*vtgatepb.Session) newSession.InTransaction = false newSession.ShardSessions = nil newSession.Autocommit = true return NewSafeSession(newSession) }
[ "func", "NewAutocommitSession", "(", "sessn", "*", "vtgatepb", ".", "Session", ")", "*", "SafeSession", "{", "newSession", ":=", "proto", ".", "Clone", "(", "sessn", ")", ".", "(", "*", "vtgatepb", ".", "Session", ")", "\n", "newSession", ".", "InTransacti...
// NewAutocommitSession returns a SafeSession based on the original // session, but with autocommit enabled.
[ "NewAutocommitSession", "returns", "a", "SafeSession", "based", "on", "the", "original", "session", "but", "with", "autocommit", "enabled", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/safe_session.go#L73-L79
134,834
vitessio/vitess
go/vt/vtgate/safe_session.go
SetAutocommitable
func (session *SafeSession) SetAutocommitable(flag bool) { session.mu.Lock() defer session.mu.Unlock() if session.autocommitState == autocommitted { panic("BUG: SetAutocommitable: unexpected autocommit state") } if flag { session.autocommitState = autocommittable } else { session.autocommitState = notAuto...
go
func (session *SafeSession) SetAutocommitable(flag bool) { session.mu.Lock() defer session.mu.Unlock() if session.autocommitState == autocommitted { panic("BUG: SetAutocommitable: unexpected autocommit state") } if flag { session.autocommitState = autocommittable } else { session.autocommitState = notAuto...
[ "func", "(", "session", "*", "SafeSession", ")", "SetAutocommitable", "(", "flag", "bool", ")", "{", "session", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "session", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "session", ".", "autocommitSta...
// SetAutocommitable sets the state to autocommitable if true. // Otherwise, it's notAutocommitable.
[ "SetAutocommitable", "sets", "the", "state", "to", "autocommitable", "if", "true", ".", "Otherwise", "it", "s", "notAutocommitable", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/safe_session.go#L83-L96
134,835
vitessio/vitess
go/vt/vtgate/safe_session.go
AutocommitApproval
func (session *SafeSession) AutocommitApproval() bool { session.mu.Lock() defer session.mu.Unlock() if session.autocommitState == autocommitted { panic("BUG: AutocommitToken: unexpected autocommit state") } if session.autocommitState == autocommittable && len(session.ShardSessions) == 0 { session.autocommitS...
go
func (session *SafeSession) AutocommitApproval() bool { session.mu.Lock() defer session.mu.Unlock() if session.autocommitState == autocommitted { panic("BUG: AutocommitToken: unexpected autocommit state") } if session.autocommitState == autocommittable && len(session.ShardSessions) == 0 { session.autocommitS...
[ "func", "(", "session", "*", "SafeSession", ")", "AutocommitApproval", "(", ")", "bool", "{", "session", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "session", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "session", ".", "autocommitState", "=...
// AutocommitApproval returns true if we can perform a single round-trip // autocommit. If so, the caller is responsible for committing their // transaction.
[ "AutocommitApproval", "returns", "true", "if", "we", "can", "perform", "a", "single", "round", "-", "trip", "autocommit", ".", "If", "so", "the", "caller", "is", "responsible", "for", "committing", "their", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/safe_session.go#L101-L114
134,836
vitessio/vitess
go/vt/vtgate/safe_session.go
InTransaction
func (session *SafeSession) InTransaction() bool { if session == nil || session.Session == nil { return false } session.mu.Lock() defer session.mu.Unlock() return session.Session.InTransaction }
go
func (session *SafeSession) InTransaction() bool { if session == nil || session.Session == nil { return false } session.mu.Lock() defer session.mu.Unlock() return session.Session.InTransaction }
[ "func", "(", "session", "*", "SafeSession", ")", "InTransaction", "(", ")", "bool", "{", "if", "session", "==", "nil", "||", "session", ".", "Session", "==", "nil", "{", "return", "false", "\n", "}", "\n", "session", ".", "mu", ".", "Lock", "(", ")",...
// InTransaction returns true if we are in a transaction
[ "InTransaction", "returns", "true", "if", "we", "are", "in", "a", "transaction" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/safe_session.go#L117-L124
134,837
vitessio/vitess
go/vt/vtgate/safe_session.go
Find
func (session *SafeSession) Find(keyspace, shard string, tabletType topodatapb.TabletType) int64 { if session == nil { return 0 } session.mu.Lock() defer session.mu.Unlock() for _, shardSession := range session.ShardSessions { if keyspace == shardSession.Target.Keyspace && tabletType == shardSession.Target.Tab...
go
func (session *SafeSession) Find(keyspace, shard string, tabletType topodatapb.TabletType) int64 { if session == nil { return 0 } session.mu.Lock() defer session.mu.Unlock() for _, shardSession := range session.ShardSessions { if keyspace == shardSession.Target.Keyspace && tabletType == shardSession.Target.Tab...
[ "func", "(", "session", "*", "SafeSession", ")", "Find", "(", "keyspace", ",", "shard", "string", ",", "tabletType", "topodatapb", ".", "TabletType", ")", "int64", "{", "if", "session", "==", "nil", "{", "return", "0", "\n", "}", "\n", "session", ".", ...
// Find returns the transactionId, if any, for a session
[ "Find", "returns", "the", "transactionId", "if", "any", "for", "a", "session" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/safe_session.go#L127-L139
134,838
vitessio/vitess
go/vt/vtgate/safe_session.go
Append
func (session *SafeSession) Append(shardSession *vtgatepb.Session_ShardSession, txMode vtgatepb.TransactionMode) error { session.mu.Lock() defer session.mu.Unlock() if session.autocommitState == autocommitted { panic("BUG: SafeSession.Append: unexpected autocommit state") } // Always append, in order for rollb...
go
func (session *SafeSession) Append(shardSession *vtgatepb.Session_ShardSession, txMode vtgatepb.TransactionMode) error { session.mu.Lock() defer session.mu.Unlock() if session.autocommitState == autocommitted { panic("BUG: SafeSession.Append: unexpected autocommit state") } // Always append, in order for rollb...
[ "func", "(", "session", "*", "SafeSession", ")", "Append", "(", "shardSession", "*", "vtgatepb", ".", "Session_ShardSession", ",", "txMode", "vtgatepb", ".", "TransactionMode", ")", "error", "{", "session", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", ...
// Append adds a new ShardSession
[ "Append", "adds", "a", "new", "ShardSession" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/safe_session.go#L142-L157
134,839
vitessio/vitess
go/vt/vtgate/safe_session.go
SetRollback
func (session *SafeSession) SetRollback() { if session == nil || session.Session == nil || !session.Session.InTransaction { return } session.mu.Lock() defer session.mu.Unlock() session.mustRollback = true }
go
func (session *SafeSession) SetRollback() { if session == nil || session.Session == nil || !session.Session.InTransaction { return } session.mu.Lock() defer session.mu.Unlock() session.mustRollback = true }
[ "func", "(", "session", "*", "SafeSession", ")", "SetRollback", "(", ")", "{", "if", "session", "==", "nil", "||", "session", ".", "Session", "==", "nil", "||", "!", "session", ".", "Session", ".", "InTransaction", "{", "return", "\n", "}", "\n", "sess...
// SetRollback sets the flag indicating that the transaction must be rolled back. // The call is a no-op if the session is not in a transaction.
[ "SetRollback", "sets", "the", "flag", "indicating", "that", "the", "transaction", "must", "be", "rolled", "back", ".", "The", "call", "is", "a", "no", "-", "op", "if", "the", "session", "is", "not", "in", "a", "transaction", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/safe_session.go#L167-L174
134,840
vitessio/vitess
go/vt/vtgate/safe_session.go
MustRollback
func (session *SafeSession) MustRollback() bool { if session == nil { return false } session.mu.Lock() defer session.mu.Unlock() return session.mustRollback }
go
func (session *SafeSession) MustRollback() bool { if session == nil { return false } session.mu.Lock() defer session.mu.Unlock() return session.mustRollback }
[ "func", "(", "session", "*", "SafeSession", ")", "MustRollback", "(", ")", "bool", "{", "if", "session", "==", "nil", "{", "return", "false", "\n", "}", "\n", "session", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "session", ".", "mu", ".", "U...
// MustRollback returns true if the transaction must be rolled back.
[ "MustRollback", "returns", "true", "if", "the", "transaction", "must", "be", "rolled", "back", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/safe_session.go#L177-L184
134,841
vitessio/vitess
go/vt/vtgate/safe_session.go
RecordWarning
func (session *SafeSession) RecordWarning(warning *querypb.QueryWarning) { session.mu.Lock() defer session.mu.Unlock() session.Session.Warnings = append(session.Session.Warnings, warning) }
go
func (session *SafeSession) RecordWarning(warning *querypb.QueryWarning) { session.mu.Lock() defer session.mu.Unlock() session.Session.Warnings = append(session.Session.Warnings, warning) }
[ "func", "(", "session", "*", "SafeSession", ")", "RecordWarning", "(", "warning", "*", "querypb", ".", "QueryWarning", ")", "{", "session", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "session", ".", "mu", ".", "Unlock", "(", ")", "\n", "session",...
// RecordWarning stores the given warning in the session
[ "RecordWarning", "stores", "the", "given", "warning", "in", "the", "session" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/safe_session.go#L187-L191
134,842
vitessio/vitess
go/vt/vtgate/safe_session.go
ClearWarnings
func (session *SafeSession) ClearWarnings() { session.mu.Lock() defer session.mu.Unlock() session.Session.Warnings = nil }
go
func (session *SafeSession) ClearWarnings() { session.mu.Lock() defer session.mu.Unlock() session.Session.Warnings = nil }
[ "func", "(", "session", "*", "SafeSession", ")", "ClearWarnings", "(", ")", "{", "session", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "session", ".", "mu", ".", "Unlock", "(", ")", "\n", "session", ".", "Session", ".", "Warnings", "=", "nil", ...
// ClearWarnings removes all the warnings from the session
[ "ClearWarnings", "removes", "all", "the", "warnings", "from", "the", "session" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/safe_session.go#L194-L198
134,843
vitessio/vitess
go/vt/vtgate/safe_session.go
Reset
func (session *SafeSession) Reset() { if session == nil || session.Session == nil { return } session.mu.Lock() defer session.mu.Unlock() session.mustRollback = false session.autocommitState = notAutocommittable session.Session.InTransaction = false session.SingleDb = false session.ShardSessions = nil }
go
func (session *SafeSession) Reset() { if session == nil || session.Session == nil { return } session.mu.Lock() defer session.mu.Unlock() session.mustRollback = false session.autocommitState = notAutocommittable session.Session.InTransaction = false session.SingleDb = false session.ShardSessions = nil }
[ "func", "(", "session", "*", "SafeSession", ")", "Reset", "(", ")", "{", "if", "session", "==", "nil", "||", "session", ".", "Session", "==", "nil", "{", "return", "\n", "}", "\n", "session", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "sessio...
// Reset clears the session
[ "Reset", "clears", "the", "session" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/safe_session.go#L201-L212
134,844
vitessio/vitess
go/vt/topo/srv_vschema.go
WatchSrvVSchema
func (ts *Server) WatchSrvVSchema(ctx context.Context, cell string) (*WatchSrvVSchemaData, <-chan *WatchSrvVSchemaData, CancelFunc) { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return &WatchSrvVSchemaData{Err: err}, nil, nil } current, wdChannel, cancel := conn.Watch(ctx, SrvVSchemaFile) if current....
go
func (ts *Server) WatchSrvVSchema(ctx context.Context, cell string) (*WatchSrvVSchemaData, <-chan *WatchSrvVSchemaData, CancelFunc) { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return &WatchSrvVSchemaData{Err: err}, nil, nil } current, wdChannel, cancel := conn.Watch(ctx, SrvVSchemaFile) if current....
[ "func", "(", "ts", "*", "Server", ")", "WatchSrvVSchema", "(", "ctx", "context", ".", "Context", ",", "cell", "string", ")", "(", "*", "WatchSrvVSchemaData", ",", "<-", "chan", "*", "WatchSrvVSchemaData", ",", "CancelFunc", ")", "{", "conn", ",", "err", ...
// WatchSrvVSchema will set a watch on the SrvVSchema object. // It has the same contract as Conn.Watch, but it also unpacks the // contents into a SrvVSchema object.
[ "WatchSrvVSchema", "will", "set", "a", "watch", "on", "the", "SrvVSchema", "object", ".", "It", "has", "the", "same", "contract", "as", "Conn", ".", "Watch", "but", "it", "also", "unpacks", "the", "contents", "into", "a", "SrvVSchema", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_vschema.go#L39-L90
134,845
vitessio/vitess
go/vt/topo/srv_vschema.go
UpdateSrvVSchema
func (ts *Server) UpdateSrvVSchema(ctx context.Context, cell string, srvVSchema *vschemapb.SrvVSchema) error { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } nodePath := SrvVSchemaFile data, err := proto.Marshal(srvVSchema) if err != nil { return err } _, err = conn.Update(ctx, nodePat...
go
func (ts *Server) UpdateSrvVSchema(ctx context.Context, cell string, srvVSchema *vschemapb.SrvVSchema) error { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } nodePath := SrvVSchemaFile data, err := proto.Marshal(srvVSchema) if err != nil { return err } _, err = conn.Update(ctx, nodePat...
[ "func", "(", "ts", "*", "Server", ")", "UpdateSrvVSchema", "(", "ctx", "context", ".", "Context", ",", "cell", "string", ",", "srvVSchema", "*", "vschemapb", ".", "SrvVSchema", ")", "error", "{", "conn", ",", "err", ":=", "ts", ".", "ConnForCell", "(", ...
// UpdateSrvVSchema updates the SrvVSchema file for a cell.
[ "UpdateSrvVSchema", "updates", "the", "SrvVSchema", "file", "for", "a", "cell", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_vschema.go#L93-L106
134,846
vitessio/vitess
go/vt/topo/srv_vschema.go
GetSrvVSchema
func (ts *Server) GetSrvVSchema(ctx context.Context, cell string) (*vschemapb.SrvVSchema, error) { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return nil, err } nodePath := SrvVSchemaFile data, _, err := conn.Get(ctx, nodePath) if err != nil { return nil, err } srvVSchema := &vschemapb.SrvVSchem...
go
func (ts *Server) GetSrvVSchema(ctx context.Context, cell string) (*vschemapb.SrvVSchema, error) { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return nil, err } nodePath := SrvVSchemaFile data, _, err := conn.Get(ctx, nodePath) if err != nil { return nil, err } srvVSchema := &vschemapb.SrvVSchem...
[ "func", "(", "ts", "*", "Server", ")", "GetSrvVSchema", "(", "ctx", "context", ".", "Context", ",", "cell", "string", ")", "(", "*", "vschemapb", ".", "SrvVSchema", ",", "error", ")", "{", "conn", ",", "err", ":=", "ts", ".", "ConnForCell", "(", "ctx...
// GetSrvVSchema returns the SrvVSchema for a cell.
[ "GetSrvVSchema", "returns", "the", "SrvVSchema", "for", "a", "cell", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_vschema.go#L109-L125
134,847
vitessio/vitess
go/vt/topo/srv_vschema.go
DeleteSrvVSchema
func (ts *Server) DeleteSrvVSchema(ctx context.Context, cell string) error { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } nodePath := SrvVSchemaFile return conn.Delete(ctx, nodePath, nil) }
go
func (ts *Server) DeleteSrvVSchema(ctx context.Context, cell string) error { conn, err := ts.ConnForCell(ctx, cell) if err != nil { return err } nodePath := SrvVSchemaFile return conn.Delete(ctx, nodePath, nil) }
[ "func", "(", "ts", "*", "Server", ")", "DeleteSrvVSchema", "(", "ctx", "context", ".", "Context", ",", "cell", "string", ")", "error", "{", "conn", ",", "err", ":=", "ts", ".", "ConnForCell", "(", "ctx", ",", "cell", ")", "\n", "if", "err", "!=", "...
// DeleteSrvVSchema deletes the SrvVSchema file for a cell.
[ "DeleteSrvVSchema", "deletes", "the", "SrvVSchema", "file", "for", "a", "cell", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/srv_vschema.go#L128-L136
134,848
vitessio/vitess
go/vt/vtgate/engine/delete.go
MarshalJSON
func (del *Delete) MarshalJSON() ([]byte, error) { var tname, vindexName string if del.Table != nil { tname = del.Table.Name.String() } if del.Vindex != nil { vindexName = del.Vindex.String() } marshalDelete := struct { Opcode DeleteOpcode Keyspace *vindexes.Keyspace `json:",om...
go
func (del *Delete) MarshalJSON() ([]byte, error) { var tname, vindexName string if del.Table != nil { tname = del.Table.Name.String() } if del.Vindex != nil { vindexName = del.Vindex.String() } marshalDelete := struct { Opcode DeleteOpcode Keyspace *vindexes.Keyspace `json:",om...
[ "func", "(", "del", "*", "Delete", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "tname", ",", "vindexName", "string", "\n", "if", "del", ".", "Table", "!=", "nil", "{", "tname", "=", "del", ".", "Table", "."...
// MarshalJSON serializes the Delete into a JSON representation. // It's used for testing and diagnostics.
[ "MarshalJSON", "serializes", "the", "Delete", "into", "a", "JSON", "representation", ".", "It", "s", "used", "for", "testing", "and", "diagnostics", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/vtgate/engine/delete.go#L74-L104
134,849
vitessio/vitess
go/vt/topo/keyspace.go
GetServedFrom
func (ki *KeyspaceInfo) GetServedFrom(tabletType topodatapb.TabletType) *topodatapb.Keyspace_ServedFrom { for _, ksf := range ki.ServedFroms { if ksf.TabletType == tabletType { return ksf } } return nil }
go
func (ki *KeyspaceInfo) GetServedFrom(tabletType topodatapb.TabletType) *topodatapb.Keyspace_ServedFrom { for _, ksf := range ki.ServedFroms { if ksf.TabletType == tabletType { return ksf } } return nil }
[ "func", "(", "ki", "*", "KeyspaceInfo", ")", "GetServedFrom", "(", "tabletType", "topodatapb", ".", "TabletType", ")", "*", "topodatapb", ".", "Keyspace_ServedFrom", "{", "for", "_", ",", "ksf", ":=", "range", "ki", ".", "ServedFroms", "{", "if", "ksf", "....
// GetServedFrom returns a Keyspace_ServedFrom record if it exists.
[ "GetServedFrom", "returns", "a", "Keyspace_ServedFrom", "record", "if", "it", "exists", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/keyspace.go#L53-L60
134,850
vitessio/vitess
go/vt/topo/keyspace.go
CheckServedFromMigration
func (ki *KeyspaceInfo) CheckServedFromMigration(tabletType topodatapb.TabletType, cells []string, keyspace string, remove bool) error { // master is a special case with a few extra checks if tabletType == topodatapb.TabletType_MASTER { if !remove { return vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "cannot ...
go
func (ki *KeyspaceInfo) CheckServedFromMigration(tabletType topodatapb.TabletType, cells []string, keyspace string, remove bool) error { // master is a special case with a few extra checks if tabletType == topodatapb.TabletType_MASTER { if !remove { return vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "cannot ...
[ "func", "(", "ki", "*", "KeyspaceInfo", ")", "CheckServedFromMigration", "(", "tabletType", "topodatapb", ".", "TabletType", ",", "cells", "[", "]", "string", ",", "keyspace", "string", ",", "remove", "bool", ")", "error", "{", "// master is a special case with a ...
// CheckServedFromMigration makes sure a requested migration is safe
[ "CheckServedFromMigration", "makes", "sure", "a", "requested", "migration", "is", "safe" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/keyspace.go#L63-L90
134,851
vitessio/vitess
go/vt/topo/keyspace.go
UpdateServedFromMap
func (ki *KeyspaceInfo) UpdateServedFromMap(tabletType topodatapb.TabletType, cells []string, keyspace string, remove bool, allCells []string) error { // check parameters to be sure if err := ki.CheckServedFromMigration(tabletType, cells, keyspace, remove); err != nil { return err } ksf := ki.GetServedFrom(table...
go
func (ki *KeyspaceInfo) UpdateServedFromMap(tabletType topodatapb.TabletType, cells []string, keyspace string, remove bool, allCells []string) error { // check parameters to be sure if err := ki.CheckServedFromMigration(tabletType, cells, keyspace, remove); err != nil { return err } ksf := ki.GetServedFrom(table...
[ "func", "(", "ki", "*", "KeyspaceInfo", ")", "UpdateServedFromMap", "(", "tabletType", "topodatapb", ".", "TabletType", ",", "cells", "[", "]", "string", ",", "keyspace", "string", ",", "remove", "bool", ",", "allCells", "[", "]", "string", ")", "error", "...
// UpdateServedFromMap handles ServedFromMap. It can add or remove // records, cells, ...
[ "UpdateServedFromMap", "handles", "ServedFromMap", ".", "It", "can", "add", "or", "remove", "records", "cells", "..." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/keyspace.go#L94-L139
134,852
vitessio/vitess
go/vt/topo/keyspace.go
ComputeCellServedFrom
func (ki *KeyspaceInfo) ComputeCellServedFrom(cell string) []*topodatapb.SrvKeyspace_ServedFrom { var result []*topodatapb.SrvKeyspace_ServedFrom for _, ksf := range ki.ServedFroms { if InCellList(cell, ksf.Cells) { result = append(result, &topodatapb.SrvKeyspace_ServedFrom{ TabletType: ksf.TabletType, K...
go
func (ki *KeyspaceInfo) ComputeCellServedFrom(cell string) []*topodatapb.SrvKeyspace_ServedFrom { var result []*topodatapb.SrvKeyspace_ServedFrom for _, ksf := range ki.ServedFroms { if InCellList(cell, ksf.Cells) { result = append(result, &topodatapb.SrvKeyspace_ServedFrom{ TabletType: ksf.TabletType, K...
[ "func", "(", "ki", "*", "KeyspaceInfo", ")", "ComputeCellServedFrom", "(", "cell", "string", ")", "[", "]", "*", "topodatapb", ".", "SrvKeyspace_ServedFrom", "{", "var", "result", "[", "]", "*", "topodatapb", ".", "SrvKeyspace_ServedFrom", "\n", "for", "_", ...
// ComputeCellServedFrom returns the ServedFrom list for a cell
[ "ComputeCellServedFrom", "returns", "the", "ServedFrom", "list", "for", "a", "cell" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/keyspace.go#L142-L153
134,853
vitessio/vitess
go/vt/topo/keyspace.go
CreateKeyspace
func (ts *Server) CreateKeyspace(ctx context.Context, keyspace string, value *topodatapb.Keyspace) error { data, err := proto.Marshal(value) if err != nil { return err } keyspacePath := path.Join(KeyspacesPath, keyspace, KeyspaceFile) if _, err := ts.globalCell.Create(ctx, keyspacePath, data); err != nil { re...
go
func (ts *Server) CreateKeyspace(ctx context.Context, keyspace string, value *topodatapb.Keyspace) error { data, err := proto.Marshal(value) if err != nil { return err } keyspacePath := path.Join(KeyspacesPath, keyspace, KeyspaceFile) if _, err := ts.globalCell.Create(ctx, keyspacePath, data); err != nil { re...
[ "func", "(", "ts", "*", "Server", ")", "CreateKeyspace", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ",", "value", "*", "topodatapb", ".", "Keyspace", ")", "error", "{", "data", ",", "err", ":=", "proto", ".", "Marshal", "(", "val...
// CreateKeyspace wraps the underlying Conn.Create // and dispatches the event.
[ "CreateKeyspace", "wraps", "the", "underlying", "Conn", ".", "Create", "and", "dispatches", "the", "event", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/keyspace.go#L157-L173
134,854
vitessio/vitess
go/vt/topo/keyspace.go
GetKeyspace
func (ts *Server) GetKeyspace(ctx context.Context, keyspace string) (*KeyspaceInfo, error) { keyspacePath := path.Join(KeyspacesPath, keyspace, KeyspaceFile) data, version, err := ts.globalCell.Get(ctx, keyspacePath) if err != nil { return nil, err } k := &topodatapb.Keyspace{} if err = proto.Unmarshal(data, k...
go
func (ts *Server) GetKeyspace(ctx context.Context, keyspace string) (*KeyspaceInfo, error) { keyspacePath := path.Join(KeyspacesPath, keyspace, KeyspaceFile) data, version, err := ts.globalCell.Get(ctx, keyspacePath) if err != nil { return nil, err } k := &topodatapb.Keyspace{} if err = proto.Unmarshal(data, k...
[ "func", "(", "ts", "*", "Server", ")", "GetKeyspace", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ")", "(", "*", "KeyspaceInfo", ",", "error", ")", "{", "keyspacePath", ":=", "path", ".", "Join", "(", "KeyspacesPath", ",", "keyspace...
// GetKeyspace reads the given keyspace and returns it
[ "GetKeyspace", "reads", "the", "given", "keyspace", "and", "returns", "it" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/keyspace.go#L176-L193
134,855
vitessio/vitess
go/vt/topo/keyspace.go
UpdateKeyspace
func (ts *Server) UpdateKeyspace(ctx context.Context, ki *KeyspaceInfo) error { // make sure it is locked first if err := CheckKeyspaceLocked(ctx, ki.keyspace); err != nil { return err } data, err := proto.Marshal(ki.Keyspace) if err != nil { return err } keyspacePath := path.Join(KeyspacesPath, ki.keyspace...
go
func (ts *Server) UpdateKeyspace(ctx context.Context, ki *KeyspaceInfo) error { // make sure it is locked first if err := CheckKeyspaceLocked(ctx, ki.keyspace); err != nil { return err } data, err := proto.Marshal(ki.Keyspace) if err != nil { return err } keyspacePath := path.Join(KeyspacesPath, ki.keyspace...
[ "func", "(", "ts", "*", "Server", ")", "UpdateKeyspace", "(", "ctx", "context", ".", "Context", ",", "ki", "*", "KeyspaceInfo", ")", "error", "{", "// make sure it is locked first", "if", "err", ":=", "CheckKeyspaceLocked", "(", "ctx", ",", "ki", ".", "keysp...
// UpdateKeyspace updates the keyspace data. It checks the keyspace is locked.
[ "UpdateKeyspace", "updates", "the", "keyspace", "data", ".", "It", "checks", "the", "keyspace", "is", "locked", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/keyspace.go#L196-L219
134,856
vitessio/vitess
go/vt/topo/keyspace.go
FindAllShardsInKeyspace
func (ts *Server) FindAllShardsInKeyspace(ctx context.Context, keyspace string) (map[string]*ShardInfo, error) { shards, err := ts.GetShardNames(ctx, keyspace) if err != nil { return nil, vterrors.Wrapf(err, "failed to get list of shards for keyspace '%v'", keyspace) } result := make(map[string]*ShardInfo, len(s...
go
func (ts *Server) FindAllShardsInKeyspace(ctx context.Context, keyspace string) (map[string]*ShardInfo, error) { shards, err := ts.GetShardNames(ctx, keyspace) if err != nil { return nil, vterrors.Wrapf(err, "failed to get list of shards for keyspace '%v'", keyspace) } result := make(map[string]*ShardInfo, len(s...
[ "func", "(", "ts", "*", "Server", ")", "FindAllShardsInKeyspace", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ")", "(", "map", "[", "string", "]", "*", "ShardInfo", ",", "error", ")", "{", "shards", ",", "err", ":=", "ts", ".", ...
// FindAllShardsInKeyspace reads and returns all the existing shards in // a keyspace. It doesn't take any lock.
[ "FindAllShardsInKeyspace", "reads", "and", "returns", "all", "the", "existing", "shards", "in", "a", "keyspace", ".", "It", "doesn", "t", "take", "any", "lock", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/keyspace.go#L223-L256
134,857
vitessio/vitess
go/vt/topo/keyspace.go
GetOnlyShard
func (ts *Server) GetOnlyShard(ctx context.Context, keyspace string) (*ShardInfo, error) { allShards, err := ts.FindAllShardsInKeyspace(ctx, keyspace) if err != nil { return nil, err } if len(allShards) == 1 { for _, s := range allShards { return s, nil } } return nil, vterrors.Errorf(vtrpc.Code_INVALID_...
go
func (ts *Server) GetOnlyShard(ctx context.Context, keyspace string) (*ShardInfo, error) { allShards, err := ts.FindAllShardsInKeyspace(ctx, keyspace) if err != nil { return nil, err } if len(allShards) == 1 { for _, s := range allShards { return s, nil } } return nil, vterrors.Errorf(vtrpc.Code_INVALID_...
[ "func", "(", "ts", "*", "Server", ")", "GetOnlyShard", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ")", "(", "*", "ShardInfo", ",", "error", ")", "{", "allShards", ",", "err", ":=", "ts", ".", "FindAllShardsInKeyspace", "(", "ctx", ...
// GetOnlyShard returns the single ShardInfo of an unsharded keyspace.
[ "GetOnlyShard", "returns", "the", "single", "ShardInfo", "of", "an", "unsharded", "keyspace", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/keyspace.go#L259-L270
134,858
vitessio/vitess
go/vt/topo/keyspace.go
DeleteKeyspace
func (ts *Server) DeleteKeyspace(ctx context.Context, keyspace string) error { keyspacePath := path.Join(KeyspacesPath, keyspace, KeyspaceFile) if err := ts.globalCell.Delete(ctx, keyspacePath, nil); err != nil { return err } event.Dispatch(&events.KeyspaceChange{ KeyspaceName: keyspace, Keyspace: nil, ...
go
func (ts *Server) DeleteKeyspace(ctx context.Context, keyspace string) error { keyspacePath := path.Join(KeyspacesPath, keyspace, KeyspaceFile) if err := ts.globalCell.Delete(ctx, keyspacePath, nil); err != nil { return err } event.Dispatch(&events.KeyspaceChange{ KeyspaceName: keyspace, Keyspace: nil, ...
[ "func", "(", "ts", "*", "Server", ")", "DeleteKeyspace", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ")", "error", "{", "keyspacePath", ":=", "path", ".", "Join", "(", "KeyspacesPath", ",", "keyspace", ",", "KeyspaceFile", ")", "\n", ...
// DeleteKeyspace wraps the underlying Conn.Delete // and dispatches the event.
[ "DeleteKeyspace", "wraps", "the", "underlying", "Conn", ".", "Delete", "and", "dispatches", "the", "event", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/keyspace.go#L274-L285
134,859
vitessio/vitess
go/vt/topo/keyspace.go
GetKeyspaces
func (ts *Server) GetKeyspaces(ctx context.Context) ([]string, error) { children, err := ts.globalCell.ListDir(ctx, KeyspacesPath, false /*full*/) switch { case err == nil: return DirEntriesToStringArray(children), nil case IsErrType(err, NoNode): return nil, nil default: return nil, err } }
go
func (ts *Server) GetKeyspaces(ctx context.Context) ([]string, error) { children, err := ts.globalCell.ListDir(ctx, KeyspacesPath, false /*full*/) switch { case err == nil: return DirEntriesToStringArray(children), nil case IsErrType(err, NoNode): return nil, nil default: return nil, err } }
[ "func", "(", "ts", "*", "Server", ")", "GetKeyspaces", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "string", ",", "error", ")", "{", "children", ",", "err", ":=", "ts", ".", "globalCell", ".", "ListDir", "(", "ctx", ",", "KeyspacesPath...
// GetKeyspaces returns the list of keyspaces in the topology.
[ "GetKeyspaces", "returns", "the", "list", "of", "keyspaces", "in", "the", "topology", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/keyspace.go#L288-L298
134,860
vitessio/vitess
go/vt/topo/keyspace.go
GetShardNames
func (ts *Server) GetShardNames(ctx context.Context, keyspace string) ([]string, error) { shardsPath := path.Join(KeyspacesPath, keyspace, ShardsPath) children, err := ts.globalCell.ListDir(ctx, shardsPath, false /*full*/) if IsErrType(err, NoNode) { // The directory doesn't exist, let's see if the keyspace // i...
go
func (ts *Server) GetShardNames(ctx context.Context, keyspace string) ([]string, error) { shardsPath := path.Join(KeyspacesPath, keyspace, ShardsPath) children, err := ts.globalCell.ListDir(ctx, shardsPath, false /*full*/) if IsErrType(err, NoNode) { // The directory doesn't exist, let's see if the keyspace // i...
[ "func", "(", "ts", "*", "Server", ")", "GetShardNames", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "shardsPath", ":=", "path", ".", "Join", "(", "KeyspacesPath", ",", "keyspac...
// GetShardNames returns the list of shards in a keyspace.
[ "GetShardNames", "returns", "the", "list", "of", "shards", "in", "a", "keyspace", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/keyspace.go#L301-L315
134,861
vitessio/vitess
go/vt/worker/vtworkerclient/interface.go
RegisterFactory
func RegisterFactory(name string, factory Factory) { if _, ok := factories[name]; ok { log.Fatalf("RegisterFactory: %s already exists", name) } factories[name] = factory }
go
func RegisterFactory(name string, factory Factory) { if _, ok := factories[name]; ok { log.Fatalf("RegisterFactory: %s already exists", name) } factories[name] = factory }
[ "func", "RegisterFactory", "(", "name", "string", ",", "factory", "Factory", ")", "{", "if", "_", ",", "ok", ":=", "factories", "[", "name", "]", ";", "ok", "{", "log", ".", "Fatalf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "factories",...
// RegisterFactory allows a client implementation to register itself.
[ "RegisterFactory", "allows", "a", "client", "implementation", "to", "register", "itself", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/worker/vtworkerclient/interface.go#L49-L54
134,862
vitessio/vitess
go/sync2/semaphore.go
NewSemaphore
func NewSemaphore(count int, timeout time.Duration) *Semaphore { sem := &Semaphore{ slots: make(chan struct{}, count), timeout: timeout, } for i := 0; i < count; i++ { sem.slots <- struct{}{} } return sem }
go
func NewSemaphore(count int, timeout time.Duration) *Semaphore { sem := &Semaphore{ slots: make(chan struct{}, count), timeout: timeout, } for i := 0; i < count; i++ { sem.slots <- struct{}{} } return sem }
[ "func", "NewSemaphore", "(", "count", "int", ",", "timeout", "time", ".", "Duration", ")", "*", "Semaphore", "{", "sem", ":=", "&", "Semaphore", "{", "slots", ":", "make", "(", "chan", "struct", "{", "}", ",", "count", ")", ",", "timeout", ":", "time...
// NewSemaphore creates a Semaphore. The count parameter must be a positive // number. A timeout of zero means that there is no timeout.
[ "NewSemaphore", "creates", "a", "Semaphore", ".", "The", "count", "parameter", "must", "be", "a", "positive", "number", ".", "A", "timeout", "of", "zero", "means", "that", "there", "is", "no", "timeout", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/sync2/semaphore.go#L36-L45
134,863
vitessio/vitess
go/vt/topo/helpers/tee.go
NewTee
func NewTee(primary, secondary *topo.Server, reverseLockOrder bool) (*topo.Server, error) { f := &TeeFactory{ primary: primary, secondary: secondary, reverseLockOrder: reverseLockOrder, } return topo.NewWithFactory(f, "" /*serverAddress*/, "" /*root*/) }
go
func NewTee(primary, secondary *topo.Server, reverseLockOrder bool) (*topo.Server, error) { f := &TeeFactory{ primary: primary, secondary: secondary, reverseLockOrder: reverseLockOrder, } return topo.NewWithFactory(f, "" /*serverAddress*/, "" /*root*/) }
[ "func", "NewTee", "(", "primary", ",", "secondary", "*", "topo", ".", "Server", ",", "reverseLockOrder", "bool", ")", "(", "*", "topo", ".", "Server", ",", "error", ")", "{", "f", ":=", "&", "TeeFactory", "{", "primary", ":", "primary", ",", "secondary...
// NewTee returns a new topo.Server object. It uses a TeeFactory.
[ "NewTee", "returns", "a", "new", "topo", ".", "Server", "object", ".", "It", "uses", "a", "TeeFactory", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/helpers/tee.go#L75-L82
134,864
vitessio/vitess
go/vt/topo/helpers/tee.go
Watch
func (c *TeeConn) Watch(ctx context.Context, filePath string) (*topo.WatchData, <-chan *topo.WatchData, topo.CancelFunc) { return c.primary.Watch(ctx, filePath) }
go
func (c *TeeConn) Watch(ctx context.Context, filePath string) (*topo.WatchData, <-chan *topo.WatchData, topo.CancelFunc) { return c.primary.Watch(ctx, filePath) }
[ "func", "(", "c", "*", "TeeConn", ")", "Watch", "(", "ctx", "context", ".", "Context", ",", "filePath", "string", ")", "(", "*", "topo", ".", "WatchData", ",", "<-", "chan", "*", "topo", ".", "WatchData", ",", "topo", ".", "CancelFunc", ")", "{", "...
// Watch is part of the topo.Conn interface
[ "Watch", "is", "part", "of", "the", "topo", ".", "Conn", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/helpers/tee.go#L161-L163
134,865
vitessio/vitess
go/vt/topo/helpers/tee.go
NewMasterParticipation
func (c *TeeConn) NewMasterParticipation(name, id string) (topo.MasterParticipation, error) { return c.primary.NewMasterParticipation(name, id) }
go
func (c *TeeConn) NewMasterParticipation(name, id string) (topo.MasterParticipation, error) { return c.primary.NewMasterParticipation(name, id) }
[ "func", "(", "c", "*", "TeeConn", ")", "NewMasterParticipation", "(", "name", ",", "id", "string", ")", "(", "topo", ".", "MasterParticipation", ",", "error", ")", "{", "return", "c", ".", "primary", ".", "NewMasterParticipation", "(", "name", ",", "id", ...
// NewMasterParticipation is part of the topo.Conn interface.
[ "NewMasterParticipation", "is", "part", "of", "the", "topo", ".", "Conn", "interface", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/helpers/tee.go#L227-L229
134,866
vitessio/vitess
go/vt/binlog/grpcbinlogstreamer/streamer.go
StreamKeyRange
func (server *UpdateStream) StreamKeyRange(req *binlogdatapb.StreamKeyRangeRequest, stream binlogservicepb.UpdateStream_StreamKeyRangeServer) (err error) { defer server.updateStream.HandlePanic(&err) return server.updateStream.StreamKeyRange(stream.Context(), req.Position, req.KeyRange, req.Charset, func(reply *binlo...
go
func (server *UpdateStream) StreamKeyRange(req *binlogdatapb.StreamKeyRangeRequest, stream binlogservicepb.UpdateStream_StreamKeyRangeServer) (err error) { defer server.updateStream.HandlePanic(&err) return server.updateStream.StreamKeyRange(stream.Context(), req.Position, req.KeyRange, req.Charset, func(reply *binlo...
[ "func", "(", "server", "*", "UpdateStream", ")", "StreamKeyRange", "(", "req", "*", "binlogdatapb", ".", "StreamKeyRangeRequest", ",", "stream", "binlogservicepb", ".", "UpdateStream_StreamKeyRangeServer", ")", "(", "err", "error", ")", "{", "defer", "server", "."...
// StreamKeyRange is part of the binlogservicepb.UpdateStreamServer interface
[ "StreamKeyRange", "is", "part", "of", "the", "binlogservicepb", ".", "UpdateStreamServer", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/grpcbinlogstreamer/streamer.go#L40-L47
134,867
vitessio/vitess
go/vt/binlog/grpcbinlogstreamer/streamer.go
StreamTables
func (server *UpdateStream) StreamTables(req *binlogdatapb.StreamTablesRequest, stream binlogservicepb.UpdateStream_StreamTablesServer) (err error) { defer server.updateStream.HandlePanic(&err) return server.updateStream.StreamTables(stream.Context(), req.Position, req.Tables, req.Charset, func(reply *binlogdatapb.Bi...
go
func (server *UpdateStream) StreamTables(req *binlogdatapb.StreamTablesRequest, stream binlogservicepb.UpdateStream_StreamTablesServer) (err error) { defer server.updateStream.HandlePanic(&err) return server.updateStream.StreamTables(stream.Context(), req.Position, req.Tables, req.Charset, func(reply *binlogdatapb.Bi...
[ "func", "(", "server", "*", "UpdateStream", ")", "StreamTables", "(", "req", "*", "binlogdatapb", ".", "StreamTablesRequest", ",", "stream", "binlogservicepb", ".", "UpdateStream_StreamTablesServer", ")", "(", "err", "error", ")", "{", "defer", "server", ".", "u...
// StreamTables is part of the binlogservicepb.UpdateStreamServer interface
[ "StreamTables", "is", "part", "of", "the", "binlogservicepb", ".", "UpdateStreamServer", "interface" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/binlog/grpcbinlogstreamer/streamer.go#L50-L57
134,868
vitessio/vitess
go/mysql/binlog_event_make.go
NewMySQL56BinlogFormat
func NewMySQL56BinlogFormat() BinlogFormat { return BinlogFormat{ FormatVersion: 4, ServerVersion: "5.6.33-0ubuntu0.14.04.1-log", HeaderLength: 19, ChecksumAlgorithm: BinlogChecksumAlgCRC32, // most commonly used. HeaderSizes: []byte{ 56, 13, 0, 8, 0, 18, 0, 4, 4, 4, 4, 18, 0, 0, 92, 0, 4,...
go
func NewMySQL56BinlogFormat() BinlogFormat { return BinlogFormat{ FormatVersion: 4, ServerVersion: "5.6.33-0ubuntu0.14.04.1-log", HeaderLength: 19, ChecksumAlgorithm: BinlogChecksumAlgCRC32, // most commonly used. HeaderSizes: []byte{ 56, 13, 0, 8, 0, 18, 0, 4, 4, 4, 4, 18, 0, 0, 92, 0, 4,...
[ "func", "NewMySQL56BinlogFormat", "(", ")", "BinlogFormat", "{", "return", "BinlogFormat", "{", "FormatVersion", ":", "4", ",", "ServerVersion", ":", "\"", "\"", ",", "HeaderLength", ":", "19", ",", "ChecksumAlgorithm", ":", "BinlogChecksumAlgCRC32", ",", "// most...
// This file contains utility methods to create binlog replication // packets. They are mostly used for testing. // NewMySQL56BinlogFormat returns a typical BinlogFormat for MySQL 5.6.
[ "This", "file", "contains", "utility", "methods", "to", "create", "binlog", "replication", "packets", ".", "They", "are", "mostly", "used", "for", "testing", ".", "NewMySQL56BinlogFormat", "returns", "a", "typical", "BinlogFormat", "for", "MySQL", "5", ".", "6",...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_make.go#L27-L39
134,869
vitessio/vitess
go/mysql/binlog_event_make.go
NewMariaDBBinlogFormat
func NewMariaDBBinlogFormat() BinlogFormat { return BinlogFormat{ FormatVersion: 4, ServerVersion: "10.0.13-MariaDB-1~precise-log", HeaderLength: 19, ChecksumAlgorithm: BinlogChecksumAlgOff, // HeaderSizes is very long because the MariaDB specific events are indexed at 160+ HeaderSizes: []byte...
go
func NewMariaDBBinlogFormat() BinlogFormat { return BinlogFormat{ FormatVersion: 4, ServerVersion: "10.0.13-MariaDB-1~precise-log", HeaderLength: 19, ChecksumAlgorithm: BinlogChecksumAlgOff, // HeaderSizes is very long because the MariaDB specific events are indexed at 160+ HeaderSizes: []byte...
[ "func", "NewMariaDBBinlogFormat", "(", ")", "BinlogFormat", "{", "return", "BinlogFormat", "{", "FormatVersion", ":", "4", ",", "ServerVersion", ":", "\"", "\"", ",", "HeaderLength", ":", "19", ",", "ChecksumAlgorithm", ":", "BinlogChecksumAlgOff", ",", "// Header...
// NewMariaDBBinlogFormat returns a typical BinlogFormat for MariaDB 10.0.
[ "NewMariaDBBinlogFormat", "returns", "a", "typical", "BinlogFormat", "for", "MariaDB", "10", ".", "0", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_make.go#L42-L68
134,870
vitessio/vitess
go/mysql/binlog_event_make.go
Packetize
func (s *FakeBinlogStream) Packetize(f BinlogFormat, typ byte, flags uint16, data []byte) []byte { length := int(f.HeaderLength) + len(data) if typ == eFormatDescriptionEvent || f.ChecksumAlgorithm == BinlogChecksumAlgCRC32 { // Just add 4 zeroes to the end. length += 4 } result := make([]byte, length) binary...
go
func (s *FakeBinlogStream) Packetize(f BinlogFormat, typ byte, flags uint16, data []byte) []byte { length := int(f.HeaderLength) + len(data) if typ == eFormatDescriptionEvent || f.ChecksumAlgorithm == BinlogChecksumAlgCRC32 { // Just add 4 zeroes to the end. length += 4 } result := make([]byte, length) binary...
[ "func", "(", "s", "*", "FakeBinlogStream", ")", "Packetize", "(", "f", "BinlogFormat", ",", "typ", "byte", ",", "flags", "uint16", ",", "data", "[", "]", "byte", ")", "[", "]", "byte", "{", "length", ":=", "int", "(", "f", ".", "HeaderLength", ")", ...
// Packetize adds the binlog event header to a packet, and optionally // the checksum.
[ "Packetize", "adds", "the", "binlog", "event", "header", "to", "a", "packet", "and", "optionally", "the", "checksum", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_make.go#L95-L113
134,871
vitessio/vitess
go/mysql/binlog_event_make.go
NewFormatDescriptionEvent
func NewFormatDescriptionEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent { length := 2 + // binlog-version 50 + // server version 4 + // create timestamp 1 + // event header length len(f.HeaderSizes) + // event type header lengths 1 // (undocumented) checksum algorithm data := make([]byte, length) b...
go
func NewFormatDescriptionEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent { length := 2 + // binlog-version 50 + // server version 4 + // create timestamp 1 + // event header length len(f.HeaderSizes) + // event type header lengths 1 // (undocumented) checksum algorithm data := make([]byte, length) b...
[ "func", "NewFormatDescriptionEvent", "(", "f", "BinlogFormat", ",", "s", "*", "FakeBinlogStream", ")", "BinlogEvent", "{", "length", ":=", "2", "+", "// binlog-version", "50", "+", "// server version", "4", "+", "// create timestamp", "1", "+", "// event header leng...
// NewFormatDescriptionEvent creates a new FormatDescriptionEvent // based on the provided BinlogFormat. It uses a mysql56BinlogEvent // but could use a MariaDB one.
[ "NewFormatDescriptionEvent", "creates", "a", "new", "FormatDescriptionEvent", "based", "on", "the", "provided", "BinlogFormat", ".", "It", "uses", "a", "mysql56BinlogEvent", "but", "could", "use", "a", "MariaDB", "one", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_make.go#L123-L140
134,872
vitessio/vitess
go/mysql/binlog_event_make.go
NewRotateEvent
func NewRotateEvent(f BinlogFormat, s *FakeBinlogStream, position uint64, filename string) BinlogEvent { length := 8 + // position len(filename) data := make([]byte, length) binary.LittleEndian.PutUint64(data[0:8], position) ev := s.Packetize(f, eRotateEvent, 0, data) ev[0] = 0 ev[1] = 0 ev[2] = 0 ev[3] = 0 ...
go
func NewRotateEvent(f BinlogFormat, s *FakeBinlogStream, position uint64, filename string) BinlogEvent { length := 8 + // position len(filename) data := make([]byte, length) binary.LittleEndian.PutUint64(data[0:8], position) ev := s.Packetize(f, eRotateEvent, 0, data) ev[0] = 0 ev[1] = 0 ev[2] = 0 ev[3] = 0 ...
[ "func", "NewRotateEvent", "(", "f", "BinlogFormat", ",", "s", "*", "FakeBinlogStream", ",", "position", "uint64", ",", "filename", "string", ")", "BinlogEvent", "{", "length", ":=", "8", "+", "// position", "len", "(", "filename", ")", "\n", "data", ":=", ...
// NewRotateEvent returns a RotateEvent. // The timestmap of such an event should be zero, so we patch it in.
[ "NewRotateEvent", "returns", "a", "RotateEvent", ".", "The", "timestmap", "of", "such", "an", "event", "should", "be", "zero", "so", "we", "patch", "it", "in", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_make.go#L155-L167
134,873
vitessio/vitess
go/mysql/binlog_event_make.go
NewQueryEvent
func NewQueryEvent(f BinlogFormat, s *FakeBinlogStream, q Query) BinlogEvent { statusVarLength := 0 if q.Charset != nil { statusVarLength += 1 + 2 + 2 + 2 } length := 4 + // slave proxy id 4 + // execution time 1 + // schema length 2 + // error code 2 + // status vars length statusVarLength + len(q.Da...
go
func NewQueryEvent(f BinlogFormat, s *FakeBinlogStream, q Query) BinlogEvent { statusVarLength := 0 if q.Charset != nil { statusVarLength += 1 + 2 + 2 + 2 } length := 4 + // slave proxy id 4 + // execution time 1 + // schema length 2 + // error code 2 + // status vars length statusVarLength + len(q.Da...
[ "func", "NewQueryEvent", "(", "f", "BinlogFormat", ",", "s", "*", "FakeBinlogStream", ",", "q", "Query", ")", "BinlogEvent", "{", "statusVarLength", ":=", "0", "\n", "if", "q", ".", "Charset", "!=", "nil", "{", "statusVarLength", "+=", "1", "+", "2", "+"...
// NewQueryEvent makes up a QueryEvent based on the Query structure.
[ "NewQueryEvent", "makes", "up", "a", "QueryEvent", "based", "on", "the", "Query", "structure", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_make.go#L170-L209
134,874
vitessio/vitess
go/mysql/binlog_event_make.go
NewInvalidQueryEvent
func NewInvalidQueryEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent { length := 100 data := make([]byte, length) data[4+4] = 200 // > 100 ev := s.Packetize(f, eQueryEvent, 0, data) return NewMysql56BinlogEvent(ev) }
go
func NewInvalidQueryEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent { length := 100 data := make([]byte, length) data[4+4] = 200 // > 100 ev := s.Packetize(f, eQueryEvent, 0, data) return NewMysql56BinlogEvent(ev) }
[ "func", "NewInvalidQueryEvent", "(", "f", "BinlogFormat", ",", "s", "*", "FakeBinlogStream", ")", "BinlogEvent", "{", "length", ":=", "100", "\n", "data", ":=", "make", "(", "[", "]", "byte", ",", "length", ")", "\n", "data", "[", "4", "+", "4", "]", ...
// NewInvalidQueryEvent returns an invalid QueryEvent. IsValid is however true. // sqlPos is out of bounds.
[ "NewInvalidQueryEvent", "returns", "an", "invalid", "QueryEvent", ".", "IsValid", "is", "however", "true", ".", "sqlPos", "is", "out", "of", "bounds", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_make.go#L213-L220
134,875
vitessio/vitess
go/mysql/binlog_event_make.go
NewXIDEvent
func NewXIDEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent { length := 8 data := make([]byte, length) ev := s.Packetize(f, eXIDEvent, 0, data) return NewMysql56BinlogEvent(ev) }
go
func NewXIDEvent(f BinlogFormat, s *FakeBinlogStream) BinlogEvent { length := 8 data := make([]byte, length) ev := s.Packetize(f, eXIDEvent, 0, data) return NewMysql56BinlogEvent(ev) }
[ "func", "NewXIDEvent", "(", "f", "BinlogFormat", ",", "s", "*", "FakeBinlogStream", ")", "BinlogEvent", "{", "length", ":=", "8", "\n", "data", ":=", "make", "(", "[", "]", "byte", ",", "length", ")", "\n\n", "ev", ":=", "s", ".", "Packetize", "(", "...
// NewXIDEvent returns a XID event. We do not use the data, so keep it 0.
[ "NewXIDEvent", "returns", "a", "XID", "event", ".", "We", "do", "not", "use", "the", "data", "so", "keep", "it", "0", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_make.go#L223-L229
134,876
vitessio/vitess
go/mysql/binlog_event_make.go
NewIntVarEvent
func NewIntVarEvent(f BinlogFormat, s *FakeBinlogStream, typ byte, value uint64) BinlogEvent { length := 9 data := make([]byte, length) data[0] = typ data[1] = byte(value) data[2] = byte(value >> 8) data[3] = byte(value >> 16) data[4] = byte(value >> 24) data[5] = byte(value >> 32) data[6] = byte(value >> 40)...
go
func NewIntVarEvent(f BinlogFormat, s *FakeBinlogStream, typ byte, value uint64) BinlogEvent { length := 9 data := make([]byte, length) data[0] = typ data[1] = byte(value) data[2] = byte(value >> 8) data[3] = byte(value >> 16) data[4] = byte(value >> 24) data[5] = byte(value >> 32) data[6] = byte(value >> 40)...
[ "func", "NewIntVarEvent", "(", "f", "BinlogFormat", ",", "s", "*", "FakeBinlogStream", ",", "typ", "byte", ",", "value", "uint64", ")", "BinlogEvent", "{", "length", ":=", "9", "\n", "data", ":=", "make", "(", "[", "]", "byte", ",", "length", ")", "\n\...
// NewIntVarEvent returns an IntVar event.
[ "NewIntVarEvent", "returns", "an", "IntVar", "event", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_make.go#L232-L248
134,877
vitessio/vitess
go/mysql/binlog_event_make.go
NewMariaDBGTIDEvent
func NewMariaDBGTIDEvent(f BinlogFormat, s *FakeBinlogStream, gtid MariadbGTID, hasBegin bool) BinlogEvent { length := 8 + // sequence 4 + // domain 1 // flags2 data := make([]byte, length) data[0] = byte(gtid.Sequence) data[1] = byte(gtid.Sequence >> 8) data[2] = byte(gtid.Sequence >> 16) data[3] = byte(gti...
go
func NewMariaDBGTIDEvent(f BinlogFormat, s *FakeBinlogStream, gtid MariadbGTID, hasBegin bool) BinlogEvent { length := 8 + // sequence 4 + // domain 1 // flags2 data := make([]byte, length) data[0] = byte(gtid.Sequence) data[1] = byte(gtid.Sequence >> 8) data[2] = byte(gtid.Sequence >> 16) data[3] = byte(gti...
[ "func", "NewMariaDBGTIDEvent", "(", "f", "BinlogFormat", ",", "s", "*", "FakeBinlogStream", ",", "gtid", "MariadbGTID", ",", "hasBegin", "bool", ")", "BinlogEvent", "{", "length", ":=", "8", "+", "// sequence", "4", "+", "// domain", "1", "// flags2", "\n", ...
// NewMariaDBGTIDEvent returns a MariaDB specific GTID event. // It ignores the Server in the gtid, instead uses the FakeBinlogStream.ServerID.
[ "NewMariaDBGTIDEvent", "returns", "a", "MariaDB", "specific", "GTID", "event", ".", "It", "ignores", "the", "Server", "in", "the", "gtid", "instead", "uses", "the", "FakeBinlogStream", ".", "ServerID", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_make.go#L252-L280
134,878
vitessio/vitess
go/mysql/binlog_event_make.go
NewTableMapEvent
func NewTableMapEvent(f BinlogFormat, s *FakeBinlogStream, tableID uint64, tm *TableMap) BinlogEvent { if f.HeaderSize(eTableMapEvent) != 8 { panic("Not implemented, post_header_length!=8") } metadataLength := metadataTotalLength(tm.Types) length := 6 + // table_id 2 + // flags 1 + // schema name length l...
go
func NewTableMapEvent(f BinlogFormat, s *FakeBinlogStream, tableID uint64, tm *TableMap) BinlogEvent { if f.HeaderSize(eTableMapEvent) != 8 { panic("Not implemented, post_header_length!=8") } metadataLength := metadataTotalLength(tm.Types) length := 6 + // table_id 2 + // flags 1 + // schema name length l...
[ "func", "NewTableMapEvent", "(", "f", "BinlogFormat", ",", "s", "*", "FakeBinlogStream", ",", "tableID", "uint64", ",", "tm", "*", "TableMap", ")", "BinlogEvent", "{", "if", "f", ".", "HeaderSize", "(", "eTableMapEvent", ")", "!=", "8", "{", "panic", "(", ...
// NewTableMapEvent returns a TableMap event. // Only works with post_header_length=8.
[ "NewTableMapEvent", "returns", "a", "TableMap", "event", ".", "Only", "works", "with", "post_header_length", "=", "8", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_make.go#L284-L343
134,879
vitessio/vitess
go/mysql/binlog_event_make.go
NewWriteRowsEvent
func NewWriteRowsEvent(f BinlogFormat, s *FakeBinlogStream, tableID uint64, rows Rows) BinlogEvent { return newRowsEvent(f, s, eWriteRowsEventV2, tableID, rows) }
go
func NewWriteRowsEvent(f BinlogFormat, s *FakeBinlogStream, tableID uint64, rows Rows) BinlogEvent { return newRowsEvent(f, s, eWriteRowsEventV2, tableID, rows) }
[ "func", "NewWriteRowsEvent", "(", "f", "BinlogFormat", ",", "s", "*", "FakeBinlogStream", ",", "tableID", "uint64", ",", "rows", "Rows", ")", "BinlogEvent", "{", "return", "newRowsEvent", "(", "f", ",", "s", ",", "eWriteRowsEventV2", ",", "tableID", ",", "ro...
// NewWriteRowsEvent returns a WriteRows event. Uses v2.
[ "NewWriteRowsEvent", "returns", "a", "WriteRows", "event", ".", "Uses", "v2", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_make.go#L346-L348
134,880
vitessio/vitess
go/mysql/binlog_event_make.go
NewUpdateRowsEvent
func NewUpdateRowsEvent(f BinlogFormat, s *FakeBinlogStream, tableID uint64, rows Rows) BinlogEvent { return newRowsEvent(f, s, eUpdateRowsEventV2, tableID, rows) }
go
func NewUpdateRowsEvent(f BinlogFormat, s *FakeBinlogStream, tableID uint64, rows Rows) BinlogEvent { return newRowsEvent(f, s, eUpdateRowsEventV2, tableID, rows) }
[ "func", "NewUpdateRowsEvent", "(", "f", "BinlogFormat", ",", "s", "*", "FakeBinlogStream", ",", "tableID", "uint64", ",", "rows", "Rows", ")", "BinlogEvent", "{", "return", "newRowsEvent", "(", "f", ",", "s", ",", "eUpdateRowsEventV2", ",", "tableID", ",", "...
// NewUpdateRowsEvent returns an UpdateRows event. Uses v2.
[ "NewUpdateRowsEvent", "returns", "an", "UpdateRows", "event", ".", "Uses", "v2", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_make.go#L351-L353
134,881
vitessio/vitess
go/mysql/binlog_event_make.go
NewDeleteRowsEvent
func NewDeleteRowsEvent(f BinlogFormat, s *FakeBinlogStream, tableID uint64, rows Rows) BinlogEvent { return newRowsEvent(f, s, eDeleteRowsEventV2, tableID, rows) }
go
func NewDeleteRowsEvent(f BinlogFormat, s *FakeBinlogStream, tableID uint64, rows Rows) BinlogEvent { return newRowsEvent(f, s, eDeleteRowsEventV2, tableID, rows) }
[ "func", "NewDeleteRowsEvent", "(", "f", "BinlogFormat", ",", "s", "*", "FakeBinlogStream", ",", "tableID", "uint64", ",", "rows", "Rows", ")", "BinlogEvent", "{", "return", "newRowsEvent", "(", "f", ",", "s", ",", "eDeleteRowsEventV2", ",", "tableID", ",", "...
// NewDeleteRowsEvent returns an DeleteRows event. Uses v2.
[ "NewDeleteRowsEvent", "returns", "an", "DeleteRows", "event", ".", "Uses", "v2", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/mysql/binlog_event_make.go#L356-L358
134,882
vitessio/vitess
go/timer/timer.go
NewTimer
func NewTimer(interval time.Duration) *Timer { tm := &Timer{ msg: make(chan typeAction), } tm.interval.Set(interval) return tm }
go
func NewTimer(interval time.Duration) *Timer { tm := &Timer{ msg: make(chan typeAction), } tm.interval.Set(interval) return tm }
[ "func", "NewTimer", "(", "interval", "time", ".", "Duration", ")", "*", "Timer", "{", "tm", ":=", "&", "Timer", "{", "msg", ":", "make", "(", "chan", "typeAction", ")", ",", "}", "\n", "tm", ".", "interval", ".", "Set", "(", "interval", ")", "\n", ...
// NewTimer creates a new Timer object
[ "NewTimer", "creates", "a", "new", "Timer", "object" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/timer/timer.go#L70-L76
134,883
vitessio/vitess
go/timer/timer.go
Start
func (tm *Timer) Start(keephouse func()) { tm.mu.Lock() defer tm.mu.Unlock() if tm.running { return } tm.running = true go tm.run(keephouse) }
go
func (tm *Timer) Start(keephouse func()) { tm.mu.Lock() defer tm.mu.Unlock() if tm.running { return } tm.running = true go tm.run(keephouse) }
[ "func", "(", "tm", "*", "Timer", ")", "Start", "(", "keephouse", "func", "(", ")", ")", "{", "tm", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tm", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "tm", ".", "running", "{", "return", "\n...
// Start starts the timer.
[ "Start", "starts", "the", "timer", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/timer/timer.go#L79-L87
134,884
vitessio/vitess
go/timer/timer.go
SetInterval
func (tm *Timer) SetInterval(ns time.Duration) { tm.interval.Set(ns) tm.mu.Lock() defer tm.mu.Unlock() if tm.running { tm.msg <- timerReset } }
go
func (tm *Timer) SetInterval(ns time.Duration) { tm.interval.Set(ns) tm.mu.Lock() defer tm.mu.Unlock() if tm.running { tm.msg <- timerReset } }
[ "func", "(", "tm", "*", "Timer", ")", "SetInterval", "(", "ns", "time", ".", "Duration", ")", "{", "tm", ".", "interval", ".", "Set", "(", "ns", ")", "\n", "tm", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tm", ".", "mu", ".", "Unlock", ...
// SetInterval changes the wait interval. // It will cause the timer to restart the wait.
[ "SetInterval", "changes", "the", "wait", "interval", ".", "It", "will", "cause", "the", "timer", "to", "restart", "the", "wait", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/timer/timer.go#L118-L125
134,885
vitessio/vitess
go/timer/timer.go
Trigger
func (tm *Timer) Trigger() { tm.mu.Lock() defer tm.mu.Unlock() if tm.running { tm.msg <- timerTrigger } }
go
func (tm *Timer) Trigger() { tm.mu.Lock() defer tm.mu.Unlock() if tm.running { tm.msg <- timerTrigger } }
[ "func", "(", "tm", "*", "Timer", ")", "Trigger", "(", ")", "{", "tm", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tm", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "tm", ".", "running", "{", "tm", ".", "msg", "<-", "timerTrigger", "\...
// Trigger will cause the timer to immediately execute the keephouse function. // It will then cause the timer to restart the wait.
[ "Trigger", "will", "cause", "the", "timer", "to", "immediately", "execute", "the", "keephouse", "function", ".", "It", "will", "then", "cause", "the", "timer", "to", "restart", "the", "wait", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/timer/timer.go#L129-L135
134,886
vitessio/vitess
go/timer/timer.go
TriggerAfter
func (tm *Timer) TriggerAfter(duration time.Duration) { go func() { time.Sleep(duration) tm.Trigger() }() }
go
func (tm *Timer) TriggerAfter(duration time.Duration) { go func() { time.Sleep(duration) tm.Trigger() }() }
[ "func", "(", "tm", "*", "Timer", ")", "TriggerAfter", "(", "duration", "time", ".", "Duration", ")", "{", "go", "func", "(", ")", "{", "time", ".", "Sleep", "(", "duration", ")", "\n", "tm", ".", "Trigger", "(", ")", "\n", "}", "(", ")", "\n", ...
// TriggerAfter waits for the specified duration and triggers the next event.
[ "TriggerAfter", "waits", "for", "the", "specified", "duration", "and", "triggers", "the", "next", "event", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/timer/timer.go#L138-L143
134,887
vitessio/vitess
go/timer/timer.go
Stop
func (tm *Timer) Stop() { tm.mu.Lock() defer tm.mu.Unlock() if tm.running { tm.msg <- timerStop tm.running = false } }
go
func (tm *Timer) Stop() { tm.mu.Lock() defer tm.mu.Unlock() if tm.running { tm.msg <- timerStop tm.running = false } }
[ "func", "(", "tm", "*", "Timer", ")", "Stop", "(", ")", "{", "tm", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "tm", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "tm", ".", "running", "{", "tm", ".", "msg", "<-", "timerStop", "\n", ...
// Stop will stop the timer. It guarantees that the timer will not execute // any more calls to keephouse once it has returned.
[ "Stop", "will", "stop", "the", "timer", ".", "It", "guarantees", "that", "the", "timer", "will", "not", "execute", "any", "more", "calls", "to", "keephouse", "once", "it", "has", "returned", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/timer/timer.go#L147-L154
134,888
vitessio/vitess
go/vt/topo/locks.go
newLock
func newLock(action string) *Lock { l := &Lock{ Action: action, HostName: "unknown", UserName: "unknown", Time: time.Now().Format(time.RFC3339), Status: "Running", } if h, err := os.Hostname(); err == nil { l.HostName = h } if u, err := user.Current(); err == nil { l.UserName = u.Username } ...
go
func newLock(action string) *Lock { l := &Lock{ Action: action, HostName: "unknown", UserName: "unknown", Time: time.Now().Format(time.RFC3339), Status: "Running", } if h, err := os.Hostname(); err == nil { l.HostName = h } if u, err := user.Current(); err == nil { l.UserName = u.Username } ...
[ "func", "newLock", "(", "action", "string", ")", "*", "Lock", "{", "l", ":=", "&", "Lock", "{", "Action", ":", "action", ",", "HostName", ":", "\"", "\"", ",", "UserName", ":", "\"", "\"", ",", "Time", ":", "time", ".", "Now", "(", ")", ".", "F...
// newLock creates a new Lock.
[ "newLock", "creates", "a", "new", "Lock", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/locks.go#L70-L85
134,889
vitessio/vitess
go/vt/topo/locks.go
ToJSON
func (l *Lock) ToJSON() (string, error) { data, err := json.MarshalIndent(l, "", " ") if err != nil { return "", vterrors.Wrapf(err, "cannot JSON-marshal node") } return string(data), nil }
go
func (l *Lock) ToJSON() (string, error) { data, err := json.MarshalIndent(l, "", " ") if err != nil { return "", vterrors.Wrapf(err, "cannot JSON-marshal node") } return string(data), nil }
[ "func", "(", "l", "*", "Lock", ")", "ToJSON", "(", ")", "(", "string", ",", "error", ")", "{", "data", ",", "err", ":=", "json", ".", "MarshalIndent", "(", "l", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "retu...
// ToJSON returns a JSON representation of the object.
[ "ToJSON", "returns", "a", "JSON", "representation", "of", "the", "object", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/locks.go#L88-L94
134,890
vitessio/vitess
go/vt/topo/locks.go
CheckKeyspaceLocked
func CheckKeyspaceLocked(ctx context.Context, keyspace string) error { // extract the locksInfo pointer i, ok := ctx.Value(locksKey).(*locksInfo) if !ok { return vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "keyspace %v is not locked (no locksInfo)", keyspace) } i.mu.Lock() defer i.mu.Unlock() // find the ind...
go
func CheckKeyspaceLocked(ctx context.Context, keyspace string) error { // extract the locksInfo pointer i, ok := ctx.Value(locksKey).(*locksInfo) if !ok { return vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "keyspace %v is not locked (no locksInfo)", keyspace) } i.mu.Lock() defer i.mu.Unlock() // find the ind...
[ "func", "CheckKeyspaceLocked", "(", "ctx", "context", ".", "Context", ",", "keyspace", "string", ")", "error", "{", "// extract the locksInfo pointer", "i", ",", "ok", ":=", "ctx", ".", "Value", "(", "locksKey", ")", ".", "(", "*", "locksInfo", ")", "\n", ...
// CheckKeyspaceLocked can be called on a context to make sure we have the lock // for a given keyspace.
[ "CheckKeyspaceLocked", "can", "be", "called", "on", "a", "context", "to", "make", "sure", "we", "have", "the", "lock", "for", "a", "given", "keyspace", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/locks.go#L193-L213
134,891
vitessio/vitess
go/vt/topo/locks.go
lockKeyspace
func (l *Lock) lockKeyspace(ctx context.Context, ts *Server, keyspace string) (LockDescriptor, error) { log.Infof("Locking keyspace %v for action %v", keyspace, l.Action) ctx, cancel := context.WithTimeout(ctx, *RemoteOperationTimeout) defer cancel() span, ctx := trace.NewSpan(ctx, "TopoServer.LockKeyspaceForActi...
go
func (l *Lock) lockKeyspace(ctx context.Context, ts *Server, keyspace string) (LockDescriptor, error) { log.Infof("Locking keyspace %v for action %v", keyspace, l.Action) ctx, cancel := context.WithTimeout(ctx, *RemoteOperationTimeout) defer cancel() span, ctx := trace.NewSpan(ctx, "TopoServer.LockKeyspaceForActi...
[ "func", "(", "l", "*", "Lock", ")", "lockKeyspace", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "Server", ",", "keyspace", "string", ")", "(", "LockDescriptor", ",", "error", ")", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "keyspace",...
// lockKeyspace will lock the keyspace in the topology server. // unlockKeyspace should be called if this returns no error.
[ "lockKeyspace", "will", "lock", "the", "keyspace", "in", "the", "topology", "server", ".", "unlockKeyspace", "should", "be", "called", "if", "this", "returns", "no", "error", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/locks.go#L217-L234
134,892
vitessio/vitess
go/vt/topo/locks.go
CheckShardLocked
func CheckShardLocked(ctx context.Context, keyspace, shard string) error { // extract the locksInfo pointer i, ok := ctx.Value(locksKey).(*locksInfo) if !ok { return vterrors.Errorf(vtrpc.Code_INTERNAL, "shard %v/%v is not locked (no locksInfo)", keyspace, shard) } i.mu.Lock() defer i.mu.Unlock() // func the ...
go
func CheckShardLocked(ctx context.Context, keyspace, shard string) error { // extract the locksInfo pointer i, ok := ctx.Value(locksKey).(*locksInfo) if !ok { return vterrors.Errorf(vtrpc.Code_INTERNAL, "shard %v/%v is not locked (no locksInfo)", keyspace, shard) } i.mu.Lock() defer i.mu.Unlock() // func the ...
[ "func", "CheckShardLocked", "(", "ctx", "context", ".", "Context", ",", "keyspace", ",", "shard", "string", ")", "error", "{", "// extract the locksInfo pointer", "i", ",", "ok", ":=", "ctx", ".", "Value", "(", "locksKey", ")", ".", "(", "*", "locksInfo", ...
// CheckShardLocked can be called on a context to make sure we have the lock // for a given shard.
[ "CheckShardLocked", "can", "be", "called", "on", "a", "context", "to", "make", "sure", "we", "have", "the", "lock", "for", "a", "given", "shard", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/locks.go#L336-L354
134,893
vitessio/vitess
go/vt/topo/locks.go
unlockShard
func (l *Lock) unlockShard(ctx context.Context, ts *Server, keyspace, shard string, lockDescriptor LockDescriptor, actionError error) error { // Detach from the parent timeout, but copy the trace span. // We need to still release the lock even if the parent context timed out. // Note that we are not using the user p...
go
func (l *Lock) unlockShard(ctx context.Context, ts *Server, keyspace, shard string, lockDescriptor LockDescriptor, actionError error) error { // Detach from the parent timeout, but copy the trace span. // We need to still release the lock even if the parent context timed out. // Note that we are not using the user p...
[ "func", "(", "l", "*", "Lock", ")", "unlockShard", "(", "ctx", "context", ".", "Context", ",", "ts", "*", "Server", ",", "keyspace", ",", "shard", "string", ",", "lockDescriptor", "LockDescriptor", ",", "actionError", "error", ")", "error", "{", "// Detach...
// unlockShard unlocks a previously locked shard.
[ "unlockShard", "unlocks", "a", "previously", "locked", "shard", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/topo/locks.go#L379-L403
134,894
vitessio/vitess
go/vt/tableacl/role.go
Name
func (r Role) Name() string { if r < READER || r > ADMIN { return "" } return roleNames[r] }
go
func (r Role) Name() string { if r < READER || r > ADMIN { return "" } return roleNames[r] }
[ "func", "(", "r", "Role", ")", "Name", "(", ")", "string", "{", "if", "r", "<", "READER", "||", "r", ">", "ADMIN", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "roleNames", "[", "r", "]", "\n", "}" ]
// Name returns the name of a role
[ "Name", "returns", "the", "name", "of", "a", "role" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/tableacl/role.go#L44-L49
134,895
vitessio/vitess
go/vt/tableacl/role.go
RoleByName
func RoleByName(s string) (Role, bool) { for i, v := range roleNames { if v == strings.ToUpper(s) { return Role(i), true } } return NumRoles, false }
go
func RoleByName(s string) (Role, bool) { for i, v := range roleNames { if v == strings.ToUpper(s) { return Role(i), true } } return NumRoles, false }
[ "func", "RoleByName", "(", "s", "string", ")", "(", "Role", ",", "bool", ")", "{", "for", "i", ",", "v", ":=", "range", "roleNames", "{", "if", "v", "==", "strings", ".", "ToUpper", "(", "s", ")", "{", "return", "Role", "(", "i", ")", ",", "tru...
// RoleByName returns the Role corresponding to a name
[ "RoleByName", "returns", "the", "Role", "corresponding", "to", "a", "name" ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/tableacl/role.go#L52-L59
134,896
vitessio/vitess
go/vt/srvtopo/resilient_server.go
NewResilientServer
func NewResilientServer(base *topo.Server, counterPrefix string) *ResilientServer { if *srvTopoCacheRefresh > *srvTopoCacheTTL { log.Fatalf("srv_topo_cache_refresh must be less than or equal to srv_topo_cache_ttl") } return &ResilientServer{ topoServer: base, cacheTTL: *srvTopoCacheTTL, cacheRefresh: ...
go
func NewResilientServer(base *topo.Server, counterPrefix string) *ResilientServer { if *srvTopoCacheRefresh > *srvTopoCacheTTL { log.Fatalf("srv_topo_cache_refresh must be less than or equal to srv_topo_cache_ttl") } return &ResilientServer{ topoServer: base, cacheTTL: *srvTopoCacheTTL, cacheRefresh: ...
[ "func", "NewResilientServer", "(", "base", "*", "topo", ".", "Server", ",", "counterPrefix", "string", ")", "*", "ResilientServer", "{", "if", "*", "srvTopoCacheRefresh", ">", "*", "srvTopoCacheTTL", "{", "log", ".", "Fatalf", "(", "\"", "\"", ")", "\n", "...
// NewResilientServer creates a new ResilientServer // based on the provided topo.Server.
[ "NewResilientServer", "creates", "a", "new", "ResilientServer", "based", "on", "the", "provided", "topo", ".", "Server", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/srvtopo/resilient_server.go#L209-L223
134,897
vitessio/vitess
go/vt/srvtopo/resilient_server.go
GetSrvKeyspaceNames
func (server *ResilientServer) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]string, error) { server.counts.Add(queryCategory, 1) // find the entry in the cache, add it if not there key := cell server.mutex.Lock() entry, ok := server.srvKeyspaceNamesCache[key] if !ok { entry = &srvKeyspaceNamesEntry...
go
func (server *ResilientServer) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]string, error) { server.counts.Add(queryCategory, 1) // find the entry in the cache, add it if not there key := cell server.mutex.Lock() entry, ok := server.srvKeyspaceNamesCache[key] if !ok { entry = &srvKeyspaceNamesEntry...
[ "func", "(", "server", "*", "ResilientServer", ")", "GetSrvKeyspaceNames", "(", "ctx", "context", ".", "Context", ",", "cell", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "server", ".", "counts", ".", "Add", "(", "queryCategory", ",",...
// GetSrvKeyspaceNames returns all keyspace names for the given cell.
[ "GetSrvKeyspaceNames", "returns", "all", "keyspace", "names", "for", "the", "given", "cell", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/srvtopo/resilient_server.go#L231-L334
134,898
vitessio/vitess
go/vt/srvtopo/resilient_server.go
GetSrvKeyspace
func (server *ResilientServer) GetSrvKeyspace(ctx context.Context, cell, keyspace string) (*topodatapb.SrvKeyspace, error) { entry := server.getSrvKeyspaceEntry(cell, keyspace) // If the watch is already running, return the value entry.mutex.RLock() if entry.watchState == watchStateRunning { v, e := entry.value,...
go
func (server *ResilientServer) GetSrvKeyspace(ctx context.Context, cell, keyspace string) (*topodatapb.SrvKeyspace, error) { entry := server.getSrvKeyspaceEntry(cell, keyspace) // If the watch is already running, return the value entry.mutex.RLock() if entry.watchState == watchStateRunning { v, e := entry.value,...
[ "func", "(", "server", "*", "ResilientServer", ")", "GetSrvKeyspace", "(", "ctx", "context", ".", "Context", ",", "cell", ",", "keyspace", "string", ")", "(", "*", "topodatapb", ".", "SrvKeyspace", ",", "error", ")", "{", "entry", ":=", "server", ".", "g...
// GetSrvKeyspace returns SrvKeyspace object for the given cell and keyspace.
[ "GetSrvKeyspace", "returns", "SrvKeyspace", "object", "for", "the", "given", "cell", "and", "keyspace", "." ]
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/srvtopo/resilient_server.go#L361-L421
134,899
vitessio/vitess
go/vt/srvtopo/resilient_server.go
watchSrvKeyspace
func (server *ResilientServer) watchSrvKeyspace(callerCtx context.Context, entry *srvKeyspaceEntry, cell, keyspace string) { // We use a background context, as starting the watch should keep going // even if the current query context is short-lived. newCtx := context.Background() current, changes, cancel := server....
go
func (server *ResilientServer) watchSrvKeyspace(callerCtx context.Context, entry *srvKeyspaceEntry, cell, keyspace string) { // We use a background context, as starting the watch should keep going // even if the current query context is short-lived. newCtx := context.Background() current, changes, cancel := server....
[ "func", "(", "server", "*", "ResilientServer", ")", "watchSrvKeyspace", "(", "callerCtx", "context", ".", "Context", ",", "entry", "*", "srvKeyspaceEntry", ",", "cell", ",", "keyspace", "string", ")", "{", "// We use a background context, as starting the watch should ke...
// watchSrvKeyspace is started in a separate goroutine and attempts to establish // a watch. The caller context is provided to show in the UI in case the watch // fails due to an error like a mistyped keyspace.
[ "watchSrvKeyspace", "is", "started", "in", "a", "separate", "goroutine", "and", "attempts", "to", "establish", "a", "watch", ".", "The", "caller", "context", "is", "provided", "to", "show", "in", "the", "UI", "in", "case", "the", "watch", "fails", "due", "...
d568817542a413611801aa17a1c213aa95592182
https://github.com/vitessio/vitess/blob/d568817542a413611801aa17a1c213aa95592182/go/vt/srvtopo/resilient_server.go#L426-L511