Documentation ¶
Index ¶
- func Migrate(ctx context.Context, dsn string) error
- type AcquireAsyncCallRow
- type Artefact
- type AssociateArtefactWithDeploymentParams
- type AsyncCall
- type AsyncCallState
- type ConnI
- type Controller
- type ControllerState
- type CreateAsyncCallParams
- type CreateCronJobParams
- type CreateIngressRouteParams
- type CronJob
- type CronJobState
- type DB
- type DBI
- type DBTX
- type Deployment
- type DeploymentArtefact
- type EndCronJobRow
- type Event
- type EventType
- type FailAsyncCallWithRetryParams
- type FsmInstance
- type FsmStatus
- type GetActiveDeploymentSchemasRow
- type GetActiveDeploymentsRow
- type GetActiveIngressRoutesRow
- type GetActiveRunnersRow
- type GetArtefactDigestsRow
- type GetCronJobsRow
- type GetDeploymentArtefactsRow
- type GetDeploymentRow
- type GetDeploymentsNeedingReconciliationRow
- type GetDeploymentsWithArtefactsRow
- type GetDeploymentsWithMinReplicasRow
- type GetExistingDeploymentForModuleRow
- type GetIngressRoutesRow
- type GetLeaseInfoRow
- type GetNextEventForSubscriptionRow
- type GetProcessListRow
- type GetRandomSubscriberRow
- type GetRouteForRunnerRow
- type GetRoutingTableRow
- type GetRunnerRow
- type GetRunnersForDeploymentRow
- type GetStaleCronJobsRow
- type GetSubscriptionsNeedingUpdateRow
- type IngressRoute
- type InsertCallEventParams
- type InsertDeploymentCreatedEventParams
- type InsertDeploymentUpdatedEventParams
- type InsertEventParams
- type InsertLogEventParams
- type InsertSubscriberParams
- type Lease
- type Module
- type ModuleConfiguration
- type NullAsyncCallState
- type NullControllerState
- type NullCronJobState
- type NullEventType
- type NullFsmStatus
- type NullOrigin
- type NullRunnerState
- type NullTopicSubscriptionState
- type Origin
- type PublishEventForTopicParams
- type Querier
- type Queries
- func (q *Queries) AcquireAsyncCall(ctx context.Context, ttl time.Duration) (AcquireAsyncCallRow, error)
- func (q *Queries) AssociateArtefactWithDeployment(ctx context.Context, arg AssociateArtefactWithDeploymentParams) error
- func (q *Queries) BeginConsumingTopicEvent(ctx context.Context, subscription model.SubscriptionKey, ...) error
- func (q *Queries) CompleteEventForSubscription(ctx context.Context, name string, module string) error
- func (q *Queries) CreateArtefact(ctx context.Context, digest []byte, content []byte) (int64, error)
- func (q *Queries) CreateAsyncCall(ctx context.Context, arg CreateAsyncCallParams) (int64, error)
- func (q *Queries) CreateCronJob(ctx context.Context, arg CreateCronJobParams) error
- func (q *Queries) CreateDeployment(ctx context.Context, moduleName string, schema []byte, key model.DeploymentKey) error
- func (q *Queries) CreateIngressRoute(ctx context.Context, arg CreateIngressRouteParams) error
- func (q *Queries) CreateRequest(ctx context.Context, origin Origin, key model.RequestKey, sourceAddr string) error
- func (q *Queries) DeleteSubscribers(ctx context.Context, deployment model.DeploymentKey) error
- func (q *Queries) DeleteSubscriptions(ctx context.Context, deployment model.DeploymentKey) error
- func (q *Queries) DeregisterRunner(ctx context.Context, key model.RunnerKey) (int64, error)
- func (q *Queries) EndCronJob(ctx context.Context, nextExecution time.Time, key model.CronJobKey, ...) (EndCronJobRow, error)
- func (q *Queries) ExpireLeases(ctx context.Context) (int64, error)
- func (q *Queries) ExpireRunnerReservations(ctx context.Context) (int64, error)
- func (q *Queries) FailAsyncCall(ctx context.Context, error string, iD int64) (bool, error)
- func (q *Queries) FailAsyncCallWithRetry(ctx context.Context, arg FailAsyncCallWithRetryParams) (bool, error)
- func (q *Queries) FailFSMInstance(ctx context.Context, fsm schema.RefKey, key string) (bool, error)
- func (q *Queries) FinishFSMTransition(ctx context.Context, fsm schema.RefKey, key string) (bool, error)
- func (q *Queries) GetActiveControllers(ctx context.Context) ([]Controller, error)
- func (q *Queries) GetActiveDeploymentSchemas(ctx context.Context) ([]GetActiveDeploymentSchemasRow, error)
- func (q *Queries) GetActiveDeployments(ctx context.Context) ([]GetActiveDeploymentsRow, error)
- func (q *Queries) GetActiveIngressRoutes(ctx context.Context) ([]GetActiveIngressRoutesRow, error)
- func (q *Queries) GetActiveRunners(ctx context.Context) ([]GetActiveRunnersRow, error)
- func (q *Queries) GetArtefactContentRange(ctx context.Context, start int32, count int32, iD int64) ([]byte, error)
- func (q *Queries) GetArtefactDigests(ctx context.Context, digests [][]byte) ([]GetArtefactDigestsRow, error)
- func (q *Queries) GetCronJobs(ctx context.Context) ([]GetCronJobsRow, error)
- func (q *Queries) GetDeployment(ctx context.Context, key model.DeploymentKey) (GetDeploymentRow, error)
- func (q *Queries) GetDeploymentArtefacts(ctx context.Context, deploymentID int64) ([]GetDeploymentArtefactsRow, error)
- func (q *Queries) GetDeploymentsByID(ctx context.Context, ids []int64) ([]Deployment, error)
- func (q *Queries) GetDeploymentsNeedingReconciliation(ctx context.Context) ([]GetDeploymentsNeedingReconciliationRow, error)
- func (q *Queries) GetDeploymentsWithArtefacts(ctx context.Context, digests [][]byte, schema []byte, count int64) ([]GetDeploymentsWithArtefactsRow, error)
- func (q *Queries) GetDeploymentsWithMinReplicas(ctx context.Context) ([]GetDeploymentsWithMinReplicasRow, error)
- func (q *Queries) GetExistingDeploymentForModule(ctx context.Context, name string) (GetExistingDeploymentForModuleRow, error)
- func (q *Queries) GetFSMInstance(ctx context.Context, fsm schema.RefKey, key string) (FsmInstance, error)
- func (q *Queries) GetIdleRunners(ctx context.Context, labels []byte, limit int64) ([]Runner, error)
- func (q *Queries) GetIngressRoutes(ctx context.Context, method string) ([]GetIngressRoutesRow, error)
- func (q *Queries) GetLeaseInfo(ctx context.Context, key leases.Key) (GetLeaseInfoRow, error)
- func (q *Queries) GetModuleConfiguration(ctx context.Context, module optional.Option[string], name string) ([]byte, error)
- func (q *Queries) GetModulesByID(ctx context.Context, ids []int64) ([]Module, error)
- func (q *Queries) GetNextEventForSubscription(ctx context.Context, consumptionDelay time.Duration, topic model.TopicKey, ...) (GetNextEventForSubscriptionRow, error)
- func (q *Queries) GetProcessList(ctx context.Context) ([]GetProcessListRow, error)
- func (q *Queries) GetRandomSubscriber(ctx context.Context, key model.SubscriptionKey) (GetRandomSubscriberRow, error)
- func (q *Queries) GetRouteForRunner(ctx context.Context, key model.RunnerKey) (GetRouteForRunnerRow, error)
- func (q *Queries) GetRoutingTable(ctx context.Context, modules []string) ([]GetRoutingTableRow, error)
- func (q *Queries) GetRunner(ctx context.Context, key model.RunnerKey) (GetRunnerRow, error)
- func (q *Queries) GetRunnerState(ctx context.Context, key model.RunnerKey) (RunnerState, error)
- func (q *Queries) GetRunnersForDeployment(ctx context.Context, key model.DeploymentKey) ([]GetRunnersForDeploymentRow, error)
- func (q *Queries) GetSchemaForDeployment(ctx context.Context, key model.DeploymentKey) (*schema.Module, error)
- func (q *Queries) GetStaleCronJobs(ctx context.Context, dollar_1 time.Duration) ([]GetStaleCronJobsRow, error)
- func (q *Queries) GetSubscriptionsNeedingUpdate(ctx context.Context) ([]GetSubscriptionsNeedingUpdateRow, error)
- func (q *Queries) InsertCallEvent(ctx context.Context, arg InsertCallEventParams) error
- func (q *Queries) InsertDeploymentCreatedEvent(ctx context.Context, arg InsertDeploymentCreatedEventParams) error
- func (q *Queries) InsertDeploymentUpdatedEvent(ctx context.Context, arg InsertDeploymentUpdatedEventParams) error
- func (q *Queries) InsertEvent(ctx context.Context, arg InsertEventParams) error
- func (q *Queries) InsertLogEvent(ctx context.Context, arg InsertLogEventParams) error
- func (q *Queries) InsertSubscriber(ctx context.Context, arg InsertSubscriberParams) error
- func (q *Queries) KillStaleControllers(ctx context.Context, timeout time.Duration) (int64, error)
- func (q *Queries) KillStaleRunners(ctx context.Context, timeout time.Duration) (int64, error)
- func (q *Queries) ListModuleConfiguration(ctx context.Context) ([]ModuleConfiguration, error)
- func (q *Queries) LoadAsyncCall(ctx context.Context, id int64) (AsyncCall, error)
- func (q *Queries) NewLease(ctx context.Context, key leases.Key, ttl time.Duration, metadata []byte) (uuid.UUID, error)
- func (q *Queries) PublishEventForTopic(ctx context.Context, arg PublishEventForTopicParams) error
- func (q *Queries) ReleaseLease(ctx context.Context, idempotencyKey uuid.UUID, key leases.Key) (bool, error)
- func (q *Queries) RenewLease(ctx context.Context, ttl time.Duration, idempotencyKey uuid.UUID, ...) (bool, error)
- func (q *Queries) ReplaceDeployment(ctx context.Context, oldDeployment model.DeploymentKey, ...) (int64, error)
- func (q *Queries) ReserveRunner(ctx context.Context, reservationTimeout time.Time, ...) (Runner, error)
- func (q *Queries) SetDeploymentDesiredReplicas(ctx context.Context, key model.DeploymentKey, minReplicas int32) error
- func (q *Queries) SetModuleConfiguration(ctx context.Context, module optional.Option[string], name string, value []byte) error
- func (q *Queries) StartCronJobs(ctx context.Context, keys []string) ([]StartCronJobsRow, error)
- func (q *Queries) StartFSMTransition(ctx context.Context, arg StartFSMTransitionParams) (FsmInstance, error)
- func (q *Queries) SucceedAsyncCall(ctx context.Context, response []byte, iD int64) (bool, error)
- func (q *Queries) SucceedFSMInstance(ctx context.Context, fsm schema.RefKey, key string) (bool, error)
- func (q *Queries) UnsetModuleConfiguration(ctx context.Context, module optional.Option[string], name string) error
- func (q *Queries) UpsertController(ctx context.Context, key model.ControllerKey, endpoint string) (int64, error)
- func (q *Queries) UpsertModule(ctx context.Context, language string, name string) (int64, error)
- func (q *Queries) UpsertRunner(ctx context.Context, arg UpsertRunnerParams) (optional.Option[int64], error)
- func (q *Queries) UpsertSubscription(ctx context.Context, arg UpsertSubscriptionParams) error
- func (q *Queries) UpsertTopic(ctx context.Context, arg UpsertTopicParams) error
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type Request
- type Runner
- type RunnerState
- type StartCronJobsRow
- type StartFSMTransitionParams
- type Topic
- type TopicEvent
- type TopicSubscriber
- type TopicSubscription
- type TopicSubscriptionState
- type Tx
- type Type
- type UpsertRunnerParams
- type UpsertSubscriptionParams
- type UpsertTopicParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AcquireAsyncCallRow ¶ added in v0.191.0
type AssociateArtefactWithDeploymentParams ¶
type AssociateArtefactWithDeploymentParams struct { Key model.DeploymentKey ArtefactID int64 Executable bool Path string }
type AsyncCallState ¶ added in v0.191.0
type AsyncCallState string
const ( AsyncCallStatePending AsyncCallState = "pending" AsyncCallStateExecuting AsyncCallState = "executing" AsyncCallStateSuccess AsyncCallState = "success" AsyncCallStateError AsyncCallState = "error" )
func (*AsyncCallState) Scan ¶ added in v0.191.0
func (e *AsyncCallState) Scan(src interface{}) error
type Controller ¶
type Controller struct { ID int64 Key model.ControllerKey Created time.Time LastSeen time.Time State ControllerState Endpoint string }
type ControllerState ¶
type ControllerState string
const ( ControllerStateLive ControllerState = "live" ControllerStateDead ControllerState = "dead" )
func (*ControllerState) Scan ¶
func (e *ControllerState) Scan(src interface{}) error
type CreateAsyncCallParams ¶ added in v0.229.0
type CreateCronJobParams ¶ added in v0.167.0
type CronJobState ¶ added in v0.167.0
type CronJobState string
const ( CronJobStateIdle CronJobState = "idle" CronJobStateExecuting CronJobState = "executing" )
func (*CronJobState) Scan ¶ added in v0.167.0
func (e *CronJobState) Scan(src interface{}) error
type Deployment ¶
type DeploymentArtefact ¶
type EndCronJobRow ¶ added in v0.167.0
type EndCronJobRow struct { Key model.CronJobKey DeploymentKey model.DeploymentKey Module string Verb string Schedule string StartTime time.Time NextExecution time.Time State model.CronJobState }
type FailAsyncCallWithRetryParams ¶ added in v0.229.0
type FsmInstance ¶ added in v0.226.0
type GetActiveDeploymentSchemasRow ¶ added in v0.79.3
type GetActiveDeploymentSchemasRow struct { Key model.DeploymentKey Schema *schema.Module }
type GetActiveDeploymentsRow ¶ added in v0.79.3
type GetActiveDeploymentsRow struct { Deployment Deployment ModuleName string Language string Replicas int64 }
type GetActiveIngressRoutesRow ¶ added in v0.177.2
type GetActiveRunnersRow ¶
type GetArtefactDigestsRow ¶
type GetCronJobsRow ¶ added in v0.167.0
type GetCronJobsRow struct { Key model.CronJobKey DeploymentKey model.DeploymentKey Module string Verb string Schedule string StartTime time.Time NextExecution time.Time State model.CronJobState }
type GetDeploymentRow ¶
type GetDeploymentRow struct { Deployment Deployment Language string ModuleName string MinReplicas int32 }
type GetDeploymentsWithMinReplicasRow ¶ added in v0.163.10
type GetDeploymentsWithMinReplicasRow struct { Deployment Deployment ModuleName string Language string }
type GetIngressRoutesRow ¶
type GetLeaseInfoRow ¶ added in v0.263.0
type GetNextEventForSubscriptionRow ¶ added in v0.241.0
type GetProcessListRow ¶
type GetRandomSubscriberRow ¶ added in v0.245.0
type GetRouteForRunnerRow ¶
type GetRoutingTableRow ¶
type GetRunnerRow ¶
type GetRunnersForDeploymentRow ¶
type GetRunnersForDeploymentRow struct { ID int64 Key model.RunnerKey Created time.Time LastSeen time.Time ReservationTimeout optional.Option[time.Time] State RunnerState Endpoint string ModuleName optional.Option[string] DeploymentID optional.Option[int64] Labels []byte ID_2 int64 CreatedAt time.Time ModuleID int64 Key_2 model.DeploymentKey Schema *schema.Module Labels_2 []byte MinReplicas int32 }
type GetStaleCronJobsRow ¶ added in v0.167.0
type GetStaleCronJobsRow struct { Key model.CronJobKey DeploymentKey model.DeploymentKey Module string Verb string Schedule string StartTime time.Time NextExecution time.Time State model.CronJobState }
type GetSubscriptionsNeedingUpdateRow ¶ added in v0.241.0
type GetSubscriptionsNeedingUpdateRow struct { Key model.SubscriptionKey Cursor optional.Option[model.TopicEventKey] Topic model.TopicKey Name string }
type IngressRoute ¶
type InsertCallEventParams ¶
type InsertCallEventParams struct { DeploymentKey model.DeploymentKey RequestKey optional.Option[string] TimeStamp time.Time SourceModule optional.Option[string] SourceVerb optional.Option[string] DestModule string DestVerb string DurationMs int64 Request []byte Response []byte Error optional.Option[string] Stack optional.Option[string] }
type InsertDeploymentCreatedEventParams ¶
type InsertDeploymentCreatedEventParams struct { DeploymentKey model.DeploymentKey Language string ModuleName string MinReplicas int32 Replaced optional.Option[model.DeploymentKey] }
type InsertEventParams ¶
type InsertLogEventParams ¶
type InsertSubscriberParams ¶ added in v0.233.0
type ModuleConfiguration ¶ added in v0.231.0
type NullAsyncCallState ¶ added in v0.191.0
type NullAsyncCallState struct { AsyncCallState AsyncCallState Valid bool // Valid is true if AsyncCallState is not NULL }
func (*NullAsyncCallState) Scan ¶ added in v0.191.0
func (ns *NullAsyncCallState) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullControllerState ¶
type NullControllerState struct { ControllerState ControllerState Valid bool // Valid is true if ControllerState is not NULL }
func (*NullControllerState) Scan ¶
func (ns *NullControllerState) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullCronJobState ¶ added in v0.167.0
type NullCronJobState struct { CronJobState CronJobState Valid bool // Valid is true if CronJobState is not NULL }
func (*NullCronJobState) Scan ¶ added in v0.167.0
func (ns *NullCronJobState) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullEventType ¶
type NullEventType struct { EventType EventType Valid bool // Valid is true if EventType is not NULL }
func (*NullEventType) Scan ¶
func (ns *NullEventType) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullFsmStatus ¶ added in v0.191.0
type NullFsmStatus struct { FsmStatus FsmStatus Valid bool // Valid is true if FsmStatus is not NULL }
func (*NullFsmStatus) Scan ¶ added in v0.191.0
func (ns *NullFsmStatus) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullOrigin ¶
func (*NullOrigin) Scan ¶
func (ns *NullOrigin) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullRunnerState ¶
type NullRunnerState struct { RunnerState RunnerState Valid bool // Valid is true if RunnerState is not NULL }
func (*NullRunnerState) Scan ¶
func (ns *NullRunnerState) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullTopicSubscriptionState ¶ added in v0.241.0
type NullTopicSubscriptionState struct { TopicSubscriptionState TopicSubscriptionState Valid bool // Valid is true if TopicSubscriptionState is not NULL }
func (*NullTopicSubscriptionState) Scan ¶ added in v0.241.0
func (ns *NullTopicSubscriptionState) Scan(value interface{}) error
Scan implements the Scanner interface.
type PublishEventForTopicParams ¶ added in v0.239.0
type PublishEventForTopicParams struct { Key model.TopicEventKey Module string Topic string Payload []byte }
type Querier ¶
type Querier interface { // Reserve a pending async call for execution, returning the associated lease // reservation key. AcquireAsyncCall(ctx context.Context, ttl time.Duration) (AcquireAsyncCallRow, error) AssociateArtefactWithDeployment(ctx context.Context, arg AssociateArtefactWithDeploymentParams) error BeginConsumingTopicEvent(ctx context.Context, subscription model.SubscriptionKey, event model.TopicEventKey) error CompleteEventForSubscription(ctx context.Context, name string, module string) error // Create a new artefact and return the artefact ID. CreateArtefact(ctx context.Context, digest []byte, content []byte) (int64, error) CreateAsyncCall(ctx context.Context, arg CreateAsyncCallParams) (int64, error) CreateCronJob(ctx context.Context, arg CreateCronJobParams) error CreateDeployment(ctx context.Context, moduleName string, schema []byte, key model.DeploymentKey) error CreateIngressRoute(ctx context.Context, arg CreateIngressRouteParams) error CreateRequest(ctx context.Context, origin Origin, key model.RequestKey, sourceAddr string) error DeleteSubscribers(ctx context.Context, deployment model.DeploymentKey) error DeleteSubscriptions(ctx context.Context, deployment model.DeploymentKey) error DeregisterRunner(ctx context.Context, key model.RunnerKey) (int64, error) EndCronJob(ctx context.Context, nextExecution time.Time, key model.CronJobKey, startTime time.Time) (EndCronJobRow, error) ExpireLeases(ctx context.Context) (int64, error) ExpireRunnerReservations(ctx context.Context) (int64, error) FailAsyncCall(ctx context.Context, error string, iD int64) (bool, error) FailAsyncCallWithRetry(ctx context.Context, arg FailAsyncCallWithRetryParams) (bool, error) FailFSMInstance(ctx context.Context, fsm schema.RefKey, key string) (bool, error) // Mark an FSM transition as completed, updating the current state and clearing the async call ID. FinishFSMTransition(ctx context.Context, fsm schema.RefKey, key string) (bool, error) GetActiveControllers(ctx context.Context) ([]Controller, error) GetActiveDeploymentSchemas(ctx context.Context) ([]GetActiveDeploymentSchemasRow, error) GetActiveDeployments(ctx context.Context) ([]GetActiveDeploymentsRow, error) GetActiveIngressRoutes(ctx context.Context) ([]GetActiveIngressRoutesRow, error) GetActiveRunners(ctx context.Context) ([]GetActiveRunnersRow, error) GetArtefactContentRange(ctx context.Context, start int32, count int32, iD int64) ([]byte, error) // Return the digests that exist in the database. GetArtefactDigests(ctx context.Context, digests [][]byte) ([]GetArtefactDigestsRow, error) GetCronJobs(ctx context.Context) ([]GetCronJobsRow, error) GetDeployment(ctx context.Context, key model.DeploymentKey) (GetDeploymentRow, error) // Get all artefacts matching the given digests. GetDeploymentArtefacts(ctx context.Context, deploymentID int64) ([]GetDeploymentArtefactsRow, error) GetDeploymentsByID(ctx context.Context, ids []int64) ([]Deployment, error) // Get deployments that have a mismatch between the number of assigned and required replicas. GetDeploymentsNeedingReconciliation(ctx context.Context) ([]GetDeploymentsNeedingReconciliationRow, error) // Get all deployments that have artefacts matching the given digests. GetDeploymentsWithArtefacts(ctx context.Context, digests [][]byte, schema []byte, count int64) ([]GetDeploymentsWithArtefactsRow, error) GetDeploymentsWithMinReplicas(ctx context.Context) ([]GetDeploymentsWithMinReplicasRow, error) GetExistingDeploymentForModule(ctx context.Context, name string) (GetExistingDeploymentForModuleRow, error) GetFSMInstance(ctx context.Context, fsm schema.RefKey, key string) (FsmInstance, error) GetIdleRunners(ctx context.Context, labels []byte, limit int64) ([]Runner, error) // Get the runner endpoints corresponding to the given ingress route. GetIngressRoutes(ctx context.Context, method string) ([]GetIngressRoutesRow, error) GetLeaseInfo(ctx context.Context, key leases.Key) (GetLeaseInfoRow, error) GetModuleConfiguration(ctx context.Context, module optional.Option[string], name string) ([]byte, error) GetModulesByID(ctx context.Context, ids []int64) ([]Module, error) GetNextEventForSubscription(ctx context.Context, consumptionDelay time.Duration, topic model.TopicKey, cursor optional.Option[model.TopicEventKey]) (GetNextEventForSubscriptionRow, error) GetProcessList(ctx context.Context) ([]GetProcessListRow, error) GetRandomSubscriber(ctx context.Context, key model.SubscriptionKey) (GetRandomSubscriberRow, error) // Retrieve routing information for a runner. GetRouteForRunner(ctx context.Context, key model.RunnerKey) (GetRouteForRunnerRow, error) GetRoutingTable(ctx context.Context, modules []string) ([]GetRoutingTableRow, error) GetRunner(ctx context.Context, key model.RunnerKey) (GetRunnerRow, error) GetRunnerState(ctx context.Context, key model.RunnerKey) (RunnerState, error) GetRunnersForDeployment(ctx context.Context, key model.DeploymentKey) ([]GetRunnersForDeploymentRow, error) GetSchemaForDeployment(ctx context.Context, key model.DeploymentKey) (*schema.Module, error) GetStaleCronJobs(ctx context.Context, dollar_1 time.Duration) ([]GetStaleCronJobsRow, error) // Results may not be ready to be scheduled yet due to event consumption delay // Sorting ensures that brand new events (that may not be ready for consumption) // don't prevent older events from being consumed GetSubscriptionsNeedingUpdate(ctx context.Context) ([]GetSubscriptionsNeedingUpdateRow, error) InsertCallEvent(ctx context.Context, arg InsertCallEventParams) error InsertDeploymentCreatedEvent(ctx context.Context, arg InsertDeploymentCreatedEventParams) error InsertDeploymentUpdatedEvent(ctx context.Context, arg InsertDeploymentUpdatedEventParams) error InsertEvent(ctx context.Context, arg InsertEventParams) error InsertLogEvent(ctx context.Context, arg InsertLogEventParams) error InsertSubscriber(ctx context.Context, arg InsertSubscriberParams) error // Mark any controller entries that haven't been updated recently as dead. KillStaleControllers(ctx context.Context, timeout time.Duration) (int64, error) KillStaleRunners(ctx context.Context, timeout time.Duration) (int64, error) ListModuleConfiguration(ctx context.Context) ([]ModuleConfiguration, error) LoadAsyncCall(ctx context.Context, id int64) (AsyncCall, error) NewLease(ctx context.Context, key leases.Key, ttl time.Duration, metadata []byte) (uuid.UUID, error) PublishEventForTopic(ctx context.Context, arg PublishEventForTopicParams) error ReleaseLease(ctx context.Context, idempotencyKey uuid.UUID, key leases.Key) (bool, error) RenewLease(ctx context.Context, ttl time.Duration, idempotencyKey uuid.UUID, key leases.Key) (bool, error) ReplaceDeployment(ctx context.Context, oldDeployment model.DeploymentKey, newDeployment model.DeploymentKey, minReplicas int32) (int64, error) // Find an idle runner and reserve it for the given deployment. ReserveRunner(ctx context.Context, reservationTimeout time.Time, deploymentKey model.DeploymentKey, labels []byte) (Runner, error) SetDeploymentDesiredReplicas(ctx context.Context, key model.DeploymentKey, minReplicas int32) error SetModuleConfiguration(ctx context.Context, module optional.Option[string], name string, value []byte) error StartCronJobs(ctx context.Context, keys []string) ([]StartCronJobsRow, error) // Start a new FSM transition, populating the destination state and async call ID. // // "key" is the unique identifier for the FSM execution. StartFSMTransition(ctx context.Context, arg StartFSMTransitionParams) (FsmInstance, error) SucceedAsyncCall(ctx context.Context, response []byte, iD int64) (bool, error) SucceedFSMInstance(ctx context.Context, fsm schema.RefKey, key string) (bool, error) UnsetModuleConfiguration(ctx context.Context, module optional.Option[string], name string) error UpsertController(ctx context.Context, key model.ControllerKey, endpoint string) (int64, error) UpsertModule(ctx context.Context, language string, name string) (int64, error) // Upsert a runner and return the deployment ID that it is assigned to, if any. // If the deployment key is null, then deployment_rel.id will be null, // otherwise we try to retrieve the deployments.id using the key. If // there is no corresponding deployment, then the deployment ID is -1 // and the parent statement will fail due to a foreign key constraint. UpsertRunner(ctx context.Context, arg UpsertRunnerParams) (optional.Option[int64], error) UpsertSubscription(ctx context.Context, arg UpsertSubscriptionParams) error UpsertTopic(ctx context.Context, arg UpsertTopicParams) error }
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) AcquireAsyncCall ¶ added in v0.191.0
func (q *Queries) AcquireAsyncCall(ctx context.Context, ttl time.Duration) (AcquireAsyncCallRow, error)
Reserve a pending async call for execution, returning the associated lease reservation key.
func (*Queries) AssociateArtefactWithDeployment ¶
func (q *Queries) AssociateArtefactWithDeployment(ctx context.Context, arg AssociateArtefactWithDeploymentParams) error
func (*Queries) BeginConsumingTopicEvent ¶ added in v0.241.0
func (q *Queries) BeginConsumingTopicEvent(ctx context.Context, subscription model.SubscriptionKey, event model.TopicEventKey) error
func (*Queries) CompleteEventForSubscription ¶ added in v0.241.0
func (*Queries) CreateArtefact ¶
Create a new artefact and return the artefact ID.
func (*Queries) CreateAsyncCall ¶ added in v0.226.0
func (*Queries) CreateCronJob ¶ added in v0.167.0
func (q *Queries) CreateCronJob(ctx context.Context, arg CreateCronJobParams) error
func (*Queries) CreateDeployment ¶
func (*Queries) CreateIngressRoute ¶
func (q *Queries) CreateIngressRoute(ctx context.Context, arg CreateIngressRouteParams) error
func (*Queries) CreateRequest ¶ added in v0.167.0
func (*Queries) DeleteSubscribers ¶ added in v0.259.1
func (*Queries) DeleteSubscriptions ¶ added in v0.259.1
func (*Queries) DeregisterRunner ¶
func (*Queries) EndCronJob ¶ added in v0.167.0
func (*Queries) ExpireLeases ¶ added in v0.186.0
func (*Queries) ExpireRunnerReservations ¶
func (*Queries) FailAsyncCall ¶ added in v0.226.0
func (*Queries) FailAsyncCallWithRetry ¶ added in v0.229.0
func (*Queries) FailFSMInstance ¶ added in v0.226.0
func (*Queries) FinishFSMTransition ¶ added in v0.226.0
func (q *Queries) FinishFSMTransition(ctx context.Context, fsm schema.RefKey, key string) (bool, error)
Mark an FSM transition as completed, updating the current state and clearing the async call ID.
func (*Queries) GetActiveControllers ¶ added in v0.177.2
func (q *Queries) GetActiveControllers(ctx context.Context) ([]Controller, error)
func (*Queries) GetActiveDeploymentSchemas ¶ added in v0.79.3
func (q *Queries) GetActiveDeploymentSchemas(ctx context.Context) ([]GetActiveDeploymentSchemasRow, error)
func (*Queries) GetActiveDeployments ¶ added in v0.79.3
func (q *Queries) GetActiveDeployments(ctx context.Context) ([]GetActiveDeploymentsRow, error)
func (*Queries) GetActiveIngressRoutes ¶ added in v0.177.2
func (q *Queries) GetActiveIngressRoutes(ctx context.Context) ([]GetActiveIngressRoutesRow, error)
func (*Queries) GetActiveRunners ¶
func (q *Queries) GetActiveRunners(ctx context.Context) ([]GetActiveRunnersRow, error)
func (*Queries) GetArtefactContentRange ¶
func (*Queries) GetArtefactDigests ¶
func (q *Queries) GetArtefactDigests(ctx context.Context, digests [][]byte) ([]GetArtefactDigestsRow, error)
Return the digests that exist in the database.
func (*Queries) GetCronJobs ¶ added in v0.167.0
func (q *Queries) GetCronJobs(ctx context.Context) ([]GetCronJobsRow, error)
func (*Queries) GetDeployment ¶
func (q *Queries) GetDeployment(ctx context.Context, key model.DeploymentKey) (GetDeploymentRow, error)
func (*Queries) GetDeploymentArtefacts ¶
func (q *Queries) GetDeploymentArtefacts(ctx context.Context, deploymentID int64) ([]GetDeploymentArtefactsRow, error)
Get all artefacts matching the given digests.
func (*Queries) GetDeploymentsByID ¶
func (*Queries) GetDeploymentsNeedingReconciliation ¶
func (q *Queries) GetDeploymentsNeedingReconciliation(ctx context.Context) ([]GetDeploymentsNeedingReconciliationRow, error)
Get deployments that have a mismatch between the number of assigned and required replicas.
func (*Queries) GetDeploymentsWithArtefacts ¶
func (q *Queries) GetDeploymentsWithArtefacts(ctx context.Context, digests [][]byte, schema []byte, count int64) ([]GetDeploymentsWithArtefactsRow, error)
Get all deployments that have artefacts matching the given digests.
func (*Queries) GetDeploymentsWithMinReplicas ¶ added in v0.163.10
func (q *Queries) GetDeploymentsWithMinReplicas(ctx context.Context) ([]GetDeploymentsWithMinReplicasRow, error)
func (*Queries) GetExistingDeploymentForModule ¶
func (*Queries) GetFSMInstance ¶ added in v0.226.0
func (*Queries) GetIdleRunners ¶
func (*Queries) GetIngressRoutes ¶
func (q *Queries) GetIngressRoutes(ctx context.Context, method string) ([]GetIngressRoutesRow, error)
Get the runner endpoints corresponding to the given ingress route.
func (*Queries) GetLeaseInfo ¶ added in v0.263.0
func (*Queries) GetModuleConfiguration ¶ added in v0.231.0
func (*Queries) GetModulesByID ¶
func (*Queries) GetNextEventForSubscription ¶ added in v0.241.0
func (*Queries) GetProcessList ¶
func (q *Queries) GetProcessList(ctx context.Context) ([]GetProcessListRow, error)
func (*Queries) GetRandomSubscriber ¶ added in v0.245.0
func (q *Queries) GetRandomSubscriber(ctx context.Context, key model.SubscriptionKey) (GetRandomSubscriberRow, error)
func (*Queries) GetRouteForRunner ¶
func (q *Queries) GetRouteForRunner(ctx context.Context, key model.RunnerKey) (GetRouteForRunnerRow, error)
Retrieve routing information for a runner.
func (*Queries) GetRoutingTable ¶
func (*Queries) GetRunnerState ¶
func (*Queries) GetRunnersForDeployment ¶
func (q *Queries) GetRunnersForDeployment(ctx context.Context, key model.DeploymentKey) ([]GetRunnersForDeploymentRow, error)
func (*Queries) GetSchemaForDeployment ¶ added in v0.259.1
func (*Queries) GetStaleCronJobs ¶ added in v0.167.0
func (*Queries) GetSubscriptionsNeedingUpdate ¶ added in v0.241.0
func (q *Queries) GetSubscriptionsNeedingUpdate(ctx context.Context) ([]GetSubscriptionsNeedingUpdateRow, error)
Results may not be ready to be scheduled yet due to event consumption delay Sorting ensures that brand new events (that may not be ready for consumption) don't prevent older events from being consumed
func (*Queries) InsertCallEvent ¶
func (q *Queries) InsertCallEvent(ctx context.Context, arg InsertCallEventParams) error
func (*Queries) InsertDeploymentCreatedEvent ¶
func (q *Queries) InsertDeploymentCreatedEvent(ctx context.Context, arg InsertDeploymentCreatedEventParams) error
func (*Queries) InsertDeploymentUpdatedEvent ¶
func (q *Queries) InsertDeploymentUpdatedEvent(ctx context.Context, arg InsertDeploymentUpdatedEventParams) error
func (*Queries) InsertEvent ¶
func (q *Queries) InsertEvent(ctx context.Context, arg InsertEventParams) error
func (*Queries) InsertLogEvent ¶
func (q *Queries) InsertLogEvent(ctx context.Context, arg InsertLogEventParams) error
func (*Queries) InsertSubscriber ¶ added in v0.233.0
func (q *Queries) InsertSubscriber(ctx context.Context, arg InsertSubscriberParams) error
func (*Queries) KillStaleControllers ¶
Mark any controller entries that haven't been updated recently as dead.
func (*Queries) KillStaleRunners ¶
func (*Queries) ListModuleConfiguration ¶ added in v0.231.0
func (q *Queries) ListModuleConfiguration(ctx context.Context) ([]ModuleConfiguration, error)
func (*Queries) LoadAsyncCall ¶ added in v0.194.0
func (*Queries) PublishEventForTopic ¶ added in v0.239.0
func (q *Queries) PublishEventForTopic(ctx context.Context, arg PublishEventForTopicParams) error
func (*Queries) ReleaseLease ¶ added in v0.186.0
func (*Queries) RenewLease ¶ added in v0.186.0
func (*Queries) ReplaceDeployment ¶
func (q *Queries) ReplaceDeployment(ctx context.Context, oldDeployment model.DeploymentKey, newDeployment model.DeploymentKey, minReplicas int32) (int64, error)
func (*Queries) ReserveRunner ¶
func (q *Queries) ReserveRunner(ctx context.Context, reservationTimeout time.Time, deploymentKey model.DeploymentKey, labels []byte) (Runner, error)
Find an idle runner and reserve it for the given deployment.
func (*Queries) SetDeploymentDesiredReplicas ¶
func (*Queries) SetModuleConfiguration ¶ added in v0.231.0
func (*Queries) StartCronJobs ¶ added in v0.167.0
func (*Queries) StartFSMTransition ¶ added in v0.226.0
func (q *Queries) StartFSMTransition(ctx context.Context, arg StartFSMTransitionParams) (FsmInstance, error)
Start a new FSM transition, populating the destination state and async call ID.
"key" is the unique identifier for the FSM execution.
func (*Queries) SucceedAsyncCall ¶ added in v0.226.0
func (*Queries) SucceedFSMInstance ¶ added in v0.226.0
func (*Queries) UnsetModuleConfiguration ¶ added in v0.231.0
func (*Queries) UpsertController ¶
func (*Queries) UpsertModule ¶
func (*Queries) UpsertRunner ¶
func (q *Queries) UpsertRunner(ctx context.Context, arg UpsertRunnerParams) (optional.Option[int64], error)
Upsert a runner and return the deployment ID that it is assigned to, if any. If the deployment key is null, then deployment_rel.id will be null, otherwise we try to retrieve the deployments.id using the key. If there is no corresponding deployment, then the deployment ID is -1 and the parent statement will fail due to a foreign key constraint.
func (*Queries) UpsertSubscription ¶ added in v0.233.0
func (q *Queries) UpsertSubscription(ctx context.Context, arg UpsertSubscriptionParams) error
func (*Queries) UpsertTopic ¶ added in v0.233.0
func (q *Queries) UpsertTopic(ctx context.Context, arg UpsertTopicParams) error
type Request ¶
type Request struct { ID int64 Origin Origin Key model.RequestKey SourceAddr string }
type RunnerState ¶
type RunnerState string
const ( RunnerStateIdle RunnerState = "idle" RunnerStateReserved RunnerState = "reserved" RunnerStateAssigned RunnerState = "assigned" RunnerStateDead RunnerState = "dead" )
func (*RunnerState) Scan ¶
func (e *RunnerState) Scan(src interface{}) error
type StartCronJobsRow ¶ added in v0.167.0
type StartCronJobsRow struct { Key model.CronJobKey DeploymentKey model.DeploymentKey Module string Verb string Schedule string StartTime time.Time NextExecution time.Time State model.CronJobState HasMinReplicas bool Updated bool }
type StartFSMTransitionParams ¶ added in v0.226.0
type TopicEvent ¶ added in v0.159.1
type TopicSubscriber ¶ added in v0.159.1
type TopicSubscription ¶ added in v0.159.1
type TopicSubscriptionState ¶ added in v0.241.0
type TopicSubscriptionState string
const ( TopicSubscriptionStateIdle TopicSubscriptionState = "idle" TopicSubscriptionStateExecuting TopicSubscriptionState = "executing" )
func (*TopicSubscriptionState) Scan ¶ added in v0.241.0
func (e *TopicSubscriptionState) Scan(src interface{}) error
type Tx ¶
type Tx struct { *Queries // contains filtered or unexported fields }
func (*Tx) CommitOrRollback ¶
CommitOrRollback can be used in a defer statement to commit or rollback a transaction depending on whether the enclosing function returned an error.
func myFunc() (err error) { tx, err := db.Begin(ctx) if err != nil { return err } defer tx.CommitOrRollback(ctx, &err) ... }
type Type ¶ added in v0.226.0
Type is a database adapter type for schema.Type.
It encodes to/from the protobuf representation of a Type.
type UpsertRunnerParams ¶
type UpsertRunnerParams struct { Key model.RunnerKey Endpoint string State RunnerState Labels []byte DeploymentKey optional.Option[model.DeploymentKey] }
type UpsertSubscriptionParams ¶ added in v0.233.0
type UpsertSubscriptionParams struct { Key model.SubscriptionKey TopicModule string TopicName string Module string Deployment model.DeploymentKey Name string }