fakejob

package
v0.0.0-...-4624acb Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

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

func (*Checkpoint) String

func (cp *Checkpoint) String() string

String implements fmt.Stringer

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) CloseImpl

func (m *Master) CloseImpl(ctx context.Context)

CloseImpl implements MasterImpl.CloseImpl

func (*Master) ID

func (m *Master) ID() worker.RunnableID

ID implements BaseJobMaster.ID

func (*Master) InitImpl

func (m *Master) InitImpl(ctx context.Context) error

InitImpl implements BaseJobMaster.InitImpl

func (*Master) IsJobMasterImpl

func (m *Master) IsJobMasterImpl()

IsJobMasterImpl implements JobMasterImpl.IsJobMasterImpl

func (*Master) OnCancel

func (m *Master) OnCancel(ctx context.Context) error

OnCancel implements JobMasterImpl.OnCancel

func (*Master) OnMasterMessage

func (m *Master) OnMasterMessage(ctx context.Context, topic p2p.Topic, message p2p.MessageValue) error

OnMasterMessage implements MasterImpl.OnMasterMessage

func (*Master) OnMasterRecovered

func (m *Master) OnMasterRecovered(ctx context.Context) error

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

func (*Master) Status

func (m *Master) Status() frameModel.WorkerStatus

Status implements

func (*Master) StopImpl

func (m *Master) StopImpl(ctx context.Context)

StopImpl implements MasterImpl.StopImpl

func (*Master) Tick

func (m *Master) Tick(ctx context.Context) error

Tick implements MasterImpl.Tick

Jump to

Keyboard shortcuts

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