store

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package store provides utilities for storing data or state in a persistent fashion.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IStore

type IStore interface {
	io.Closer
	// GetPath returns the store path
	GetPath() string
	// SetPath sets the store path
	SetPath(path string) error
	// Create sets up the store
	Create(ctx context.Context) error
	// Exists returns whether the store exists or not
	Exists() bool
	// Clear clears the store
	Clear(ctx context.Context) error
	// GetElementPath determines the path to an element in the store.
	GetElementPath(elementName string) (path string)
	// HasElement States whether elementName is in the store or not.
	HasElement(elementName string) bool
	// GetFilesystem returns the store's filesystem
	GetFilesystem() filesystem.FS
}

func NewLocalStore

func NewLocalStore(rootPath string) IStore

NewLocalStore creates a persistent local store in the filesystem.

func NewLocalTemporaryStore

func NewLocalTemporaryStore() IStore

NewLocalTemporaryStore creates a local store in the temp directory

type LocalStore

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

func (*LocalStore) Clear

func (s *LocalStore) Clear(ctx context.Context) error

func (*LocalStore) Close

func (s *LocalStore) Close() error

func (*LocalStore) Create

func (s *LocalStore) Create(context.Context) error

func (*LocalStore) Exists

func (s *LocalStore) Exists() bool

func (*LocalStore) GetElementPath

func (s *LocalStore) GetElementPath(elementName string) (path string)

func (*LocalStore) GetFilesystem

func (s *LocalStore) GetFilesystem() filesystem.FS

func (*LocalStore) GetPath

func (s *LocalStore) GetPath() string

func (*LocalStore) HasElement

func (s *LocalStore) HasElement(elementName string) bool

func (*LocalStore) SetPath

func (s *LocalStore) SetPath(path string) error

type LocalTemporaryStore

type LocalTemporaryStore struct {
	LocalStore
}

func (*LocalTemporaryStore) Close

func (s *LocalTemporaryStore) Close() error

func (*LocalTemporaryStore) Create

func (*LocalTemporaryStore) SetPath

func (s *LocalTemporaryStore) SetPath(string) error

Jump to

Keyboard shortcuts

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