db

package
v0.2.8-rc2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: AGPL-3.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const BOLT_TIMEOUT = 5 * time.Second

Variables

View Source
var (
	ErrKeyNotFound      = errors.New("key not found")
	ErrKeyAlreadyExists = errors.New("key already exists")
)

Functions

func HashPassword

func HashPassword(password string) (string, error)

Types

type AgentDB

type AgentDB struct {
	DeploymentsRepository common.DeploymentsRepository
	NodesRepository       common.NodesRepository
	// contains filtered or unexported fields
}

func GetDB

func GetDB() *AgentDB

func (*AgentDB) AddNetConfig

func (db *AgentDB) AddNetConfig(network string, container string, config []byte, cniResult []byte, guest_ifname string, host_ifname string) error

We store guest and host ifnames because we are storing only bridge configs

func (*AgentDB) Close

func (db *AgentDB) Close()

func (*AgentDB) CreateContainer

func (db *AgentDB) CreateContainer(containerName string, image string, state dto.ContainerStatus) (Container, error)

func (*AgentDB) CreateUser

func (db *AgentDB) CreateUser(username string, password string, role int32) error

func (*AgentDB) DeleteAllNetConfigs

func (db *AgentDB) DeleteAllNetConfigs(container string) error

Delete all network configs for a container

func (*AgentDB) DeleteContainer

func (db *AgentDB) DeleteContainer(containerName string) error

func (*AgentDB) DeleteDNSRecord

func (db *AgentDB) DeleteDNSRecord(key string) error

func (*AgentDB) DeleteHealthStatus

func (db *AgentDB) DeleteHealthStatus(hostname string) error

func (*AgentDB) GetAllContainers

func (db *AgentDB) GetAllContainers() ([]Container, error)

func (*AgentDB) GetAllHealthStatuses

func (db *AgentDB) GetAllHealthStatuses() ([]HealthStatus, error)

func (*AgentDB) GetContainer

func (db *AgentDB) GetContainer(containerName string) (Container, error)

func (*AgentDB) GetDNSRecord

func (db *AgentDB) GetDNSRecord(key string) (string, error)

func (*AgentDB) GetHealthStatus

func (db *AgentDB) GetHealthStatus(hostname string) (HealthStatus, error)

func (*AgentDB) GetNetConfigs

func (db *AgentDB) GetNetConfigs(container string) ([]NetConfig, error)

func (*AgentDB) GetNetworkContainerCount

func (db *AgentDB) GetNetworkContainerCount(network string) (int, error)

GetNetworkContainerCount returns the number of containers using a network

func (*AgentDB) GetVerifiedUser

func (db *AgentDB) GetVerifiedUser(username string, password string) (int32, error)

func (*AgentDB) IsHostIfaceUsedExceptForContainer

func (db *AgentDB) IsHostIfaceUsedExceptForContainer(hostIface string, container string) (bool, error)

func (*AgentDB) NewOrRetrieveSubnetOffset

func (db *AgentDB) NewOrRetrieveSubnetOffset(network string) (int32, error)

func (*AgentDB) PublishHealthStatus

func (db *AgentDB) PublishHealthStatus(hostname string, status string, metadata map[string]any) error

func (*AgentDB) PurgeDB

func (db *AgentDB) PurgeDB() error

PurgeDB deletes all data for the current agent from the database

func (*AgentDB) ReleaseSubnet

func (db *AgentDB) ReleaseSubnet(network string) error

ReleaseSubnet releases the subnet assignment for a network

func (*AgentDB) SetDNSRecord

func (db *AgentDB) SetDNSRecord(key, ip string) error

func (*AgentDB) UpdateContainerImage

func (db *AgentDB) UpdateContainerImage(containerName string, image string) (string, error)

type BoltDeploymentsRepository added in v0.2.5

type BoltDeploymentsRepository struct {
	// contains filtered or unexported fields
}

func (*BoltDeploymentsRepository) Create added in v0.2.5

func (r *BoltDeploymentsRepository) Create(loadName string, driver common.LoadDriver, status common.DeploymentStatus, metadata any) (common.DeploymentID, error)

func (*BoltDeploymentsRepository) DeleteByLoad added in v0.2.5

func (r *BoltDeploymentsRepository) DeleteByLoad(loadName string) error

func (*BoltDeploymentsRepository) DeleteDeployment added in v0.2.5

func (r *BoltDeploymentsRepository) DeleteDeployment(deploymentID uuid.UUID) error

func (*BoltDeploymentsRepository) GetAll added in v0.2.5

func (*BoltDeploymentsRepository) GetByLoad added in v0.2.5

func (r *BoltDeploymentsRepository) GetByLoad(loadName string) ([]common.Deployment, error)

func (*BoltDeploymentsRepository) GetByLoadAndStatus added in v0.2.5

func (r *BoltDeploymentsRepository) GetByLoadAndStatus(loadName string, statusCode common.DeploymentStatusCode) ([]common.Deployment, error)

func (*BoltDeploymentsRepository) GetDeployment added in v0.2.5

func (r *BoltDeploymentsRepository) GetDeployment(deploymentID common.DeploymentID) (*common.Deployment, error)

func (*BoltDeploymentsRepository) UpdateMetadata added in v0.2.5

func (r *BoltDeploymentsRepository) UpdateMetadata(deploymentID common.DeploymentID, updateFn func(metadataPtr any) error) error

func (*BoltDeploymentsRepository) UpdateStatus added in v0.2.5

func (r *BoltDeploymentsRepository) UpdateStatus(deploymentID common.DeploymentID, status common.DeploymentStatus) error

type BoltNodesRepository added in v0.2.5

type BoltNodesRepository struct {
	// contains filtered or unexported fields
}

func (*BoltNodesRepository) DeleteGuestNode added in v0.2.5

func (r *BoltNodesRepository) DeleteGuestNode(guestNodeName string, guestDriver common.NodeDriver) error

func (*BoltNodesRepository) DeleteSelf added in v0.2.5

func (r *BoltNodesRepository) DeleteSelf() error

func (*BoltNodesRepository) GetAllGuestNodes added in v0.2.5

func (r *BoltNodesRepository) GetAllGuestNodes() ([]common.NodeEntry, error)

func (*BoltNodesRepository) GetByAgentId added in v0.2.5

func (r *BoltNodesRepository) GetByAgentId(agentId string) (common.NodeEntry, error)

func (*BoltNodesRepository) GetGuestNode added in v0.2.5

func (r *BoltNodesRepository) GetGuestNode(guestNodeName string) (common.NodeEntry, error)

func (*BoltNodesRepository) GetSelf added in v0.2.5

func (r *BoltNodesRepository) GetSelf() (common.NodeEntry, error)

func (*BoltNodesRepository) SetGuestNode added in v0.2.5

func (r *BoltNodesRepository) SetGuestNode(guestNodeName string, guestDriver common.NodeDriver) error

func (*BoltNodesRepository) SetSelf added in v0.2.5

func (r *BoltNodesRepository) SetSelf(nodeName string, driver common.NodeDriver, registries []common.RegistryConfig) error

func (*BoltNodesRepository) UpdateGuestMetadata added in v0.2.5

func (r *BoltNodesRepository) UpdateGuestMetadata(guestNodeName string, updateFn func(metadataPtr any) error) error

func (*BoltNodesRepository) UpdateSelfMetadata added in v0.2.5

func (r *BoltNodesRepository) UpdateSelfMetadata(updateFn func(metadataPtr any) error) error

type Container

type Container struct {
	ContainerName string `json:"container_name"`
	Image         string `json:"image"`
}

type DeploymentValue

type DeploymentValue struct {
	ID               common.DeploymentID     `json:"id"`
	LoadName         string                  `json:"load_name"`
	LoadDriverConfig common.LoadDriverConfig `json:"load_driver_config"`
	Status           common.DeploymentStatus `json:"status"`
	Metadata         any                     `json:"metadata"`
}

type HealthStatus

type HealthStatus struct {
	Hostname  string         `json:"hostname"`
	Status    string         `json:"status"`
	Timestamp time.Time      `json:"timestamp"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

type NetConfig

type NetConfig struct {
	Network        string `json:"network"`
	Config         string `json:"config"`
	CniResult      string `json:"cni_result"`
	GuestIfaceName string `json:"guest_ifname"`
	HostIfaceName  string `json:"host_ifname"`
}

TODO replace usage with NetworkConfig type if possible

type NetworkConfig

type NetworkConfig struct {
	Network        string `json:"network"`
	Container      string `json:"container"`
	Config         string `json:"config"`
	CniResult      string `json:"cni_result"`
	GuestIfaceName string `json:"guest_ifname"`
	HostIfaceName  string `json:"host_ifname"`
}

type NodeValue

type NodeValue struct {
	NodeName         string                  `json:"node_name"`
	NodeDriverConfig common.NodeDriverConfig `json:"node_driver_config"`
	Registries       []common.RegistryConfig `json:"registries,omitempty"`
	Metadata         any                     `json:"metadata"`
}

type User

type User struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Role     int32  `json:"role"`
}

Jump to

Keyboard shortcuts

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