store

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: AGPL-3.0-or-later Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTokenNotFound = errors.New("token not found")

Functions

This section is empty.

Types

type Destination

type Destination struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
	URL  string    `json:"url"`
}

Destination represents a destination for a stream.

type FileStore

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

FileStore is a file-based store for persistent application state. It will probably be replaced with sqlite3 at some point.

FileStore is not thread-safe and should always be used from a single goroutine.

func New

func New(path string) (*FileStore, error)

New creates a new FileStore with the provided config file, creating it if it does not exist.

func (*FileStore) Get

func (s *FileStore) Get() State

Get returns the current state of the store.

func (*FileStore) Set

func (s *FileStore) Set(state State) error

Set sets the state of the store to the provided state.

type State

type State struct {
	Destinations []Destination `json:"destinations"`
}

State is the storable persistent state.

type TokenStore added in v0.0.15

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

TokenStore is a store which persistently stores tokens in the filesystem.

It will probably be replaced with sqlite3 at some point. All methods are safe for use from multiple goroutines.

func NewTokenStore added in v0.0.15

func NewTokenStore(dataDir string, logger *slog.Logger) *TokenStore

NewTokenStore creates a new TokenStore instance with the specified data directory and logger.

func (*TokenStore) Delete added in v0.0.15

func (s *TokenStore) Delete(key string) error

Delete removes a value from the store by its key.

func (*TokenStore) Get added in v0.0.15

func (s *TokenStore) Get(key string) (domain.Token, error)

Get retrieves a value from the store by its key.

func (*TokenStore) Put added in v0.0.15

func (s *TokenStore) Put(key string, token domain.Token) error

Put stores a value in the store under the specified key.

Jump to

Keyboard shortcuts

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