storage

package
v1.2.5-0...-4df68ab Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

README

HAProxy

Data Plane API internal storage (dataplane_storage_dir)

Dataplane API internal storage location

Location of Dataplane API storage is managed by :

  • dataplane API start argument dataplane-storage-dir (default value: /etc/haproxy/dataplane)

It can be overriden by a field in Daplane API configuration file:

  • dataplaneapi.resources.dataplane_storage_dir: refer to example-full

Files stored in Dataplane API internal storage location

File name content example Comment
cluster.json Cluster configuration + Cluster users cluster.json Prior to 3.0 was in Dapi config file: cluster, dataplaneapi.user, status sections
service_discovery/consul.json Consul configuration Prior to 3.0 was in Dapi config file service_discovery.consuls section
service_discovery/aws.json AWS configuration Prior to 3.0 was in Dapi config file service_discovery.aws_regions section

Documentation

Index

Constants

View Source
const (
	AWSRegionFileName = "service_discovery/aws.json"
)
View Source
const (
	ClusterModeDataFileName = "cluster.json"
)
View Source
const (
	ConsulFileName = "service_discovery/consul.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AWS

type AWS interface {
	// GetAWS does not load the AWSRegions from the storage. Use Load() to load the them if needed.
	GetAWSRegions() storagetype.AWSRegions
	// AddAWSRegionsAndStore adds a list of AWSRegions to the storage and stores in the storage file.
	AddAWSRegionsAndStore(AWS storagetype.AWSRegions) error
	// AddAWSRegionAndStore adds a new AWSRegion to the storage and stores in the storage file.
	AddAWSRegionAndStore(AWS *models.AwsRegion) error
	// RemoveAWSAndStore removes a AWSRegion from the storage and stores in the storage file.
	RemoveAWSRegionAndStore(AWS *models.AwsRegion) error
	// ReplaceAllAWSRegionsAndStore replaces the list of AWSRegions in the storage and stores in the storage file.
	ReplaceAllAWSRegionsAndStore(AWS storagetype.AWSRegions) error
}

type AWSRegionStorageImpl

type AWSRegionStorageImpl struct {
	AWSData storagetype.AWSRegionData
	// contains filtered or unexported fields
}

func (*AWSRegionStorageImpl) AddAWSRegionAndStore

func (cs *AWSRegionStorageImpl) AddAWSRegionAndStore(region *models.AwsRegion) error

func (*AWSRegionStorageImpl) AddAWSRegionsAndStore

func (cs *AWSRegionStorageImpl) AddAWSRegionsAndStore(regions storagetype.AWSRegions) error

func (*AWSRegionStorageImpl) GetAWSRegions

func (cs *AWSRegionStorageImpl) GetAWSRegions() storagetype.AWSRegions

func (*AWSRegionStorageImpl) Load

func (cs *AWSRegionStorageImpl) Load() error

func (*AWSRegionStorageImpl) RemoveAWSRegionAndStore

func (cs *AWSRegionStorageImpl) RemoveAWSRegionAndStore(region *models.AwsRegion) error

func (*AWSRegionStorageImpl) ReplaceAllAWSRegionsAndStore

func (cs *AWSRegionStorageImpl) ReplaceAllAWSRegionsAndStore(regions storagetype.AWSRegions) error

func (*AWSRegionStorageImpl) Store

func (cs *AWSRegionStorageImpl) Store() error

type Cluster

type Cluster interface {
	// GetCluster does not load the data from the storage. Use Load() to load the data if needed.
	GetCluster() *storagetype.Cluster
	// GetStatus does not load the data from the storage. Use Load() to load the data if needed.
	GetStatus() *string

	// SetClusterAndStore adds a new cluster to the storage and stores in the storage file.
	SetClusterAndStore(cluster *storagetype.Cluster) error
	// SetStatusAndStore sets a new status to the storage and stores in the storage file.
	SetStatusAndStore(status *string) error
	// UnsetClusterAndStore removes a cluster from the storage and stores in the storage file.
	UnsetClusterAndStore() error
}

type ClusterModeStorage

type ClusterModeStorage interface {
	Cluster
	Users

	Load() error
	Store() error
	// IsClusterMode returns true if the storage is in cluster mode, false otherwise.
	// i.e. if ClusterModeData are not empty
	IsClusterMode() bool
}

func NewClusterModeStorage

func NewClusterModeStorage(path string) (ClusterModeStorage, error)

NewClusterModeStorage creates a new clusterStorageImpl with initial configuration from a file path.

type Consul

type Consul interface {
	// GetConsuls does not load the consuls from the storage. Use Load() to load the them if needed.
	GetConsuls() storagetype.Consuls
	// AddConsulsAndStore adds a list of consuls to the storage and stores in the storage file.
	AddConsulsAndStore(consuls storagetype.Consuls) error
	// AddConsulAndStore adds a new consul to the storage and stores in the storage file.
	AddConsulAndStore(consul *models.Consul) error
	// RemoveConsulAndStore removes a consul from the storage and stores in the storage file.
	RemoveConsulAndStore(consul *models.Consul) error
	// ReplaceAllConsulsAndStore replaces the list of consuls in the storage and stores in the storage file.
	ReplaceAllConsulsAndStore(consuls storagetype.Consuls) error
}

type SDAWStorage

type SDAWStorage interface {
	AWS

	Load() error
	Store() error
}

func NewSDAWSRegionStorage

func NewSDAWSRegionStorage(path string) (SDAWStorage, error)

NewSDAWSRegionStorage creates a new AWSRegionStorageImpl with initial configuration from a file path.

type SDConsulStorage

type SDConsulStorage interface {
	Consul

	Load() error
	Store() error
}

func NewSDConsulStorage

func NewSDConsulStorage(path string) (SDConsulStorage, error)

NewSDConsulStorage creates a new consulStorageImpl with initial configuration from a file path.

type Storable

type constraint for storable objects, add more when need arises with |

type Storage

type Storage[T Storable] interface {
	Get() (T, error)
	Store(data T) error
}

type Users

type Users interface {
	// GetUsers does not load the users from the storage. Use Load() to load the users if needed.
	GetUsers() storagetype.Users
	// AddUsersAndStore adds a list of users to the storage and stores in the storage file.
	AddUsersAndStore(users storagetype.Users) error
	// AddUserAndStore adds a new user to the storage and stores in the storage file.
	AddUserAndStore(user storagetype.User) error
	// RemoveUserAndStore removes a user from the storage and stores in the storage file.
	RemoveUserAndStore(user storagetype.User) error
	// ReplaceAllUsersAndStore replaces the list of users in the storage and stores in the storage file.
	ReplaceAllUsersAndStore(users storagetype.Users) error
}

Jump to

Keyboard shortcuts

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