Documentation
¶
Overview ¶
Package server serves Blitz's API (proto/blitz/v1) over Connect: one process holding every workspace a user opens, each an engine.Workspace. Handlers translate between the protos and the engine; they hold no logic of their own.
Index ¶
- func RetryPings(ctx context.Context, r *pings.Recorder, every time.Duration)
- func Serve(ctx context.Context, l net.Listener, h http.Handler, grace time.Duration) error
- func ServePlain(ctx context.Context, l net.Listener, h http.Handler, grace time.Duration) error
- func ServeTLS(ctx context.Context, l net.Listener, h http.Handler, cfg *tls.Config, ...) error
- type Opener
- type Option
- type SchedulerConfig
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RetryPings ¶
RetryPings sends the pings that failed every interval until ctx ends (AI-12): a ping that waited out an outage goes within the hour.
func Serve ¶
Serve serves h on l (HTTP/1.1, and HTTP/2 without TLS for gRPC clients) until ctx is done, then stops accepting and waits up to grace for calls in progress.
func ServePlain ¶
ServePlain serves h on l without TLS, HTTP/1.1 and HTTP/2 in cleartext (h2c), until ctx is done, as ServeTLS does: for a listener behind a front end that ends TLS itself (spec_053_enterprise EN-03). It's Serve, named for the network listener.
func ServeTLS ¶
func ServeTLS(ctx context.Context, l net.Listener, h http.Handler, cfg *tls.Config, grace time.Duration) error
ServeTLS serves h on l over TLS with cfg (HTTP/2, and HTTP/1.1 for clients without it), as Serve does: the network listener of a service others reach (spec_053_enterprise EN-03).
Types ¶
type Opener ¶
Opener opens the workspace in dir, an absolute directory. The server calls it once per workspace; each call must build its own configuration, since a workspace owns and changes it.
type Option ¶
type Option func(*Server)
Option configures a Server.
func WithConfigDir ¶
WithConfigDir is the settings directory the service loads from ("" for the usual one, ~/.blitz), as the --config flag.
func WithLogDir ¶
WithLogDir is the directory of the service's diagnostic log, which ListLogDays and ReadLog read ("": none).
func WithScheduler ¶
func WithScheduler(c SchedulerConfig) Option
WithScheduler makes the server run enabled workers on their schedules (StartScheduler) and serve WorkerService.
func WithShutdown ¶
func WithShutdown(stop func()) Option
WithShutdown is what Shutdown calls to stop the service; without it the service can't be stopped that way.
func WithUse ¶
WithUse counts the front ends' use with r, once a day each (spec_054_active_installs AI-02): nil, or without it, nothing is counted.
func WithVersion ¶
WithVersion is the version GetServiceInfo reports ("dev" otherwise).
type SchedulerConfig ¶
type SchedulerConfig struct {
// Store says which workers are enabled; the Opener must give each
// workspace the same one (engine.Options.Workers).
Store *workers.Store
// Runs is where workspaces record finished runs (the same directory
// engine.Workspace uses), for looking runs up by ID.
Runs *workers.RunLog
// MaxConcurrent is how many runs may go at once (at least 1).
MaxConcurrent int
// Rescan is how often workers are rescanned, to pick up new, edited
// and removed WORKER.md files (0: a minute).
Rescan time.Duration
}
SchedulerConfig configures the service's worker scheduler.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds the open workspaces and serves the API.
func (*Server) Close ¶
Close closes every workspace, once those being opened are (they close themselves, seeing closed); none opens after it.
func (*Server) IdleFor ¶
IdleFor is how long the service has had nothing to do: no request in flight, no turn running in any workspace, no background run, eval run, health check or scheduled reflection going; 0 while it has.
func (*Server) OrgWorkspaceFor ¶
OrgWorkspaceFor is the organization's workspace at dir, asked as the workspace opens: its ID ("" when dir isn't one; each model call carries it, spec_053 EN-22), and why it's read-only ("" when it isn't): it's a clone the person is only a Viewer of (EN-60). When the service can't be reached it's what the service last said for dir (EN-37), else neither (a Viewer's push is refused there anyway).
func (*Server) StartScheduler ¶
StartScheduler runs workers on their schedules until ctx is done, which also stops the runs going then (as Close does). It does nothing without WithScheduler.
Source Files
¶
- agents.go
- background.go
- broker.go
- browserprofiles.go
- compose.go
- config.go
- connectors.go
- convert.go
- enterprise.go
- evalruns.go
- evals.go
- files.go
- globalconnectors.go
- guardrails.go
- health.go
- idle.go
- language.go
- listen.go
- mcp.go
- models.go
- orgfolders.go
- orgjobs.go
- orgpublish.go
- orgshare.go
- orgsync.go
- orgworkspaces.go
- personality.go
- pictures.go
- rules.go
- scheduler.go
- secrets.go
- server.go
- session.go
- signin.go
- skills.go
- skills_edit.go
- skillscenarios.go
- studio.go
- tasks.go
- terminal.go
- use.go
- voice.go
- worker.go
- workflowruns.go
- workflows.go
- workspace.go