Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewExecutorInvokeWorker ¶
func NewExecutorInvokeWorker(exector executor, status Status, cfg config.RepoConfig, signal chan int) (*executorInvokeWorker, error)
creates a new executorInvokeWorker, which encapsules an executor into a Worker and provides functinalities like auto-retry and state management
Types ¶
type ExternalWorker ¶
type ExternalWorker struct {
// contains filtered or unexported fields
}
ExternalWorker is a stub worker which always returns {Idle: false, Result: true}.
func NewExternalWorker ¶
func NewExternalWorker(cfg config.RepoConfig) (*ExternalWorker, error)
func (*ExternalWorker) GetConfig ¶
func (ew *ExternalWorker) GetConfig() config.RepoConfig
func (*ExternalWorker) GetStatus ¶
func (ew *ExternalWorker) GetStatus() Status
func (*ExternalWorker) RunSync ¶
func (ew *ExternalWorker) RunSync()
func (*ExternalWorker) TriggerSync ¶
func (ew *ExternalWorker) TriggerSync()
type Status ¶
type Status struct { // Result is true if sync succeed, else false Result bool // LastFinished indicates last success time LastFinished time.Time // Idle stands for whether worker is idle, false if syncing Idle bool // Last stdout(s) for admin. Internal implementation may vary to provide it in Status() Stdout []string // Last stderr(s) for admin. Internal implementation may vary to provide it in Status() Stderr []string }
Status shows sync result and last timestamp.
type Worker ¶
type Worker interface { // This call should be thread-safe GetStatus() Status // This should block forever RunSync() // This call should be thread-safe TriggerSync() GetConfig() config.RepoConfig }
Worker declares interface for workers using diffenent ways of sync.
Click to show internal directories.
Click to hide internal directories.