db

package
v0.0.0-...-d48a1cd Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func NewDB

func NewDB(cfg *config.Config) (*DB, error)

func (*DB) AcquireTask

func (db *DB) AcquireTask(workerName string) (*Task, error)

func (*DB) DeleteTask

func (db *DB) DeleteTask(t *Task) error

func (*DB) EmptyTask

func (db *DB) EmptyTask() Task

func (*DB) GetTask

func (db *DB) GetTask(index string, args ...interface{}) (*Task, error)

func (*DB) GetTasks

func (db *DB) GetTasks(ch chan *Task, index string, args ...interface{}) error

func (*DB) GetTasksBetweenState

func (db *DB) GetTasksBetweenState(ch chan *Task, stateStart int, stateEnd int) error

func (*DB) InsertTasks

func (db *DB) InsertTasks(tasks []*Task) error

func (*DB) ReadSnapshot

func (db *DB) ReadSnapshot(path string) error

func (*DB) UpdateTask

func (db *DB) UpdateTask(t *Task, state int, status string) error

func (*DB) WriteSnapshot

func (db *DB) WriteSnapshot(path string) error

type Task

type Task struct {
	Id       string `json:"id"`
	Sticker  string `json:"sticker"`
	Priority int    `json:"priority"`
	Body     string `json:"body"`
	Pool     string `json:"pool"`
	State    int    `json:"state"` // 0:NEW, 1:ACQUIRED, 2:WORK, 3:DONE, 4:ERROR
	Status   string `json:"status,omitempty"`
	Worker   string `json:"worker,omitempty"`
	Added    uint64 `json:"added"`
	Updated  uint64 `json:"updated"`
}

Jump to

Keyboard shortcuts

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