interfaces

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerCreationModel

type ContainerCreationModel struct {
	Id                      uint32
	Ip                      *net.IPNet
	SubnetworkId            uint32
	Image                   string
	CreatedAt               time.Time
	EntrypointCustomization *ContainerProcessCustomization
	Spec                    *runspecs.Spec
	Stdout                  *os.File
}

type ContainerModel

type ContainerModel interface {
	GetData() *ContainerModelData
	GetState() (*runspecs.State, error)
	// Executes the user program in a 'created' container
	Exec() error
	Stop() error
	StartAdditionalProcess(process *runspecs.Process) (ContainerProcess, error)
}

type ContainerModelData

type ContainerModelData struct {
	Id                      uint32
	Ip                      *net.IPNet
	SubnetworkId            uint32
	Image                   string
	CreatedAt               time.Time
	StartedAt               time.Time
	EntrypointCustomization *ContainerProcessCustomization
	Spec                    *runspecs.Spec
}

type ContainerProcess

type ContainerProcess interface {
	GetPty() *os.File
	Wait() (int, error)
	Stop() error
}

type ContainerProcessCustomization

type ContainerProcessCustomization struct {
	Entrypoint []string
	Cmd        []string
	Env        []string
}

type ContainerRepository

type ContainerRepository interface {
	Get(id uint32) (ContainerModel, error)
	GetAll(ctx context.Context) (<-chan ContainerModel, <-chan error)
	// Returns a container in a 'created' state
	Create(creationModel *ContainerCreationModel) (ContainerModel, error)
	Delete(id uint32) (ContainerModel, error)
}

type IpamRepository

type IpamRepository interface {
	GetSubnetworkGateway(subnetwork *SubnetworkModel) *net.IPNet
	Allocate(subnetwork *SubnetworkModel, resourceType IpamType) (*net.IPNet, error)
	Deallocate(subnetwork *SubnetworkModel, ip *net.IPNet) error
	// Returns the first allocation found
	HasAllocations(subnetwork *SubnetworkModel) (IpamType, bool)
}

type IpamType

type IpamType int
const (
	IPAM_UNALLOCATED IpamType = iota
	IPAM_CONTAINER
)

type NetworkModel

type NetworkModel = pb.Network

type NetworkRepository

type NetworkRepository interface {
	Get(id uint32) (*NetworkModel, error)
	// TODO: Maybe Reader/Writer would work better here than two manually handled channels?
	GetAll(ctx context.Context) (<-chan *NetworkModel, <-chan error)
	Add(network *NetworkModel) (*NetworkModel, error)
	Delete(id uint32) (*NetworkModel, error)
	Update(id uint32, updateFn func(*NetworkModel)) (*NetworkModel, error)
}

type SubnetworkModel

type SubnetworkModel = pb.Subnetwork

type SubnetworkRepository

type SubnetworkRepository interface {
	Get(id uint32) (*SubnetworkModel, error)
	GetAll(ctx context.Context) (<-chan *SubnetworkModel, <-chan error)
	GetAllByNetworkId(id uint32, ctx context.Context) (<-chan *SubnetworkModel, <-chan error)
	Add(subnetwork *SubnetworkModel) (*SubnetworkModel, error)
	Delete(id uint32) (*SubnetworkModel, error)
	Update(id uint32, updateFn func(*SubnetworkModel)) (*SubnetworkModel, error)
}

Jump to

Keyboard shortcuts

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