Documentation
¶
Index ¶
- Variables
- func NewNotFoundJob(jobID int64) *apierror.NotFound
- func NewNotFoundQueue(name string) *apierror.NotFound
- func NewNotFoundWorkflow(id string) *apierror.NotFound
- func NormalizePathPrefix(prefix string) string
- type ConcurrencyConfig
- type DB
- type PartitionConfig
- type RiverJob
- type RiverProducer
- type RiverQueue
- type Server
- type ServerOpts
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type ConcurrencyConfig ¶ added in v0.9.0
type ConcurrencyConfig struct {
GlobalLimit int32 `json:"global_limit"`
LocalLimit int32 `json:"local_limit"`
Partition PartitionConfig `json:"partition"`
}
type DB ¶
type DB interface {
Begin(ctx context.Context) (pgx.Tx, error)
Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
Query(ctx context.Context, query string, args ...interface{}) (pgx.Rows, error)
QueryRow(ctx context.Context, query string, args ...interface{}) pgx.Row
}
DB is the interface for a pgx database connection.
type PartitionConfig ¶ added in v0.9.0
type RiverJob ¶
type RiverJob struct {
ID int64 `json:"id"`
Args json.RawMessage `json:"args"`
Attempt int `json:"attempt"`
AttemptedAt *time.Time `json:"attempted_at"`
AttemptedBy []string `json:"attempted_by"`
CreatedAt time.Time `json:"created_at"`
Errors []rivertype.AttemptError `json:"errors"`
FinalizedAt *time.Time `json:"finalized_at"`
Kind string `json:"kind"`
MaxAttempts int `json:"max_attempts"`
Metadata json.RawMessage `json:"metadata"`
Priority int `json:"priority"`
Queue string `json:"queue"`
ScheduledAt time.Time `json:"scheduled_at"`
State string `json:"state"`
Tags []string `json:"tags"`
}
type RiverProducer ¶ added in v0.9.0
type RiverProducer struct {
ID int64 `json:"id"`
ClientID string `json:"client_id"`
Concurrency *ConcurrencyConfig `json:"concurrency"`
CreatedAt time.Time `json:"created_at"`
MaxWorkers int `json:"max_workers"`
PausedAt *time.Time `json:"paused_at"`
QueueName string `json:"queue_name"`
Running int32 `json:"running"`
UpdatedAt time.Time `json:"updated_at"`
}
type RiverQueue ¶
type RiverQueue struct {
CountAvailable int `json:"count_available"`
CountRunning int `json:"count_running"`
CreatedAt time.Time `json:"created_at"`
Concurrency *ConcurrencyConfig `json:"concurrency"`
Name string `json:"name"`
PausedAt *time.Time `json:"paused_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an HTTP server that serves the River UI and API. It must be started with Start to initialize caching and background query functionality prior to serving requests. Server implements http.Handler, so it can be directly mounted in an http.ServeMux.
func NewServer ¶
func NewServer(opts *ServerOpts) (*Server, error)
NewServer creates a new Server that serves the River UI and API.
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP returns an http.ServeHTTP that can be mounted to serve HTTP requests.
func (*Server) Start ¶
Start starts the server's background services. Notably, this does _not_ cause the server to start listening for HTTP in any way. To serve HTTP requests, the Server implements `http.Handler` via a `ServeHTTP` method and can be mounted in an existing `http.ServeMux`.
type ServerOpts ¶
type ServerOpts struct {
// Client is the River client to use for API requests.
Client *river.Client[pgx.Tx]
// DB is the database to use for API requests.
DB DB
// DevMode is whether the server is running in development mode.
DevMode bool
// LiveFS is whether to use the live filesystem for the frontend.
LiveFS bool
// Logger is the logger to use logging errors within the handler.
Logger *slog.Logger
// Prefix is the path prefix to use for the API and UI HTTP requests.
Prefix string
}
ServerOpts are the options for creating a new Server.
Source Files
¶
- embed.go
- handler.go
- handler_api_endpoint.go
- int64_string.go
- spa_response_writer.go