id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
27,700 | RichardKnop/machinery | v1/tasks/task.go | SignatureFromContext | func SignatureFromContext(ctx context.Context) *Signature {
if ctx == nil {
return nil
}
v := ctx.Value(signatureCtx)
if v == nil {
return nil
}
signature, _ := v.(*Signature)
return signature
} | go | func SignatureFromContext(ctx context.Context) *Signature {
if ctx == nil {
return nil
}
v := ctx.Value(signatureCtx)
if v == nil {
return nil
}
signature, _ := v.(*Signature)
return signature
} | [
"func",
"SignatureFromContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"Signature",
"{",
"if",
"ctx",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"v",
":=",
"ctx",
".",
"Value",
"(",
"signatureCtx",
")",
"\n",
"if",
"v",
"==",
"ni... | // SignatureFromContext gets the signature from the context | [
"SignatureFromContext",
"gets",
"the",
"signature",
"from",
"the",
"context"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/tasks/task.go#L34-L46 |
27,701 | RichardKnop/machinery | v1/tasks/task.go | NewWithSignature | func NewWithSignature(taskFunc interface{}, signature *Signature) (*Task, error) {
args := signature.Args
ctx := context.Background()
ctx = context.WithValue(ctx, signatureCtx, signature)
task := &Task{
TaskFunc: reflect.ValueOf(taskFunc),
Context: ctx,
}
taskFuncType := reflect.TypeOf(taskFunc)
if taskFun... | go | func NewWithSignature(taskFunc interface{}, signature *Signature) (*Task, error) {
args := signature.Args
ctx := context.Background()
ctx = context.WithValue(ctx, signatureCtx, signature)
task := &Task{
TaskFunc: reflect.ValueOf(taskFunc),
Context: ctx,
}
taskFuncType := reflect.TypeOf(taskFunc)
if taskFun... | [
"func",
"NewWithSignature",
"(",
"taskFunc",
"interface",
"{",
"}",
",",
"signature",
"*",
"Signature",
")",
"(",
"*",
"Task",
",",
"error",
")",
"{",
"args",
":=",
"signature",
".",
"Args",
"\n",
"ctx",
":=",
"context",
".",
"Background",
"(",
")",
"\... | // NewWithSignature is the same as New but injects the signature | [
"NewWithSignature",
"is",
"the",
"same",
"as",
"New",
"but",
"injects",
"the",
"signature"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/tasks/task.go#L49-L71 |
27,702 | RichardKnop/machinery | v1/tasks/task.go | New | func New(taskFunc interface{}, args []Arg) (*Task, error) {
task := &Task{
TaskFunc: reflect.ValueOf(taskFunc),
Context: context.Background(),
}
taskFuncType := reflect.TypeOf(taskFunc)
if taskFuncType.NumIn() > 0 {
arg0Type := taskFuncType.In(0)
if IsContextType(arg0Type) {
task.UseContext = true
}
... | go | func New(taskFunc interface{}, args []Arg) (*Task, error) {
task := &Task{
TaskFunc: reflect.ValueOf(taskFunc),
Context: context.Background(),
}
taskFuncType := reflect.TypeOf(taskFunc)
if taskFuncType.NumIn() > 0 {
arg0Type := taskFuncType.In(0)
if IsContextType(arg0Type) {
task.UseContext = true
}
... | [
"func",
"New",
"(",
"taskFunc",
"interface",
"{",
"}",
",",
"args",
"[",
"]",
"Arg",
")",
"(",
"*",
"Task",
",",
"error",
")",
"{",
"task",
":=",
"&",
"Task",
"{",
"TaskFunc",
":",
"reflect",
".",
"ValueOf",
"(",
"taskFunc",
")",
",",
"Context",
... | // New tries to use reflection to convert the function and arguments
// into a reflect.Value and prepare it for invocation | [
"New",
"tries",
"to",
"use",
"reflection",
"to",
"convert",
"the",
"function",
"and",
"arguments",
"into",
"a",
"reflect",
".",
"Value",
"and",
"prepare",
"it",
"for",
"invocation"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/tasks/task.go#L75-L94 |
27,703 | RichardKnop/machinery | v1/tracing/tracing.go | StartSpanFromHeaders | func StartSpanFromHeaders(headers tasks.Headers, operationName string) opentracing.Span {
// Try to extract the span context from the carrier.
spanContext, err := opentracing.GlobalTracer().Extract(opentracing.TextMap, headers)
// Create a new span from the span context if found or start a new trace with the functi... | go | func StartSpanFromHeaders(headers tasks.Headers, operationName string) opentracing.Span {
// Try to extract the span context from the carrier.
spanContext, err := opentracing.GlobalTracer().Extract(opentracing.TextMap, headers)
// Create a new span from the span context if found or start a new trace with the functi... | [
"func",
"StartSpanFromHeaders",
"(",
"headers",
"tasks",
".",
"Headers",
",",
"operationName",
"string",
")",
"opentracing",
".",
"Span",
"{",
"// Try to extract the span context from the carrier.",
"spanContext",
",",
"err",
":=",
"opentracing",
".",
"GlobalTracer",
"(... | // StartSpanFromHeaders will extract a span from the signature headers
// and start a new span with the given operation name. | [
"StartSpanFromHeaders",
"will",
"extract",
"a",
"span",
"from",
"the",
"signature",
"headers",
"and",
"start",
"a",
"new",
"span",
"with",
"the",
"given",
"operation",
"name",
"."
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/tracing/tracing.go#L23-L41 |
27,704 | RichardKnop/machinery | v1/tracing/tracing.go | HeadersWithSpan | func HeadersWithSpan(headers tasks.Headers, span opentracing.Span) tasks.Headers {
// check if the headers aren't nil
if headers == nil {
headers = make(tasks.Headers)
}
if err := opentracing.GlobalTracer().Inject(span.Context(), opentracing.TextMap, headers); err != nil {
span.LogFields(opentracing_log.Error(... | go | func HeadersWithSpan(headers tasks.Headers, span opentracing.Span) tasks.Headers {
// check if the headers aren't nil
if headers == nil {
headers = make(tasks.Headers)
}
if err := opentracing.GlobalTracer().Inject(span.Context(), opentracing.TextMap, headers); err != nil {
span.LogFields(opentracing_log.Error(... | [
"func",
"HeadersWithSpan",
"(",
"headers",
"tasks",
".",
"Headers",
",",
"span",
"opentracing",
".",
"Span",
")",
"tasks",
".",
"Headers",
"{",
"// check if the headers aren't nil",
"if",
"headers",
"==",
"nil",
"{",
"headers",
"=",
"make",
"(",
"tasks",
".",
... | // HeadersWithSpan will inject a span into the signature headers | [
"HeadersWithSpan",
"will",
"inject",
"a",
"span",
"into",
"the",
"signature",
"headers"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/tracing/tracing.go#L44-L55 |
27,705 | RichardKnop/machinery | v1/brokers/sqs/sqs.go | consume | func (b *Broker) consume(deliveries <-chan *awssqs.ReceiveMessageOutput, concurrency int, taskProcessor iface.TaskProcessor) error {
pool := make(chan struct{}, concurrency)
// initialize worker pool with maxWorkers workers
go func() {
b.initializePool(pool, concurrency)
}()
errorsChan := make(chan error)
fo... | go | func (b *Broker) consume(deliveries <-chan *awssqs.ReceiveMessageOutput, concurrency int, taskProcessor iface.TaskProcessor) error {
pool := make(chan struct{}, concurrency)
// initialize worker pool with maxWorkers workers
go func() {
b.initializePool(pool, concurrency)
}()
errorsChan := make(chan error)
fo... | [
"func",
"(",
"b",
"*",
"Broker",
")",
"consume",
"(",
"deliveries",
"<-",
"chan",
"*",
"awssqs",
".",
"ReceiveMessageOutput",
",",
"concurrency",
"int",
",",
"taskProcessor",
"iface",
".",
"TaskProcessor",
")",
"error",
"{",
"pool",
":=",
"make",
"(",
"cha... | // consume is a method which keeps consuming deliveries from a channel, until there is an error or a stop signal | [
"consume",
"is",
"a",
"method",
"which",
"keeps",
"consuming",
"deliveries",
"from",
"a",
"channel",
"until",
"there",
"is",
"an",
"error",
"or",
"a",
"stop",
"signal"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/sqs/sqs.go#L184-L203 |
27,706 | RichardKnop/machinery | v1/brokers/sqs/sqs.go | consumeOne | func (b *Broker) consumeOne(delivery *awssqs.ReceiveMessageOutput, taskProcessor iface.TaskProcessor) error {
if len(delivery.Messages) == 0 {
log.ERROR.Printf("received an empty message, the delivery was %v", delivery)
return errors.New("received empty message, the delivery is " + delivery.GoString())
}
sig :=... | go | func (b *Broker) consumeOne(delivery *awssqs.ReceiveMessageOutput, taskProcessor iface.TaskProcessor) error {
if len(delivery.Messages) == 0 {
log.ERROR.Printf("received an empty message, the delivery was %v", delivery)
return errors.New("received empty message, the delivery is " + delivery.GoString())
}
sig :=... | [
"func",
"(",
"b",
"*",
"Broker",
")",
"consumeOne",
"(",
"delivery",
"*",
"awssqs",
".",
"ReceiveMessageOutput",
",",
"taskProcessor",
"iface",
".",
"TaskProcessor",
")",
"error",
"{",
"if",
"len",
"(",
"delivery",
".",
"Messages",
")",
"==",
"0",
"{",
"... | // consumeOne is a method consumes a delivery. If a delivery was consumed successfully, it will be deleted from AWS SQS | [
"consumeOne",
"is",
"a",
"method",
"consumes",
"a",
"delivery",
".",
"If",
"a",
"delivery",
"was",
"consumed",
"successfully",
"it",
"will",
"be",
"deleted",
"from",
"AWS",
"SQS"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/sqs/sqs.go#L206-L235 |
27,707 | RichardKnop/machinery | v1/brokers/sqs/sqs.go | deleteOne | func (b *Broker) deleteOne(delivery *awssqs.ReceiveMessageOutput) error {
qURL := b.defaultQueueURL()
_, err := b.service.DeleteMessage(&awssqs.DeleteMessageInput{
QueueUrl: qURL,
ReceiptHandle: delivery.Messages[0].ReceiptHandle,
})
if err != nil {
return err
}
return nil
} | go | func (b *Broker) deleteOne(delivery *awssqs.ReceiveMessageOutput) error {
qURL := b.defaultQueueURL()
_, err := b.service.DeleteMessage(&awssqs.DeleteMessageInput{
QueueUrl: qURL,
ReceiptHandle: delivery.Messages[0].ReceiptHandle,
})
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"b",
"*",
"Broker",
")",
"deleteOne",
"(",
"delivery",
"*",
"awssqs",
".",
"ReceiveMessageOutput",
")",
"error",
"{",
"qURL",
":=",
"b",
".",
"defaultQueueURL",
"(",
")",
"\n",
"_",
",",
"err",
":=",
"b",
".",
"service",
".",
"DeleteMessag... | // deleteOne is a method delete a delivery from AWS SQS | [
"deleteOne",
"is",
"a",
"method",
"delete",
"a",
"delivery",
"from",
"AWS",
"SQS"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/sqs/sqs.go#L238-L249 |
27,708 | RichardKnop/machinery | v1/brokers/sqs/sqs.go | defaultQueueURL | func (b *Broker) defaultQueueURL() *string {
if b.queueUrl != nil {
return b.queueUrl
} else {
return aws.String(b.GetConfig().Broker + "/" + b.GetConfig().DefaultQueue)
}
} | go | func (b *Broker) defaultQueueURL() *string {
if b.queueUrl != nil {
return b.queueUrl
} else {
return aws.String(b.GetConfig().Broker + "/" + b.GetConfig().DefaultQueue)
}
} | [
"func",
"(",
"b",
"*",
"Broker",
")",
"defaultQueueURL",
"(",
")",
"*",
"string",
"{",
"if",
"b",
".",
"queueUrl",
"!=",
"nil",
"{",
"return",
"b",
".",
"queueUrl",
"\n",
"}",
"else",
"{",
"return",
"aws",
".",
"String",
"(",
"b",
".",
"GetConfig",... | // defaultQueueURL is a method returns the default queue url | [
"defaultQueueURL",
"is",
"a",
"method",
"returns",
"the",
"default",
"queue",
"url"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/sqs/sqs.go#L252-L259 |
27,709 | RichardKnop/machinery | v1/brokers/sqs/sqs.go | receiveMessage | func (b *Broker) receiveMessage(qURL *string) (*awssqs.ReceiveMessageOutput, error) {
var waitTimeSeconds int
var visibilityTimeout *int
if b.GetConfig().SQS != nil {
waitTimeSeconds = b.GetConfig().SQS.WaitTimeSeconds
visibilityTimeout = b.GetConfig().SQS.VisibilityTimeout
} else {
waitTimeSeconds = 0
}
in... | go | func (b *Broker) receiveMessage(qURL *string) (*awssqs.ReceiveMessageOutput, error) {
var waitTimeSeconds int
var visibilityTimeout *int
if b.GetConfig().SQS != nil {
waitTimeSeconds = b.GetConfig().SQS.WaitTimeSeconds
visibilityTimeout = b.GetConfig().SQS.VisibilityTimeout
} else {
waitTimeSeconds = 0
}
in... | [
"func",
"(",
"b",
"*",
"Broker",
")",
"receiveMessage",
"(",
"qURL",
"*",
"string",
")",
"(",
"*",
"awssqs",
".",
"ReceiveMessageOutput",
",",
"error",
")",
"{",
"var",
"waitTimeSeconds",
"int",
"\n",
"var",
"visibilityTimeout",
"*",
"int",
"\n",
"if",
"... | // receiveMessage is a method receives a message from specified queue url | [
"receiveMessage",
"is",
"a",
"method",
"receives",
"a",
"message",
"from",
"specified",
"queue",
"url"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/sqs/sqs.go#L262-L290 |
27,710 | RichardKnop/machinery | v1/brokers/sqs/sqs.go | initializePool | func (b *Broker) initializePool(pool chan struct{}, concurrency int) {
for i := 0; i < concurrency; i++ {
pool <- struct{}{}
}
} | go | func (b *Broker) initializePool(pool chan struct{}, concurrency int) {
for i := 0; i < concurrency; i++ {
pool <- struct{}{}
}
} | [
"func",
"(",
"b",
"*",
"Broker",
")",
"initializePool",
"(",
"pool",
"chan",
"struct",
"{",
"}",
",",
"concurrency",
"int",
")",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"concurrency",
";",
"i",
"++",
"{",
"pool",
"<-",
"struct",
"{",
"}",
"{",... | // initializePool is a method which initializes concurrency pool | [
"initializePool",
"is",
"a",
"method",
"which",
"initializes",
"concurrency",
"pool"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/sqs/sqs.go#L293-L297 |
27,711 | RichardKnop/machinery | v1/brokers/sqs/sqs.go | consumeDeliveries | func (b *Broker) consumeDeliveries(deliveries <-chan *awssqs.ReceiveMessageOutput, concurrency int, taskProcessor iface.TaskProcessor, pool chan struct{}, errorsChan chan error) (bool, error) {
select {
case err := <-errorsChan:
return false, err
case d := <-deliveries:
if concurrency > 0 {
// get worker from... | go | func (b *Broker) consumeDeliveries(deliveries <-chan *awssqs.ReceiveMessageOutput, concurrency int, taskProcessor iface.TaskProcessor, pool chan struct{}, errorsChan chan error) (bool, error) {
select {
case err := <-errorsChan:
return false, err
case d := <-deliveries:
if concurrency > 0 {
// get worker from... | [
"func",
"(",
"b",
"*",
"Broker",
")",
"consumeDeliveries",
"(",
"deliveries",
"<-",
"chan",
"*",
"awssqs",
".",
"ReceiveMessageOutput",
",",
"concurrency",
"int",
",",
"taskProcessor",
"iface",
".",
"TaskProcessor",
",",
"pool",
"chan",
"struct",
"{",
"}",
"... | // consumeDeliveries is a method consuming deliveries from deliveries channel | [
"consumeDeliveries",
"is",
"a",
"method",
"consuming",
"deliveries",
"from",
"deliveries",
"channel"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/sqs/sqs.go#L300-L331 |
27,712 | RichardKnop/machinery | v1/brokers/sqs/sqs.go | continueReceivingMessages | func (b *Broker) continueReceivingMessages(qURL *string, deliveries chan *awssqs.ReceiveMessageOutput) (bool, error) {
select {
// A way to stop this goroutine from b.StopConsuming
case <-b.stopReceivingChan:
return false, nil
default:
output, err := b.receiveMessage(qURL)
if err != nil {
return true, err
... | go | func (b *Broker) continueReceivingMessages(qURL *string, deliveries chan *awssqs.ReceiveMessageOutput) (bool, error) {
select {
// A way to stop this goroutine from b.StopConsuming
case <-b.stopReceivingChan:
return false, nil
default:
output, err := b.receiveMessage(qURL)
if err != nil {
return true, err
... | [
"func",
"(",
"b",
"*",
"Broker",
")",
"continueReceivingMessages",
"(",
"qURL",
"*",
"string",
",",
"deliveries",
"chan",
"*",
"awssqs",
".",
"ReceiveMessageOutput",
")",
"(",
"bool",
",",
"error",
")",
"{",
"select",
"{",
"// A way to stop this goroutine from b... | // continueReceivingMessages is a method returns a continue signal | [
"continueReceivingMessages",
"is",
"a",
"method",
"returns",
"a",
"continue",
"signal"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/sqs/sqs.go#L334-L350 |
27,713 | RichardKnop/machinery | v1/brokers/sqs/sqs.go | getQueueURL | func (b *Broker) getQueueURL(taskProcessor iface.TaskProcessor) *string {
queueName := b.GetConfig().DefaultQueue
if taskProcessor.CustomQueue() != "" {
queueName = taskProcessor.CustomQueue()
}
return aws.String(b.GetConfig().Broker + "/" + queueName)
} | go | func (b *Broker) getQueueURL(taskProcessor iface.TaskProcessor) *string {
queueName := b.GetConfig().DefaultQueue
if taskProcessor.CustomQueue() != "" {
queueName = taskProcessor.CustomQueue()
}
return aws.String(b.GetConfig().Broker + "/" + queueName)
} | [
"func",
"(",
"b",
"*",
"Broker",
")",
"getQueueURL",
"(",
"taskProcessor",
"iface",
".",
"TaskProcessor",
")",
"*",
"string",
"{",
"queueName",
":=",
"b",
".",
"GetConfig",
"(",
")",
".",
"DefaultQueue",
"\n",
"if",
"taskProcessor",
".",
"CustomQueue",
"("... | // getQueueURL is a method returns that returns queueURL first by checking if custom queue was set and usign it
// otherwise using default queueName from config | [
"getQueueURL",
"is",
"a",
"method",
"returns",
"that",
"returns",
"queueURL",
"first",
"by",
"checking",
"if",
"custom",
"queue",
"was",
"set",
"and",
"usign",
"it",
"otherwise",
"using",
"default",
"queueName",
"from",
"config"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/sqs/sqs.go#L360-L367 |
27,714 | RichardKnop/machinery | v1/tasks/workflow.go | GetUUIDs | func (group *Group) GetUUIDs() []string {
taskUUIDs := make([]string, len(group.Tasks))
for i, signature := range group.Tasks {
taskUUIDs[i] = signature.UUID
}
return taskUUIDs
} | go | func (group *Group) GetUUIDs() []string {
taskUUIDs := make([]string, len(group.Tasks))
for i, signature := range group.Tasks {
taskUUIDs[i] = signature.UUID
}
return taskUUIDs
} | [
"func",
"(",
"group",
"*",
"Group",
")",
"GetUUIDs",
"(",
")",
"[",
"]",
"string",
"{",
"taskUUIDs",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"group",
".",
"Tasks",
")",
")",
"\n",
"for",
"i",
",",
"signature",
":=",
"range",
"grou... | // GetUUIDs returns slice of task UUIDS | [
"GetUUIDs",
"returns",
"slice",
"of",
"task",
"UUIDS"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/tasks/workflow.go#L28-L34 |
27,715 | RichardKnop/machinery | v1/tasks/workflow.go | NewChain | func NewChain(signatures ...*Signature) (*Chain, error) {
// Auto generate task UUIDs if needed
for _, signature := range signatures {
if signature.UUID == "" {
signatureID := uuid.New().String()
signature.UUID = fmt.Sprintf("task_%v", signatureID)
}
}
for i := len(signatures) - 1; i > 0; i-- {
if i > ... | go | func NewChain(signatures ...*Signature) (*Chain, error) {
// Auto generate task UUIDs if needed
for _, signature := range signatures {
if signature.UUID == "" {
signatureID := uuid.New().String()
signature.UUID = fmt.Sprintf("task_%v", signatureID)
}
}
for i := len(signatures) - 1; i > 0; i-- {
if i > ... | [
"func",
"NewChain",
"(",
"signatures",
"...",
"*",
"Signature",
")",
"(",
"*",
"Chain",
",",
"error",
")",
"{",
"// Auto generate task UUIDs if needed",
"for",
"_",
",",
"signature",
":=",
"range",
"signatures",
"{",
"if",
"signature",
".",
"UUID",
"==",
"\"... | // NewChain creates a new chain of tasks to be processed one by one, passing
// results unless task signatures are set to be immutable | [
"NewChain",
"creates",
"a",
"new",
"chain",
"of",
"tasks",
"to",
"be",
"processed",
"one",
"by",
"one",
"passing",
"results",
"unless",
"task",
"signatures",
"are",
"set",
"to",
"be",
"immutable"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/tasks/workflow.go#L38-L56 |
27,716 | RichardKnop/machinery | v1/tasks/workflow.go | NewGroup | func NewGroup(signatures ...*Signature) (*Group, error) {
// Generate a group UUID
groupUUID := uuid.New().String()
groupID := fmt.Sprintf("group_%v", groupUUID)
// Auto generate task UUIDs if needed, group tasks by common group UUID
for _, signature := range signatures {
if signature.UUID == "" {
signatureI... | go | func NewGroup(signatures ...*Signature) (*Group, error) {
// Generate a group UUID
groupUUID := uuid.New().String()
groupID := fmt.Sprintf("group_%v", groupUUID)
// Auto generate task UUIDs if needed, group tasks by common group UUID
for _, signature := range signatures {
if signature.UUID == "" {
signatureI... | [
"func",
"NewGroup",
"(",
"signatures",
"...",
"*",
"Signature",
")",
"(",
"*",
"Group",
",",
"error",
")",
"{",
"// Generate a group UUID",
"groupUUID",
":=",
"uuid",
".",
"New",
"(",
")",
".",
"String",
"(",
")",
"\n",
"groupID",
":=",
"fmt",
".",
"Sp... | // NewGroup creates a new group of tasks to be processed in parallel | [
"NewGroup",
"creates",
"a",
"new",
"group",
"of",
"tasks",
"to",
"be",
"processed",
"in",
"parallel"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/tasks/workflow.go#L59-L78 |
27,717 | RichardKnop/machinery | v1/backends/amqp/amqp.go | GetState | func (b *Backend) GetState(taskUUID string) (*tasks.TaskState, error) {
declareQueueArgs := amqp.Table{
// Time in milliseconds
// after that message will expire
"x-message-ttl": int32(b.getExpiresIn()),
// Time after that the queue will be deleted.
"x-expires": int32(b.getExpiresIn()),
}
conn, channel, _,... | go | func (b *Backend) GetState(taskUUID string) (*tasks.TaskState, error) {
declareQueueArgs := amqp.Table{
// Time in milliseconds
// after that message will expire
"x-message-ttl": int32(b.getExpiresIn()),
// Time after that the queue will be deleted.
"x-expires": int32(b.getExpiresIn()),
}
conn, channel, _,... | [
"func",
"(",
"b",
"*",
"Backend",
")",
"GetState",
"(",
"taskUUID",
"string",
")",
"(",
"*",
"tasks",
".",
"TaskState",
",",
"error",
")",
"{",
"declareQueueArgs",
":=",
"amqp",
".",
"Table",
"{",
"// Time in milliseconds",
"// after that message will expire",
... | // GetState returns the latest task state. It will only return the status once
// as the message will get consumed and removed from the queue. | [
"GetState",
"returns",
"the",
"latest",
"task",
"state",
".",
"It",
"will",
"only",
"return",
"the",
"status",
"once",
"as",
"the",
"message",
"will",
"get",
"consumed",
"and",
"removed",
"from",
"the",
"queue",
"."
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/amqp/amqp.go#L190-L239 |
27,718 | RichardKnop/machinery | v1/backends/amqp/amqp.go | getExpiresIn | func (b *Backend) getExpiresIn() int {
resultsExpireIn := b.GetConfig().ResultsExpireIn * 1000
if resultsExpireIn == 0 {
// // expire results after 1 hour by default
resultsExpireIn = config.DefaultResultsExpireIn * 1000
}
return resultsExpireIn
} | go | func (b *Backend) getExpiresIn() int {
resultsExpireIn := b.GetConfig().ResultsExpireIn * 1000
if resultsExpireIn == 0 {
// // expire results after 1 hour by default
resultsExpireIn = config.DefaultResultsExpireIn * 1000
}
return resultsExpireIn
} | [
"func",
"(",
"b",
"*",
"Backend",
")",
"getExpiresIn",
"(",
")",
"int",
"{",
"resultsExpireIn",
":=",
"b",
".",
"GetConfig",
"(",
")",
".",
"ResultsExpireIn",
"*",
"1000",
"\n",
"if",
"resultsExpireIn",
"==",
"0",
"{",
"// // expire results after 1 hour by def... | // getExpiresIn returns expiration time | [
"getExpiresIn",
"returns",
"expiration",
"time"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/amqp/amqp.go#L321-L328 |
27,719 | RichardKnop/machinery | v1/common/redis.go | NewPool | func (rc *RedisConnector) NewPool(socketPath, host, password string, db int, cnf *config.RedisConfig, tlsConfig *tls.Config) *redis.Pool {
if cnf == nil {
cnf = defaultConfig
}
return &redis.Pool{
MaxIdle: cnf.MaxIdle,
IdleTimeout: time.Duration(cnf.IdleTimeout) * time.Second,
MaxActive: cnf.MaxActive,... | go | func (rc *RedisConnector) NewPool(socketPath, host, password string, db int, cnf *config.RedisConfig, tlsConfig *tls.Config) *redis.Pool {
if cnf == nil {
cnf = defaultConfig
}
return &redis.Pool{
MaxIdle: cnf.MaxIdle,
IdleTimeout: time.Duration(cnf.IdleTimeout) * time.Second,
MaxActive: cnf.MaxActive,... | [
"func",
"(",
"rc",
"*",
"RedisConnector",
")",
"NewPool",
"(",
"socketPath",
",",
"host",
",",
"password",
"string",
",",
"db",
"int",
",",
"cnf",
"*",
"config",
".",
"RedisConfig",
",",
"tlsConfig",
"*",
"tls",
".",
"Config",
")",
"*",
"redis",
".",
... | // NewPool returns a new pool of Redis connections | [
"NewPool",
"returns",
"a",
"new",
"pool",
"of",
"Redis",
"connections"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/common/redis.go#L26-L59 |
27,720 | RichardKnop/machinery | v1/common/redis.go | open | func (rc *RedisConnector) open(socketPath, host, password string, db int, cnf *config.RedisConfig, tlsConfig *tls.Config) (redis.Conn, error) {
var opts = []redis.DialOption{
redis.DialDatabase(db),
redis.DialReadTimeout(time.Duration(cnf.ReadTimeout) * time.Second),
redis.DialWriteTimeout(time.Duration(cnf.Writ... | go | func (rc *RedisConnector) open(socketPath, host, password string, db int, cnf *config.RedisConfig, tlsConfig *tls.Config) (redis.Conn, error) {
var opts = []redis.DialOption{
redis.DialDatabase(db),
redis.DialReadTimeout(time.Duration(cnf.ReadTimeout) * time.Second),
redis.DialWriteTimeout(time.Duration(cnf.Writ... | [
"func",
"(",
"rc",
"*",
"RedisConnector",
")",
"open",
"(",
"socketPath",
",",
"host",
",",
"password",
"string",
",",
"db",
"int",
",",
"cnf",
"*",
"config",
".",
"RedisConfig",
",",
"tlsConfig",
"*",
"tls",
".",
"Config",
")",
"(",
"redis",
".",
"C... | // Open a new Redis connection | [
"Open",
"a",
"new",
"Redis",
"connection"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/common/redis.go#L62-L83 |
27,721 | RichardKnop/machinery | v1/backends/result/async_result.go | NewAsyncResult | func NewAsyncResult(signature *tasks.Signature, backend iface.Backend) *AsyncResult {
return &AsyncResult{
Signature: signature,
taskState: new(tasks.TaskState),
backend: backend,
}
} | go | func NewAsyncResult(signature *tasks.Signature, backend iface.Backend) *AsyncResult {
return &AsyncResult{
Signature: signature,
taskState: new(tasks.TaskState),
backend: backend,
}
} | [
"func",
"NewAsyncResult",
"(",
"signature",
"*",
"tasks",
".",
"Signature",
",",
"backend",
"iface",
".",
"Backend",
")",
"*",
"AsyncResult",
"{",
"return",
"&",
"AsyncResult",
"{",
"Signature",
":",
"signature",
",",
"taskState",
":",
"new",
"(",
"tasks",
... | // NewAsyncResult creates AsyncResult instance | [
"NewAsyncResult",
"creates",
"AsyncResult",
"instance"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/result/async_result.go#L40-L46 |
27,722 | RichardKnop/machinery | v1/backends/result/async_result.go | NewChordAsyncResult | func NewChordAsyncResult(groupTasks []*tasks.Signature, chordCallback *tasks.Signature, backend iface.Backend) *ChordAsyncResult {
asyncResults := make([]*AsyncResult, len(groupTasks))
for i, task := range groupTasks {
asyncResults[i] = NewAsyncResult(task, backend)
}
return &ChordAsyncResult{
groupAsyncResults... | go | func NewChordAsyncResult(groupTasks []*tasks.Signature, chordCallback *tasks.Signature, backend iface.Backend) *ChordAsyncResult {
asyncResults := make([]*AsyncResult, len(groupTasks))
for i, task := range groupTasks {
asyncResults[i] = NewAsyncResult(task, backend)
}
return &ChordAsyncResult{
groupAsyncResults... | [
"func",
"NewChordAsyncResult",
"(",
"groupTasks",
"[",
"]",
"*",
"tasks",
".",
"Signature",
",",
"chordCallback",
"*",
"tasks",
".",
"Signature",
",",
"backend",
"iface",
".",
"Backend",
")",
"*",
"ChordAsyncResult",
"{",
"asyncResults",
":=",
"make",
"(",
"... | // NewChordAsyncResult creates ChordAsyncResult instance | [
"NewChordAsyncResult",
"creates",
"ChordAsyncResult",
"instance"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/result/async_result.go#L49-L59 |
27,723 | RichardKnop/machinery | v1/backends/result/async_result.go | NewChainAsyncResult | func NewChainAsyncResult(tasks []*tasks.Signature, backend iface.Backend) *ChainAsyncResult {
asyncResults := make([]*AsyncResult, len(tasks))
for i, task := range tasks {
asyncResults[i] = NewAsyncResult(task, backend)
}
return &ChainAsyncResult{
asyncResults: asyncResults,
backend: backend,
}
} | go | func NewChainAsyncResult(tasks []*tasks.Signature, backend iface.Backend) *ChainAsyncResult {
asyncResults := make([]*AsyncResult, len(tasks))
for i, task := range tasks {
asyncResults[i] = NewAsyncResult(task, backend)
}
return &ChainAsyncResult{
asyncResults: asyncResults,
backend: backend,
}
} | [
"func",
"NewChainAsyncResult",
"(",
"tasks",
"[",
"]",
"*",
"tasks",
".",
"Signature",
",",
"backend",
"iface",
".",
"Backend",
")",
"*",
"ChainAsyncResult",
"{",
"asyncResults",
":=",
"make",
"(",
"[",
"]",
"*",
"AsyncResult",
",",
"len",
"(",
"tasks",
... | // NewChainAsyncResult creates ChainAsyncResult instance | [
"NewChainAsyncResult",
"creates",
"ChainAsyncResult",
"instance"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/result/async_result.go#L62-L71 |
27,724 | RichardKnop/machinery | v1/backends/result/async_result.go | Touch | func (asyncResult *AsyncResult) Touch() ([]reflect.Value, error) {
if asyncResult.backend == nil {
return nil, ErrBackendNotConfigured
}
asyncResult.GetState()
// Purge state if we are using AMQP backend
if asyncResult.backend.IsAMQP() && asyncResult.taskState.IsCompleted() {
asyncResult.backend.PurgeState(a... | go | func (asyncResult *AsyncResult) Touch() ([]reflect.Value, error) {
if asyncResult.backend == nil {
return nil, ErrBackendNotConfigured
}
asyncResult.GetState()
// Purge state if we are using AMQP backend
if asyncResult.backend.IsAMQP() && asyncResult.taskState.IsCompleted() {
asyncResult.backend.PurgeState(a... | [
"func",
"(",
"asyncResult",
"*",
"AsyncResult",
")",
"Touch",
"(",
")",
"(",
"[",
"]",
"reflect",
".",
"Value",
",",
"error",
")",
"{",
"if",
"asyncResult",
".",
"backend",
"==",
"nil",
"{",
"return",
"nil",
",",
"ErrBackendNotConfigured",
"\n",
"}",
"... | // Touch the state and don't wait | [
"Touch",
"the",
"state",
"and",
"don",
"t",
"wait"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/result/async_result.go#L74-L95 |
27,725 | RichardKnop/machinery | v1/backends/result/async_result.go | GetState | func (asyncResult *AsyncResult) GetState() *tasks.TaskState {
if asyncResult.taskState.IsCompleted() {
return asyncResult.taskState
}
taskState, err := asyncResult.backend.GetState(asyncResult.Signature.UUID)
if err == nil {
asyncResult.taskState = taskState
}
return asyncResult.taskState
} | go | func (asyncResult *AsyncResult) GetState() *tasks.TaskState {
if asyncResult.taskState.IsCompleted() {
return asyncResult.taskState
}
taskState, err := asyncResult.backend.GetState(asyncResult.Signature.UUID)
if err == nil {
asyncResult.taskState = taskState
}
return asyncResult.taskState
} | [
"func",
"(",
"asyncResult",
"*",
"AsyncResult",
")",
"GetState",
"(",
")",
"*",
"tasks",
".",
"TaskState",
"{",
"if",
"asyncResult",
".",
"taskState",
".",
"IsCompleted",
"(",
")",
"{",
"return",
"asyncResult",
".",
"taskState",
"\n",
"}",
"\n\n",
"taskSta... | // GetState returns latest task state | [
"GetState",
"returns",
"latest",
"task",
"state"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/result/async_result.go#L131-L142 |
27,726 | RichardKnop/machinery | v1/tasks/validate.go | ValidateTask | func ValidateTask(task interface{}) error {
v := reflect.ValueOf(task)
t := v.Type()
// Task must be a function
if t.Kind() != reflect.Func {
return ErrTaskMustBeFunc
}
// Task must return at least a single value
if t.NumOut() < 1 {
return ErrTaskReturnsNoValue
}
// Last return value must be error
last... | go | func ValidateTask(task interface{}) error {
v := reflect.ValueOf(task)
t := v.Type()
// Task must be a function
if t.Kind() != reflect.Func {
return ErrTaskMustBeFunc
}
// Task must return at least a single value
if t.NumOut() < 1 {
return ErrTaskReturnsNoValue
}
// Last return value must be error
last... | [
"func",
"ValidateTask",
"(",
"task",
"interface",
"{",
"}",
")",
"error",
"{",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"task",
")",
"\n",
"t",
":=",
"v",
".",
"Type",
"(",
")",
"\n\n",
"// Task must be a function",
"if",
"t",
".",
"Kind",
"(",
")"... | // ValidateTask validates task function using reflection and makes sure
// it has a proper signature. Functions used as tasks must return at least a
// single value and the last return type must be error | [
"ValidateTask",
"validates",
"task",
"function",
"using",
"reflection",
"and",
"makes",
"sure",
"it",
"has",
"a",
"proper",
"signature",
".",
"Functions",
"used",
"as",
"tasks",
"must",
"return",
"at",
"least",
"a",
"single",
"value",
"and",
"the",
"last",
"... | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/tasks/validate.go#L20-L42 |
27,727 | RichardKnop/machinery | v1/backends/dynamodb/dynamodb.go | New | func New(cnf *config.Config) iface.Backend {
backend := &Backend{Backend: common.NewBackend(cnf), cnf: cnf}
if cnf.DynamoDB != nil && cnf.DynamoDB.Client != nil {
backend.client = cnf.DynamoDB.Client
} else {
sess := session.Must(session.NewSessionWithOptions(session.Options{
SharedConfigState: session.Share... | go | func New(cnf *config.Config) iface.Backend {
backend := &Backend{Backend: common.NewBackend(cnf), cnf: cnf}
if cnf.DynamoDB != nil && cnf.DynamoDB.Client != nil {
backend.client = cnf.DynamoDB.Client
} else {
sess := session.Must(session.NewSessionWithOptions(session.Options{
SharedConfigState: session.Share... | [
"func",
"New",
"(",
"cnf",
"*",
"config",
".",
"Config",
")",
"iface",
".",
"Backend",
"{",
"backend",
":=",
"&",
"Backend",
"{",
"Backend",
":",
"common",
".",
"NewBackend",
"(",
"cnf",
")",
",",
"cnf",
":",
"cnf",
"}",
"\n\n",
"if",
"cnf",
".",
... | // New creates a Backend instance | [
"New",
"creates",
"a",
"Backend",
"instance"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/dynamodb/dynamodb.go#L29-L47 |
27,728 | RichardKnop/machinery | v1/config/env.go | NewFromEnvironment | func NewFromEnvironment(keepReloading bool) (*Config, error) {
cnf, err := fromEnvironment()
if err != nil {
return nil, err
}
log.INFO.Print("Successfully loaded config from the environment")
if keepReloading {
// Open a goroutine to watch remote changes forever
go func() {
for {
// Delay after eac... | go | func NewFromEnvironment(keepReloading bool) (*Config, error) {
cnf, err := fromEnvironment()
if err != nil {
return nil, err
}
log.INFO.Print("Successfully loaded config from the environment")
if keepReloading {
// Open a goroutine to watch remote changes forever
go func() {
for {
// Delay after eac... | [
"func",
"NewFromEnvironment",
"(",
"keepReloading",
"bool",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"cnf",
",",
"err",
":=",
"fromEnvironment",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"l... | // NewFromEnvironment creates a config object from environment variables | [
"NewFromEnvironment",
"creates",
"a",
"config",
"object",
"from",
"environment",
"variables"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/config/env.go#L11-L40 |
27,729 | RichardKnop/machinery | v1/common/broker.go | NewBroker | func NewBroker(cnf *config.Config) Broker {
return Broker{cnf: cnf, retry: true}
} | go | func NewBroker(cnf *config.Config) Broker {
return Broker{cnf: cnf, retry: true}
} | [
"func",
"NewBroker",
"(",
"cnf",
"*",
"config",
".",
"Config",
")",
"Broker",
"{",
"return",
"Broker",
"{",
"cnf",
":",
"cnf",
",",
"retry",
":",
"true",
"}",
"\n",
"}"
] | // NewBroker creates new Broker instance | [
"NewBroker",
"creates",
"new",
"Broker",
"instance"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/common/broker.go#L24-L26 |
27,730 | RichardKnop/machinery | v1/common/broker.go | IsTaskRegistered | func (b *Broker) IsTaskRegistered(name string) bool {
for _, registeredTaskName := range b.registeredTaskNames {
if registeredTaskName == name {
return true
}
}
return false
} | go | func (b *Broker) IsTaskRegistered(name string) bool {
for _, registeredTaskName := range b.registeredTaskNames {
if registeredTaskName == name {
return true
}
}
return false
} | [
"func",
"(",
"b",
"*",
"Broker",
")",
"IsTaskRegistered",
"(",
"name",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"registeredTaskName",
":=",
"range",
"b",
".",
"registeredTaskNames",
"{",
"if",
"registeredTaskName",
"==",
"name",
"{",
"return",
"true",
... | // IsTaskRegistered returns true if the task is registered with this broker | [
"IsTaskRegistered",
"returns",
"true",
"if",
"the",
"task",
"is",
"registered",
"with",
"this",
"broker"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/common/broker.go#L64-L71 |
27,731 | RichardKnop/machinery | v1/common/broker.go | StartConsuming | func (b *Broker) StartConsuming(consumerTag string, concurrency int, taskProcessor iface.TaskProcessor) {
if b.retryFunc == nil {
b.retryFunc = retry.Closure()
}
b.stopChan = make(chan int)
b.retryStopChan = make(chan int)
} | go | func (b *Broker) StartConsuming(consumerTag string, concurrency int, taskProcessor iface.TaskProcessor) {
if b.retryFunc == nil {
b.retryFunc = retry.Closure()
}
b.stopChan = make(chan int)
b.retryStopChan = make(chan int)
} | [
"func",
"(",
"b",
"*",
"Broker",
")",
"StartConsuming",
"(",
"consumerTag",
"string",
",",
"concurrency",
"int",
",",
"taskProcessor",
"iface",
".",
"TaskProcessor",
")",
"{",
"if",
"b",
".",
"retryFunc",
"==",
"nil",
"{",
"b",
".",
"retryFunc",
"=",
"re... | // StartConsuming is a common part of StartConsuming method | [
"StartConsuming",
"is",
"a",
"common",
"part",
"of",
"StartConsuming",
"method"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/common/broker.go#L79-L86 |
27,732 | RichardKnop/machinery | v1/common/broker.go | StopConsuming | func (b *Broker) StopConsuming() {
// Do not retry from now on
b.retry = false
// Stop the retry closure earlier
select {
case b.retryStopChan <- 1:
log.WARNING.Print("Stopping retry closure.")
default:
}
// Notifying the stop channel stops consuming of messages
select {
case b.stopChan <- 1:
log.WARNING.... | go | func (b *Broker) StopConsuming() {
// Do not retry from now on
b.retry = false
// Stop the retry closure earlier
select {
case b.retryStopChan <- 1:
log.WARNING.Print("Stopping retry closure.")
default:
}
// Notifying the stop channel stops consuming of messages
select {
case b.stopChan <- 1:
log.WARNING.... | [
"func",
"(",
"b",
"*",
"Broker",
")",
"StopConsuming",
"(",
")",
"{",
"// Do not retry from now on",
"b",
".",
"retry",
"=",
"false",
"\n",
"// Stop the retry closure earlier",
"select",
"{",
"case",
"b",
".",
"retryStopChan",
"<-",
"1",
":",
"log",
".",
"WA... | // StopConsuming is a common part of StopConsuming | [
"StopConsuming",
"is",
"a",
"common",
"part",
"of",
"StopConsuming"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/common/broker.go#L89-L104 |
27,733 | RichardKnop/machinery | v1/backends/memcache/memcache.go | lockGroupMeta | func (b *Backend) lockGroupMeta(groupMeta *tasks.GroupMeta) error {
groupMeta.Lock = true
encoded, err := json.Marshal(groupMeta)
if err != nil {
return err
}
return b.getClient().Set(&gomemcache.Item{
Key: groupMeta.GroupUUID,
Value: encoded,
Expiration: b.getExpirationTimestamp(),
})
} | go | func (b *Backend) lockGroupMeta(groupMeta *tasks.GroupMeta) error {
groupMeta.Lock = true
encoded, err := json.Marshal(groupMeta)
if err != nil {
return err
}
return b.getClient().Set(&gomemcache.Item{
Key: groupMeta.GroupUUID,
Value: encoded,
Expiration: b.getExpirationTimestamp(),
})
} | [
"func",
"(",
"b",
"*",
"Backend",
")",
"lockGroupMeta",
"(",
"groupMeta",
"*",
"tasks",
".",
"GroupMeta",
")",
"error",
"{",
"groupMeta",
".",
"Lock",
"=",
"true",
"\n",
"encoded",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"groupMeta",
")",
"\n",
... | // lockGroupMeta acquires lock on group meta data | [
"lockGroupMeta",
"acquires",
"lock",
"on",
"group",
"meta",
"data"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/memcache/memcache.go#L207-L219 |
27,734 | RichardKnop/machinery | v1/backends/memcache/memcache.go | getExpirationTimestamp | func (b *Backend) getExpirationTimestamp() int32 {
expiresIn := b.GetConfig().ResultsExpireIn
if expiresIn == 0 {
// // expire results after 1 hour by default
expiresIn = config.DefaultResultsExpireIn
}
return int32(time.Now().Unix() + int64(expiresIn))
} | go | func (b *Backend) getExpirationTimestamp() int32 {
expiresIn := b.GetConfig().ResultsExpireIn
if expiresIn == 0 {
// // expire results after 1 hour by default
expiresIn = config.DefaultResultsExpireIn
}
return int32(time.Now().Unix() + int64(expiresIn))
} | [
"func",
"(",
"b",
"*",
"Backend",
")",
"getExpirationTimestamp",
"(",
")",
"int32",
"{",
"expiresIn",
":=",
"b",
".",
"GetConfig",
"(",
")",
".",
"ResultsExpireIn",
"\n",
"if",
"expiresIn",
"==",
"0",
"{",
"// // expire results after 1 hour by default",
"expires... | // getExpirationTimestamp returns expiration timestamp | [
"getExpirationTimestamp",
"returns",
"expiration",
"timestamp"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/memcache/memcache.go#L277-L284 |
27,735 | RichardKnop/machinery | v1/backends/memcache/memcache.go | getClient | func (b *Backend) getClient() *gomemcache.Client {
if b.client == nil {
b.client = gomemcache.New(b.servers...)
}
return b.client
} | go | func (b *Backend) getClient() *gomemcache.Client {
if b.client == nil {
b.client = gomemcache.New(b.servers...)
}
return b.client
} | [
"func",
"(",
"b",
"*",
"Backend",
")",
"getClient",
"(",
")",
"*",
"gomemcache",
".",
"Client",
"{",
"if",
"b",
".",
"client",
"==",
"nil",
"{",
"b",
".",
"client",
"=",
"gomemcache",
".",
"New",
"(",
"b",
".",
"servers",
"...",
")",
"\n",
"}",
... | // getClient returns or creates instance of Memcache client | [
"getClient",
"returns",
"or",
"creates",
"instance",
"of",
"Memcache",
"client"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/memcache/memcache.go#L287-L292 |
27,736 | RichardKnop/machinery | v1/backends/eager/eager.go | New | func New() iface.Backend {
return &Backend{
Backend: common.NewBackend(new(config.Config)),
groups: make(map[string][]string),
tasks: make(map[string][]byte),
}
} | go | func New() iface.Backend {
return &Backend{
Backend: common.NewBackend(new(config.Config)),
groups: make(map[string][]string),
tasks: make(map[string][]byte),
}
} | [
"func",
"New",
"(",
")",
"iface",
".",
"Backend",
"{",
"return",
"&",
"Backend",
"{",
"Backend",
":",
"common",
".",
"NewBackend",
"(",
"new",
"(",
"config",
".",
"Config",
")",
")",
",",
"groups",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
... | // New creates EagerBackend instance | [
"New",
"creates",
"EagerBackend",
"instance"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/eager/eager.go#L54-L60 |
27,737 | RichardKnop/machinery | v1/config/file.go | NewFromYaml | func NewFromYaml(cnfPath string, keepReloading bool) (*Config, error) {
cnf, err := fromFile(cnfPath)
if err != nil {
return nil, err
}
log.INFO.Printf("Successfully loaded config from file %s", cnfPath)
if keepReloading {
// Open a goroutine to watch remote changes forever
go func() {
for {
// Dela... | go | func NewFromYaml(cnfPath string, keepReloading bool) (*Config, error) {
cnf, err := fromFile(cnfPath)
if err != nil {
return nil, err
}
log.INFO.Printf("Successfully loaded config from file %s", cnfPath)
if keepReloading {
// Open a goroutine to watch remote changes forever
go func() {
for {
// Dela... | [
"func",
"NewFromYaml",
"(",
"cnfPath",
"string",
",",
"keepReloading",
"bool",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"cnf",
",",
"err",
":=",
"fromFile",
"(",
"cnfPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err"... | // NewFromYaml creates a config object from YAML file | [
"NewFromYaml",
"creates",
"a",
"config",
"object",
"from",
"YAML",
"file"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/config/file.go#L13-L42 |
27,738 | RichardKnop/machinery | v1/config/file.go | ReadFromFile | func ReadFromFile(cnfPath string) ([]byte, error) {
file, err := os.Open(cnfPath)
// Config file not found
if err != nil {
return nil, fmt.Errorf("Open file error: %s", err)
}
// Config file found, let's try to read it
data := make([]byte, 1000)
count, err := file.Read(data)
if err != nil {
return nil, fm... | go | func ReadFromFile(cnfPath string) ([]byte, error) {
file, err := os.Open(cnfPath)
// Config file not found
if err != nil {
return nil, fmt.Errorf("Open file error: %s", err)
}
// Config file found, let's try to read it
data := make([]byte, 1000)
count, err := file.Read(data)
if err != nil {
return nil, fm... | [
"func",
"ReadFromFile",
"(",
"cnfPath",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"file",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"cnfPath",
")",
"\n\n",
"// Config file not found",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
... | // ReadFromFile reads data from a file | [
"ReadFromFile",
"reads",
"data",
"from",
"a",
"file"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/config/file.go#L45-L61 |
27,739 | RichardKnop/machinery | v1/tasks/signature.go | NewSignature | func NewSignature(name string, args []Arg) (*Signature, error) {
signatureID := uuid.New().String()
return &Signature{
UUID: fmt.Sprintf("task_%v", signatureID),
Name: name,
Args: args,
}, nil
} | go | func NewSignature(name string, args []Arg) (*Signature, error) {
signatureID := uuid.New().String()
return &Signature{
UUID: fmt.Sprintf("task_%v", signatureID),
Name: name,
Args: args,
}, nil
} | [
"func",
"NewSignature",
"(",
"name",
"string",
",",
"args",
"[",
"]",
"Arg",
")",
"(",
"*",
"Signature",
",",
"error",
")",
"{",
"signatureID",
":=",
"uuid",
".",
"New",
"(",
")",
".",
"String",
"(",
")",
"\n",
"return",
"&",
"Signature",
"{",
"UUI... | // NewSignature creates a new task signature | [
"NewSignature",
"creates",
"a",
"new",
"task",
"signature"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/tasks/signature.go#L65-L72 |
27,740 | RichardKnop/machinery | v1/server.go | NewServer | func NewServer(cnf *config.Config) (*Server, error) {
broker, err := BrokerFactory(cnf)
if err != nil {
return nil, err
}
// Backend is optional so we ignore the error
backend, _ := BackendFactory(cnf)
srv := NewServerWithBrokerBackend(cnf, broker, backend)
// init for eager-mode
eager, ok := broker.(eager... | go | func NewServer(cnf *config.Config) (*Server, error) {
broker, err := BrokerFactory(cnf)
if err != nil {
return nil, err
}
// Backend is optional so we ignore the error
backend, _ := BackendFactory(cnf)
srv := NewServerWithBrokerBackend(cnf, broker, backend)
// init for eager-mode
eager, ok := broker.(eager... | [
"func",
"NewServer",
"(",
"cnf",
"*",
"config",
".",
"Config",
")",
"(",
"*",
"Server",
",",
"error",
")",
"{",
"broker",
",",
"err",
":=",
"BrokerFactory",
"(",
"cnf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
... | // NewServer creates Server instance | [
"NewServer",
"creates",
"Server",
"instance"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L42-L61 |
27,741 | RichardKnop/machinery | v1/server.go | NewWorker | func (server *Server) NewWorker(consumerTag string, concurrency int) *Worker {
return &Worker{
server: server,
ConsumerTag: consumerTag,
Concurrency: concurrency,
Queue: "",
}
} | go | func (server *Server) NewWorker(consumerTag string, concurrency int) *Worker {
return &Worker{
server: server,
ConsumerTag: consumerTag,
Concurrency: concurrency,
Queue: "",
}
} | [
"func",
"(",
"server",
"*",
"Server",
")",
"NewWorker",
"(",
"consumerTag",
"string",
",",
"concurrency",
"int",
")",
"*",
"Worker",
"{",
"return",
"&",
"Worker",
"{",
"server",
":",
"server",
",",
"ConsumerTag",
":",
"consumerTag",
",",
"Concurrency",
":"... | // NewWorker creates Worker instance | [
"NewWorker",
"creates",
"Worker",
"instance"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L64-L71 |
27,742 | RichardKnop/machinery | v1/server.go | NewCustomQueueWorker | func (server *Server) NewCustomQueueWorker(consumerTag string, concurrency int, queue string) *Worker {
return &Worker{
server: server,
ConsumerTag: consumerTag,
Concurrency: concurrency,
Queue: queue,
}
} | go | func (server *Server) NewCustomQueueWorker(consumerTag string, concurrency int, queue string) *Worker {
return &Worker{
server: server,
ConsumerTag: consumerTag,
Concurrency: concurrency,
Queue: queue,
}
} | [
"func",
"(",
"server",
"*",
"Server",
")",
"NewCustomQueueWorker",
"(",
"consumerTag",
"string",
",",
"concurrency",
"int",
",",
"queue",
"string",
")",
"*",
"Worker",
"{",
"return",
"&",
"Worker",
"{",
"server",
":",
"server",
",",
"ConsumerTag",
":",
"co... | // NewCustomQueueWorker creates Worker instance with Custom Queue | [
"NewCustomQueueWorker",
"creates",
"Worker",
"instance",
"with",
"Custom",
"Queue"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L74-L81 |
27,743 | RichardKnop/machinery | v1/server.go | RegisterTasks | func (server *Server) RegisterTasks(namedTaskFuncs map[string]interface{}) error {
for _, task := range namedTaskFuncs {
if err := tasks.ValidateTask(task); err != nil {
return err
}
}
server.registeredTasks = namedTaskFuncs
server.broker.SetRegisteredTaskNames(server.GetRegisteredTaskNames())
return nil
} | go | func (server *Server) RegisterTasks(namedTaskFuncs map[string]interface{}) error {
for _, task := range namedTaskFuncs {
if err := tasks.ValidateTask(task); err != nil {
return err
}
}
server.registeredTasks = namedTaskFuncs
server.broker.SetRegisteredTaskNames(server.GetRegisteredTaskNames())
return nil
} | [
"func",
"(",
"server",
"*",
"Server",
")",
"RegisterTasks",
"(",
"namedTaskFuncs",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"error",
"{",
"for",
"_",
",",
"task",
":=",
"range",
"namedTaskFuncs",
"{",
"if",
"err",
":=",
"tasks",
".",
"Val... | // RegisterTasks registers all tasks at once | [
"RegisterTasks",
"registers",
"all",
"tasks",
"at",
"once"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L119-L128 |
27,744 | RichardKnop/machinery | v1/server.go | RegisterTask | func (server *Server) RegisterTask(name string, taskFunc interface{}) error {
if err := tasks.ValidateTask(taskFunc); err != nil {
return err
}
server.registeredTasks[name] = taskFunc
server.broker.SetRegisteredTaskNames(server.GetRegisteredTaskNames())
return nil
} | go | func (server *Server) RegisterTask(name string, taskFunc interface{}) error {
if err := tasks.ValidateTask(taskFunc); err != nil {
return err
}
server.registeredTasks[name] = taskFunc
server.broker.SetRegisteredTaskNames(server.GetRegisteredTaskNames())
return nil
} | [
"func",
"(",
"server",
"*",
"Server",
")",
"RegisterTask",
"(",
"name",
"string",
",",
"taskFunc",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"err",
":=",
"tasks",
".",
"ValidateTask",
"(",
"taskFunc",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
... | // RegisterTask registers a single task | [
"RegisterTask",
"registers",
"a",
"single",
"task"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L131-L138 |
27,745 | RichardKnop/machinery | v1/server.go | IsTaskRegistered | func (server *Server) IsTaskRegistered(name string) bool {
_, ok := server.registeredTasks[name]
return ok
} | go | func (server *Server) IsTaskRegistered(name string) bool {
_, ok := server.registeredTasks[name]
return ok
} | [
"func",
"(",
"server",
"*",
"Server",
")",
"IsTaskRegistered",
"(",
"name",
"string",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"server",
".",
"registeredTasks",
"[",
"name",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] | // IsTaskRegistered returns true if the task name is registered with this broker | [
"IsTaskRegistered",
"returns",
"true",
"if",
"the",
"task",
"name",
"is",
"registered",
"with",
"this",
"broker"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L141-L144 |
27,746 | RichardKnop/machinery | v1/server.go | GetRegisteredTask | func (server *Server) GetRegisteredTask(name string) (interface{}, error) {
taskFunc, ok := server.registeredTasks[name]
if !ok {
return nil, fmt.Errorf("Task not registered error: %s", name)
}
return taskFunc, nil
} | go | func (server *Server) GetRegisteredTask(name string) (interface{}, error) {
taskFunc, ok := server.registeredTasks[name]
if !ok {
return nil, fmt.Errorf("Task not registered error: %s", name)
}
return taskFunc, nil
} | [
"func",
"(",
"server",
"*",
"Server",
")",
"GetRegisteredTask",
"(",
"name",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"taskFunc",
",",
"ok",
":=",
"server",
".",
"registeredTasks",
"[",
"name",
"]",
"\n",
"if",
"!",
"ok",
"{... | // GetRegisteredTask returns registered task by name | [
"GetRegisteredTask",
"returns",
"registered",
"task",
"by",
"name"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L147-L153 |
27,747 | RichardKnop/machinery | v1/server.go | SendTaskWithContext | func (server *Server) SendTaskWithContext(ctx context.Context, signature *tasks.Signature) (*result.AsyncResult, error) {
span, _ := opentracing.StartSpanFromContext(ctx, "SendTask", tracing.ProducerOption(), tracing.MachineryTag)
defer span.Finish()
// tag the span with some info about the signature
signature.Hea... | go | func (server *Server) SendTaskWithContext(ctx context.Context, signature *tasks.Signature) (*result.AsyncResult, error) {
span, _ := opentracing.StartSpanFromContext(ctx, "SendTask", tracing.ProducerOption(), tracing.MachineryTag)
defer span.Finish()
// tag the span with some info about the signature
signature.Hea... | [
"func",
"(",
"server",
"*",
"Server",
")",
"SendTaskWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"signature",
"*",
"tasks",
".",
"Signature",
")",
"(",
"*",
"result",
".",
"AsyncResult",
",",
"error",
")",
"{",
"span",
",",
"_",
":=",
"ope... | // SendTaskWithContext will inject the trace context in the signature headers before publishing it | [
"SendTaskWithContext",
"will",
"inject",
"the",
"trace",
"context",
"in",
"the",
"signature",
"headers",
"before",
"publishing",
"it"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L156-L188 |
27,748 | RichardKnop/machinery | v1/server.go | SendTask | func (server *Server) SendTask(signature *tasks.Signature) (*result.AsyncResult, error) {
return server.SendTaskWithContext(context.Background(), signature)
} | go | func (server *Server) SendTask(signature *tasks.Signature) (*result.AsyncResult, error) {
return server.SendTaskWithContext(context.Background(), signature)
} | [
"func",
"(",
"server",
"*",
"Server",
")",
"SendTask",
"(",
"signature",
"*",
"tasks",
".",
"Signature",
")",
"(",
"*",
"result",
".",
"AsyncResult",
",",
"error",
")",
"{",
"return",
"server",
".",
"SendTaskWithContext",
"(",
"context",
".",
"Background",... | // SendTask publishes a task to the default queue | [
"SendTask",
"publishes",
"a",
"task",
"to",
"the",
"default",
"queue"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L191-L193 |
27,749 | RichardKnop/machinery | v1/server.go | SendChainWithContext | func (server *Server) SendChainWithContext(ctx context.Context, chain *tasks.Chain) (*result.ChainAsyncResult, error) {
span, _ := opentracing.StartSpanFromContext(ctx, "SendChain", tracing.ProducerOption(), tracing.MachineryTag, tracing.WorkflowChainTag)
defer span.Finish()
tracing.AnnotateSpanWithChainInfo(span, ... | go | func (server *Server) SendChainWithContext(ctx context.Context, chain *tasks.Chain) (*result.ChainAsyncResult, error) {
span, _ := opentracing.StartSpanFromContext(ctx, "SendChain", tracing.ProducerOption(), tracing.MachineryTag, tracing.WorkflowChainTag)
defer span.Finish()
tracing.AnnotateSpanWithChainInfo(span, ... | [
"func",
"(",
"server",
"*",
"Server",
")",
"SendChainWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"chain",
"*",
"tasks",
".",
"Chain",
")",
"(",
"*",
"result",
".",
"ChainAsyncResult",
",",
"error",
")",
"{",
"span",
",",
"_",
":=",
"opent... | // SendChainWithContext will inject the trace context in all the signature headers before publishing it | [
"SendChainWithContext",
"will",
"inject",
"the",
"trace",
"context",
"in",
"all",
"the",
"signature",
"headers",
"before",
"publishing",
"it"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L196-L203 |
27,750 | RichardKnop/machinery | v1/server.go | SendChain | func (server *Server) SendChain(chain *tasks.Chain) (*result.ChainAsyncResult, error) {
_, err := server.SendTask(chain.Tasks[0])
if err != nil {
return nil, err
}
return result.NewChainAsyncResult(chain.Tasks, server.backend), nil
} | go | func (server *Server) SendChain(chain *tasks.Chain) (*result.ChainAsyncResult, error) {
_, err := server.SendTask(chain.Tasks[0])
if err != nil {
return nil, err
}
return result.NewChainAsyncResult(chain.Tasks, server.backend), nil
} | [
"func",
"(",
"server",
"*",
"Server",
")",
"SendChain",
"(",
"chain",
"*",
"tasks",
".",
"Chain",
")",
"(",
"*",
"result",
".",
"ChainAsyncResult",
",",
"error",
")",
"{",
"_",
",",
"err",
":=",
"server",
".",
"SendTask",
"(",
"chain",
".",
"Tasks",
... | // SendChain triggers a chain of tasks | [
"SendChain",
"triggers",
"a",
"chain",
"of",
"tasks"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L206-L213 |
27,751 | RichardKnop/machinery | v1/server.go | SendGroupWithContext | func (server *Server) SendGroupWithContext(ctx context.Context, group *tasks.Group, sendConcurrency int) ([]*result.AsyncResult, error) {
span, _ := opentracing.StartSpanFromContext(ctx, "SendGroup", tracing.ProducerOption(), tracing.MachineryTag, tracing.WorkflowGroupTag)
defer span.Finish()
tracing.AnnotateSpanWi... | go | func (server *Server) SendGroupWithContext(ctx context.Context, group *tasks.Group, sendConcurrency int) ([]*result.AsyncResult, error) {
span, _ := opentracing.StartSpanFromContext(ctx, "SendGroup", tracing.ProducerOption(), tracing.MachineryTag, tracing.WorkflowGroupTag)
defer span.Finish()
tracing.AnnotateSpanWi... | [
"func",
"(",
"server",
"*",
"Server",
")",
"SendGroupWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"group",
"*",
"tasks",
".",
"Group",
",",
"sendConcurrency",
"int",
")",
"(",
"[",
"]",
"*",
"result",
".",
"AsyncResult",
",",
"error",
")",
... | // SendGroupWithContext will inject the trace context in all the signature headers before publishing it | [
"SendGroupWithContext",
"will",
"inject",
"the",
"trace",
"context",
"in",
"all",
"the",
"signature",
"headers",
"before",
"publishing",
"it"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L216-L289 |
27,752 | RichardKnop/machinery | v1/server.go | SendGroup | func (server *Server) SendGroup(group *tasks.Group, sendConcurrency int) ([]*result.AsyncResult, error) {
return server.SendGroupWithContext(context.Background(), group, sendConcurrency)
} | go | func (server *Server) SendGroup(group *tasks.Group, sendConcurrency int) ([]*result.AsyncResult, error) {
return server.SendGroupWithContext(context.Background(), group, sendConcurrency)
} | [
"func",
"(",
"server",
"*",
"Server",
")",
"SendGroup",
"(",
"group",
"*",
"tasks",
".",
"Group",
",",
"sendConcurrency",
"int",
")",
"(",
"[",
"]",
"*",
"result",
".",
"AsyncResult",
",",
"error",
")",
"{",
"return",
"server",
".",
"SendGroupWithContext... | // SendGroup triggers a group of parallel tasks | [
"SendGroup",
"triggers",
"a",
"group",
"of",
"parallel",
"tasks"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L292-L294 |
27,753 | RichardKnop/machinery | v1/server.go | SendChordWithContext | func (server *Server) SendChordWithContext(ctx context.Context, chord *tasks.Chord, sendConcurrency int) (*result.ChordAsyncResult, error) {
span, _ := opentracing.StartSpanFromContext(ctx, "SendChord", tracing.ProducerOption(), tracing.MachineryTag, tracing.WorkflowChordTag)
defer span.Finish()
tracing.AnnotateSpa... | go | func (server *Server) SendChordWithContext(ctx context.Context, chord *tasks.Chord, sendConcurrency int) (*result.ChordAsyncResult, error) {
span, _ := opentracing.StartSpanFromContext(ctx, "SendChord", tracing.ProducerOption(), tracing.MachineryTag, tracing.WorkflowChordTag)
defer span.Finish()
tracing.AnnotateSpa... | [
"func",
"(",
"server",
"*",
"Server",
")",
"SendChordWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"chord",
"*",
"tasks",
".",
"Chord",
",",
"sendConcurrency",
"int",
")",
"(",
"*",
"result",
".",
"ChordAsyncResult",
",",
"error",
")",
"{",
"... | // SendChordWithContext will inject the trace context in all the signature headers before publishing it | [
"SendChordWithContext",
"will",
"inject",
"the",
"trace",
"context",
"in",
"all",
"the",
"signature",
"headers",
"before",
"publishing",
"it"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L297-L313 |
27,754 | RichardKnop/machinery | v1/server.go | SendChord | func (server *Server) SendChord(chord *tasks.Chord, sendConcurrency int) (*result.ChordAsyncResult, error) {
return server.SendChordWithContext(context.Background(), chord, sendConcurrency)
} | go | func (server *Server) SendChord(chord *tasks.Chord, sendConcurrency int) (*result.ChordAsyncResult, error) {
return server.SendChordWithContext(context.Background(), chord, sendConcurrency)
} | [
"func",
"(",
"server",
"*",
"Server",
")",
"SendChord",
"(",
"chord",
"*",
"tasks",
".",
"Chord",
",",
"sendConcurrency",
"int",
")",
"(",
"*",
"result",
".",
"ChordAsyncResult",
",",
"error",
")",
"{",
"return",
"server",
".",
"SendChordWithContext",
"(",... | // SendChord triggers a group of parallel tasks with a callback | [
"SendChord",
"triggers",
"a",
"group",
"of",
"parallel",
"tasks",
"with",
"a",
"callback"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L316-L318 |
27,755 | RichardKnop/machinery | v1/server.go | GetRegisteredTaskNames | func (server *Server) GetRegisteredTaskNames() []string {
taskNames := make([]string, len(server.registeredTasks))
var i = 0
for name := range server.registeredTasks {
taskNames[i] = name
i++
}
return taskNames
} | go | func (server *Server) GetRegisteredTaskNames() []string {
taskNames := make([]string, len(server.registeredTasks))
var i = 0
for name := range server.registeredTasks {
taskNames[i] = name
i++
}
return taskNames
} | [
"func",
"(",
"server",
"*",
"Server",
")",
"GetRegisteredTaskNames",
"(",
")",
"[",
"]",
"string",
"{",
"taskNames",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"server",
".",
"registeredTasks",
")",
")",
"\n",
"var",
"i",
"=",
"0",
"\n",... | // GetRegisteredTaskNames returns slice of registered task names | [
"GetRegisteredTaskNames",
"returns",
"slice",
"of",
"registered",
"task",
"names"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/server.go#L321-L329 |
27,756 | RichardKnop/machinery | v1/log/log.go | Set | func Set(l logging.LoggerInterface) {
DEBUG = l
INFO = l
WARNING = l
ERROR = l
FATAL = l
} | go | func Set(l logging.LoggerInterface) {
DEBUG = l
INFO = l
WARNING = l
ERROR = l
FATAL = l
} | [
"func",
"Set",
"(",
"l",
"logging",
".",
"LoggerInterface",
")",
"{",
"DEBUG",
"=",
"l",
"\n",
"INFO",
"=",
"l",
"\n",
"WARNING",
"=",
"l",
"\n",
"ERROR",
"=",
"l",
"\n",
"FATAL",
"=",
"l",
"\n",
"}"
] | // Set sets a custom logger for all log levels | [
"Set",
"sets",
"a",
"custom",
"logger",
"for",
"all",
"log",
"levels"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/log/log.go#L23-L29 |
27,757 | RichardKnop/machinery | v1/brokers/redis/redis.go | GetPendingTasks | func (b *Broker) GetPendingTasks(queue string) ([]*tasks.Signature, error) {
conn := b.open()
defer conn.Close()
if queue == "" {
queue = b.GetConfig().DefaultQueue
}
dataBytes, err := conn.Do("LRANGE", queue, 0, -1)
if err != nil {
return nil, err
}
results, err := redis.ByteSlices(dataBytes, err)
if err... | go | func (b *Broker) GetPendingTasks(queue string) ([]*tasks.Signature, error) {
conn := b.open()
defer conn.Close()
if queue == "" {
queue = b.GetConfig().DefaultQueue
}
dataBytes, err := conn.Do("LRANGE", queue, 0, -1)
if err != nil {
return nil, err
}
results, err := redis.ByteSlices(dataBytes, err)
if err... | [
"func",
"(",
"b",
"*",
"Broker",
")",
"GetPendingTasks",
"(",
"queue",
"string",
")",
"(",
"[",
"]",
"*",
"tasks",
".",
"Signature",
",",
"error",
")",
"{",
"conn",
":=",
"b",
".",
"open",
"(",
")",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
... | // GetPendingTasks returns a slice of task signatures waiting in the queue | [
"GetPendingTasks",
"returns",
"a",
"slice",
"of",
"task",
"signatures",
"waiting",
"in",
"the",
"queue"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/redis/redis.go#L203-L230 |
27,758 | RichardKnop/machinery | v1/brokers/redis/redis.go | nextTask | func (b *Broker) nextTask(queue string) (result []byte, err error) {
conn := b.open()
defer conn.Close()
items, err := redis.ByteSlices(conn.Do("BLPOP", queue, 1000))
if err != nil {
return []byte{}, err
}
// items[0] - the name of the key where an element was popped
// items[1] - the value of the popped ele... | go | func (b *Broker) nextTask(queue string) (result []byte, err error) {
conn := b.open()
defer conn.Close()
items, err := redis.ByteSlices(conn.Do("BLPOP", queue, 1000))
if err != nil {
return []byte{}, err
}
// items[0] - the name of the key where an element was popped
// items[1] - the value of the popped ele... | [
"func",
"(",
"b",
"*",
"Broker",
")",
"nextTask",
"(",
"queue",
"string",
")",
"(",
"result",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"conn",
":=",
"b",
".",
"open",
"(",
")",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n\n",
"ite... | // nextTask pops next available task from the default queue | [
"nextTask",
"pops",
"next",
"available",
"task",
"from",
"the",
"default",
"queue"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/redis/redis.go#L284-L302 |
27,759 | RichardKnop/machinery | v1/brokers/redis/redis.go | open | func (b *Broker) open() redis.Conn {
b.redisOnce.Do(func() {
b.pool = b.NewPool(b.socketPath, b.host, b.password, b.db, b.GetConfig().Redis, b.GetConfig().TLSConfig)
b.redsync = redsync.New([]redsync.Pool{b.pool})
})
return b.pool.Get()
} | go | func (b *Broker) open() redis.Conn {
b.redisOnce.Do(func() {
b.pool = b.NewPool(b.socketPath, b.host, b.password, b.db, b.GetConfig().Redis, b.GetConfig().TLSConfig)
b.redsync = redsync.New([]redsync.Pool{b.pool})
})
return b.pool.Get()
} | [
"func",
"(",
"b",
"*",
"Broker",
")",
"open",
"(",
")",
"redis",
".",
"Conn",
"{",
"b",
".",
"redisOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"b",
".",
"pool",
"=",
"b",
".",
"NewPool",
"(",
"b",
".",
"socketPath",
",",
"b",
".",
"host",
... | // open returns or creates instance of Redis connection | [
"open",
"returns",
"or",
"creates",
"instance",
"of",
"Redis",
"connection"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/redis/redis.go#L378-L385 |
27,760 | RichardKnop/machinery | v1/retry/fibonacci.go | Fibonacci | func Fibonacci() func() int {
a, b := 0, 1
return func() int {
a, b = b, a+b
return a
}
} | go | func Fibonacci() func() int {
a, b := 0, 1
return func() int {
a, b = b, a+b
return a
}
} | [
"func",
"Fibonacci",
"(",
")",
"func",
"(",
")",
"int",
"{",
"a",
",",
"b",
":=",
"0",
",",
"1",
"\n",
"return",
"func",
"(",
")",
"int",
"{",
"a",
",",
"b",
"=",
"b",
",",
"a",
"+",
"b",
"\n",
"return",
"a",
"\n",
"}",
"\n",
"}"
] | // Fibonacci returns successive Fibonacci numbers starting from 1 | [
"Fibonacci",
"returns",
"successive",
"Fibonacci",
"numbers",
"starting",
"from",
"1"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/retry/fibonacci.go#L4-L10 |
27,761 | RichardKnop/machinery | v1/retry/fibonacci.go | FibonacciNext | func FibonacciNext(start int) int {
fib := Fibonacci()
num := fib()
for num <= start {
num = fib()
}
return num
} | go | func FibonacciNext(start int) int {
fib := Fibonacci()
num := fib()
for num <= start {
num = fib()
}
return num
} | [
"func",
"FibonacciNext",
"(",
"start",
"int",
")",
"int",
"{",
"fib",
":=",
"Fibonacci",
"(",
")",
"\n",
"num",
":=",
"fib",
"(",
")",
"\n",
"for",
"num",
"<=",
"start",
"{",
"num",
"=",
"fib",
"(",
")",
"\n",
"}",
"\n",
"return",
"num",
"\n",
... | // FibonacciNext returns next number in Fibonacci sequence greater than start | [
"FibonacciNext",
"returns",
"next",
"number",
"in",
"Fibonacci",
"sequence",
"greater",
"than",
"start"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/retry/fibonacci.go#L13-L20 |
27,762 | RichardKnop/machinery | v1/backends/mongo/mongodb.go | decodeResults | func (b *Backend) decodeResults(results []*tasks.TaskResult) []*tasks.TaskResult {
l := len(results)
jsonResults := make([]*tasks.TaskResult, l, l)
for i, result := range results {
jsonResult := new(bson.M)
resultType := reflect.TypeOf(result.Value).Kind()
if resultType == reflect.String {
err := json.NewDe... | go | func (b *Backend) decodeResults(results []*tasks.TaskResult) []*tasks.TaskResult {
l := len(results)
jsonResults := make([]*tasks.TaskResult, l, l)
for i, result := range results {
jsonResult := new(bson.M)
resultType := reflect.TypeOf(result.Value).Kind()
if resultType == reflect.String {
err := json.NewDe... | [
"func",
"(",
"b",
"*",
"Backend",
")",
"decodeResults",
"(",
"results",
"[",
"]",
"*",
"tasks",
".",
"TaskResult",
")",
"[",
"]",
"*",
"tasks",
".",
"TaskResult",
"{",
"l",
":=",
"len",
"(",
"results",
")",
"\n",
"jsonResults",
":=",
"make",
"(",
"... | // decodeResults detects & decodes json strings in TaskResult.Value and returns a new slice | [
"decodeResults",
"detects",
"&",
"decodes",
"json",
"strings",
"in",
"TaskResult",
".",
"Value",
"and",
"returns",
"a",
"new",
"slice"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/mongo/mongodb.go#L148-L167 |
27,763 | RichardKnop/machinery | v1/backends/mongo/mongodb.go | lockGroupMeta | func (b *Backend) lockGroupMeta(groupUUID string) error {
query := bson.M{
"_id": groupUUID,
"lock": false,
}
change := bson.M{
"$set": bson.M{
"lock": true,
},
}
_, err := b.groupMetasCollection.UpdateOne(context.Background(), query, change, options.Update().SetUpsert(true))
return err
} | go | func (b *Backend) lockGroupMeta(groupUUID string) error {
query := bson.M{
"_id": groupUUID,
"lock": false,
}
change := bson.M{
"$set": bson.M{
"lock": true,
},
}
_, err := b.groupMetasCollection.UpdateOne(context.Background(), query, change, options.Update().SetUpsert(true))
return err
} | [
"func",
"(",
"b",
"*",
"Backend",
")",
"lockGroupMeta",
"(",
"groupUUID",
"string",
")",
"error",
"{",
"query",
":=",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"groupUUID",
",",
"\"",
"\"",
":",
"false",
",",
"}",
"\n",
"change",
":=",
"bson",
".",
... | // lockGroupMeta acquires lock on groupUUID document | [
"lockGroupMeta",
"acquires",
"lock",
"on",
"groupUUID",
"document"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/mongo/mongodb.go#L199-L213 |
27,764 | RichardKnop/machinery | v1/backends/mongo/mongodb.go | unlockGroupMeta | func (b *Backend) unlockGroupMeta(groupUUID string) error {
update := bson.M{"$set": bson.M{"lock": false}}
_, err := b.groupMetasCollection.UpdateOne(context.Background(), bson.M{"_id": groupUUID}, update, options.Update())
return err
} | go | func (b *Backend) unlockGroupMeta(groupUUID string) error {
update := bson.M{"$set": bson.M{"lock": false}}
_, err := b.groupMetasCollection.UpdateOne(context.Background(), bson.M{"_id": groupUUID}, update, options.Update())
return err
} | [
"func",
"(",
"b",
"*",
"Backend",
")",
"unlockGroupMeta",
"(",
"groupUUID",
"string",
")",
"error",
"{",
"update",
":=",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"false",
"}",
"}",
"\n",
"_",
",",
"err",
"... | // unlockGroupMeta releases lock on groupUUID document | [
"unlockGroupMeta",
"releases",
"lock",
"on",
"groupUUID",
"document"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/mongo/mongodb.go#L216-L220 |
27,765 | RichardKnop/machinery | v1/backends/mongo/mongodb.go | connect | func (b *Backend) connect() error {
client, err := b.dial()
if err != nil {
return err
}
b.client = client
database := "machinery"
if b.GetConfig().MongoDB != nil {
database = b.GetConfig().MongoDB.Database
}
b.tasksCollection = b.client.Database(database).Collection("tasks")
b.groupMetasCollection = b.... | go | func (b *Backend) connect() error {
client, err := b.dial()
if err != nil {
return err
}
b.client = client
database := "machinery"
if b.GetConfig().MongoDB != nil {
database = b.GetConfig().MongoDB.Database
}
b.tasksCollection = b.client.Database(database).Collection("tasks")
b.groupMetasCollection = b.... | [
"func",
"(",
"b",
"*",
"Backend",
")",
"connect",
"(",
")",
"error",
"{",
"client",
",",
"err",
":=",
"b",
".",
"dial",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"b",
".",
"client",
"=",
"client",
"\n\n",
... | // connect creates the underlying mgo connection if it doesn't exist
// creates required indexes for our collections | [
"connect",
"creates",
"the",
"underlying",
"mgo",
"connection",
"if",
"it",
"doesn",
"t",
"exist",
"creates",
"required",
"indexes",
"for",
"our",
"collections"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/mongo/mongodb.go#L265-L286 |
27,766 | RichardKnop/machinery | v1/backends/mongo/mongodb.go | dial | func (b *Backend) dial() (*mongo.Client, error) {
if b.GetConfig().MongoDB != nil && b.GetConfig().MongoDB.Client != nil {
return b.GetConfig().MongoDB.Client, nil
}
uri := b.GetConfig().ResultBackend
if strings.HasPrefix(uri, "mongodb://") == false &&
strings.HasPrefix(uri, "mongodb+srv://") == false {
uri... | go | func (b *Backend) dial() (*mongo.Client, error) {
if b.GetConfig().MongoDB != nil && b.GetConfig().MongoDB.Client != nil {
return b.GetConfig().MongoDB.Client, nil
}
uri := b.GetConfig().ResultBackend
if strings.HasPrefix(uri, "mongodb://") == false &&
strings.HasPrefix(uri, "mongodb+srv://") == false {
uri... | [
"func",
"(",
"b",
"*",
"Backend",
")",
"dial",
"(",
")",
"(",
"*",
"mongo",
".",
"Client",
",",
"error",
")",
"{",
"if",
"b",
".",
"GetConfig",
"(",
")",
".",
"MongoDB",
"!=",
"nil",
"&&",
"b",
".",
"GetConfig",
"(",
")",
".",
"MongoDB",
".",
... | // dial connects to mongo with TLSConfig if provided
// else connects via ResultBackend uri | [
"dial",
"connects",
"to",
"mongo",
"with",
"TLSConfig",
"if",
"provided",
"else",
"connects",
"via",
"ResultBackend",
"uri"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/mongo/mongodb.go#L290-L315 |
27,767 | RichardKnop/machinery | v1/backends/mongo/mongodb.go | createMongoIndexes | func (b *Backend) createMongoIndexes(database string) error {
tasksCollection := b.client.Database(database).Collection("tasks")
expireIn := int32(b.GetConfig().ResultsExpireIn)
_, err := tasksCollection.Indexes().CreateMany(context.Background(), []mongo.IndexModel{
{
Keys: bson.M{"state": 1},
Options:... | go | func (b *Backend) createMongoIndexes(database string) error {
tasksCollection := b.client.Database(database).Collection("tasks")
expireIn := int32(b.GetConfig().ResultsExpireIn)
_, err := tasksCollection.Indexes().CreateMany(context.Background(), []mongo.IndexModel{
{
Keys: bson.M{"state": 1},
Options:... | [
"func",
"(",
"b",
"*",
"Backend",
")",
"createMongoIndexes",
"(",
"database",
"string",
")",
"error",
"{",
"tasksCollection",
":=",
"b",
".",
"client",
".",
"Database",
"(",
"database",
")",
".",
"Collection",
"(",
"\"",
"\"",
")",
"\n\n",
"expireIn",
":... | // createMongoIndexes ensures all indexes are in place | [
"createMongoIndexes",
"ensures",
"all",
"indexes",
"are",
"in",
"place"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/mongo/mongodb.go#L318-L339 |
27,768 | RichardKnop/machinery | v1/brokers/errs/errors.go | NewErrCouldNotUnmarshaTaskSignature | func NewErrCouldNotUnmarshaTaskSignature(msg []byte, err error) ErrCouldNotUnmarshaTaskSignature {
return ErrCouldNotUnmarshaTaskSignature{msg: msg, reason: err.Error()}
} | go | func NewErrCouldNotUnmarshaTaskSignature(msg []byte, err error) ErrCouldNotUnmarshaTaskSignature {
return ErrCouldNotUnmarshaTaskSignature{msg: msg, reason: err.Error()}
} | [
"func",
"NewErrCouldNotUnmarshaTaskSignature",
"(",
"msg",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"ErrCouldNotUnmarshaTaskSignature",
"{",
"return",
"ErrCouldNotUnmarshaTaskSignature",
"{",
"msg",
":",
"msg",
",",
"reason",
":",
"err",
".",
"Error",
"(",
")",... | // NewErrCouldNotUnmarshaTaskSignature returns new ErrCouldNotUnmarshaTaskSignature instance | [
"NewErrCouldNotUnmarshaTaskSignature",
"returns",
"new",
"ErrCouldNotUnmarshaTaskSignature",
"instance"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/errs/errors.go#L19-L21 |
27,769 | RichardKnop/machinery | v1/tasks/errors.go | NewErrRetryTaskLater | func NewErrRetryTaskLater(msg string, retryIn time.Duration) ErrRetryTaskLater {
return ErrRetryTaskLater{msg: msg, retryIn: retryIn}
} | go | func NewErrRetryTaskLater(msg string, retryIn time.Duration) ErrRetryTaskLater {
return ErrRetryTaskLater{msg: msg, retryIn: retryIn}
} | [
"func",
"NewErrRetryTaskLater",
"(",
"msg",
"string",
",",
"retryIn",
"time",
".",
"Duration",
")",
"ErrRetryTaskLater",
"{",
"return",
"ErrRetryTaskLater",
"{",
"msg",
":",
"msg",
",",
"retryIn",
":",
"retryIn",
"}",
"\n",
"}"
] | // NewErrRetryTaskLater returns new ErrRetryTaskLater instance | [
"NewErrRetryTaskLater",
"returns",
"new",
"ErrRetryTaskLater",
"instance"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/tasks/errors.go#L25-L27 |
27,770 | RichardKnop/machinery | v1/backends/redis/redis.go | setExpirationTime | func (b *Backend) setExpirationTime(key string) error {
expiresIn := b.GetConfig().ResultsExpireIn
if expiresIn == 0 {
// // expire results after 1 hour by default
expiresIn = config.DefaultResultsExpireIn
}
expirationTimestamp := int32(time.Now().Unix() + int64(expiresIn))
conn := b.open()
defer conn.Close(... | go | func (b *Backend) setExpirationTime(key string) error {
expiresIn := b.GetConfig().ResultsExpireIn
if expiresIn == 0 {
// // expire results after 1 hour by default
expiresIn = config.DefaultResultsExpireIn
}
expirationTimestamp := int32(time.Now().Unix() + int64(expiresIn))
conn := b.open()
defer conn.Close(... | [
"func",
"(",
"b",
"*",
"Backend",
")",
"setExpirationTime",
"(",
"key",
"string",
")",
"error",
"{",
"expiresIn",
":=",
"b",
".",
"GetConfig",
"(",
")",
".",
"ResultsExpireIn",
"\n",
"if",
"expiresIn",
"==",
"0",
"{",
"// // expire results after 1 hour by defa... | // setExpirationTime sets expiration timestamp on a stored task state | [
"setExpirationTime",
"sets",
"expiration",
"timestamp",
"on",
"a",
"stored",
"task",
"state"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/backends/redis/redis.go#L312-L329 |
27,771 | RichardKnop/machinery | v1/brokers/amqp/amqp.go | GetOrOpenConnection | func (b *Broker) GetOrOpenConnection(queueName string, queueBindingKey string, exchangeDeclareArgs, queueDeclareArgs, queueBindingArgs amqp.Table) (*AMQPConnection, error) {
var err error
b.connectionsMutex.Lock()
defer b.connectionsMutex.Unlock()
conn, ok := b.connections[queueName]
if !ok {
conn = &AMQPConne... | go | func (b *Broker) GetOrOpenConnection(queueName string, queueBindingKey string, exchangeDeclareArgs, queueDeclareArgs, queueBindingArgs amqp.Table) (*AMQPConnection, error) {
var err error
b.connectionsMutex.Lock()
defer b.connectionsMutex.Unlock()
conn, ok := b.connections[queueName]
if !ok {
conn = &AMQPConne... | [
"func",
"(",
"b",
"*",
"Broker",
")",
"GetOrOpenConnection",
"(",
"queueName",
"string",
",",
"queueBindingKey",
"string",
",",
"exchangeDeclareArgs",
",",
"queueDeclareArgs",
",",
"queueBindingArgs",
"amqp",
".",
"Table",
")",
"(",
"*",
"AMQPConnection",
",",
"... | // GetOrOpenConnection will return a connection on a particular queue name. Open connections
// are saved to avoid having to reopen connection for multiple queues | [
"GetOrOpenConnection",
"will",
"return",
"a",
"connection",
"on",
"a",
"particular",
"queue",
"name",
".",
"Open",
"connections",
"are",
"saved",
"to",
"avoid",
"having",
"to",
"reopen",
"connection",
"for",
"multiple",
"queues"
] | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/amqp/amqp.go#L117-L163 |
27,772 | RichardKnop/machinery | v1/brokers/amqp/amqp.go | delay | func (b *Broker) delay(signature *tasks.Signature, delayMs int64) error {
if delayMs <= 0 {
return errors.New("Cannot delay task by 0ms")
}
message, err := json.Marshal(signature)
if err != nil {
return fmt.Errorf("JSON marshal error: %s", err)
}
// It's necessary to redeclare the queue each time (to zero i... | go | func (b *Broker) delay(signature *tasks.Signature, delayMs int64) error {
if delayMs <= 0 {
return errors.New("Cannot delay task by 0ms")
}
message, err := json.Marshal(signature)
if err != nil {
return fmt.Errorf("JSON marshal error: %s", err)
}
// It's necessary to redeclare the queue each time (to zero i... | [
"func",
"(",
"b",
"*",
"Broker",
")",
"delay",
"(",
"signature",
"*",
"tasks",
".",
"Signature",
",",
"delayMs",
"int64",
")",
"error",
"{",
"if",
"delayMs",
"<=",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
... | // delay a task by delayDuration miliseconds, the way it works is a new queue
// is created without any consumers, the message is then published to this queue
// with appropriate ttl expiration headers, after the expiration, it is sent to
// the proper queue with consumers | [
"delay",
"a",
"task",
"by",
"delayDuration",
"miliseconds",
"the",
"way",
"it",
"works",
"is",
"a",
"new",
"queue",
"is",
"created",
"without",
"any",
"consumers",
"the",
"message",
"is",
"then",
"published",
"to",
"this",
"queue",
"with",
"appropriate",
"tt... | 07418869e268a380aea5b9aefbb0b9f5bb715a12 | https://github.com/RichardKnop/machinery/blob/07418869e268a380aea5b9aefbb0b9f5bb715a12/v1/brokers/amqp/amqp.go#L327-L390 |
27,773 | cri-o/cri-o | server/version.go | Version | func (s *Server) Version(ctx context.Context, req *pb.VersionRequest) (resp *pb.VersionResponse, err error) {
const operation = "version"
defer func() {
recordOperation(operation, time.Now())
recordError(operation, err)
}()
return &pb.VersionResponse{
Version: kubeAPIVersion,
RuntimeName: c... | go | func (s *Server) Version(ctx context.Context, req *pb.VersionRequest) (resp *pb.VersionResponse, err error) {
const operation = "version"
defer func() {
recordOperation(operation, time.Now())
recordError(operation, err)
}()
return &pb.VersionResponse{
Version: kubeAPIVersion,
RuntimeName: c... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Version",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"pb",
".",
"VersionRequest",
")",
"(",
"resp",
"*",
"pb",
".",
"VersionResponse",
",",
"err",
"error",
")",
"{",
"const",
"operation",
"=",
"\"",... | // Version returns the runtime name, runtime version and runtime API version | [
"Version",
"returns",
"the",
"runtime",
"name",
"runtime",
"version",
"and",
"runtime",
"API",
"version"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/version.go#L22-L35 |
27,774 | cri-o/cri-o | lib/sandbox/sandbox.go | NetNsGet | func (s *Sandbox) NetNsGet(nspath, name string) (*NetNs, error) {
if err := ns.IsNSorErr(nspath); err != nil {
return nil, ErrClosedNetNS
}
symlink, symlinkErr := isSymbolicLink(nspath)
if symlinkErr != nil {
return nil, symlinkErr
}
var resolvedNsPath string
if symlink {
path, err := os.Readlink(nspath)... | go | func (s *Sandbox) NetNsGet(nspath, name string) (*NetNs, error) {
if err := ns.IsNSorErr(nspath); err != nil {
return nil, ErrClosedNetNS
}
symlink, symlinkErr := isSymbolicLink(nspath)
if symlinkErr != nil {
return nil, symlinkErr
}
var resolvedNsPath string
if symlink {
path, err := os.Readlink(nspath)... | [
"func",
"(",
"s",
"*",
"Sandbox",
")",
"NetNsGet",
"(",
"nspath",
",",
"name",
"string",
")",
"(",
"*",
"NetNs",
",",
"error",
")",
"{",
"if",
"err",
":=",
"ns",
".",
"IsNSorErr",
"(",
"nspath",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",... | // NetNsGet returns the NetNs associated with the given nspath and name | [
"NetNsGet",
"returns",
"the",
"NetNs",
"associated",
"with",
"the",
"given",
"nspath",
"and",
"name"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox.go#L28-L66 |
27,775 | cri-o/cri-o | lib/sandbox/sandbox.go | New | func New(id, namespace, name, kubeName, logDir string, labels, annotations map[string]string, processLabel, mountLabel string, metadata *pb.PodSandboxMetadata, shmPath, cgroupParent string, privileged bool, runtimeHandler string, resolvPath, hostname string, portMappings []*hostport.PortMapping, hostNetwork bool) (*San... | go | func New(id, namespace, name, kubeName, logDir string, labels, annotations map[string]string, processLabel, mountLabel string, metadata *pb.PodSandboxMetadata, shmPath, cgroupParent string, privileged bool, runtimeHandler string, resolvPath, hostname string, portMappings []*hostport.PortMapping, hostNetwork bool) (*San... | [
"func",
"New",
"(",
"id",
",",
"namespace",
",",
"name",
",",
"kubeName",
",",
"logDir",
"string",
",",
"labels",
",",
"annotations",
"map",
"[",
"string",
"]",
"string",
",",
"processLabel",
",",
"mountLabel",
"string",
",",
"metadata",
"*",
"pb",
".",
... | // New creates and populates a new pod sandbox
// New sandboxes have no containers, no infra container, and no network namespaces associated with them
// An infra container must be attached before the sandbox is added to the state | [
"New",
"creates",
"and",
"populates",
"a",
"new",
"pod",
"sandbox",
"New",
"sandboxes",
"have",
"no",
"containers",
"no",
"infra",
"container",
"and",
"no",
"network",
"namespaces",
"associated",
"with",
"them",
"An",
"infra",
"container",
"must",
"be",
"attac... | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox.go#L152-L176 |
27,776 | cri-o/cri-o | lib/sandbox/sandbox.go | AddContainer | func (s *Sandbox) AddContainer(c *oci.Container) {
s.containers.Add(c.Name(), c)
} | go | func (s *Sandbox) AddContainer(c *oci.Container) {
s.containers.Add(c.Name(), c)
} | [
"func",
"(",
"s",
"*",
"Sandbox",
")",
"AddContainer",
"(",
"c",
"*",
"oci",
".",
"Container",
")",
"{",
"s",
".",
"containers",
".",
"Add",
"(",
"c",
".",
"Name",
"(",
")",
",",
"c",
")",
"\n",
"}"
] | // AddContainer adds a container to the sandbox | [
"AddContainer",
"adds",
"a",
"container",
"to",
"the",
"sandbox"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox.go#L328-L330 |
27,777 | cri-o/cri-o | lib/sandbox/sandbox.go | GetContainer | func (s *Sandbox) GetContainer(name string) *oci.Container {
return s.containers.Get(name)
} | go | func (s *Sandbox) GetContainer(name string) *oci.Container {
return s.containers.Get(name)
} | [
"func",
"(",
"s",
"*",
"Sandbox",
")",
"GetContainer",
"(",
"name",
"string",
")",
"*",
"oci",
".",
"Container",
"{",
"return",
"s",
".",
"containers",
".",
"Get",
"(",
"name",
")",
"\n",
"}"
] | // GetContainer retrieves a container from the sandbox | [
"GetContainer",
"retrieves",
"a",
"container",
"from",
"the",
"sandbox"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox.go#L333-L335 |
27,778 | cri-o/cri-o | lib/sandbox/sandbox.go | RemoveContainer | func (s *Sandbox) RemoveContainer(c *oci.Container) {
s.containers.Delete(c.Name())
} | go | func (s *Sandbox) RemoveContainer(c *oci.Container) {
s.containers.Delete(c.Name())
} | [
"func",
"(",
"s",
"*",
"Sandbox",
")",
"RemoveContainer",
"(",
"c",
"*",
"oci",
".",
"Container",
")",
"{",
"s",
".",
"containers",
".",
"Delete",
"(",
"c",
".",
"Name",
"(",
")",
")",
"\n",
"}"
] | // RemoveContainer deletes a container from the sandbox | [
"RemoveContainer",
"deletes",
"a",
"container",
"from",
"the",
"sandbox"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox.go#L338-L340 |
27,779 | cri-o/cri-o | lib/sandbox/sandbox.go | SetInfraContainer | func (s *Sandbox) SetInfraContainer(infraCtr *oci.Container) error {
if s.infraContainer != nil {
return fmt.Errorf("sandbox already has an infra container")
} else if infraCtr == nil {
return fmt.Errorf("must provide non-nil infra container")
}
s.infraContainer = infraCtr
return nil
} | go | func (s *Sandbox) SetInfraContainer(infraCtr *oci.Container) error {
if s.infraContainer != nil {
return fmt.Errorf("sandbox already has an infra container")
} else if infraCtr == nil {
return fmt.Errorf("must provide non-nil infra container")
}
s.infraContainer = infraCtr
return nil
} | [
"func",
"(",
"s",
"*",
"Sandbox",
")",
"SetInfraContainer",
"(",
"infraCtr",
"*",
"oci",
".",
"Container",
")",
"error",
"{",
"if",
"s",
".",
"infraContainer",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",... | // SetInfraContainer sets the infrastructure container of a sandbox
// Attempts to set the infrastructure container after one is already present will throw an error | [
"SetInfraContainer",
"sets",
"the",
"infrastructure",
"container",
"of",
"a",
"sandbox",
"Attempts",
"to",
"set",
"the",
"infrastructure",
"container",
"after",
"one",
"is",
"already",
"present",
"will",
"throw",
"an",
"error"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox.go#L344-L354 |
27,780 | cri-o/cri-o | lib/sandbox/sandbox.go | NetNs | func (s *Sandbox) NetNs() *NetNs {
if s.netns == nil {
return nil
}
return s.netns.Get()
} | go | func (s *Sandbox) NetNs() *NetNs {
if s.netns == nil {
return nil
}
return s.netns.Get()
} | [
"func",
"(",
"s",
"*",
"Sandbox",
")",
"NetNs",
"(",
")",
"*",
"NetNs",
"{",
"if",
"s",
".",
"netns",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"s",
".",
"netns",
".",
"Get",
"(",
")",
"\n",
"}"
] | // NetNs retrieves the network namespace of the sandbox
// If the sandbox uses the host namespace, nil is returned | [
"NetNs",
"retrieves",
"the",
"network",
"namespace",
"of",
"the",
"sandbox",
"If",
"the",
"sandbox",
"uses",
"the",
"host",
"namespace",
"nil",
"is",
"returned"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox.go#L363-L368 |
27,781 | cri-o/cri-o | lib/sandbox/sandbox.go | NetNsPath | func (s *Sandbox) NetNsPath() string {
if s.netns == nil || s.netns.Get() == nil ||
s.netns.Get().symlink == nil {
if s.infraContainer != nil {
return fmt.Sprintf("/proc/%v/ns/net", s.infraContainer.State().Pid)
}
return ""
}
return s.netns.Get().symlink.Name()
} | go | func (s *Sandbox) NetNsPath() string {
if s.netns == nil || s.netns.Get() == nil ||
s.netns.Get().symlink == nil {
if s.infraContainer != nil {
return fmt.Sprintf("/proc/%v/ns/net", s.infraContainer.State().Pid)
}
return ""
}
return s.netns.Get().symlink.Name()
} | [
"func",
"(",
"s",
"*",
"Sandbox",
")",
"NetNsPath",
"(",
")",
"string",
"{",
"if",
"s",
".",
"netns",
"==",
"nil",
"||",
"s",
".",
"netns",
".",
"Get",
"(",
")",
"==",
"nil",
"||",
"s",
".",
"netns",
".",
"Get",
"(",
")",
".",
"symlink",
"=="... | // NetNsPath returns the path to the network namespace of the sandbox.
// If the sandbox uses the host namespace, nil is returned | [
"NetNsPath",
"returns",
"the",
"path",
"to",
"the",
"network",
"namespace",
"of",
"the",
"sandbox",
".",
"If",
"the",
"sandbox",
"uses",
"the",
"host",
"namespace",
"nil",
"is",
"returned"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox.go#L372-L382 |
27,782 | cri-o/cri-o | lib/sandbox/sandbox.go | UserNsPath | func (s *Sandbox) UserNsPath() string {
if s.infraContainer != nil {
return fmt.Sprintf("/proc/%v/ns/user", s.infraContainer.State().Pid)
}
return ""
} | go | func (s *Sandbox) UserNsPath() string {
if s.infraContainer != nil {
return fmt.Sprintf("/proc/%v/ns/user", s.infraContainer.State().Pid)
}
return ""
} | [
"func",
"(",
"s",
"*",
"Sandbox",
")",
"UserNsPath",
"(",
")",
"string",
"{",
"if",
"s",
".",
"infraContainer",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"infraContainer",
".",
"State",
"(",
")",
".",
"Pid",... | // UserNsPath returns the path to the user namespace of the sandbox.
// If the sandbox uses the host namespace, nil is returned | [
"UserNsPath",
"returns",
"the",
"path",
"to",
"the",
"user",
"namespace",
"of",
"the",
"sandbox",
".",
"If",
"the",
"sandbox",
"uses",
"the",
"host",
"namespace",
"nil",
"is",
"returned"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox.go#L386-L391 |
27,783 | cri-o/cri-o | lib/sandbox/sandbox.go | NetNsCreate | func (s *Sandbox) NetNsCreate(netNs NetNsIface) error {
// Create a new netNs if nil provided
if netNs == nil {
netNs = &NetNs{}
}
// Check if interface is already initialized
if netNs.Initialized() {
return fmt.Errorf("net NS already initialized")
}
netNs, err := netNs.Initialize()
if err != nil {
retu... | go | func (s *Sandbox) NetNsCreate(netNs NetNsIface) error {
// Create a new netNs if nil provided
if netNs == nil {
netNs = &NetNs{}
}
// Check if interface is already initialized
if netNs.Initialized() {
return fmt.Errorf("net NS already initialized")
}
netNs, err := netNs.Initialize()
if err != nil {
retu... | [
"func",
"(",
"s",
"*",
"Sandbox",
")",
"NetNsCreate",
"(",
"netNs",
"NetNsIface",
")",
"error",
"{",
"// Create a new netNs if nil provided",
"if",
"netNs",
"==",
"nil",
"{",
"netNs",
"=",
"&",
"NetNs",
"{",
"}",
"\n",
"}",
"\n\n",
"// Check if interface is al... | // NetNsCreate creates a new network namespace for the sandbox | [
"NetNsCreate",
"creates",
"a",
"new",
"network",
"namespace",
"for",
"the",
"sandbox"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox.go#L394-L422 |
27,784 | cri-o/cri-o | lib/sandbox/sandbox.go | NetNsJoin | func (s *Sandbox) NetNsJoin(nspath, name string) error {
if s.netns != nil {
return fmt.Errorf("sandbox already has a network namespace, cannot join another")
}
netNS, err := s.NetNsGet(nspath, name)
if err != nil {
return err
}
s.netns = netNS
return nil
} | go | func (s *Sandbox) NetNsJoin(nspath, name string) error {
if s.netns != nil {
return fmt.Errorf("sandbox already has a network namespace, cannot join another")
}
netNS, err := s.NetNsGet(nspath, name)
if err != nil {
return err
}
s.netns = netNS
return nil
} | [
"func",
"(",
"s",
"*",
"Sandbox",
")",
"NetNsJoin",
"(",
"nspath",
",",
"name",
"string",
")",
"error",
"{",
"if",
"s",
".",
"netns",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"netNS",
",",
"err",
... | // NetNsJoin attempts to join the sandbox to an existing network namespace
// This will fail if the sandbox is already part of a network namespace | [
"NetNsJoin",
"attempts",
"to",
"join",
"the",
"sandbox",
"to",
"an",
"existing",
"network",
"namespace",
"This",
"will",
"fail",
"if",
"the",
"sandbox",
"is",
"already",
"part",
"of",
"a",
"network",
"namespace"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox.go#L439-L452 |
27,785 | cri-o/cri-o | lib/sandbox/sandbox.go | NetNsRemove | func (s *Sandbox) NetNsRemove() error {
if s.netns == nil {
logrus.Warn("no networking namespace")
return nil
}
return s.netns.Remove()
} | go | func (s *Sandbox) NetNsRemove() error {
if s.netns == nil {
logrus.Warn("no networking namespace")
return nil
}
return s.netns.Remove()
} | [
"func",
"(",
"s",
"*",
"Sandbox",
")",
"NetNsRemove",
"(",
")",
"error",
"{",
"if",
"s",
".",
"netns",
"==",
"nil",
"{",
"logrus",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"netns",
".",
"R... | // NetNsRemove removes the network namespace associated with the sandbox | [
"NetNsRemove",
"removes",
"the",
"network",
"namespace",
"associated",
"with",
"the",
"sandbox"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox.go#L455-L462 |
27,786 | cri-o/cri-o | client/client.go | New | func New(crioSocketPath string) (CrioClient, error) {
tr := new(http.Transport)
configureUnixTransport(tr, "unix", crioSocketPath)
c := &http.Client{
Transport: tr,
}
return &crioClientImpl{
client: c,
crioSocketPath: crioSocketPath,
}, nil
} | go | func New(crioSocketPath string) (CrioClient, error) {
tr := new(http.Transport)
configureUnixTransport(tr, "unix", crioSocketPath)
c := &http.Client{
Transport: tr,
}
return &crioClientImpl{
client: c,
crioSocketPath: crioSocketPath,
}, nil
} | [
"func",
"New",
"(",
"crioSocketPath",
"string",
")",
"(",
"CrioClient",
",",
"error",
")",
"{",
"tr",
":=",
"new",
"(",
"http",
".",
"Transport",
")",
"\n",
"configureUnixTransport",
"(",
"tr",
",",
"\"",
"\"",
",",
"crioSocketPath",
")",
"\n",
"c",
":... | // New returns a crio client | [
"New",
"returns",
"a",
"crio",
"client"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/client/client.go#L43-L53 |
27,787 | cri-o/cri-o | client/client.go | DaemonInfo | func (c *crioClientImpl) DaemonInfo() (types.CrioInfo, error) {
info := types.CrioInfo{}
req, err := c.getRequest("/info")
if err != nil {
return info, err
}
resp, err := c.client.Do(req)
if err != nil {
return info, err
}
defer resp.Body.Close()
err = json.NewDecoder(resp.Body).Decode(&info)
return info,... | go | func (c *crioClientImpl) DaemonInfo() (types.CrioInfo, error) {
info := types.CrioInfo{}
req, err := c.getRequest("/info")
if err != nil {
return info, err
}
resp, err := c.client.Do(req)
if err != nil {
return info, err
}
defer resp.Body.Close()
err = json.NewDecoder(resp.Body).Decode(&info)
return info,... | [
"func",
"(",
"c",
"*",
"crioClientImpl",
")",
"DaemonInfo",
"(",
")",
"(",
"types",
".",
"CrioInfo",
",",
"error",
")",
"{",
"info",
":=",
"types",
".",
"CrioInfo",
"{",
"}",
"\n",
"req",
",",
"err",
":=",
"c",
".",
"getRequest",
"(",
"\"",
"\"",
... | // DaemonInfo return cri-o daemon info from the cri-o
// info endpoint. | [
"DaemonInfo",
"return",
"cri",
"-",
"o",
"daemon",
"info",
"from",
"the",
"cri",
"-",
"o",
"info",
"endpoint",
"."
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/client/client.go#L70-L83 |
27,788 | cri-o/cri-o | client/client.go | ContainerInfo | func (c *crioClientImpl) ContainerInfo(id string) (*types.ContainerInfo, error) {
req, err := c.getRequest("/containers/" + id)
if err != nil {
return nil, err
}
resp, err := c.client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
cInfo := types.ContainerInfo{}
if err := json.NewDecoder(... | go | func (c *crioClientImpl) ContainerInfo(id string) (*types.ContainerInfo, error) {
req, err := c.getRequest("/containers/" + id)
if err != nil {
return nil, err
}
resp, err := c.client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
cInfo := types.ContainerInfo{}
if err := json.NewDecoder(... | [
"func",
"(",
"c",
"*",
"crioClientImpl",
")",
"ContainerInfo",
"(",
"id",
"string",
")",
"(",
"*",
"types",
".",
"ContainerInfo",
",",
"error",
")",
"{",
"req",
",",
"err",
":=",
"c",
".",
"getRequest",
"(",
"\"",
"\"",
"+",
"id",
")",
"\n",
"if",
... | // ContainerInfo returns container info by querying
// the cri-o container endpoint. | [
"ContainerInfo",
"returns",
"container",
"info",
"by",
"querying",
"the",
"cri",
"-",
"o",
"container",
"endpoint",
"."
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/client/client.go#L87-L102 |
27,789 | cri-o/cri-o | utils/fifo/fifo.go | Write | func (f *fifo) Write(b []byte) (int, error) {
if f.flag&(syscall.O_WRONLY|syscall.O_RDWR) == 0 {
return 0, errors.New("writing to read-only fifo")
}
select {
case <-f.opened:
return f.file.Write(b)
default:
}
select {
case <-f.opened:
return f.file.Write(b)
case <-f.closed:
return 0, errors.New("writin... | go | func (f *fifo) Write(b []byte) (int, error) {
if f.flag&(syscall.O_WRONLY|syscall.O_RDWR) == 0 {
return 0, errors.New("writing to read-only fifo")
}
select {
case <-f.opened:
return f.file.Write(b)
default:
}
select {
case <-f.opened:
return f.file.Write(b)
case <-f.closed:
return 0, errors.New("writin... | [
"func",
"(",
"f",
"*",
"fifo",
")",
"Write",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"f",
".",
"flag",
"&",
"(",
"syscall",
".",
"O_WRONLY",
"|",
"syscall",
".",
"O_RDWR",
")",
"==",
"0",
"{",
"return",
"0",... | // Write from byte array to a fifo. | [
"Write",
"from",
"byte",
"array",
"to",
"a",
"fifo",
"."
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/fifo/fifo.go#L166-L181 |
27,790 | cri-o/cri-o | server/useragent/useragent.go | Get | func Get(ctx context.Context) string {
httpVersion := make([]VersionInfo, 0, 4)
httpVersion = append(httpVersion, VersionInfo{Name: "cri-o", Version: version.Version})
httpVersion = append(httpVersion, VersionInfo{Name: "go", Version: runtime.Version()})
httpVersion = append(httpVersion, VersionInfo{Name: "os", Ver... | go | func Get(ctx context.Context) string {
httpVersion := make([]VersionInfo, 0, 4)
httpVersion = append(httpVersion, VersionInfo{Name: "cri-o", Version: version.Version})
httpVersion = append(httpVersion, VersionInfo{Name: "go", Version: runtime.Version()})
httpVersion = append(httpVersion, VersionInfo{Name: "os", Ver... | [
"func",
"Get",
"(",
"ctx",
"context",
".",
"Context",
")",
"string",
"{",
"httpVersion",
":=",
"make",
"(",
"[",
"]",
"VersionInfo",
",",
"0",
",",
"4",
")",
"\n",
"httpVersion",
"=",
"append",
"(",
"httpVersion",
",",
"VersionInfo",
"{",
"Name",
":",
... | // Get is the User-Agent the CRI-O daemon uses to identify itself. | [
"Get",
"is",
"the",
"User",
"-",
"Agent",
"the",
"CRI",
"-",
"O",
"daemon",
"uses",
"to",
"identify",
"itself",
"."
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/useragent/useragent.go#L11-L19 |
27,791 | cri-o/cri-o | server/secrets.go | SaveTo | func (s SecretData) SaveTo(dir string) error {
path := filepath.Join(dir, s.Name)
if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil && !os.IsExist(err) {
return err
}
return ioutil.WriteFile(path, s.Data, 0700)
} | go | func (s SecretData) SaveTo(dir string) error {
path := filepath.Join(dir, s.Name)
if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil && !os.IsExist(err) {
return err
}
return ioutil.WriteFile(path, s.Data, 0700)
} | [
"func",
"(",
"s",
"SecretData",
")",
"SaveTo",
"(",
"dir",
"string",
")",
"error",
"{",
"path",
":=",
"filepath",
".",
"Join",
"(",
"dir",
",",
"s",
".",
"Name",
")",
"\n",
"if",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"filepath",
".",
"Dir",
"(... | // SaveTo saves secret data to given directory | [
"SaveTo",
"saves",
"secret",
"data",
"to",
"given",
"directory"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/secrets.go#L23-L29 |
27,792 | cri-o/cri-o | server/secrets.go | secretMounts | func secretMounts(defaultMountsPaths []string, mountLabel, containerWorkingDir string, runtimeMounts []rspec.Mount) ([]rspec.Mount, error) {
mounts := make([]rspec.Mount, 0, len(defaultMountsPaths))
for _, path := range defaultMountsPaths {
hostDir, ctrDir, err := getMountsMap(path)
if err != nil {
return nil,... | go | func secretMounts(defaultMountsPaths []string, mountLabel, containerWorkingDir string, runtimeMounts []rspec.Mount) ([]rspec.Mount, error) {
mounts := make([]rspec.Mount, 0, len(defaultMountsPaths))
for _, path := range defaultMountsPaths {
hostDir, ctrDir, err := getMountsMap(path)
if err != nil {
return nil,... | [
"func",
"secretMounts",
"(",
"defaultMountsPaths",
"[",
"]",
"string",
",",
"mountLabel",
",",
"containerWorkingDir",
"string",
",",
"runtimeMounts",
"[",
"]",
"rspec",
".",
"Mount",
")",
"(",
"[",
"]",
"rspec",
".",
"Mount",
",",
"error",
")",
"{",
"mount... | // secretMount copies the contents of host directory to container directory
// and returns a list of mounts | [
"secretMount",
"copies",
"the",
"contents",
"of",
"host",
"directory",
"to",
"container",
"directory",
"and",
"returns",
"a",
"list",
"of",
"mounts"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/secrets.go#L103-L157 |
27,793 | cri-o/cri-o | utils/io/logger.go | NewCRILogger | func NewCRILogger(path string, w io.Writer, stream StreamType, maxLen int) (io.WriteCloser, <-chan struct{}) {
logrus.Debugf("Start writing stream %q to log file %q", stream, path)
prc, pwc := io.Pipe()
stop := make(chan struct{})
go func() {
redirectLogs(path, prc, w, stream, maxLen)
close(stop)
}()
return p... | go | func NewCRILogger(path string, w io.Writer, stream StreamType, maxLen int) (io.WriteCloser, <-chan struct{}) {
logrus.Debugf("Start writing stream %q to log file %q", stream, path)
prc, pwc := io.Pipe()
stop := make(chan struct{})
go func() {
redirectLogs(path, prc, w, stream, maxLen)
close(stop)
}()
return p... | [
"func",
"NewCRILogger",
"(",
"path",
"string",
",",
"w",
"io",
".",
"Writer",
",",
"stream",
"StreamType",
",",
"maxLen",
"int",
")",
"(",
"io",
".",
"WriteCloser",
",",
"<-",
"chan",
"struct",
"{",
"}",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
... | // NewCRILogger returns a write closer which redirect container log into
// log file, and decorate the log line into CRI defined format. It also
// returns a channel which indicates whether the logger is stopped.
// maxLen is the max length limit of a line. A line longer than the
// limit will be cut into multiple line... | [
"NewCRILogger",
"returns",
"a",
"write",
"closer",
"which",
"redirect",
"container",
"log",
"into",
"log",
"file",
"and",
"decorate",
"the",
"log",
"line",
"into",
"CRI",
"defined",
"format",
".",
"It",
"also",
"returns",
"a",
"channel",
"which",
"indicates",
... | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/io/logger.go#L53-L62 |
27,794 | cri-o/cri-o | server/utils.go | inStringSlice | func inStringSlice(ss []string, str string) bool {
for _, s := range ss {
if strings.EqualFold(s, str) {
return true
}
}
return false
} | go | func inStringSlice(ss []string, str string) bool {
for _, s := range ss {
if strings.EqualFold(s, str) {
return true
}
}
return false
} | [
"func",
"inStringSlice",
"(",
"ss",
"[",
"]",
"string",
",",
"str",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"ss",
"{",
"if",
"strings",
".",
"EqualFold",
"(",
"s",
",",
"str",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
... | // inStringSlice checks whether a string is inside a string slice.
// Comparison is case insensitive. | [
"inStringSlice",
"checks",
"whether",
"a",
"string",
"is",
"inside",
"a",
"string",
"slice",
".",
"Comparison",
"is",
"case",
"insensitive",
"."
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/utils.go#L113-L120 |
27,795 | cri-o/cri-o | server/utils.go | getOCICapabilitiesList | func getOCICapabilitiesList() []string {
caps := make([]string, 0, len(capability.List()))
for _, cap := range capability.List() {
if cap > validate.LastCap() {
continue
}
caps = append(caps, "CAP_"+strings.ToUpper(cap.String()))
}
return caps
} | go | func getOCICapabilitiesList() []string {
caps := make([]string, 0, len(capability.List()))
for _, cap := range capability.List() {
if cap > validate.LastCap() {
continue
}
caps = append(caps, "CAP_"+strings.ToUpper(cap.String()))
}
return caps
} | [
"func",
"getOCICapabilitiesList",
"(",
")",
"[",
"]",
"string",
"{",
"caps",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"capability",
".",
"List",
"(",
")",
")",
")",
"\n",
"for",
"_",
",",
"cap",
":=",
"range",
"capability",... | // getOCICapabilitiesList returns a list of all available capabilities. | [
"getOCICapabilitiesList",
"returns",
"a",
"list",
"of",
"all",
"available",
"capabilities",
"."
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/utils.go#L123-L132 |
27,796 | cri-o/cri-o | server/utils.go | validateSysctl | func validateSysctl(sysctl string, hostNet, hostIPC bool) error {
nsErrorFmt := "%q not allowed with host %s enabled"
if ns, found := namespaces[sysctl]; found {
if ns == IpcNamespace && hostIPC {
return errors.Errorf(nsErrorFmt, sysctl, ns)
}
if ns == NetNamespace && hostNet {
return errors.Errorf(nsErro... | go | func validateSysctl(sysctl string, hostNet, hostIPC bool) error {
nsErrorFmt := "%q not allowed with host %s enabled"
if ns, found := namespaces[sysctl]; found {
if ns == IpcNamespace && hostIPC {
return errors.Errorf(nsErrorFmt, sysctl, ns)
}
if ns == NetNamespace && hostNet {
return errors.Errorf(nsErro... | [
"func",
"validateSysctl",
"(",
"sysctl",
"string",
",",
"hostNet",
",",
"hostIPC",
"bool",
")",
"error",
"{",
"nsErrorFmt",
":=",
"\"",
"\"",
"\n",
"if",
"ns",
",",
"found",
":=",
"namespaces",
"[",
"sysctl",
"]",
";",
"found",
"{",
"if",
"ns",
"==",
... | // validateSysctl checks that a sysctl is whitelisted because it is known
// to be namespaced by the Linux kernel.
// The parameters hostNet and hostIPC are used to forbid sysctls for pod sharing the
// respective namespaces with the host. This check is only used on sysctls defined by
// the user in the crio.conf file. | [
"validateSysctl",
"checks",
"that",
"a",
"sysctl",
"is",
"whitelisted",
"because",
"it",
"is",
"known",
"to",
"be",
"namespaced",
"by",
"the",
"Linux",
"kernel",
".",
"The",
"parameters",
"hostNet",
"and",
"hostIPC",
"are",
"used",
"to",
"forbid",
"sysctls",
... | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/utils.go#L230-L253 |
27,797 | cri-o/cri-o | server/utils.go | translateLabelsToDescription | func translateLabelsToDescription(labels map[string]string) string {
return fmt.Sprintf("%s/%s/%s", labels[types.KubernetesPodNamespaceLabel], labels[types.KubernetesPodNameLabel], labels[types.KubernetesContainerNameLabel])
} | go | func translateLabelsToDescription(labels map[string]string) string {
return fmt.Sprintf("%s/%s/%s", labels[types.KubernetesPodNamespaceLabel], labels[types.KubernetesPodNameLabel], labels[types.KubernetesContainerNameLabel])
} | [
"func",
"translateLabelsToDescription",
"(",
"labels",
"map",
"[",
"string",
"]",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"labels",
"[",
"types",
".",
"KubernetesPodNamespaceLabel",
"]",
",",
"labels",
"[",
"types... | // Translate container labels to a description of the container | [
"Translate",
"container",
"labels",
"to",
"a",
"description",
"of",
"the",
"container"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/utils.go#L279-L281 |
27,798 | cri-o/cri-o | lib/config.go | GetStore | func (c *Config) GetStore() (cstorage.Store, error) {
return cstorage.GetStore(cstorage.StoreOptions{
RunRoot: c.RunRoot,
GraphRoot: c.Root,
GraphDriverName: c.Storage,
GraphDriverOptions: c.StorageOptions,
})
} | go | func (c *Config) GetStore() (cstorage.Store, error) {
return cstorage.GetStore(cstorage.StoreOptions{
RunRoot: c.RunRoot,
GraphRoot: c.Root,
GraphDriverName: c.Storage,
GraphDriverOptions: c.StorageOptions,
})
} | [
"func",
"(",
"c",
"*",
"Config",
")",
"GetStore",
"(",
")",
"(",
"cstorage",
".",
"Store",
",",
"error",
")",
"{",
"return",
"cstorage",
".",
"GetStore",
"(",
"cstorage",
".",
"StoreOptions",
"{",
"RunRoot",
":",
"c",
".",
"RunRoot",
",",
"GraphRoot",
... | // GetStore returns the container storage for a given configuration | [
"GetStore",
"returns",
"the",
"container",
"storage",
"for",
"a",
"given",
"configuration"
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/config.go#L49-L56 |
27,799 | cri-o/cri-o | lib/config.go | UpdateFromFile | func (c *Config) UpdateFromFile(path string) error {
data, err := ioutil.ReadFile(path)
if err != nil {
return err
}
t := new(tomlConfig)
t.fromConfig(c)
_, err = toml.Decode(string(data), t)
if err != nil {
return fmt.Errorf("unable to decode configuration %v: %v", path, err)
}
t.toConfig(c)
return ni... | go | func (c *Config) UpdateFromFile(path string) error {
data, err := ioutil.ReadFile(path)
if err != nil {
return err
}
t := new(tomlConfig)
t.fromConfig(c)
_, err = toml.Decode(string(data), t)
if err != nil {
return fmt.Errorf("unable to decode configuration %v: %v", path, err)
}
t.toConfig(c)
return ni... | [
"func",
"(",
"c",
"*",
"Config",
")",
"UpdateFromFile",
"(",
"path",
"string",
")",
"error",
"{",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"t",
... | // UpdateFromFile populates the Config from the TOML-encoded file at the given path.
// Returns errors encountered when reading or parsing the files, or nil
// otherwise. | [
"UpdateFromFile",
"populates",
"the",
"Config",
"from",
"the",
"TOML",
"-",
"encoded",
"file",
"at",
"the",
"given",
"path",
".",
"Returns",
"errors",
"encountered",
"when",
"reading",
"or",
"parsing",
"the",
"files",
"or",
"nil",
"otherwise",
"."
] | 0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5 | https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/config.go#L320-L336 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.