types

package
v0.3.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ImplementedVersion = 1

ImplementedVersion contains implemented version of the store file layout

Variables

View Source
var (
	ErrCorruptData = errors.New("data corrupted, checksum mismatch")
)

Functions

This section is empty.

Types

type Checksum

type Checksum uint32

Checksum is the data to be stored as checkpoint

func NewChecksum

func NewChecksum(r *Root) Checksum

NewChecksum returns the Checksum of the object

func (Checksum) Verify

func (cs Checksum) Verify(r *Root) error

Verify verifies that passed checksum is same as calculated checksum

type PoolReservations

type PoolReservations struct {
	Name string `json:"name"`
	// key is container_id + _ + interface_name
	Entries map[string]Reservation `json:"entries"`
	// contains pool config from the latest store update
	LastPoolConfig string `json:"last_pool_config"`
	LastReservedIP net.IP `json:"last_reserved_ip"`
}

PoolReservations is object which used to store IP reservations for the IP pool

func NewPoolReservations

func NewPoolReservations(name string) *PoolReservations

NewPoolReservations returns initialized PoolReservations object

func (*PoolReservations) DeepCopy

func (in *PoolReservations) DeepCopy() *PoolReservations

DeepCopy is a deepcopy function for the PoolReservations struct

type Reservation

type Reservation struct {
	ContainerID   string              `json:"container_id"`
	InterfaceName string              `json:"interface_name"`
	IPAddress     net.IP              `json:"ip_address"`
	Metadata      ReservationMetadata `json:"metadata"`
}

Reservation is used to store Reservation in a checkpoint file

func (*Reservation) DeepCopy

func (in *Reservation) DeepCopy() *Reservation

DeepCopy is a deepcopy function for the Reservation struct

func (*Reservation) String

func (in *Reservation) String() string

String returns string representation of the Reservation

type ReservationMetadata

type ReservationMetadata struct {
	CreateTime         string `json:"create_time"`
	PodUUID            string `json:"pod_uuid"`
	PodName            string `json:"pod_name"`
	PodNamespace       string `json:"pod_namespace"`
	DeviceID           string `json:"device_id"`
	PoolConfigSnapshot string `json:"pool_config_snapshot"`
}

ReservationMetadata contains meta information for reservation

func (*ReservationMetadata) DeepCopy

func (in *ReservationMetadata) DeepCopy() *ReservationMetadata

DeepCopy is a deepcopy function for the ReservationMetadata struct

type Root

type Root struct {
	Version  int                         `json:"version"`
	Checksum Checksum                    `json:"checksum"`
	Pools    map[string]PoolReservations `json:"pools"`
}

Root is the root object of the store

func NewRoot

func NewRoot() *Root

NewRoot returns initialized store Root

func (*Root) DeepCopy

func (in *Root) DeepCopy() *Root

DeepCopy is a deepcopy function for the Root struct

Jump to

Keyboard shortcuts

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