store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound errors when the querying object not exists
	ErrNotFound = errors.New("object not found")
	// ErrAlreadyExists errors when duplicated object found
	ErrAlreadyExists = errors.New("object already exists")
)

Functions

This section is empty.

Types

type Blob

type Blob struct {
	CreateAt time.Time
	UpdateAt time.Time
}

type CacheStore

type CacheStore struct {
	sync.Mutex
	*Database
}

func NewCacheStore

func NewCacheStore(db *Database) (*CacheStore, error)

func (*CacheStore) AddSnapshot

func (cs *CacheStore) AddSnapshot(imageID string, blobs []string) error

func (*CacheStore) DelSnapshot

func (cs *CacheStore) DelSnapshot(imageID string) error

func (*CacheStore) GC

func (cs *CacheStore) GC(delFunc func(blob string) error) ([]string, error)

type DaemonStore

type DaemonStore struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewDaemonStore

func NewDaemonStore(db *Database) (*DaemonStore, error)

func (*DaemonStore) Add

func (s *DaemonStore) Add(d *daemon.Daemon) error

func (*DaemonStore) CleanupDaemons

func (s *DaemonStore) CleanupDaemons(ctx context.Context) error

func (*DaemonStore) Delete

func (s *DaemonStore) Delete(d *daemon.Daemon) error

func (*DaemonStore) Get

func (s *DaemonStore) Get(id string) (*daemon.Daemon, error)

func (*DaemonStore) GetBySnapshot

func (s *DaemonStore) GetBySnapshot(snapshotID string) (*daemon.Daemon, error)

func (*DaemonStore) List

func (s *DaemonStore) List() []*daemon.Daemon

func (*DaemonStore) Size

func (s *DaemonStore) Size() int

func (*DaemonStore) Update

func (s *DaemonStore) Update(d *daemon.Daemon) error

func (*DaemonStore) WalkDaemons

func (s *DaemonStore) WalkDaemons(ctx context.Context, cb func(d *daemon.Daemon) error) error

type Database

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

Database keeps infos that need to survive among snapshotter restart

func NewDatabase

func NewDatabase(rootDir string) (*Database, error)

NewDatabase creates a new or open existing database file

func (*Database) CleanupDaemons

func (d *Database) CleanupDaemons(ctx context.Context) error

Cleanup deletes all daemon records

func (*Database) Close

func (d *Database) Close() error

func (*Database) DeleteDaemon

func (d *Database) DeleteDaemon(ctx context.Context, id string) error

DeleteDaemon deletes daemon record from database

func (*Database) SaveDaemon

func (d *Database) SaveDaemon(ctx context.Context, dmn *daemon.Daemon) error

SaveDaemon saves daemon record from database

func (*Database) UpdateDaemon

func (d *Database) UpdateDaemon(ctx context.Context, dmn *daemon.Daemon) error

UpdateDaemon updates daemon record in the database

func (*Database) WalkDaemons

func (d *Database) WalkDaemons(ctx context.Context, cb func(info *daemon.Daemon) error) error

WalkDaemons iterates all daemon records and invoke callback on each

type Snapshot

type Snapshot struct {
	ImageID  string
	Blobs    []string
	CreateAt time.Time
	UpdateAt time.Time
}

Jump to

Keyboard shortcuts

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