queue

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package queue implements the asynchronous queue lifecycle: submit, poll, fetch result, cancel and subscribe. It is surfaced through fal.Client (Submit, Subscribe, Status, Result, Cancel, GetHandle) and the matching package-level functions; the Handle type is re-exported as fal.RequestHandle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cancel

func Cancel(ctx context.Context, core *transport.Core, application, requestID string) error

Cancel cancels a request by id. It mirrors fal_client.cancel.

func Result

func Result(ctx context.Context, core *transport.Core, application, requestID string) (any, error)

Result polls a request by id until completion and returns its result. It mirrors fal_client.result.

func Status

func Status(ctx context.Context, core *transport.Core, application, requestID string, withLogs bool) (status.Status, error)

Status fetches the status of a request by id. It mirrors fal_client.status.

func Subscribe

func Subscribe(ctx context.Context, core *transport.Core, application string, arguments any, o *option.CallOptions) (any, error)

Subscribe submits a request and polls until completion, returning the result. It mirrors fal_client.subscribe / SyncClient.subscribe.

Types

type Handle

type Handle struct {
	RequestID   string
	ResponseURL string
	StatusURL   string
	CancelURL   string
	// contains filtered or unexported fields
}

Handle references a submitted queue request. It mirrors fal_client.SyncRequestHandle and is re-exported as fal.RequestHandle.

func GetHandle

func GetHandle(core *transport.Core, application, requestID string) (*Handle, error)

GetHandle reconstructs a handle from an application id and request id. It mirrors SyncClient.get_handle / SyncRequestHandle.from_request_id.

func Submit

func Submit(ctx context.Context, core *transport.Core, application string, arguments any, o *option.CallOptions) (*Handle, error)

Submit enqueues a request and returns a handle to poll it. It mirrors fal_client.submit / SyncClient.submit.

func (*Handle) Cancel

func (h *Handle) Cancel(ctx context.Context) error

Cancel requests cancellation of the queued request.

func (*Handle) Get

func (h *Handle) Get(ctx context.Context) (any, error)

Get polls until completion and returns the result. It mirrors SyncRequestHandle.get.

func (*Handle) IterEvents

func (h *Handle) IterEvents(ctx context.Context, withLogs bool, interval time.Duration) iter.Seq2[status.Status, error]

IterEvents polls the request at the given interval, yielding each status until (and including) the Completed status. A non-nil error is yielded once and ends iteration; breaking early stops polling. It mirrors SyncRequestHandle.iter_events.

func (*Handle) Status

func (h *Handle) Status(ctx context.Context, withLogs bool) (status.Status, error)

Status fetches the current status of the request.

Jump to

Keyboard shortcuts

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