storage

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: Apache-2.0, BSD-3-Clause, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

func New

func New(db *mongo.Client) *Storage

func (*Storage) Ack

func (s *Storage) Ack(ctx context.Context, task *service.Task) error

Ack removes a task from the `tasks` collection.

func (*Storage) AckGroupTasks

func (s *Storage) AckGroupTasks(ctx context.Context, group *service.Group) error

AckGroupTasks removes tasks from tasks collection by groupID

func (*Storage) AckList

func (s *Storage) AckList(ctx context.Context, taskList *service.TaskList) error

AckList removes a taskList from the `tasksLists` collection.

func (*Storage) Add

func (s *Storage) Add(ctx context.Context, task *service.Task) error

func (*Storage) AddTaskList

func (s *Storage) AddTaskList(ctx context.Context, taskList *service.TaskList, tasks []*service.Task) error

func (*Storage) EventTask

func (s *Storage) EventTask(ctx context.Context, key, namespace, scope string) (*service.EventTask, error)

func (*Storage) GetGroupTasks

func (s *Storage) GetGroupTasks(ctx context.Context, group *service.Group) ([]*service.Task, error)

GetGroupTasks fetches all tasks by a groupID

func (*Storage) Poll

func (s *Storage) Poll(ctx context.Context) (*service.Task, error)

Poll retrieves one task with empty groupID from the tasks collection with the older ones being retrieved first (FIFO). It updates the state of the task to "pending", so that consequent calls to Poll would not retrieve the same task.

func (*Storage) PollList

func (s *Storage) PollList(ctx context.Context) (*service.TaskList, error)

PollList retrieves one taskList from the taskLists collection with the older ones being retrieved first (FIFO). It updates the state of the task to "pending", so that consequent calls to PollList would not retrieve the same task.

func (*Storage) SaveTaskHistory

func (s *Storage) SaveTaskHistory(ctx context.Context, task *service.Task) error

SaveTaskHistory saves a task to the `tasksHistory` collection.

func (*Storage) SaveTaskListHistory

func (s *Storage) SaveTaskListHistory(ctx context.Context, taskList *service.TaskList) error

SaveTaskListHistory adds a tasklist to the taskListHistory collection

func (*Storage) Task

func (s *Storage) Task(ctx context.Context, taskID string) (*service.Task, error)

func (*Storage) TaskHistory

func (s *Storage) TaskHistory(ctx context.Context, taskID string) (*service.Task, error)

func (*Storage) TaskList

func (s *Storage) TaskList(ctx context.Context, taskListID string) (*service.TaskList, error)

TaskList retrieves a tasklist.TaskList from taskLists collection by ID

func (*Storage) TaskListHistory

func (s *Storage) TaskListHistory(ctx context.Context, taskListID string) (*service.TaskList, error)

TaskListHistory retrieves a tasklist.TaskList from taskListHistory collection by ID

func (*Storage) TaskListTemplate

func (s *Storage) TaskListTemplate(ctx context.Context, taskListName string) (*service.Template, error)

TaskListTemplate retrieves one taskList definition by name from storage

func (*Storage) TaskTemplate

func (s *Storage) TaskTemplate(ctx context.Context, taskName string) (*service.Task, error)

func (*Storage) TaskTemplates

func (s *Storage) TaskTemplates(ctx context.Context, names []string) (map[string]*service.Task, error)

TaskTemplates retrieves task definitions from storage by names.

The result is a map where 'key' is the task name and 'value' is the task definition

func (*Storage) Unack

func (s *Storage) Unack(ctx context.Context, t *service.Task) error

Unack changes the "pending" state of a task to "created", so that it can be retrieved for processing again.

Jump to

Keyboard shortcuts

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