fakejob

package
v0.0.0-...-1ba95a4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DummyWorkerStatus

type DummyWorkerStatus struct {
	BusinessID int               `json:"business-id"`
	Tick       int64             `json:"tick"`
	Checkpoint *WorkerCheckpoint `json:"checkpoint"`
	// contains filtered or unexported fields
}

DummyWorkerStatus is used in fake worker as status.

func (*DummyWorkerStatus) DoTick

func (s *DummyWorkerStatus) DoTick()

DoTick is a periodically tick function.

func (*DummyWorkerStatus) GetEtcdCheckpoint

func (s *DummyWorkerStatus) GetEtcdCheckpoint() WorkerCheckpoint

GetEtcdCheckpoint returns cached checkpoint stored in etcd.

func (*DummyWorkerStatus) Marshal

func (s *DummyWorkerStatus) Marshal() ([]byte, error)

Marshal returns the JSON encoding of DummyWorkerStatus.

func (*DummyWorkerStatus) SetEtcdCheckpoint

func (s *DummyWorkerStatus) SetEtcdCheckpoint(ckpt *WorkerCheckpoint)

SetEtcdCheckpoint sets checkpoint to memory cache.

func (*DummyWorkerStatus) Unmarshal

func (s *DummyWorkerStatus) Unmarshal(data []byte) error

Unmarshal parses the JSON-encoded data and stores the result in DummyWorkerStatus.

type WorkerCheckpoint

type WorkerCheckpoint struct {
	Tick      int64  `json:"tick"`
	Revision  int64  `json:"revision"`
	MvccCount int    `json:"mvcc-count"`
	Value     string `json:"value"`
}

WorkerCheckpoint is used to resume a new worker from old checkpoint

type WorkerConfig

type WorkerConfig struct {
	ID         int   `json:"id"`
	TargetTick int64 `json:"target-tick"`

	EtcdWatchEnable     bool          `json:"etcd-watch-enable"`
	EtcdEndpoints       []string      `json:"etcd-endpoints"`
	EtcdWatchPrefix     string        `json:"etcd-watch-prefix"`
	InjectErrorInterval time.Duration `json:"inject-error-interval"`

	Checkpoint WorkerCheckpoint `json:"checkpoint"`
}

WorkerConfig defines config of fake worker

Jump to

Keyboard shortcuts

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