flowcore

package
v19.1.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkflowStateUnknown   = autocore.WorkflowStateUnknown
	WorkflowStateRunning   = autocore.WorkflowStateRunning
	WorkflowStateCompleted = autocore.WorkflowStateCompleted
	WorkflowStateFailed    = autocore.WorkflowStateFailed
	WorkflowStateCanceled  = autocore.WorkflowStateCanceled
	WorkflowStateTimedOut  = autocore.WorkflowStateTimedOut
)

Variables

View Source
var ErrInvalidWorkflowKey = autocore.ErrInvalidWorkflowKey

ErrInvalidWorkflowKey is returned by GetWorkflow when the key is malformed.

View Source
var ErrWorkflowNotFound = autocore.ErrWorkflowNotFound

ErrWorkflowNotFound is returned by GetWorkflow when no workflow exists for the given key.

View Source
var File_internal_flowcore_engine_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type CallResult

type CallResult struct {
	Data  []byte
	Error string
}

type CallUnaryFunctionActivityInput

type CallUnaryFunctionActivityInput struct {
	ModuleName string `protobuf:"bytes,1,opt,name=module_name,json=moduleName" json:"module_name,omitempty"`
	FuncName   string `protobuf:"bytes,2,opt,name=func_name,json=funcName" json:"func_name,omitempty"`
	Input      []byte `protobuf:"bytes,3,opt,name=input" json:"input,omitempty"`
	// contains filtered or unexported fields
}

func (*CallUnaryFunctionActivityInput) Descriptor deprecated

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

Deprecated: Use CallUnaryFunctionActivityInput.ProtoReflect.Descriptor instead.

func (*CallUnaryFunctionActivityInput) GetFuncName

func (x *CallUnaryFunctionActivityInput) GetFuncName() string

func (*CallUnaryFunctionActivityInput) GetInput

func (x *CallUnaryFunctionActivityInput) GetInput() []byte

func (*CallUnaryFunctionActivityInput) GetModuleName

func (x *CallUnaryFunctionActivityInput) GetModuleName() string

func (*CallUnaryFunctionActivityInput) ProtoMessage

func (*CallUnaryFunctionActivityInput) ProtoMessage()

func (*CallUnaryFunctionActivityInput) ProtoReflect

func (*CallUnaryFunctionActivityInput) Reset

func (x *CallUnaryFunctionActivityInput) Reset()

func (*CallUnaryFunctionActivityInput) String

type CallUnaryFunctionActivityOutput

type CallUnaryFunctionActivityOutput struct {

	// Types that are valid to be assigned to Response:
	//
	//	*CallUnaryFunctionActivityOutput_Output
	//	*CallUnaryFunctionActivityOutput_Error
	Response isCallUnaryFunctionActivityOutput_Response `protobuf_oneof:"response"`
	// contains filtered or unexported fields
}

func (*CallUnaryFunctionActivityOutput) Descriptor deprecated

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

Deprecated: Use CallUnaryFunctionActivityOutput.ProtoReflect.Descriptor instead.

func (*CallUnaryFunctionActivityOutput) GetError

func (*CallUnaryFunctionActivityOutput) GetOutput

func (x *CallUnaryFunctionActivityOutput) GetOutput() []byte

func (*CallUnaryFunctionActivityOutput) GetResponse

func (x *CallUnaryFunctionActivityOutput) GetResponse() isCallUnaryFunctionActivityOutput_Response

func (*CallUnaryFunctionActivityOutput) ProtoMessage

func (*CallUnaryFunctionActivityOutput) ProtoMessage()

func (*CallUnaryFunctionActivityOutput) ProtoReflect

func (*CallUnaryFunctionActivityOutput) Reset

func (*CallUnaryFunctionActivityOutput) String

type CallUnaryFunctionActivityOutput_Error

type CallUnaryFunctionActivityOutput_Error struct {
	Error string `protobuf:"bytes,2,opt,name=error,oneof"`
}

type CallUnaryFunctionActivityOutput_Output

type CallUnaryFunctionActivityOutput_Output struct {
	Output []byte `protobuf:"bytes,1,opt,name=output,oneof"`
}

type Engine

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

func NewEngine

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

func (*Engine) GetWorkflow

func (e *Engine) GetWorkflow(ctx context.Context, workflowKey string) (*Workflow, error)

GetWorkflow returns a snapshot of the workflow addressed by workflowKey, the key string returned by RunWorkflow. Returns autocore.ErrWorkflowNotFound if no such workflow exists, or an error if the key is malformed.

func (*Engine) RunWorkflow

func (e *Engine) RunWorkflow(ctx context.Context, identityKey string, input *RunWorkflowInput) (string, error)

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

type LoadModuleActivityInput

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

func (*LoadModuleActivityInput) Descriptor deprecated

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

Deprecated: Use LoadModuleActivityInput.ProtoReflect.Descriptor instead.

func (*LoadModuleActivityInput) GetName

func (x *LoadModuleActivityInput) GetName() string

func (*LoadModuleActivityInput) ProtoMessage

func (*LoadModuleActivityInput) ProtoMessage()

func (*LoadModuleActivityInput) ProtoReflect

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

func (*LoadModuleActivityInput) Reset

func (x *LoadModuleActivityInput) Reset()

func (*LoadModuleActivityInput) String

func (x *LoadModuleActivityInput) String() string

type LoadModuleActivityOutput

type LoadModuleActivityOutput struct {
	ModuleDesc *autoflow.ModuleDescriptor `protobuf:"bytes,1,opt,name=module_desc,json=moduleDesc" json:"module_desc,omitempty"`
	// contains filtered or unexported fields
}

func (*LoadModuleActivityOutput) Descriptor deprecated

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

Deprecated: Use LoadModuleActivityOutput.ProtoReflect.Descriptor instead.

func (*LoadModuleActivityOutput) GetModuleDesc

func (*LoadModuleActivityOutput) ProtoMessage

func (*LoadModuleActivityOutput) ProtoMessage()

func (*LoadModuleActivityOutput) ProtoReflect

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

func (*LoadModuleActivityOutput) Reset

func (x *LoadModuleActivityOutput) Reset()

func (*LoadModuleActivityOutput) String

func (x *LoadModuleActivityOutput) String() string

type ModuleDescriptorResolver

type ModuleDescriptorResolver struct {
	ModuleName        string
	Desc              *autoflow.ModuleDescriptor
	PredeclaredFiles  *protoregistry.Files
	CallUnaryFunction func(context.Context, *CallUnaryFunctionActivityInput) (*CallUnaryFunctionActivityOutput, error)
	// contains filtered or unexported fields
}

func (*ModuleDescriptorResolver) LoadSymbols

func (r *ModuleDescriptorResolver) LoadSymbols() (starlark.StringDict, error)

type ModuleManager

type ModuleManager interface {
	// LoadModuleDescriptor loads a module descriptor.
	// Returns (nil, nil) if not found.
	LoadModuleDescriptor(ctx context.Context, moduleName string) (*autoflow.ModuleDescriptor, error)
	CallUnaryFunction(ctx context.Context, moduleName, funcName, idempotencyKey string, input []byte) (CallResult, error)
}

type Options

type Options struct {
	Log            *slog.Logger
	Client         autocore.Client
	Registry       *autocore.Registry
	RateLimiter    RateLimiter
	ModuleManager  ModuleManager
	TracerProvider oteltrace.TracerProvider
	// PredeclaredProtoFiles is the set of proto file descriptors that
	// AutoFlow modules' descriptor sets may import. Used to resolve
	// imports when reconstructing module proto descriptors; we deliberately
	// do not fall back to protoregistry.GlobalFiles so a module cannot pull
	// in arbitrary types linked into the binary.
	// Order is important here - files that come later can import files that come earlier,
	// but not the other way around.
	PredeclaredProtoFiles []protoreflect.FileDescriptor
}

type RateLimiter

type RateLimiter interface {
	Allow(ctx context.Context, projectID int64, eventType string) bool
}

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 RunWorkflowInput

type RunWorkflowInput 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 (*RunWorkflowInput) Descriptor deprecated

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

Deprecated: Use RunWorkflowInput.ProtoReflect.Descriptor instead.

func (*RunWorkflowInput) GetSecrets

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

func (*RunWorkflowInput) GetWorkflowDefinition

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

func (*RunWorkflowInput) ProtoMessage

func (*RunWorkflowInput) ProtoMessage()

func (*RunWorkflowInput) ProtoReflect

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

func (*RunWorkflowInput) Reset

func (x *RunWorkflowInput) Reset()

func (*RunWorkflowInput) String

func (x *RunWorkflowInput) String() string

type RunWorkflowOutput

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

func (*RunWorkflowOutput) Descriptor deprecated

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

Deprecated: Use RunWorkflowOutput.ProtoReflect.Descriptor instead.

func (*RunWorkflowOutput) ProtoMessage

func (*RunWorkflowOutput) ProtoMessage()

func (*RunWorkflowOutput) ProtoReflect

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

func (*RunWorkflowOutput) Reset

func (x *RunWorkflowOutput) Reset()

func (*RunWorkflowOutput) String

func (x *RunWorkflowOutput) 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 Workflow

type Workflow struct {
	Key         string
	Name        string
	IdentityKey string
	State       WorkflowState
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Output      *RunWorkflowOutput
	Error       string
}

Workflow is a read-only snapshot of a workflow returned by GetWorkflow. Output holds the workflow's decoded output and is set only when the workflow completed; Error holds the failure message and is set only when it failed.

type WorkflowState

type WorkflowState = autocore.WorkflowState

WorkflowState is the lifecycle state of an AutoFlow workflow.

Jump to

Keyboard shortcuts

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