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, verifies a person on the git routes and the creation of a repository, and Rules give that
// person a scope. A grant is tried first, then Identity with Rules, then the per-user tokens of Meta.
Identity identity.Verifier
Rules identity.Rules
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
// RangeCacheBytes is the memory of the cache of pack ranges that requests share. Zero turns the cache off.
RangeCacheBytes int64
// Limits are the size limits of the requests. Zero fields take the defaults.
Limits Limits
// 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 Limits ¶ added in v0.21.0
type Limits struct {
// Object is the largest object that a put accepts, in bytes.
Object int
// DecodeWindow bounds the JSON text that the decoder of an object put holds for one object: 16 MiB in base64 and
// some slack.
DecodeWindow int64
// TreeReserve is the first reservation of a tree read, and TreeSlack the fixed part of every later one.
TreeReserve, TreeSlack int64
// FetchLarge is the reservation above which a fetch takes one of the FetchSlots slots of large fetches, which a
// clone of a large repository needs. Without the slots, a few clones hold the whole memory budget for as long as
// they run.
FetchLarge int64
FetchSlots int
}
Limits are the size limits of one server. A zero field takes its default, which is the value of the spec.
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) Close ¶ added in v0.19.0
func (s *Server) Close()
Close stops the leaders of lands and waits for them. Call it after the server stops taking requests and before the metadata store closes.
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) Registry ¶ added in v0.15.0
func (s *Server) Registry() prometheus.Gatherer
Registry returns the metrics that /metrics serves, so an exporter can read the same values.
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.