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 LeaseRenewer ¶ added in v0.5.0
func WatchLeases ¶ added in v0.5.0
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 ¶ added in v0.2.0
type EtcdManager ¶ added in v0.5.0
type EtcdManager struct {
// contains filtered or unexported fields
}
func (*EtcdManager) AcquireLease ¶ added in v0.5.0
func (m *EtcdManager) AcquireLease(ctx context.Context, network string, attrs *LeaseAttrs) (*Lease, error)
func (*EtcdManager) GetNetworkConfig ¶ added in v0.5.0
func (*EtcdManager) RenewLease ¶ added in v0.5.0
func (*EtcdManager) WatchLeases ¶ added in v0.5.0
func (m *EtcdManager) WatchLeases(ctx context.Context, network string, cursor interface{}) (WatchResult, error)
type EventType ¶
type EventType int
func (EventType) MarshalJSON ¶ added in v0.5.0
func (*EventType) UnmarshalJSON ¶ added in v0.5.0
type Lease ¶ added in v0.5.0
type Lease struct { Subnet ip.IP4Net Attrs *LeaseAttrs Expiration time.Time }
type LeaseAttrs ¶ added in v0.2.0
type LeaseAttrs struct { PublicIP ip.IP4 BackendType string `json:",omitempty"` BackendData json.RawMessage `json:",omitempty"` }
type Manager ¶ added in v0.5.0
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 ¶ added in v0.5.0
func NewEtcdManager(config *EtcdConfig) (Manager, error)
type Registry ¶ added in v0.5.0
type Registry interface {
// contains filtered or unexported methods
}
type WatchResult ¶ added in v0.5.0
Click to show internal directories.
Click to hide internal directories.