A Raft-based embedded job scheduler for your Go projects.
- Disaster tolerance: if not all of the hosts are down, the job should be fired successfully.
- Validity: only one host runs each job.
- Schedule strategy.
- Automatic panic recovery.
The Examples folder contains a bunch of code samples you can look into.
All jobs implementations have to satisfy jobs/Job
interface. Internal job state such as counters should only change in PostExecution
method.
PostExecution
method is called on each node in cluster in order to provide consistency.
NextTriggerTime
method is idempotent and can be called many times, it have to return zero time.Time if job is finished.
Job struct fields have to be public in order to marshal/unmarshal correctly or covered by Marshal/Unmarshal methods.
Note that all nodes in cluster must register the same JobExecutors because all nodes store full jobs state.
- Implement new Job types
- Add sync.Pool to cluster.prepareCommand()
- Library API improvements
Gds uses go modules and Go 1.13
Checks before commit:
golangci-lint run
go test ./... -race
MIT