lease

package
v0.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type  EventType `json:"type"`
	Lease Lease     `json:"lease,omitempty"`
}

type EventType

type EventType int
const (
	EventAdded EventType = iota
	EventRemoved
)

type Lease

type Lease struct {
	EnableIPv4 bool
	EnableIPv6 bool
	Subnet     ip.IP4Net
	IPv6Subnet ip.IP6Net
	Attrs      LeaseAttrs
	Expiration time.Time

	Asof int64 //Only used in etcd
}

Lease includes information about the lease

type LeaseAttrs

type LeaseAttrs struct {
	PublicIP      ip.IP4
	PublicIPv6    *ip.IP6
	BackendType   string          `json:",omitempty"`
	BackendData   json.RawMessage `json:",omitempty"`
	BackendV6Data json.RawMessage `json:",omitempty"`
}

LeaseAttrs includes extra information for the lease

type LeaseWatchResult

type LeaseWatchResult struct {
	// Either Events or Snapshot will be set.  If Events is empty, it means
	// the cursor was out of range and Snapshot contains the current list
	// of items, even if empty.
	Events   []Event     `json:"events"`
	Snapshot []Lease     `json:"snapshot"` //Only used in etcd
	Cursor   interface{} `json:"cursor"`   //Only used in etcd
}

type LeaseWatcher

type LeaseWatcher struct {
	OwnLease *Lease  //Lease with the subnet of the local node
	Leases   []Lease //Leases with subnets from other nodes
}

func (*LeaseWatcher) Reset

func (lw *LeaseWatcher) Reset(leases []Lease) []Event

Reset is called by etcd-subnet when using a snapshot

func (*LeaseWatcher) Update

func (lw *LeaseWatcher) Update(events []Event) []Event

Update reads the leases in the events and depending on Type, adds them or removes them

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL