task

package
v0.0.0-...-f0b9b21 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByLastActivity

type ByLastActivity []Info

func (ByLastActivity) Len

func (n ByLastActivity) Len() int

func (ByLastActivity) Less

func (n ByLastActivity) Less(i, j int) bool

func (ByLastActivity) Swap

func (n ByLastActivity) Swap(i, j int)

type ByName

type ByName []Info

func (ByName) Len

func (n ByName) Len() int

func (ByName) Less

func (n ByName) Less(i, j int) bool

func (ByName) Swap

func (n ByName) Swap(i, j int)

type Config

type Config struct {
	Period time.Duration
	Other  any
}

type Info

type Info struct {
	ID           uuid.UUID     `json:"id"`
	Name         string        `json:"name"`
	State        State         `json:"state"`
	LastActivity time.Time     `json:"lastActivity,omitempty"`
	StartedAt    *time.Time    `json:"startedAt,omitempty"`
	EndedAt      *time.Time    `json:"endedAt,omitempty"`
	NextActivity *time.Time    `json:"nextActivity,omitempty"`
	Period       time.Duration `json:"period"`
}

type State

type State int
const (
	State_Undefined State = 1 << iota
	State_Enable
	State_Disable
	State_Passive
	State_Active
)

func GetState

func GetState(state string) State

func (State) MarshalJSON

func (s State) MarshalJSON() ([]byte, error)

func (State) String

func (s State) String() string

func (*State) UnmarshalJSON

func (s *State) UnmarshalJSON(b []byte) error

type Task

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

func (*Task) Config

func (t *Task) Config() any

func (*Task) Context

func (t *Task) Context() context.Context

func (*Task) FS

func (t *Task) FS() *fs.FileSystem

func (*Task) ID

func (t *Task) ID() uuid.UUID

func (*Task) L

func (t *Task) L(ctx context.Context) *zap.Logger

func (*Task) Name

func (t *Task) Name() string

func (*Task) Relay

func (t *Task) Relay() *relay.Relay

func (*Task) Svcs

func (t *Task) Svcs() lifecycle.ServiceLifecycle

func (*Task) Tracer

func (t *Task) Tracer() trace.Tracer

type TaskFactory

type TaskFactory interface {
	Create(name string, config any) *Task
}

func NewFactory

func NewFactory(
	svcs lifecycle.ServiceLifecycle,
	relay *relay.Relay,
	fs *fs.FileSystem,
) TaskFactory

type Tasker

type Tasker interface {
	Config() any
	Svcs() lifecycle.ServiceLifecycle
	Relay() *relay.Relay
	FS() *fs.FileSystem
	ID() uuid.UUID
	Name() string
	Run(ctx context.Context) error
	L(ctx context.Context) *zap.Logger
}

Jump to

Keyboard shortcuts

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