gocron_server

package
v0.0.0-...-940c57f Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBroadcastResponse

func NewBroadcastResponse(name, result string) *pb.ListenJobResponse

func NewRunJobError

func NewRunJobError(reason string) (*pb.RunJobResponse, error)

func NewRunJobSucces

func NewRunJobSucces() (*pb.RunJobResponse, error)

Types

type EventBroadcaster

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

func NewEventBroadcaster

func NewEventBroadcaster() *EventBroadcaster

func (*EventBroadcaster) Publish

func (b *EventBroadcaster) Publish(resp *pb.ListenJobResponse)

func (*EventBroadcaster) Subscribe

func (b *EventBroadcaster) Subscribe(stream Streamer)

func (*EventBroadcaster) SubscriberCount

func (b *EventBroadcaster) SubscriberCount() int

type JobFunc

type JobFunc func() (string, error)

type JobStore

type JobStore map[string]*gocron.Job

type SchedulerService

type SchedulerService struct {
	pb.UnimplementedSchedulerServer
	UnitStore
	JobStore
	EventBroadcaster

	Scheduler *gocron.Scheduler
}

func NewSchedulerService

func NewSchedulerService() *SchedulerService

func (*SchedulerService) AddUnit

func (s *SchedulerService) AddUnit(unit *SchedulerUnit) error

func (*SchedulerService) BuildRoutine

func (s *SchedulerService) BuildRoutine(unit *SchedulerUnit) func()

func (*SchedulerService) ListenJobs

func (*SchedulerService) RunJob

func (*SchedulerService) Shutdown

func (s *SchedulerService) Shutdown()

type SchedulerUnit

type SchedulerUnit struct {
	Name string
	Exec UnitExecutable
	Cron string
}

func NewManualUnit

func NewManualUnit(name string, exec UnitExecutable) *SchedulerUnit

func NewSchedulerUnit

func NewSchedulerUnit(name, cron string, exec UnitExecutable) *SchedulerUnit

type Streamer

type Streamer interface {
	Send(*pb.ListenJobResponse) error
}

type Streams

type Streams []Streamer

type UnitExecCmd

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

func NewUnitExecCmd

func NewUnitExecCmd(command string) *UnitExecCmd

func (*UnitExecCmd) Call

func (ue *UnitExecCmd) Call() (string, error)

type UnitExecFn

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

func NewUnitExecFn

func NewUnitExecFn(fn JobFunc) *UnitExecFn

func (*UnitExecFn) Call

func (ue *UnitExecFn) Call() (string, error)

type UnitExecutable

type UnitExecutable interface {
	Call() (string, error)
}

type UnitStore

type UnitStore map[string]*SchedulerUnit

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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