storage

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPostgresStorage

func NewPostgresStorage(config PostgresDBConfig) (postgres *postgresStorage, err error)

creates new instance of postgres DB

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) Close

func (memStore *MemoryStorage) Close() error

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) Close

func (noop NoOpStorage) Close() error

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 PostgresDBConfig

type PostgresDBConfig struct {
	DbURL string
}

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
	Close() 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