dogu

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: AGPL-3.0 Imports: 5 Imported by: 39

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CurrentVersionsWatchResult added in v0.2.0

type CurrentVersionsWatchResult struct {
	Versions     map[SimpleName]core.Version
	PrevVersions map[SimpleName]core.Version
	Diff         []SimpleNameVersion
	Err          error
}

CurrentVersionsWatchResult is used to notify users on local dogu version registry changes. It contains all old, current versions and the resulting diff from those versions. Err contains possible errors and should always be checked first before reading the results.

func NewCurrentVersionsWatchResult added in v0.2.0

func NewCurrentVersionsWatchResult(versions map[SimpleName]core.Version, prevVersions map[SimpleName]core.Version, diff []SimpleNameVersion, err error) CurrentVersionsWatchResult

type LocalDoguDescriptorRepository added in v0.2.0

type LocalDoguDescriptorRepository interface {
	// Get returns the dogu descriptor from the local registry.
	// ConnectionError if there are any connection issues
	// Generic Error if there are any other issues.
	Get(context.Context, SimpleNameVersion) (*core.Dogu, error)
	// GetAll returns all dogu descriptor by parameter from the local registry.
	// ConnectionError if there are any connection issues
	// Generic Error if there are any other issues.
	GetAll(context.Context, []SimpleNameVersion) (map[SimpleNameVersion]*core.Dogu, error)
	// Add adds a dogu descriptor to the local registry.
	// ConnectionError if there are any connection issues
	// Generic Error if there are any other issues.
	Add(context.Context, SimpleName, *core.Dogu) error
	// DeleteAll deletes all dogu descriptors for a given dogu name.
	// ConnectionError if there are any connection issues
	// Generic Error if there are any other issues.
	DeleteAll(context.Context, SimpleName) error
}

LocalDoguDescriptorRepository is an append-only Repository, no updates will happen

type Namespace

type Namespace string

type QualifiedName

type QualifiedName struct {
	SimpleName SimpleName
	Namespace  Namespace
}

func NewQualifiedName

func NewQualifiedName(namespace Namespace, simpleName SimpleName) (QualifiedName, error)

func QualifiedNameFromString

func QualifiedNameFromString(qualifiedName string) (QualifiedName, error)

QualifiedNameFromString converts a qualified dogu as a string, e.g. "official/nginx", to a dedicated QualifiedName or raises an error if this is not possible.

func (QualifiedName) String

func (name QualifiedName) String() string

String returns the dogu name with namespace, e.g. official/postgresql

func (QualifiedName) Validate

func (name QualifiedName) Validate() error

type QualifiedVersion

type QualifiedVersion struct {
	Name    QualifiedName
	Version core.Version
}

func NewQualifiedVersion

func NewQualifiedVersion(name QualifiedName, version core.Version) (QualifiedVersion, error)

type RemoteDoguDescriptorRepository

type RemoteDoguDescriptorRepository interface {
	// GetLatest returns the dogu descriptor for a dogu from the remote server.
	// DoguDescriptorNotFoundError if there is no descriptor for that dogu
	// ConnectionError if there are any connection issues
	// Generic Error if there are any other issues
	GetLatest(context.Context, QualifiedName) (*core.Dogu, error)
	// Get returns a version specific dogu descriptor.
	// DoguDescriptorNotFoundError if there is no descriptor for that dogu
	// ConnectionError if there are any connection issues
	// Generic Error if there are any other issues
	Get(context.Context, QualifiedVersion) (*core.Dogu, error)
}

type SimpleName

type SimpleName string

func (SimpleName) String

func (s SimpleName) String() string

String returns the string representation of the SimpleName.

type SimpleNameVersion added in v0.2.0

type SimpleNameVersion struct {
	Name    SimpleName
	Version core.Version
}

func NewSimpleNameVersion added in v0.2.0

func NewSimpleNameVersion(name SimpleName, version core.Version) SimpleNameVersion

type VersionRegistry added in v0.2.0

type VersionRegistry interface {
	// GetCurrent returns the current installed dogu version.
	// NotFound Error if the dogu is not installed.
	// ConnectionError if there are any connection issues.
	// Generic Error if there are any other issues.
	GetCurrent(context.Context, SimpleName) (SimpleNameVersion, error)
	// GetCurrentOfAll returns all current installed dogu versions.
	// ConnectionError if there are any connection issues.
	// Generic Error if there are any other issues.
	GetCurrentOfAll(context.Context) ([]SimpleNameVersion, error)
	// IsEnabled returns true if the dogu version is installed.
	// False otherwise.
	// ConnectionError if there are any connection issues
	// Generic Error if there are any other issues.
	IsEnabled(context.Context, SimpleNameVersion) (bool, error)
	// Enable the dogu version as current. It returns
	// ConnectionError if there are any connection issues
	// Generic Error if there are any other issues.
	Enable(context.Context, SimpleNameVersion) error
	// WatchAllCurrent watches the version registry and notifies via the returned channel if changes happen.
	// ConnectionError if there are any connection issues
	// Generic Error if there are any other issues.
	WatchAllCurrent(context.Context) (<-chan CurrentVersionsWatchResult, error)
}

Jump to

Keyboard shortcuts

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