engine

package
v19.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2026 License: MIT Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_internal_module_autoflow_engine_engine_proto protoreflect.FileDescriptor

Functions

func EventToDict

func EventToDict(e *event.CloudEvent) (*starlark.Dict, error)

func HTTPDo

func HTTPDo(ctx context.Context, rt http.RoundTripper, url, method string, body []byte, header http.Header) (statusCode int, status string, respHeader http.Header, respBody []byte, retErr error)

func NewGitalySource

NewGitalySource returns the production flow.Source that loads Starlark from Gitaly, using gl to resolve project paths to repository info and caching the resolution in repoInfoCache.

Types

type AllowLimiter

type AllowLimiter interface {
	Allow(ctx context.Context) bool
}

func NewRedisAllowLimiter

func NewRedisAllowLimiter(
	redisClient rueidis.Client,
	keyPrefix string,
	perMinute uint32,
	log *slog.Logger,
	handleProcessingError func(msg string, err error),
	tracer trace.Tracer,
	meter otelmetric.Meter,
) (AllowLimiter, error)

NewRedisAllowLimiter returns a metrics-instrumented AllowLimiter backed by a Redis token bucket keyed per project ID + event type, allowing perMinute events through each one-minute window. Returns an error if the metric instrumentation fails to register.

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(opts Options) (*Engine, error)

func (*Engine) HandleEvent

func (e *Engine) HandleEvent(ctx context.Context, req *HandleEventRequest) error

func (*Engine) RegisterOn

func (e *Engine) RegisterOn(r *autocore.Registry)

func (*Engine) RunStarlark

func (e *Engine) RunStarlark(ctx context.Context, identityKey string, input *RunStarlarkWorkflowInput) (string, error)

RunStarlark submits a RunStarlarkWorkflow with the given input. Returns the autocore-assigned workflow ID. If a workflow with the given identityKey already exists, returns its existing workflow ID without re-creating.

type HandleEventRequest

type HandleEventRequest struct {
	Event       *event.CloudEvent `protobuf:"bytes,1,opt,name=event" json:"event,omitempty"`
	FlowProject *event.Project    `protobuf:"bytes,2,opt,name=flow_project,json=flowProject" json:"flow_project,omitempty"`
	Variables   map[string]string `` /* 138-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*HandleEventRequest) Descriptor deprecated

func (*HandleEventRequest) Descriptor() ([]byte, []int)

Deprecated: Use HandleEventRequest.ProtoReflect.Descriptor instead.

func (*HandleEventRequest) GetEvent

func (x *HandleEventRequest) GetEvent() *event.CloudEvent

func (*HandleEventRequest) GetFlowProject

func (x *HandleEventRequest) GetFlowProject() *event.Project

func (*HandleEventRequest) GetVariables

func (x *HandleEventRequest) GetVariables() map[string]string

func (*HandleEventRequest) ProtoMessage

func (*HandleEventRequest) ProtoMessage()

func (*HandleEventRequest) ProtoReflect

func (x *HandleEventRequest) ProtoReflect() protoreflect.Message

func (*HandleEventRequest) Reset

func (x *HandleEventRequest) Reset()

func (*HandleEventRequest) String

func (x *HandleEventRequest) String() string

type HandleEventWorkflowInput

type HandleEventWorkflowInput struct {
	Event       *event.CloudEvent `protobuf:"bytes,1,opt,name=event" json:"event,omitempty"`
	FlowProject *event.Project    `protobuf:"bytes,2,opt,name=flow_project,json=flowProject" json:"flow_project,omitempty"`
	Entrypoint  string            `protobuf:"bytes,3,opt,name=entrypoint" json:"entrypoint,omitempty"`
	Variables   map[string]string `` /* 138-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*HandleEventWorkflowInput) Descriptor deprecated

func (*HandleEventWorkflowInput) Descriptor() ([]byte, []int)

Deprecated: Use HandleEventWorkflowInput.ProtoReflect.Descriptor instead.

func (*HandleEventWorkflowInput) GetEntrypoint

func (x *HandleEventWorkflowInput) GetEntrypoint() string

func (*HandleEventWorkflowInput) GetEvent

func (x *HandleEventWorkflowInput) GetEvent() *event.CloudEvent

func (*HandleEventWorkflowInput) GetFlowProject

func (x *HandleEventWorkflowInput) GetFlowProject() *event.Project

func (*HandleEventWorkflowInput) GetVariables

func (x *HandleEventWorkflowInput) GetVariables() map[string]string

func (*HandleEventWorkflowInput) ProtoMessage

func (*HandleEventWorkflowInput) ProtoMessage()

func (*HandleEventWorkflowInput) ProtoReflect

func (x *HandleEventWorkflowInput) ProtoReflect() protoreflect.Message

func (*HandleEventWorkflowInput) Reset

func (x *HandleEventWorkflowInput) Reset()

func (*HandleEventWorkflowInput) String

func (x *HandleEventWorkflowInput) String() string

type HandleEventWorkflowOutput

type HandleEventWorkflowOutput struct {
	// contains filtered or unexported fields
}

func (*HandleEventWorkflowOutput) Descriptor deprecated

func (*HandleEventWorkflowOutput) Descriptor() ([]byte, []int)

Deprecated: Use HandleEventWorkflowOutput.ProtoReflect.Descriptor instead.

func (*HandleEventWorkflowOutput) ProtoMessage

func (*HandleEventWorkflowOutput) ProtoMessage()

func (*HandleEventWorkflowOutput) ProtoReflect

func (*HandleEventWorkflowOutput) Reset

func (x *HandleEventWorkflowOutput) Reset()

func (*HandleEventWorkflowOutput) String

func (x *HandleEventWorkflowOutput) String() string

type HandlerInfo

type HandlerInfo struct {
	WorkflowId string `protobuf:"bytes,1,opt,name=workflow_id,json=workflowId" json:"workflow_id,omitempty"`
	// contains filtered or unexported fields
}

func (*HandlerInfo) Descriptor deprecated

func (*HandlerInfo) Descriptor() ([]byte, []int)

Deprecated: Use HandlerInfo.ProtoReflect.Descriptor instead.

func (*HandlerInfo) GetWorkflowId

func (x *HandlerInfo) GetWorkflowId() string

func (*HandlerInfo) ProtoMessage

func (*HandlerInfo) ProtoMessage()

func (*HandlerInfo) ProtoReflect

func (x *HandlerInfo) ProtoReflect() protoreflect.Message

func (*HandlerInfo) Reset

func (x *HandlerInfo) Reset()

func (*HandlerInfo) String

func (x *HandlerInfo) String() string

type HttpDoActivityInput

type HttpDoActivityInput struct {
	Method string             `protobuf:"bytes,1,opt,name=method" json:"method,omitempty"`
	Url    string             `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"`
	Header map[string]*Values `` /* 132-byte string literal not displayed */
	Body   []byte             `protobuf:"bytes,4,opt,name=body" json:"body,omitempty"`
	// contains filtered or unexported fields
}

func (*HttpDoActivityInput) Descriptor deprecated

func (*HttpDoActivityInput) Descriptor() ([]byte, []int)

Deprecated: Use HttpDoActivityInput.ProtoReflect.Descriptor instead.

func (*HttpDoActivityInput) GetBody

func (x *HttpDoActivityInput) GetBody() []byte

func (*HttpDoActivityInput) GetHeader

func (x *HttpDoActivityInput) GetHeader() map[string]*Values

func (*HttpDoActivityInput) GetMethod

func (x *HttpDoActivityInput) GetMethod() string

func (*HttpDoActivityInput) GetUrl

func (x *HttpDoActivityInput) GetUrl() string

func (*HttpDoActivityInput) ProtoMessage

func (*HttpDoActivityInput) ProtoMessage()

func (*HttpDoActivityInput) ProtoReflect

func (x *HttpDoActivityInput) ProtoReflect() protoreflect.Message

func (*HttpDoActivityInput) Reset

func (x *HttpDoActivityInput) Reset()

func (*HttpDoActivityInput) String

func (x *HttpDoActivityInput) String() string

type HttpDoActivityOutput

type HttpDoActivityOutput struct {
	StatusCode uint32             `protobuf:"varint,1,opt,name=status_code,json=statusCode" json:"status_code,omitempty"`
	Status     string             `protobuf:"bytes,2,opt,name=status" json:"status,omitempty"`
	Header     map[string]*Values `` /* 132-byte string literal not displayed */
	Body       []byte             `protobuf:"bytes,4,opt,name=body" json:"body,omitempty"`
	// contains filtered or unexported fields
}

func (*HttpDoActivityOutput) Descriptor deprecated

func (*HttpDoActivityOutput) Descriptor() ([]byte, []int)

Deprecated: Use HttpDoActivityOutput.ProtoReflect.Descriptor instead.

func (*HttpDoActivityOutput) GetBody

func (x *HttpDoActivityOutput) GetBody() []byte

func (*HttpDoActivityOutput) GetHeader

func (x *HttpDoActivityOutput) GetHeader() map[string]*Values

func (*HttpDoActivityOutput) GetStatus

func (x *HttpDoActivityOutput) GetStatus() string

func (*HttpDoActivityOutput) GetStatusCode

func (x *HttpDoActivityOutput) GetStatusCode() uint32

func (*HttpDoActivityOutput) ProtoMessage

func (*HttpDoActivityOutput) ProtoMessage()

func (*HttpDoActivityOutput) ProtoReflect

func (x *HttpDoActivityOutput) ProtoReflect() protoreflect.Message

func (*HttpDoActivityOutput) Reset

func (x *HttpDoActivityOutput) Reset()

func (*HttpDoActivityOutput) String

func (x *HttpDoActivityOutput) String() string

type LoadAllEventHandlersActivityInput

type LoadAllEventHandlersActivityInput struct {
	Event       *event.CloudEvent `protobuf:"bytes,1,opt,name=event" json:"event,omitempty"`
	FlowProject *event.Project    `protobuf:"bytes,2,opt,name=flow_project,json=flowProject" json:"flow_project,omitempty"`
	Entrypoint  string            `protobuf:"bytes,3,opt,name=entrypoint" json:"entrypoint,omitempty"`
	// contains filtered or unexported fields
}

func (*LoadAllEventHandlersActivityInput) Descriptor deprecated

func (*LoadAllEventHandlersActivityInput) Descriptor() ([]byte, []int)

Deprecated: Use LoadAllEventHandlersActivityInput.ProtoReflect.Descriptor instead.

func (*LoadAllEventHandlersActivityInput) GetEntrypoint

func (x *LoadAllEventHandlersActivityInput) GetEntrypoint() string

func (*LoadAllEventHandlersActivityInput) GetEvent

func (*LoadAllEventHandlersActivityInput) GetFlowProject

func (x *LoadAllEventHandlersActivityInput) GetFlowProject() *event.Project

func (*LoadAllEventHandlersActivityInput) ProtoMessage

func (*LoadAllEventHandlersActivityInput) ProtoMessage()

func (*LoadAllEventHandlersActivityInput) ProtoReflect

func (*LoadAllEventHandlersActivityInput) Reset

func (*LoadAllEventHandlersActivityInput) String

type LoadAllEventHandlersActivityOutput

type LoadAllEventHandlersActivityOutput struct {
	Handlers []*HandlerInfo  `protobuf:"bytes,1,rep,name=handlers" json:"handlers,omitempty"`
	Modules  []*ModuleSource `protobuf:"bytes,2,rep,name=modules" json:"modules,omitempty"`
	// contains filtered or unexported fields
}

func (*LoadAllEventHandlersActivityOutput) Descriptor deprecated

func (*LoadAllEventHandlersActivityOutput) Descriptor() ([]byte, []int)

Deprecated: Use LoadAllEventHandlersActivityOutput.ProtoReflect.Descriptor instead.

func (*LoadAllEventHandlersActivityOutput) GetHandlers

func (x *LoadAllEventHandlersActivityOutput) GetHandlers() []*HandlerInfo

func (*LoadAllEventHandlersActivityOutput) GetModules

func (*LoadAllEventHandlersActivityOutput) ProtoMessage

func (*LoadAllEventHandlersActivityOutput) ProtoMessage()

func (*LoadAllEventHandlersActivityOutput) ProtoReflect

func (*LoadAllEventHandlersActivityOutput) Reset

func (*LoadAllEventHandlersActivityOutput) String

type ModuleSource

type ModuleSource struct {
	SourceName string `protobuf:"bytes,1,opt,name=source_name,json=sourceName" json:"source_name,omitempty"`
	File       string `protobuf:"bytes,2,opt,name=file" json:"file,omitempty"`
	Data       []byte `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*ModuleSource) Descriptor deprecated

func (*ModuleSource) Descriptor() ([]byte, []int)

Deprecated: Use ModuleSource.ProtoReflect.Descriptor instead.

func (*ModuleSource) GetData

func (x *ModuleSource) GetData() []byte

func (*ModuleSource) GetFile

func (x *ModuleSource) GetFile() string

func (*ModuleSource) GetSourceName

func (x *ModuleSource) GetSourceName() string

func (*ModuleSource) ProtoMessage

func (*ModuleSource) ProtoMessage()

func (*ModuleSource) ProtoReflect

func (x *ModuleSource) ProtoReflect() protoreflect.Message

func (*ModuleSource) Reset

func (x *ModuleSource) Reset()

func (*ModuleSource) String

func (x *ModuleSource) String() string

type Options

type Options struct {
	Log          *slog.Logger
	Client       autocore.Client
	HTTPRT       http.RoundTripper
	GitLabURL    string
	RL           *workflowRateLimiter
	Source       flow.Source
	AllowLimiter AllowLimiter
}

type RateLimiterCtxKey

type RateLimiterCtxKey string

type RepoInfoCacheKey

type RepoInfoCacheKey struct {
	// TODO identity must be part of the cache key
	ProjectID string
}

type RunActivityInput

type RunActivityInput struct {
	Uri           string   `protobuf:"bytes,1,opt,name=uri" json:"uri,omitempty"`
	WorkflowId    string   `protobuf:"bytes,2,opt,name=workflow_id,json=workflowId" json:"workflow_id,omitempty"`
	Args          []string `protobuf:"bytes,3,rep,name=args" json:"args,omitempty"`
	DuoCallNumber int32    `protobuf:"varint,4,opt,name=duo_call_number,json=duoCallNumber" json:"duo_call_number,omitempty"`
	// contains filtered or unexported fields
}

func (*RunActivityInput) Descriptor deprecated

func (*RunActivityInput) Descriptor() ([]byte, []int)

Deprecated: Use RunActivityInput.ProtoReflect.Descriptor instead.

func (*RunActivityInput) GetArgs

func (x *RunActivityInput) GetArgs() []string

func (*RunActivityInput) GetDuoCallNumber

func (x *RunActivityInput) GetDuoCallNumber() int32

func (*RunActivityInput) GetUri

func (x *RunActivityInput) GetUri() string

func (*RunActivityInput) GetWorkflowId

func (x *RunActivityInput) GetWorkflowId() string

func (*RunActivityInput) ProtoMessage

func (*RunActivityInput) ProtoMessage()

func (*RunActivityInput) ProtoReflect

func (x *RunActivityInput) ProtoReflect() protoreflect.Message

func (*RunActivityInput) Reset

func (x *RunActivityInput) Reset()

func (*RunActivityInput) String

func (x *RunActivityInput) String() string

type RunActivityOutput

type RunActivityOutput struct {
	Payload string `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

func (*RunActivityOutput) Descriptor deprecated

func (*RunActivityOutput) Descriptor() ([]byte, []int)

Deprecated: Use RunActivityOutput.ProtoReflect.Descriptor instead.

func (*RunActivityOutput) GetPayload

func (x *RunActivityOutput) GetPayload() string

func (*RunActivityOutput) ProtoMessage

func (*RunActivityOutput) ProtoMessage()

func (*RunActivityOutput) ProtoReflect

func (x *RunActivityOutput) ProtoReflect() protoreflect.Message

func (*RunActivityOutput) Reset

func (x *RunActivityOutput) Reset()

func (*RunActivityOutput) String

func (x *RunActivityOutput) String() string

type RunEventHandlerWorkflowInput

type RunEventHandlerWorkflowInput struct {
	Event            *event.CloudEvent `protobuf:"bytes,1,opt,name=event" json:"event,omitempty"`
	FlowProject      *event.Project    `protobuf:"bytes,2,opt,name=flow_project,json=flowProject" json:"flow_project,omitempty"`
	Entrypoint       string            `protobuf:"bytes,3,opt,name=entrypoint" json:"entrypoint,omitempty"`
	Modules          []*ModuleSource   `protobuf:"bytes,4,rep,name=modules" json:"modules,omitempty"`
	Handler          uint32            `protobuf:"varint,5,opt,name=handler" json:"handler,omitempty"`
	WorkflowIdPrefix string            `protobuf:"bytes,6,opt,name=workflow_id_prefix,json=workflowIdPrefix" json:"workflow_id_prefix,omitempty"`
	Variables        map[string]string `` /* 138-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*RunEventHandlerWorkflowInput) Descriptor deprecated

func (*RunEventHandlerWorkflowInput) Descriptor() ([]byte, []int)

Deprecated: Use RunEventHandlerWorkflowInput.ProtoReflect.Descriptor instead.

func (*RunEventHandlerWorkflowInput) GetEntrypoint

func (x *RunEventHandlerWorkflowInput) GetEntrypoint() string

func (*RunEventHandlerWorkflowInput) GetEvent

func (*RunEventHandlerWorkflowInput) GetFlowProject

func (x *RunEventHandlerWorkflowInput) GetFlowProject() *event.Project

func (*RunEventHandlerWorkflowInput) GetHandler

func (x *RunEventHandlerWorkflowInput) GetHandler() uint32

func (*RunEventHandlerWorkflowInput) GetModules

func (x *RunEventHandlerWorkflowInput) GetModules() []*ModuleSource

func (*RunEventHandlerWorkflowInput) GetVariables

func (x *RunEventHandlerWorkflowInput) GetVariables() map[string]string

func (*RunEventHandlerWorkflowInput) GetWorkflowIdPrefix

func (x *RunEventHandlerWorkflowInput) GetWorkflowIdPrefix() string

func (*RunEventHandlerWorkflowInput) ProtoMessage

func (*RunEventHandlerWorkflowInput) ProtoMessage()

func (*RunEventHandlerWorkflowInput) ProtoReflect

func (*RunEventHandlerWorkflowInput) Reset

func (x *RunEventHandlerWorkflowInput) Reset()

func (*RunEventHandlerWorkflowInput) String

type RunEventHandlerWorkflowOutput

type RunEventHandlerWorkflowOutput struct {
	// contains filtered or unexported fields
}

func (*RunEventHandlerWorkflowOutput) Descriptor deprecated

func (*RunEventHandlerWorkflowOutput) Descriptor() ([]byte, []int)

Deprecated: Use RunEventHandlerWorkflowOutput.ProtoReflect.Descriptor instead.

func (*RunEventHandlerWorkflowOutput) ProtoMessage

func (*RunEventHandlerWorkflowOutput) ProtoMessage()

func (*RunEventHandlerWorkflowOutput) ProtoReflect

func (*RunEventHandlerWorkflowOutput) Reset

func (x *RunEventHandlerWorkflowOutput) Reset()

func (*RunEventHandlerWorkflowOutput) String

type RunStarlarkWorkflowInput

type RunStarlarkWorkflowInput struct {
	WorkflowDefinition []byte    `protobuf:"bytes,1,opt,name=workflow_definition,json=workflowDefinition" json:"workflow_definition,omitempty"`
	Secrets            []*Secret `protobuf:"bytes,2,rep,name=secrets" json:"secrets,omitempty"`
	// contains filtered or unexported fields
}

func (*RunStarlarkWorkflowInput) Descriptor deprecated

func (*RunStarlarkWorkflowInput) Descriptor() ([]byte, []int)

Deprecated: Use RunStarlarkWorkflowInput.ProtoReflect.Descriptor instead.

func (*RunStarlarkWorkflowInput) GetSecrets

func (x *RunStarlarkWorkflowInput) GetSecrets() []*Secret

func (*RunStarlarkWorkflowInput) GetWorkflowDefinition

func (x *RunStarlarkWorkflowInput) GetWorkflowDefinition() []byte

func (*RunStarlarkWorkflowInput) ProtoMessage

func (*RunStarlarkWorkflowInput) ProtoMessage()

func (*RunStarlarkWorkflowInput) ProtoReflect

func (x *RunStarlarkWorkflowInput) ProtoReflect() protoreflect.Message

func (*RunStarlarkWorkflowInput) Reset

func (x *RunStarlarkWorkflowInput) Reset()

func (*RunStarlarkWorkflowInput) String

func (x *RunStarlarkWorkflowInput) String() string

type RunStarlarkWorkflowOutput

type RunStarlarkWorkflowOutput struct {
	// contains filtered or unexported fields
}

func (*RunStarlarkWorkflowOutput) Descriptor deprecated

func (*RunStarlarkWorkflowOutput) Descriptor() ([]byte, []int)

Deprecated: Use RunStarlarkWorkflowOutput.ProtoReflect.Descriptor instead.

func (*RunStarlarkWorkflowOutput) ProtoMessage

func (*RunStarlarkWorkflowOutput) ProtoMessage()

func (*RunStarlarkWorkflowOutput) ProtoReflect

func (*RunStarlarkWorkflowOutput) Reset

func (x *RunStarlarkWorkflowOutput) Reset()

func (*RunStarlarkWorkflowOutput) String

func (x *RunStarlarkWorkflowOutput) String() string

type Secret

type Secret struct {
	Key   string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
	Value string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Secret) Descriptor deprecated

func (*Secret) Descriptor() ([]byte, []int)

Deprecated: Use Secret.ProtoReflect.Descriptor instead.

func (*Secret) GetKey

func (x *Secret) GetKey() string

func (*Secret) GetValue

func (x *Secret) GetValue() string

func (*Secret) ProtoMessage

func (*Secret) ProtoMessage()

func (*Secret) ProtoReflect

func (x *Secret) ProtoReflect() protoreflect.Message

func (*Secret) Reset

func (x *Secret) Reset()

func (*Secret) String

func (x *Secret) String() string

type SignalPayload

type SignalPayload struct {
	Payload string `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

func (*SignalPayload) Descriptor deprecated

func (*SignalPayload) Descriptor() ([]byte, []int)

Deprecated: Use SignalPayload.ProtoReflect.Descriptor instead.

func (*SignalPayload) GetPayload

func (x *SignalPayload) GetPayload() string

func (*SignalPayload) ProtoMessage

func (*SignalPayload) ProtoMessage()

func (*SignalPayload) ProtoReflect

func (x *SignalPayload) ProtoReflect() protoreflect.Message

func (*SignalPayload) Reset

func (x *SignalPayload) Reset()

func (*SignalPayload) String

func (x *SignalPayload) String() string

type Values

type Values struct {
	Value []string `protobuf:"bytes,1,rep,name=value" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Values) Descriptor deprecated

func (*Values) Descriptor() ([]byte, []int)

Deprecated: Use Values.ProtoReflect.Descriptor instead.

func (*Values) GetValue

func (x *Values) GetValue() []string

func (*Values) ProtoMessage

func (*Values) ProtoMessage()

func (*Values) ProtoReflect

func (x *Values) ProtoReflect() protoreflect.Message

func (*Values) Reset

func (x *Values) Reset()

func (*Values) String

func (x *Values) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL