storagestate

package
v0.0.0-...-8f7bd20 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SetUserFSQuota     = fs.SetUserFSQuota
	StateChangeTimeout = 1 * time.Second
)

These global variables are used to be able to mocking the functionality in tests.

View Source
var (
	ErrNotExist = errors.New("entry does not exist")
	ErrNotFound = errors.New("instance not found")
)

ErrNotExist is returned when requested entry not exist in DB.

Functions

This section is empty.

Types

type MessageSender

type MessageSender interface {
	SendInstanceNewState(newState cloudprotocol.NewState) error
	SendInstanceStateRequest(request cloudprotocol.StateRequest) error
}

MessageSender sends messages to the cloud.

type SetupParams

type SetupParams struct {
	aostypes.InstanceIdent
	UID          int
	GID          int
	StateQuota   uint64
	StorageQuota uint64
}

SetupParams setup storage state instance params.

type StateChangedInfo

type StateChangedInfo struct {
	aostypes.InstanceIdent
	Checksum []byte
}

StateChangedInfo contains state changed information.

type Storage

type Storage interface {
	GetAllStorageStateInfo() ([]StorageStateInstanceInfo, error)
	GetStorageStateInfo(instanceIdent aostypes.InstanceIdent) (StorageStateInstanceInfo, error)
	SetStorageStateQuotas(instanceIdent aostypes.InstanceIdent, storageQuota, stateQuota uint64) error
	AddStorageStateInfo(storageStateInfo StorageStateInstanceInfo) error
	SetStateChecksum(instanceIdent aostypes.InstanceIdent, checksum []byte) error
	RemoveStorageStateInfo(instanceIdent aostypes.InstanceIdent) error
}

Storage storage interface.

type StorageState

type StorageState struct {
	sync.Mutex
	// contains filtered or unexported fields
}

StorageState storage state instance.

func New

func New(cfg *config.Config, messageSender MessageSender, storage Storage) (storageState *StorageState, err error)

New creates storagestate instance.

func (*StorageState) Cleanup

func (storageState *StorageState) Cleanup(instanceIdent aostypes.InstanceIdent) error

Cleanup cleans storagestate instance.

func (*StorageState) Close

func (storageState *StorageState) Close()

Close closes storagestate instance.

func (*StorageState) GetInstanceCheckSum

func (storageState *StorageState) GetInstanceCheckSum(instanceIdent aostypes.InstanceIdent) string

func (*StorageState) RemoveServiceInstance

func (storageState *StorageState) RemoveServiceInstance(instanceIdent aostypes.InstanceIdent) error

func (*StorageState) Setup

func (storageState *StorageState) Setup(
	params SetupParams,
) (storagePath string, statePath string, err error)

Setup setups storagestate instance.

func (*StorageState) StateAcceptance

func (storageState *StorageState) StateAcceptance(updateState cloudprotocol.StateAcceptance) error

StateAcceptance acceptance state.

func (*StorageState) UpdateState

func (storageState *StorageState) UpdateState(updateState cloudprotocol.UpdateState) error

UpdateState updates state.

type StorageStateInstanceInfo

type StorageStateInstanceInfo struct {
	aostypes.InstanceIdent
	InstanceID    string
	StorageQuota  uint64
	StateQuota    uint64
	StateChecksum []byte
}

StorageStateInstanceInfo storage state instance info.

Jump to

Keyboard shortcuts

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