storage

package
v0.0.0-...-eef338d Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const Bucket = "duty-tasks"

Variables

This section is empty.

Functions

func Deserialize

func Deserialize(payload []byte) (task.ScheduledTask, error)

func Serialize

func Serialize(task task.ScheduledTask) ([]byte, error)

Types

type BoltDB

type BoltDB struct {
	DB *bolt.DB
}

func NewBoltDBStorage

func NewBoltDBStorage(path string) (*BoltDB, error)

func (BoltDB) Close

func (s BoltDB) Close()

func (BoltDB) Delete

func (s BoltDB) Delete(id string) (bool, error)

func (BoltDB) Exists

func (s BoltDB) Exists(id string) bool

func (BoltDB) ListAll

func (s BoltDB) ListAll() ([]task.ScheduledTask, error)

func (BoltDB) ListByType

func (s BoltDB) ListByType(types string) ([]task.ScheduledTask, error)

func (BoltDB) Status

func (s BoltDB) Status(id string) (task.ScheduledTask, error)

func (BoltDB) Store

func (s BoltDB) Store(task task.ScheduledTask) error

func (BoltDB) Update

func (s BoltDB) Update(task task.ScheduledTask, status task.Status) error

type Memory

type Memory struct {
	Tasks map[string]task.ScheduledTask
}

func NewMemoryStorage

func NewMemoryStorage() Memory

func (Memory) Close

func (m Memory) Close()

func (Memory) Delete

func (m Memory) Delete(id string) (bool, error)

func (Memory) Exists

func (m Memory) Exists(id string) bool

func (Memory) ListAll

func (m Memory) ListAll() ([]task.ScheduledTask, error)

func (Memory) ListByType

func (m Memory) ListByType(types string) ([]task.ScheduledTask, error)

func (Memory) Status

func (m Memory) Status(id string) (task.ScheduledTask, error)

func (Memory) Store

func (m Memory) Store(task task.ScheduledTask) error

func (Memory) Update

func (m Memory) Update(task task.ScheduledTask, status task.Status) error

type Storage

type Storage interface {
	Store(task task.ScheduledTask) error

	Update(task.ScheduledTask, task.Status) error

	Status(id string) (task.ScheduledTask, error)

	Exists(id string) bool

	ListByType(types string) ([]task.ScheduledTask, error)

	ListAll() ([]task.ScheduledTask, error)

	Delete(id string) (bool, error)

	Close()
}

Jump to

Keyboard shortcuts

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