Documentation
¶
Index ¶
Constants ¶
View Source
const (
ResponseAcknowlegeDeadline = time.Second * 5
)
View Source
const (
WorkerHeartbeatInterval = 10 * time.Second
)
Variables ¶
View Source
var ErrTooManyConnections = fmt.Errorf("too many connections")
View Source
var ErrUnauthenticated = fmt.Errorf("authentication failed")
Functions ¶
func NewWorkerPool ¶
Types ¶
type ConnectionState ¶
type ConnectionState string
const ( ConnectionStateConnecting ConnectionState = "CONNECTING" ConnectionStateActive ConnectionState = "ACTIVE" ConnectionStatePaused ConnectionState = "PAUSED" ConnectionStateReconnecting ConnectionState = "RECONNECTING" ConnectionStateClosing ConnectionState = "CLOSING" ConnectionStateClosed ConnectionState = "CLOSED" )
type FunctionInvoker ¶
type FunctionInvoker interface {
InvokeFunction(ctx context.Context, slug string, stepId *string, request sdkrequest.Request) (any, []state.GeneratorOpcode, error)
}
type Opts ¶
type Opts struct {
AppName string
Env *string
Functions []sdk.SDKFunction
Capabilities sdk.Capabilities
HashedSigningKey []byte
HashedSigningKeyFallback []byte
MaxConcurrency int
APIBaseUrl string
IsDev bool
DevServerUrl string
AppVersion *string
InstanceID *string
Platform *string
SDKVersion string
SDKLanguage string
RewriteGatewayEndpoint func(endpoint url.URL) (url.URL, error)
}
type WorkerConnection ¶
type WorkerConnection interface {
// State returns the current connection state.
State() ConnectionState
// Close connection gracefully.
Close() error
}
func Connect ¶
func Connect(ctx context.Context, opts Opts, invoker FunctionInvoker, logger *slog.Logger) (WorkerConnection, error)
Click to show internal directories.
Click to hide internal directories.