Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles a lease document and manages the lease state.
func NewManager ¶
func NewManager(ctx context.Context, logger *logging.Logger, guaranteedUntil time.Time, docRef *firestore.DocumentRef) *Manager
NewManager creates a new lease watcher.
- guaranteedUntil is the time until which the lease is guaranteed to be active
- if guaranteedUntil is in the past, the lease is disabled immediately
- if guaranteedUntil is in the future, the lease is enabled until that time
- to handle changes to the lease, WatchLease must be called
- start the lease manager in a goroutine to watch the lease until the context is canceled
func (*Manager) SlogLogger ¶
SlogLogger returns a slog.Logger that writes to both stdout and the logger.
- always logs to stdout
- logs to the logger only when the lease is enabled or the initial lease time has not yet expired
func (*Manager) StderrWriter ¶
StderrWriter returns an io.Writer that writes to both stderr and the logger.
- it always writes all messages to stderr and the logger, regardless of the lease state
- logs are all written as ERROR level
func (*Manager) StdoutWriter ¶
StdoutWriter returns an io.Writer that writes to both stdout and the logger.
- it writes to stdout only when the lease is enabled or the initial lease time has not yet expired
- logs are all written as INFO level
Click to show internal directories.
Click to hide internal directories.