Versions in this module Expand all Collapse all v0 v0.2.0 Apr 14, 2021 Changes in this version + func HandleAsLeader(ctx context.Context, nl net.Listener, dp string, cond *sync.Cond, ...) + func HandleAsWorker(ctx context.Context, addr string, storages []types.Storager) + type Leader struct + func NewLeader(ctx context.Context, nl net.Listener, databasePath string, job *models.Job) (l *Leader, err error) + func (l *Leader) CreateJob(ctx context.Context, req *models.CreateJobRequest) (reply *models.CreateJobReply, err error) + func (l *Leader) FinishJob(ctx context.Context, req *models.FinishJobRequest) (reply *models.FinishJobReply, err error) + func (l *Leader) PollJob(req *models.PollJobRequest, srv models.Worker_PollJobServer) (err error) + func (l *Leader) Serve(ctx context.Context) (err error) + func (l *Leader) WaitJob(ctx context.Context, req *models.WaitJobRequest) (reply *models.WaitJobReply, err error) + type Manager struct + func NewManager(ctx context.Context, cfg ManagerConfig) (p *Manager, err error) + func (p *Manager) DB() *models.DB + func (p *Manager) Elect(ctx context.Context, req *models.ElectRequest) (reply *models.ElectReply, err error) + func (p *Manager) Finish(ctx context.Context, req *models.FinishRequest) (reply *models.FinishReply, err error) + func (p *Manager) Poll(req *models.PollRequest, srv models.Staff_PollServer) (err error) + func (p *Manager) Register(ctx context.Context, req *models.RegisterRequest) (reply *models.RegisterReply, err error) + func (p *Manager) Stop(ctx context.Context) (err error) + type ManagerConfig struct + DatabasePath string + GrpcPort int + Host string + func (p ManagerConfig) GrpcAddr() string + type Staff struct + func NewStaff(ctx context.Context, cfg StaffConfig) (s *Staff, err error) + func (s *Staff) FinishTask(ctx context.Context, taskId string) (err error) + func (s *Staff) Start(ctx context.Context) (err error) + type StaffConfig struct + DataPath string + Host string + ManagerAddr string + type Worker struct + func NewWorker(ctx context.Context, addr string, storages []types.Storager) (w *Worker, err error) + func (w *Worker) Serve(ctx context.Context) (err error)