tasks

package
v0.11.7 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NothingToSelectError = fmt.Errorf("nothing to select")

Functions

This section is empty.

Types

type Map added in v0.4.0

type Map[T any] interface {
	Store(id string, data T)
	Load(id string) (data T, ok bool)
	Delete(id string)
	Range(f func(k string, v T) bool)
}

func New added in v0.4.0

func New[T any]() Map[T]

type TaskData

type TaskData[DT any] struct {
	Id       uuid.UUID `json:"id"`
	Data     DT        `json:"data"`
	TimeOut  time.Time `json:"time_out,omitempty"`
	Selector string    `json:"selector"`
	Next     uuid.UUID `json:"next_id"`
}

type Tasks

type Tasks[DT any] interface {
	Create(uuid.UUID, DT) error
	Select() (TaskData[DT], error)
	Finish(uuid.UUID) error
}

func Init

func Init[DT any](s stream.Stream, dataTypeName, dataTypeVersion string, p stream.CryptoKeyProvider, ctx context.Context) (ed Tasks[DT], err error)

Jump to

Keyboard shortcuts

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