instances

package
v0.0.0-...-dae269f Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWissKINotFound = errors.New("WissKI not found")

ErrWissKINotFound is returned when a WissKI is not found

Functions

This section is empty.

Types

type Instances

type Instances struct {
	component.Base
	Dependencies struct {
		Malt *malt.Malt
		SQL  *sql.SQL

		InstanceTable *sql.InstanceTable
	}
}

Instances manages multiple WissKI Instances.

func (*Instances) All

func (instances *Instances) All(ctx context.Context) ([]*wisski.WissKI, error)

All returns all instances of the WissKI Distillery in consistent order.

There is no guarantee that this order remains identical between different api releases; however subsequent invocations are guaranteed to return the same order.

func (*Instances) Create

func (instances *Instances) Create(slug string, system models.System) (wissKI *wisski.WissKI, err error)

Create fills the struct for a new WissKI instance. It validates that slug is a valid name for an instance.

It does not perform any checks if the instance already exists, or does the creation in the database.

func (*Instances) Has

func (instances *Instances) Has(ctx context.Context, slug string) (ok bool, err error)

Has checks if a WissKI with the provided slug exists inside the database. It does not perform any checks on the WissKI itself.

func (*Instances) Instance

func (instances *Instances) Instance(ctx context.Context, instance models.Instance) *wisski.WissKI

Instance is a convenience function to return an instance based on a model slug. When the instance does not exist, returns nil.

func (*Instances) IsValidSlug

func (instances *Instances) IsValidSlug(slug string) (string, error)

IsValidSlug checks if slug represents a valid slug for an instance.

func (*Instances) Load

func (instances *Instances) Load(ctx context.Context, slugs ...string) ([]*wisski.WissKI, error)

Load is like All, except that when no slugs are provided, it calls All.

func (*Instances) Path

func (instances *Instances) Path() string

func (*Instances) Update

func (instances *Instances) Update(ctx context.Context, progress io.Writer) error

Update installs or updates runtime components needed by this component.

func (*Instances) WissKI

func (instances *Instances) WissKI(ctx context.Context, slug string) (wissKI *wisski.WissKI, err error)

WissKI returns the WissKI with the provided slug, if it exists. It the WissKI does not exist, returns ErrWissKINotFound.

func (*Instances) WissKIs

func (instances *Instances) WissKIs(ctx context.Context, slugs ...string) ([]*wisski.WissKI, error)

WissKIs returns the WissKI instances with the provides slugs. If a slug does not exist, it is omitted from the result.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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