go-micro: github.com/micro/go-micro/sync/task Index | Files | Directories

package task

import "github.com/micro/go-micro/sync/task"

Package task provides an interface for distributed jobs


Package Files


type Command Uses

type Command struct {
    Name string
    Func func() error

Command to be executed

func (Command) Execute Uses

func (c Command) Execute() error

func (Command) String Uses

func (c Command) String() string

type Option Uses

type Option func(o *Options)

func WithPool Uses

func WithPool(i int) Option

WithPool sets the pool size for concurrent work

type Options Uses

type Options struct {
    // Pool size for workers
    Pool int
    // Alternative options
    Context context.Context

type Schedule Uses

type Schedule struct {
    // When to start the schedule. Zero time means immediately
    Time time.Time
    // Non zero interval dictates an ongoing schedule
    Interval time.Duration

Schedule represents a time or interval at which a task should run

func (Schedule) Run Uses

func (s Schedule) Run() <-chan time.Time

func (Schedule) String Uses

func (s Schedule) String() string

type Task Uses

type Task interface {
    // Run runs a command immediately until completion
    Run(Command) error
    // Status provides status of last execution
    Status() string

Task represents a distributed task


brokerPackage broker provides a distributed task manager built on the micro broker
localPackage local provides a local task runner

Package task imports 3 packages (graph) and is imported by 17 packages. Updated 2020-01-30. Refresh now. Tools for package owners.