Documentation ¶
Index ¶
- func NewBroadcastResponse(name, result string) *pb.ListenJobResponse
- func NewRunJobError(reason string) (*pb.RunJobResponse, error)
- func NewRunJobSucces() (*pb.RunJobResponse, error)
- type EventBroadcaster
- type JobFunc
- type JobStore
- type SchedulerService
- func (s *SchedulerService) AddUnit(unit *SchedulerUnit) error
- func (s *SchedulerService) BuildRoutine(unit *SchedulerUnit) func()
- func (s *SchedulerService) ListenJobs(req *pb.ListenJobRequest, stream pb.Scheduler_ListenJobsServer) error
- func (s *SchedulerService) RunJob(ctx context.Context, req *pb.RunJobRequest) (*pb.RunJobResponse, error)
- func (s *SchedulerService) Shutdown()
- type SchedulerUnit
- type Streamer
- type Streams
- type UnitExecCmd
- type UnitExecFn
- type UnitExecutable
- type UnitStore
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 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 (s *SchedulerService) ListenJobs(req *pb.ListenJobRequest, stream pb.Scheduler_ListenJobsServer) error
func (*SchedulerService) RunJob ¶
func (s *SchedulerService) RunJob(ctx context.Context, req *pb.RunJobRequest) (*pb.RunJobResponse, error)
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 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 UnitStore ¶
type UnitStore map[string]*SchedulerUnit
Click to show internal directories.
Click to hide internal directories.