item

package
v0.5.15 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxTime             = time.Unix(1<<63-62135596801, 999999999)
	ErrSortNotSupported = fmt.Errorf("sort parameter not supported")
)
View Source
var (
	ErrInvalidRequestID  = fmt.Errorf("invalid request id")
	ErrInvalidRequestCID = fmt.Errorf("invalid request cid")
)

Functions

This section is empty.

Types

type Item

type Item struct {
	ID        uuid.UUID
	RootNodes []dag.Node[dag.IOSpec]
	CID       string
	Metadata  ItemMetadata
}

type ItemMetadata

type ItemMetadata struct {
	CreatedAt time.Time
	StartedAt time.Time
	EndedAt   time.Time
}

type ItemParams

type ItemParams struct {
	ID       uuid.UUID
	CID      string
	Priority bool
}

type ItemStore

type ItemStore interface {
	NewItem(ctx context.Context, params ItemParams) error
	ListItems(ctx context.Context, params ListParams) ([]*Item, error)
	CountItems(ctx context.Context) (int64, error)
	GetItem(ctx context.Context, id uuid.UUID) (*Item, error)
}

ItemStore is an interface to retrieve and store items

func NewItemStore

func NewItemStore(ctx context.Context, database db.Queue, nodeStore dag.NodeStore[dag.IOSpec]) (ItemStore, error)

type ListParams added in v0.5.1

type ListParams struct {
	PageSize   int
	PageNumber int
	Sort       string
}

func NewListParams added in v0.5.4

func NewListParams() ListParams

type QueueRepository

type QueueRepository interface {
	List(context.Context, ListParams) ([]*Item, error)
	Count(context.Context) (int64, error)
	Get(context.Context, uuid.UUID) (*Item, error)
	Create(context.Context, ItemParams) error
}

QueueRepository is a repository of Queue items

func NewQueueRepository

func NewQueueRepository(repo ItemStore, priorityQueue queue.Queue, secondaryQueue queue.Queue, taskFactory task.TaskFactory, nodeExecutor dag.NodeExecutor[dag.IOSpec]) (QueueRepository, error)

Jump to

Keyboard shortcuts

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