Documentation
¶
Index ¶
- func LeaseRenewer(ctx context.Context, m Manager, network string, lease *Lease)
- func WatchLeases(ctx context.Context, sm Manager, network string, ownLease *Lease, ...)
- type Config
- type EtcdConfig
- type EtcdManager
- func (m *EtcdManager) AcquireLease(ctx context.Context, network string, attrs *LeaseAttrs) (*Lease, error)
- func (m *EtcdManager) GetNetworkConfig(ctx context.Context, network string) (*Config, error)
- func (m *EtcdManager) RenewLease(ctx context.Context, network string, lease *Lease) error
- func (m *EtcdManager) WatchLeases(ctx context.Context, network string, cursor interface{}) (WatchResult, error)
- type Event
- type EventType
- type Lease
- type LeaseAttrs
- type Manager
- type Registry
- type WatchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WatchLeases ¶
func WatchLeases(ctx context.Context, sm Manager, network string, ownLease *Lease, receiver chan []Event)
WatchLeases performs a long term watch of the given network's subnet leases and communicates addition/deletion events on receiver channel. It takes care of handling "fall-behind" logic where the history window has advanced too far and it needs to diff the latest snapshot with its saved state and generate events
Types ¶
type Config ¶
type Config struct {
Network ip.IP4Net
SubnetMin ip.IP4
SubnetMax ip.IP4
SubnetLen uint
Backend json.RawMessage `json:",omitempty"`
}
func ParseConfig ¶
type EtcdConfig ¶
type EtcdManager ¶
type EtcdManager struct {
// contains filtered or unexported fields
}
func (*EtcdManager) AcquireLease ¶
func (m *EtcdManager) AcquireLease(ctx context.Context, network string, attrs *LeaseAttrs) (*Lease, error)
func (*EtcdManager) GetNetworkConfig ¶
func (*EtcdManager) RenewLease ¶
func (*EtcdManager) WatchLeases ¶
func (m *EtcdManager) WatchLeases(ctx context.Context, network string, cursor interface{}) (WatchResult, error)
type EventType ¶
type EventType int
func (EventType) MarshalJSON ¶
func (*EventType) UnmarshalJSON ¶
type LeaseAttrs ¶
type LeaseAttrs struct {
PublicIP ip.IP4
BackendType string `json:",omitempty"`
BackendData json.RawMessage `json:",omitempty"`
}
type Manager ¶
type Manager interface {
GetNetworkConfig(ctx context.Context, network string) (*Config, error)
AcquireLease(ctx context.Context, network string, attrs *LeaseAttrs) (*Lease, error)
RenewLease(ctx context.Context, network string, lease *Lease) error
WatchLeases(ctx context.Context, network string, cursor interface{}) (WatchResult, error)
}
func NewEtcdManager ¶
func NewEtcdManager(config *EtcdConfig) (Manager, error)
type WatchResult ¶
Click to show internal directories.
Click to hide internal directories.