storage

package
v0.0.0-...-f95c406 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStorage

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

MemoryStorage is a memory task store

func NewMemoryStorage

func NewMemoryStorage() *MemoryStorage

NewMemoryStorage returns an instance of MemoryStorage.

func (*MemoryStorage) Add

func (memStore *MemoryStorage) Add(task TaskAttributes) error

Add adds a task to the memory store.

func (*MemoryStorage) Fetch

func (memStore *MemoryStorage) Fetch() ([]TaskAttributes, error)

Fetch will return all tasks stored.

func (*MemoryStorage) Remove

func (memStore *MemoryStorage) Remove(task TaskAttributes) error

Remove will remove task from store

type NoOpStorage

type NoOpStorage struct {
}

NoOpStorage is an ineffective storage which can be used to prevent storing tasks altogether.

func NewNoOpStorage

func NewNoOpStorage() NoOpStorage

NewNoOpStorage returns an instance of NoOpStorage

func (NoOpStorage) Add

func (noop NoOpStorage) Add(task TaskAttributes) error

Add does nothing

func (NoOpStorage) Fetch

func (noop NoOpStorage) Fetch() ([]TaskAttributes, error)

Fetch returns an empty list of tasks

func (NoOpStorage) Remove

func (noop NoOpStorage) Remove(task TaskAttributes) error

Remove does nothing

type Sqlite3Config

type Sqlite3Config struct {
	DbName string
}

Sqlite3Config is the config structure holding information about sqlite db.

type Sqlite3Storage

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

Sqlite3Storage is the structure responsible for handling sqlite3 storage.

func NewSqlite3Storage

func NewSqlite3Storage(config Sqlite3Config) Sqlite3Storage

NewSqlite3Storage returns a new instance of Sqlite3Storage.

func (Sqlite3Storage) Add

func (sqlite Sqlite3Storage) Add(task TaskAttributes) error

Add stores the task to sqlite.

func (*Sqlite3Storage) Close

func (sqlite *Sqlite3Storage) Close() error

Close will close the open DB file.

func (*Sqlite3Storage) Connect

func (sqlite *Sqlite3Storage) Connect() error

Connect creates the database file.

func (Sqlite3Storage) Fetch

func (sqlite Sqlite3Storage) Fetch() ([]TaskAttributes, error)

Fetch will return the list of all stored tasks.

func (*Sqlite3Storage) Initialize

func (sqlite *Sqlite3Storage) Initialize() error

Initialize will run once to initialize the state of the database into the required one. In this case, it'll create the tables required to store task information.

func (Sqlite3Storage) Remove

func (sqlite Sqlite3Storage) Remove(task TaskAttributes) error

Remove will delete the task from storage.

type TaskAttributes

type TaskAttributes struct {
	Hash        string
	Name        string
	LastRun     string
	NextRun     string
	Duration    string
	IsRecurring string
	Params      string
}

TaskAttributes is a struct which is used to transfer data from/to stores. All task data are converted from/to string to prevent the store from worrying about details of converting data to the proper formats.

type TaskStore

type TaskStore interface {
	Add(TaskAttributes) error
	Fetch() ([]TaskAttributes, error)
	Remove(TaskAttributes) error
}

TaskStore is the interface to implement when adding custom task storage.

Jump to

Keyboard shortcuts

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