service

package
v0.0.1-alpha8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAccountAlreadyExists = errors.New("account already exists")
	ErrAccountNotFound      = errors.New("account not found")
)
View Source
var (
	ErrWritingModuleFailed = errors.New("module write failed")
	ErrReadingModule       = errors.New("module read failed")
)
View Source
var ErrDeviceNotFound = errors.New("device not found")

Functions

This section is empty.

Types

type Account

type Account interface {
	Username() string
	HashedPass() string
}

type Accounts

type Accounts interface {
	Find(ctx context.Context, username string) (Account, error)
	Register(ctx context.Context, username string) (Account, string, error)
	Share(ctx context.Context, username string) (string, error)

	ActiveShares(ctx context.Context, username string) ([]string, error)
	IsShared(ctx context.Context, username string, share string) (bool, error)
	Revoke(ctx context.Context, username string, shareCode string) error

	HealthCheck() HealthCheck
}

type Device

type Device interface {
	ID() string
}

type Devices

type Devices interface {
	FindByAccount(ctx context.Context, acc Account) ([]Device, error)
	FindByDeviceID(ctx context.Context, acc Account, deviceID string) (Device, error)
	Register(ctx context.Context, acc Account, deviceID string) (Device, error)
	HealthCheck() HealthCheck
}

type Health

type Health interface {
	Check(ctx context.Context) HealthAggregation
}

func HealthAggregator

func HealthAggregator(healthChecks []HealthCheck) Health

type HealthAggregation

type HealthAggregation struct {
	Health     HealthResult                 `yaml:"health"`
	Components []HealthAggregationComponent `yaml:"components"`
}

type HealthAggregationComponent

type HealthAggregationComponent struct {
	Name   string       `yaml:"name"`
	Health HealthResult `yaml:"health"`
}

type HealthCheck

type HealthCheck func(ctx context.Context) (string, bool)

type HealthResult

type HealthResult string
const (
	HealthUp   HealthResult = "Up"
	HealthDown HealthResult = "Down"
)

func HealthResultFromBool

func HealthResultFromBool(healthUp bool) HealthResult

type Module

type Module interface {
	Raw() io.Reader
	Size() int
}

type Modules

type Modules interface {
	Set(ctx context.Context, name string, module Module) error
	Get(ctx context.Context, name string) (Module, error)
	HealthCheck() HealthCheck
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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