storage

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// <version>|<index>|<time>|<id>|<command>
	HistoryItemVersion1 string = "1"
)

Variables

View Source
var (
	ErrNoPreviousMeasurements = errors.New("no previous measurements found")
	ErrInvalidIndex           = errors.New("invalid index")
	ErrIndexOutOfRange        = errors.New("index out of range")
)
View Source
var (
	ErrReadHistory = errors.New("failed to read history")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Profile       string              `json:"profile"`
	Profiles      map[string]*Profile `json:"profiles"`
	LastMigration int                 `json:"last_migration"`
}

type LocalStorage

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

func NewLocalStorage

func NewLocalStorage(utils utils.Utils) *LocalStorage

func (*LocalStorage) Cleanup added in v1.4.2

func (s *LocalStorage) Cleanup() error

func (*LocalStorage) GetHistory added in v1.4.2

func (s *LocalStorage) GetHistory(limit int) ([]string, error)

func (*LocalStorage) GetHistoryIndex added in v1.4.2

func (s *LocalStorage) GetHistoryIndex() (int, error)

func (*LocalStorage) GetIdFromSession added in v1.4.2

func (s *LocalStorage) GetIdFromSession(index int) (string, error)

Returns the measurement ID at the given index from the session history

func (*LocalStorage) GetMeasurements added in v1.4.2

func (s *LocalStorage) GetMeasurements() ([]byte, error)

func (*LocalStorage) GetProfile

func (s *LocalStorage) GetProfile() *Profile

func (*LocalStorage) Init

func (s *LocalStorage) Init(dirName string) error

func (*LocalStorage) LoadConfig

func (s *LocalStorage) LoadConfig() (*Config, error)

func (*LocalStorage) Migrate added in v1.4.2

func (s *LocalStorage) Migrate() error

func (*LocalStorage) Remove

func (s *LocalStorage) Remove() error

func (*LocalStorage) SaveCommandToHistory added in v1.4.2

func (s *LocalStorage) SaveCommandToHistory(
	index string,
	time int64,
	ids string,
	cmd string,
) error

func (*LocalStorage) SaveConfig

func (s *LocalStorage) SaveConfig() error

func (*LocalStorage) SaveIdToSession added in v1.4.2

func (s *LocalStorage) SaveIdToSession(id string) error

func (*LocalStorage) UpdateSessionDir added in v1.4.2

func (s *LocalStorage) UpdateSessionDir() error

type MigrationFunc added in v1.4.2

type MigrationFunc func() error

type Profile

type Profile struct {
	Token *globalping.Token `json:"token"`
}

Jump to

Keyboard shortcuts

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