Documentation ¶
Index ¶
- Constants
- func HandleAsLeader(ctx context.Context, addr, subject string, workerIds []string, job *proto.Job) (err error)
- func HandleAsWorker(ctx context.Context, addr, subject string, storages []types.Storager) (err error)
- func SubjectClockin(subject string) string
- func SubjectClockout(subject string) string
- func SubjectClockoutNotify(subject string) string
- func SubjectJobReply(jobId string) string
- func SubjectTask(taskId string) string
- func SubjectTaskReply(taskId string) string
- func SubjectTasks() string
- type Leader
- type Manager
- func (p *Manager) Elect(ctx context.Context, request *proto.ElectRequest) (*proto.ElectReply, error)
- func (p *Manager) Publish(ctx context.Context, task *proto.Task) (err error)
- func (p *Manager) Register(ctx context.Context, request *proto.RegisterRequest) (*proto.RegisterReply, error)
- func (p *Manager) Wait(ctx context.Context, task *proto.Task) (err error)
- type ManagerConfig
- type Runner
- func (rn *Runner) Async(ctx context.Context, job *proto.Job) (err error)
- func (rn *Runner) Await(ctx context.Context) (err error)
- func (rn *Runner) Finish(ctx context.Context, reply string, err error) error
- func (rn *Runner) Handle(reply string)
- func (rn *Runner) HandleCopyDir(ctx context.Context, msg protobuf.Message) error
- func (rn *Runner) HandleCopyFile(ctx context.Context, msg protobuf.Message) error
- func (rn *Runner) HandleCopyMultipart(ctx context.Context, msg protobuf.Message) error
- func (rn *Runner) HandleCopyMultipartFile(ctx context.Context, msg protobuf.Message) error
- func (rn *Runner) HandleCopySingleFile(ctx context.Context, msg protobuf.Message) error
- func (rn *Runner) Sync(ctx context.Context, job *proto.Job) (err error)
- type Staff
- type StaffConfig
- type Worker
Constants ¶
View Source
const ( TypeCopyDir uint32 = iota + 1 TypeCopyFile TypeCopySingleFile TypeCopyMultipartFile TypeCopyMultipart )
View Source
const ( JobStatusSucceed uint32 = iota JobStatusFailed )
Variables ¶
This section is empty.
Functions ¶
func HandleAsLeader ¶
func HandleAsWorker ¶
func SubjectClockout ¶
subject is the ElectReply.Subject
func SubjectClockoutNotify ¶
subject is the ElectReply.Subject
func SubjectJobReply ¶
JobReply subject will be holding on Staff. Staff will use this subject to wait for replies on specific job.
func SubjectTask ¶
Task subject will be holding on Staff. All staff (both leader and worker) will use this subject to publish new jobs.
func SubjectTaskReply ¶
TaskReply subject will be holding on Manager.
func SubjectTasks ¶
func SubjectTasks() string
Tasks subject will be holding on Manager. Manager use this subject to publish new tasks.
Types ¶
type Manager ¶
type Manager struct { proto.UnimplementedStaffServer // contains filtered or unexported fields }
func NewManager ¶
func NewManager(ctx context.Context, cfg ManagerConfig) (p *Manager, err error)
func (*Manager) Elect ¶
func (p *Manager) Elect(ctx context.Context, request *proto.ElectRequest) (*proto.ElectReply, error)
func (*Manager) Register ¶
func (p *Manager) Register(ctx context.Context, request *proto.RegisterRequest) (*proto.RegisterReply, error)
type ManagerConfig ¶
func (ManagerConfig) GrpcAddr ¶
func (p ManagerConfig) GrpcAddr() string
func (ManagerConfig) QueueAddr ¶
func (p ManagerConfig) QueueAddr() string
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func (*Runner) HandleCopyDir ¶
func (*Runner) HandleCopyFile ¶
func (*Runner) HandleCopyMultipart ¶
func (*Runner) HandleCopyMultipartFile ¶
func (*Runner) HandleCopySingleFile ¶
type Staff ¶
type Staff struct {
// contains filtered or unexported fields
}
type StaffConfig ¶
Click to show internal directories.
Click to hide internal directories.