Documentation
¶
Overview ¶
Package server is the HTTP surface of the store: the store plane that the node daemon and the jj backend call, and the control plane of the caller.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.5.0
type Config struct {
Meta meta.Store
Bucket bucket.Store
Verifier *grant.Verifier
Logger *slog.Logger
// Now is the clock of grant expiry and the root commit. It defaults to time.Now.
Now func() time.Time
// Events tunes the delivery and the retention of ref events. Zero values take the defaults.
Events EventsConfig
// Lands tunes the batched land. Zero values take the defaults.
Lands LandsConfig
}
Config is the dependencies of a Server. New builds the object service from Meta and Bucket, so every composition shares one graph.
type EventsConfig ¶ added in v0.6.0
type EventsConfig struct {
// Retention is how long an event is kept. Default 14 days.
Retention time.Duration
// Poll is the wait between passes over the subscriptions. Default 1 second.
Poll time.Duration
// Lease is the time that one replica holds a subscription before it must renew. Default 30 seconds. The clocks
// of the replicas must differ by much less.
Lease time.Duration
// Timeout is the time limit of one delivery request. Default 10 seconds.
Timeout time.Duration
// MaxBackoff is the longest wait between two attempts of one event. Default 5 minutes.
MaxBackoff time.Duration
// Instance names the replica in the lease. Default random.
Instance string
// HTTP sends the deliveries. It follows no redirect. Default a new client.
HTTP *http.Client
// Clock times every wait and every lease. Default the real clock.
Clock clock.Clock
}
EventsConfig tunes the delivery and the retention of ref events. A zero field takes its default.
type LandsConfig ¶ added in v0.6.0
type LandsConfig struct {
// Lease is the time that a leader holds a ref before it must renew. Default 10 seconds. The clocks of the replicas
// must differ by much less.
Lease time.Duration
// Poll is the wait between two reads of the queue by a waiting request, and the wait of an idle leader. Default 50
// milliseconds.
Poll time.Duration
// Timeout is how long a request waits for its result. Default 30 seconds.
Timeout time.Duration
// MaxBatch is the most lands that one ref move holds. Default 256.
MaxBatch int
}
LandsConfig tunes the batched land. A zero field takes its default.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func New ¶ added in v0.5.0
New returns a Server over the metadata of cfg.Meta and the object store cfg.Bucket.
func (*Server) Handler ¶
Handler returns the handler of every route. An unknown path or method answers with the error envelope.
func (*Server) Run ¶ added in v0.6.0
Run delivers ref events to the subscriptions and prunes old events until ctx ends. A ref write of this replica wakes it at once; the poll finds the writes of other replicas. A worker sends one partition of one subscription while it holds that lease, so replicas deliver different partitions of a subscription in parallel. Run waits for its workers before it returns.