Documentation ¶
Index ¶
- Constants
- func Manifold(config ManifoldConfig) dependency.Manifold
- func NewClientFunc(clientType ClientType, apiInfo *api.Info, hub *pubsub.StructuredHub, ...) (raftlease.Client, error)
- func NewStore(config raftlease.StoreConfig) *raftlease.Store
- func NewWorker(config lease.ManagerConfig) (worker.Worker, error)
- type ClientFunc
- type ClientType
- type Logger
- type ManifoldConfig
Constants ¶
const ( // MaxSleep is the longest the manager will sleep before checking // whether any leases should be expired. If it can see a lease // expiring sooner than that it will still wake up earlier. MaxSleep = time.Minute // ForwardTimeout is how long the store should wait for a response // after sending a lease operation over the hub before deciding a // a response is never coming back (for example if we send the // request during a raft-leadership election). This should be long // enough that we can be very confident the request was missed. ForwardTimeout = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func Manifold ¶
func Manifold(config ManifoldConfig) dependency.Manifold
Manifold builds a dependency.Manifold for running a lease manager.
func NewClientFunc ¶
func NewClientFunc(clientType ClientType, apiInfo *api.Info, hub *pubsub.StructuredHub, requestTopic string, clock clock.Clock, metrics *raftlease.OperationClientMetrics, logger Logger) (raftlease.Client, error)
NewClientFunc returns a client depending on the type of feature flag enablement.
func NewStore ¶
func NewStore(config raftlease.StoreConfig) *raftlease.Store
NewStore is a shim to make a raftlease.Store for testability.
func NewWorker ¶
func NewWorker(config lease.ManagerConfig) (worker.Worker, error)
NewWorker wraps NewManager to return worker.Worker for testability.
Types ¶
type ClientFunc ¶
type ClientFunc = func(ClientType, *api.Info, *pubsub.StructuredHub, string, clock.Clock, *raftlease.OperationClientMetrics, Logger) (raftlease.Client, error)
ClientFunc only exists until we can just one of the clients. Until then we have to create this type. TODO (stickupkid): Remove this once API Client type is battle tested and we've deprecated pubsub client.
type ClientType ¶
type ClientType string
ClientType defines the type of client we want to create.
const ( // PubsubClientType will request a pubsub client. PubsubClientType ClientType = "pubsub" // APIClientType will request a API client. APIClientType ClientType = "api-client" )
type ManifoldConfig ¶
type ManifoldConfig struct { AgentName string ClockName string CentralHubName string StateName string FSM *raftlease.FSM RequestTopic string Logger lease.Logger LogDir string PrometheusRegisterer prometheus.Registerer NewWorker func(lease.ManagerConfig) (worker.Worker, error) NewStore func(raftlease.StoreConfig) *raftlease.Store NewClient ClientFunc }
ManifoldConfig holds the resources needed to start the lease manager in a dependency engine.
func (ManifoldConfig) Validate ¶
func (c ManifoldConfig) Validate() error
Validate checks that the config has all the required values.