config

package
v0.0.0-...-460841a Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfigNotFound = stderrors.New("config not found")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Context maybe.Maybe[StoreID] // store ID
	Stores  []Store              // paths to stores

	Identities []encryption.Identity
}

type Service

type Service interface {
	Init(ctx context.Context) error

	SetCurrentStore(ctx context.Context, storeID string) error

	CurrentStoreID(ctx context.Context) (maybe.Maybe[StoreID], error)
	CurrentStorePath(ctx context.Context) (maybe.Maybe[string], error)
	GostoreLocation(ctx context.Context) string

	ListStores(ctx context.Context) ([]StoreView, error)
	StoreByID(ctx context.Context, storeID StoreID) (maybe.Maybe[StoreView], error)

	AddIdentity(ctx context.Context, identities ...encryption.Identity) error
	AddStore(ctx context.Context, storeID StoreID, path string) error

	ImportRawIdentity(ctx context.Context, provider encryption.Provider, data []byte) error
	ExportRawIdentity(ctx context.Context, recipients ...encryption.Recipient) ([][]byte, error)

	RemoveStore(ctx context.Context, storeID StoreID) error

	store.IdentityProvider
}

func NewService

func NewService(
	storage Storage,
	gostoreLocation string,
	storageManager storage.Manager,
	encryptionManager encryption.Manager,
) Service

type Storage

type Storage interface {
	Load(ctx context.Context) (Config, error)
	Store(ctx context.Context, config Config) error
}

type Store

type Store struct {
	ID   StoreID
	Path string
}

type StoreID

type StoreID string

type StoreView

type StoreView struct {
	ID      StoreID
	Path    string
	Current bool
}

Jump to

Keyboard shortcuts

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