metadata

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CorrectMetadata

func CorrectMetadata(cl client.Client, access Access, log logr.Logger) error

CorrectMetadata checks if the entries in the storage are actually valid Removes not valid entries

Types

type Access

type Access interface {
	Setup(path string) error

	InsertTenant(tenant *Tenant) error
	UpdateTenant(tenant *Tenant) error
	DeleteTenant(dynakubeName string) error
	GetTenant(dynakubeName string) (*Tenant, error)
	GetTenants() (map[string]string, error)

	InsertVolume(volume *Volume) error
	DeleteVolume(volumeID string) error
	GetVolume(volumeID string) (*Volume, error)
	GetPodNames() (map[string]string, error)
	GetUsedVersions(tenantUUID string) (map[string]bool, error)
}

func NewAccess

func NewAccess(path string) (Access, error)

NewAccess creates a new SqliteAccess, connects to the database.

type FakeFailDB

type FakeFailDB struct{}

func (*FakeFailDB) DeleteTenant

func (f *FakeFailDB) DeleteTenant(dynakubeName string) error

func (*FakeFailDB) DeleteVolume

func (f *FakeFailDB) DeleteVolume(volumeID string) error

func (*FakeFailDB) GetPodNames

func (f *FakeFailDB) GetPodNames() (map[string]string, error)

func (*FakeFailDB) GetTenant

func (f *FakeFailDB) GetTenant(dynakubeName string) (*Tenant, error)

func (*FakeFailDB) GetTenants

func (f *FakeFailDB) GetTenants() (map[string]string, error)

func (*FakeFailDB) GetUsedVersions

func (f *FakeFailDB) GetUsedVersions(tenantUUID string) (map[string]bool, error)

func (*FakeFailDB) GetVolume

func (f *FakeFailDB) GetVolume(volumeID string) (*Volume, error)

func (*FakeFailDB) InsertTenant

func (f *FakeFailDB) InsertTenant(tenant *Tenant) error

func (*FakeFailDB) InsertVolume

func (f *FakeFailDB) InsertVolume(volume *Volume) error

func (*FakeFailDB) Setup

func (f *FakeFailDB) Setup(dbPath string) error

func (*FakeFailDB) UpdateTenant

func (f *FakeFailDB) UpdateTenant(tenant *Tenant) error

type PathResolver

type PathResolver struct {
	RootDir string
}

func (PathResolver) AgentBinaryDir

func (pr PathResolver) AgentBinaryDir(tenantUUID string) string

func (PathResolver) AgentBinaryDirForVersion

func (pr PathResolver) AgentBinaryDirForVersion(tenantUUID string, version string) string

func (PathResolver) AgentRunDir

func (pr PathResolver) AgentRunDir(tenantUUID string) string

func (PathResolver) AgentRunDirForVolume

func (pr PathResolver) AgentRunDirForVolume(tenantUUID string, volumeId string) string

func (PathResolver) EnvDir

func (pr PathResolver) EnvDir(tenantUUID string) string

func (PathResolver) OverlayMappedDir

func (pr PathResolver) OverlayMappedDir(tenantUUID string, volumeId string) string

func (PathResolver) OverlayVarDir

func (pr PathResolver) OverlayVarDir(tenantUUID string, volumeId string) string

func (PathResolver) OverlayWorkDir

func (pr PathResolver) OverlayWorkDir(tenantUUID string, volumeId string) string

type SqliteAccess

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

func FakeMemoryDB

func FakeMemoryDB() *SqliteAccess

func (*SqliteAccess) DeleteTenant

func (a *SqliteAccess) DeleteTenant(dynakubeName string) error

DeleteTenant deletes an existing Tenant by Dynakube name

func (*SqliteAccess) DeleteVolume

func (a *SqliteAccess) DeleteVolume(volumeID string) error

DeleteVolume deletes a Volume by its ID

func (*SqliteAccess) GetPodNames

func (a *SqliteAccess) GetPodNames() (map[string]string, error)

GetPodNames gets all PodNames present in the `volumes` database in map with their corresponding volumeIDs.

func (*SqliteAccess) GetTenant

func (a *SqliteAccess) GetTenant(dynakubeName string) (*Tenant, error)

GetTenant gets Tenant by Dynakube name

func (*SqliteAccess) GetTenants

func (a *SqliteAccess) GetTenants() (map[string]string, error)

GetTenants gets all Tenants and maps their tenantUUID to the corresponding Dynakubes.

func (*SqliteAccess) GetUsedVersions

func (a *SqliteAccess) GetUsedVersions(tenantUUID string) (map[string]bool, error)

GetUsedVersions gets all UNIQUE versions present in the `volumes` database in map. Map is used to make sure we don't return the same version multiple time, it's also easier to check if a version is in it or not. (a Set in style of Golang)

func (*SqliteAccess) GetVolume

func (a *SqliteAccess) GetVolume(volumeID string) (*Volume, error)

GetVolume gets Volume by its ID

func (*SqliteAccess) InsertTenant

func (a *SqliteAccess) InsertTenant(tenant *Tenant) error

InsertTenant inserts a new Tenant

func (*SqliteAccess) InsertVolume

func (a *SqliteAccess) InsertVolume(volume *Volume) error

InsertVolume inserts a new Volume

func (*SqliteAccess) Setup

func (a *SqliteAccess) Setup(path string) error

Setup connects to the database and creates the necessary tables if they don't exist

func (*SqliteAccess) UpdateTenant

func (a *SqliteAccess) UpdateTenant(tenant *Tenant) error

UpdateTenant updates an existing Tenant by matching the Dynakube name

type Tenant

type Tenant struct {
	TenantUUID    string
	LatestVersion string
	Dynakube      string
}

func NewTenant

func NewTenant(uuid, latestVersion, dynakube string) *Tenant

NewTenant returns a new Tenant if all fields are set.

type Volume

type Volume struct {
	VolumeID   string
	PodName    string
	Version    string
	TenantUUID string
}

func NewVolume

func NewVolume(id, podUID, version, tenantUUID string) *Volume

NewVolume returns a new Volume if all fields are set.

Jump to

Keyboard shortcuts

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