Documentation ¶
Index ¶
- func CheckpointKey(id frameModel.MasterID) string
- func RegisterWorker()
- type Checkpoint
- type Config
- type Master
- func (m *Master) CloseImpl(ctx context.Context)
- func (m *Master) ID() worker.RunnableID
- func (m *Master) InitImpl(ctx context.Context) error
- func (m *Master) IsJobMasterImpl()
- func (m *Master) OnCancel(ctx context.Context) error
- func (m *Master) OnMasterMessage(ctx context.Context, topic p2p.Topic, message p2p.MessageValue) error
- func (m *Master) OnMasterRecovered(ctx context.Context) error
- func (m *Master) OnOpenAPIInitialized(apiGroup *gin.RouterGroup)
- func (m *Master) OnWorkerDispatched(worker framework.WorkerHandle, result error) error
- func (m *Master) OnWorkerMessage(worker framework.WorkerHandle, topic p2p.Topic, message interface{}) error
- func (m *Master) OnWorkerOffline(worker framework.WorkerHandle, reason error) error
- func (m *Master) OnWorkerOnline(worker framework.WorkerHandle) error
- func (m *Master) OnWorkerStatusUpdated(worker framework.WorkerHandle, newStatus *frameModel.WorkerStatus) error
- func (m *Master) Status() frameModel.WorkerStatus
- func (m *Master) StopImpl(ctx context.Context)
- func (m *Master) Tick(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckpointKey ¶
func CheckpointKey(id frameModel.MasterID) string
CheckpointKey returns key path used in etcd for checkpoint
func RegisterWorker ¶
func RegisterWorker()
RegisterWorker registers fake job master and fake worker to global registry.
Types ¶
type Checkpoint ¶
type Checkpoint struct { Ticks map[int]int64 `json:"ticks"` Checkpoints map[int]fakejobPkg.WorkerCheckpoint `json:"checkpoints"` }
Checkpoint defines the checkpoint of fake job
type Config ¶
type Config struct { JobName string `json:"job-name"` WorkerCount int `json:"worker-count"` TargetTick int `json:"target-tick"` EtcdWatchEnable bool `json:"etcd-watch-enable"` EtcdEndpoints []string `json:"etcd-endpoints"` EtcdWatchPrefix string `json:"etcd-watch-prefix"` EtcdStartRevision int64 `json:"etcd-start-revision"` InjectErrorInterval time.Duration `json:"inject-error-interval"` }
Config represents the job config of fake master
type Master ¶
type Master struct { framework.BaseJobMaster // contains filtered or unexported fields }
Master defines the job master implementation of fake job.
func NewFakeMaster ¶
func NewFakeMaster(ctx *dcontext.Context, workerID frameModel.WorkerID, masterID frameModel.MasterID, masterConfig *Config) *Master
NewFakeMaster creates a new fake master instance
func (*Master) IsJobMasterImpl ¶
func (m *Master) IsJobMasterImpl()
IsJobMasterImpl implements JobMasterImpl.IsJobMasterImpl
func (*Master) OnMasterMessage ¶
func (m *Master) OnMasterMessage(ctx context.Context, topic p2p.Topic, message p2p.MessageValue) error
OnMasterMessage implements MasterImpl.OnMasterMessage
func (*Master) OnMasterRecovered ¶
OnMasterRecovered implements MasterImpl.OnMasterRecovered
func (*Master) OnOpenAPIInitialized ¶
func (m *Master) OnOpenAPIInitialized(apiGroup *gin.RouterGroup)
OnOpenAPIInitialized implements JobMasterImpl.OnOpenAPIInitialized.
func (*Master) OnWorkerDispatched ¶
func (m *Master) OnWorkerDispatched(worker framework.WorkerHandle, result error) error
OnWorkerDispatched implements MasterImpl.OnWorkerDispatched
func (*Master) OnWorkerMessage ¶
func (m *Master) OnWorkerMessage(worker framework.WorkerHandle, topic p2p.Topic, message interface{}) error
OnWorkerMessage implements MasterImpl.OnWorkerMessage
func (*Master) OnWorkerOffline ¶
func (m *Master) OnWorkerOffline(worker framework.WorkerHandle, reason error) error
OnWorkerOffline implements MasterImpl.OnWorkerOffline
func (*Master) OnWorkerOnline ¶
func (m *Master) OnWorkerOnline(worker framework.WorkerHandle) error
OnWorkerOnline implements MasterImpl.OnWorkerOnline
func (*Master) OnWorkerStatusUpdated ¶
func (m *Master) OnWorkerStatusUpdated(worker framework.WorkerHandle, newStatus *frameModel.WorkerStatus) error
OnWorkerStatusUpdated implements MasterImpl.OnWorkerStatusUpdated