Documentation
¶
Overview ¶
Package versionstatus answers /api/version-status: whether to tell the visitor of a pad that this Etherpad is a minor version or more behind. Only the pad's first author is told, as the person most likely to run or know who runs the instance (etherpad-lite's updateStatus).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FirstAuthor ¶
FirstAuthor is the author of the lowest pool entry ['author', id] with an id, or "" for a pad nobody has written in yet.
Types ¶
type Deps ¶
type Deps struct {
// Status is the updater's view: current and latest version.
Status func() updater.Status
// Pool returns the attribute pool of an existing pad, or false.
Pool func(padID string) (*apool.APool, bool)
// Author is the author id of the request's token cookie, or "".
Author func(c fiber.Ctx) string
// Now and TTL drive the cache; zero values mean time.Now and a minute.
Now func() time.Time
TTL time.Duration
// Capacity bounds the cache (pad and author pairs); 0 means 1000.
Capacity int
}
Deps are what the handler reads.
type Handler ¶
type Handler struct {
// Computations counts cache misses (tests).
Computations int
// contains filtered or unexported fields
}
Handler is the /api/version-status handler. Answers are cached per pad and author for a minute: every pad load asks.