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 CompactionConfig ¶ added in v0.10.0
type CompactionConfig struct {
// Interval is the wait between passes over the repositories. Default 30 seconds.
Interval time.Duration
// Grace is how long a retired pack or layer file stays before it is deleted. Default one hour.
Grace time.Duration
}
CompactionConfig tunes Compact.
type Config ¶ added in v0.5.0
type Config struct {
Meta meta.Store
Bucket bucket.Store
Verifier *grant.Verifier
// Identity, when set, authenticates a person on the git routes and the creation of a repository. A grant is tried
// first, then Identity, then the per-user tokens of Meta.
Identity identity.Authenticator
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
// Compaction tunes Compact. Zero values take the defaults.
Compaction CompactionConfig
// Warm makes the server answer /ready with 503 until Warm has opened every pack index.
Warm bool
// Clock paces the retry of Warm. It defaults to the real clock.
Clock clock.Clock
}
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) Compact ¶ added in v0.10.0
Compact runs maintenance of the packs and layers of every repository until ctx ends: it compacts packs, merges layers and deletes retired files. Run it on the writer only. A pass that fails is logged and tried again at the next pass.
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.