Documentation
¶
Overview ¶
Package durable performs authenticated Volcano durable function workflows.
Durable functions are their own collection: they are started rather than invoked, an execution outlives the request that began it, and the API resolves a function by name or id server-side. That last part is why this package is thinner than internal/function, which pages a list to turn a name into an id.
Index ¶
- type Service
- func (s Service) CreateScheduler(ctx context.Context, identifier string, input api.FunctionSchedulerInput) (*apiclient.FunctionScheduler, error)
- func (s Service) Delete(ctx context.Context, identifier string) error
- func (s Service) DeleteScheduler(ctx context.Context, identifier string, schedulerID uuid.UUID) error
- func (s Service) Deploy(ctx context.Context, pkg clifunction.Package, ...) (deployed *apiclient.DurableFunction, created bool, err error)
- func (s Service) DeploymentLogs(ctx context.Context, functionID, deploymentID uuid.UUID, limit int, ...) (*apiclient.LogSearchResponse, error)
- func (s Service) DisableScheduler(ctx context.Context, identifier string, schedulerID uuid.UUID) (*apiclient.FunctionScheduler, error)
- func (s Service) EnableScheduler(ctx context.Context, identifier string, schedulerID uuid.UUID) (*apiclient.FunctionScheduler, error)
- func (s Service) Get(ctx context.Context, identifier string) (*apiclient.DurableFunction, error)
- func (s Service) GetExecution(ctx context.Context, identifier string, executionID uuid.UUID) (*apiclient.DurableExecution, error)
- func (s Service) ListExecutions(ctx context.Context, identifier, status string, page, limit int) (*apiclient.PaginatedDurableExecutions, error)
- func (s Service) ListPage(ctx context.Context, page, limit int) (*apiclient.PaginatedDurableFunctions, error)
- func (s Service) ListSchedulers(ctx context.Context, identifier string) (*apiclient.FunctionSchedulerListResponse, error)
- func (s Service) RuntimeLogs(ctx context.Context, functionID uuid.UUID, limit int, cursor string) (*apiclient.LogSearchResponse, error)
- func (s Service) StartExecution(ctx context.Context, identifier string, input api.DurableExecutionStartInput) (*apiclient.DurableExecution, error)
- func (s Service) StopExecution(ctx context.Context, identifier string, executionID uuid.UUID) (*apiclient.DurableExecution, error)
- func (s Service) StreamDeploymentLogs(ctx context.Context, functionID, deploymentID uuid.UUID, limit int) (*api.ProjectLogStream, error)
- func (s Service) StreamRuntimeLogs(ctx context.Context, functionID uuid.UUID, limit int, lastEventID string) (*api.ProjectLogStream, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service performs durable function workflows against the current project.
func NewService ¶
func NewService(deps cliruntime.Deps) Service
NewService returns a durable function service.
func (Service) CreateScheduler ¶
func (s Service) CreateScheduler( ctx context.Context, identifier string, input api.FunctionSchedulerInput, ) (*apiclient.FunctionScheduler, error)
CreateScheduler adds a scheduler to one durable function. Each tick starts an execution rather than invoking the function.
func (Service) DeleteScheduler ¶
func (s Service) DeleteScheduler(ctx context.Context, identifier string, schedulerID uuid.UUID) error
DeleteScheduler removes a scheduler and its run history. Executions it already started keep running.
func (Service) Deploy ¶
func (s Service) Deploy( ctx context.Context, pkg clifunction.Package, visibility *apiclient.FunctionVisibility, ) (deployed *apiclient.DurableFunction, created bool, err error)
Deploy uploads one packaged source archive as a durable function. It creates the function on the first call for a name and redeploys it after that; created reports which one happened.
visibility is left nil to keep the deployed function's current visibility, which is what the collection does with an absent field. A new function starts private.
func (Service) DeploymentLogs ¶ added in v0.32.0
func (s Service) DeploymentLogs( ctx context.Context, functionID, deploymentID uuid.UUID, limit int, cursor string, ) (*apiclient.LogSearchResponse, error)
DeploymentLogs returns one build log search page for a durable function's deployment.
func (Service) DisableScheduler ¶
func (s Service) DisableScheduler( ctx context.Context, identifier string, schedulerID uuid.UUID, ) (*apiclient.FunctionScheduler, error)
DisableScheduler stops a scheduler's ticks without deleting it. Executions already started keep running.
func (Service) EnableScheduler ¶
func (s Service) EnableScheduler( ctx context.Context, identifier string, schedulerID uuid.UUID, ) (*apiclient.FunctionScheduler, error)
EnableScheduler resumes a scheduler's ticks.
func (Service) GetExecution ¶
func (s Service) GetExecution( ctx context.Context, identifier string, executionID uuid.UUID, ) (*apiclient.DurableExecution, error)
GetExecution returns one execution, including its result once it has finished.
func (Service) ListExecutions ¶
func (s Service) ListExecutions( ctx context.Context, identifier, status string, page, limit int, ) (*apiclient.PaginatedDurableExecutions, error)
ListExecutions returns one execution page for a durable function. An empty status lists every execution.
func (Service) ListPage ¶
func (s Service) ListPage(ctx context.Context, page, limit int) (*apiclient.PaginatedDurableFunctions, error)
ListPage returns one durable function page in the current project.
func (Service) ListSchedulers ¶
func (s Service) ListSchedulers( ctx context.Context, identifier string, ) (*apiclient.FunctionSchedulerListResponse, error)
ListSchedulers returns the schedulers of one durable function.
func (Service) RuntimeLogs ¶ added in v0.32.0
func (s Service) RuntimeLogs( ctx context.Context, functionID uuid.UUID, limit int, cursor string, ) (*apiclient.LogSearchResponse, error)
RuntimeLogs returns one runtime log search page for a durable function.
The log routes are project-scoped and take a function id whatever collection it came from, so these four read a durable function's logs through the same endpoints a standard function's do.
func (Service) StartExecution ¶
func (s Service) StartExecution( ctx context.Context, identifier string, input api.DurableExecutionStartInput, ) (*apiclient.DurableExecution, error)
StartExecution starts one execution and returns its handle. Starting is asynchronous by construction, so this never carries a result.
func (Service) StopExecution ¶
func (s Service) StopExecution( ctx context.Context, identifier string, executionID uuid.UUID, ) (*apiclient.DurableExecution, error)
StopExecution stops one execution. Steps already completed are not undone.
func (Service) StreamDeploymentLogs ¶ added in v0.32.0
func (s Service) StreamDeploymentLogs( ctx context.Context, functionID, deploymentID uuid.UUID, limit int, ) (*api.ProjectLogStream, error)
StreamDeploymentLogs opens a build log stream for a durable function's deployment.
func (Service) StreamRuntimeLogs ¶ added in v0.32.0
func (s Service) StreamRuntimeLogs( ctx context.Context, functionID uuid.UUID, limit int, lastEventID string, ) (*api.ProjectLogStream, error)
StreamRuntimeLogs opens a runtime log stream for a durable function, resuming after lastEventID when it is set.