dkron: Index | Files | Directories

package dkron

import ""


Package Files

agent.go api.go config.go dashboard.go execution.go execution_processor.go executor.go executor.pb.go grpc.go hclog_adapter.go invoke.go job.go log.go metrics.go notifier.go queries.go scheduler.go store.go utils.go version.go


const (
    StatusNotSet = ""
    // Success is status of a job whose last run was a success.
    StatusSuccess = "success"
    // Running is status of a job whose last run has not finished.
    StatusRunning = "running"
    // Failed is status of a job whose last run was not successful on any nodes.
    StatusFailed = "failed"
    // PartialyFailed is status of a job whose last run was successful on only some nodes.
    StatusPartialyFailed = "partially_failed"

    // ConcurrencyAllow allows a job to execute concurrency.
    ConcurrencyAllow = "allow"
    // ConcurrencyForbid forbids a job from executing concurrency.
    ConcurrencyForbid = "forbid"
const (
    QuerySchedulerRestart = "scheduler:restart"
    QueryRunJob           = "run:job"
    QueryExecutionDone    = "execution:done"
const DefaultBindPort int = 8946

DefaultBindPort is the default port that dkron will use for Serf communication

const MaxExecutions = 100


var (

    // ErrLeaderNotFound is returned when obtained leader from store is not found in member list
    ErrLeaderNotFound = errors.New("No member leader found in member list")
    ErrNoRPCAddress   = errors.New("No RPC address tag found in server")
var (
    ErrExecutionDoneForDeletedJob = errors.New("rpc: Received execution done for a deleted job")
    ErrRPCDialing                 = errors.New("rpc: Error dialing, verify the network connection to the server")
var (
    // ErrParentJobNotFound is returned when the parent job is not found.
    ErrParentJobNotFound = errors.New("Specified parent job not found")
    // ErrNoAgent is returned when the job's agent is nil.
    ErrNoAgent = errors.New("No agent defined")
    // ErrSameParent is returned when the job's parent is itself.
    ErrSameParent = errors.New("The job can not have itself as parent")
    // ErrNoParent is returned when the job has no parent.
    ErrNoParent = errors.New("The job doens't have a parent job set")
    // ErrNoCommand is returned when attempting to store a job that has no command.
    ErrNoCommand = errors.New("Unespecified command for job")
    // ErrWrongConcurrency is returned when Concurrency is set to a non existing setting.
    ErrWrongConcurrency = errors.New("Wrong concurrency policy value, use: allow/forbid")
var (
    ErrScheduleParse = errors.New("Can't parse job schedule")
var Name = "Dkron"
var Version = "devel"

func ConfigFlagSet Uses

func ConfigFlagSet() *flag.FlagSet

configFlagSet creates all of our configuration flags.

func CreateMyRender Uses

func CreateMyRender() multitemplate.Render

func InitLogger Uses

func InitLogger(logLevel string, node string) logrus.FieldLogger

InitLogger creates the logger instance

func RegisterExecutorServer Uses

func RegisterExecutorServer(s *grpc.Server, srv ExecutorServer)

type Agent Uses

type Agent struct {
    ProcessorPlugins map[string]ExecutionProcessor
    ExecutorPlugins  map[string]Executor
    HTTPTransport    Transport
    Store            Storage
    GRPCServer       DkronGRPCServer
    GRPCClient       DkronGRPCClient

    // Set a global peer updater func
    PeerUpdaterFunc func(...string)
    // contains filtered or unexported fields

Agent is the main struct that represents a dkron agent

func NewAgent Uses

func NewAgent(config *Config, plugins *Plugins) *Agent

func (*Agent) Config Uses

func (a *Agent) Config() *Config

Config returns the agent's config.

func (*Agent) DashboardRoutes Uses

func (a *Agent) DashboardRoutes(r *gin.RouterGroup)

dashboardRoutes registers dashboard specific routes on the gin RouterGroup.

func (*Agent) GetBindIP Uses

func (a *Agent) GetBindIP() (string, error)

GetBindIP returns the IP address that the agent is bound to. This could be different than the originally configured address.

func (*Agent) GetPeers Uses

func (a *Agent) GetPeers() (peers []string)

GetPeers returns a list of the current serf servers peers addresses

func (*Agent) ListServers Uses

func (a *Agent) ListServers() []serf.Member

ListServers returns the list of server members

func (*Agent) LocalMember Uses

func (a *Agent) LocalMember() serf.Member

LocalMember return the local serf member

func (*Agent) RefreshJobStatus Uses

func (a *Agent) RefreshJobStatus(jobName string)

RefreshJobStatus asks the nodes their progress on an execution

func (*Agent) RunQuery Uses

func (a *Agent) RunQuery(job *Job, ex *Execution)

Send a serf run query to the cluster, this is used to ask a node or nodes to run a Job.

func (*Agent) SchedulerRestart Uses

func (a *Agent) SchedulerRestart()

SchedulerRestart Dispatch a SchedulerRestartQuery to the cluster but after a timeout to actually throtle subsequent calls

func (*Agent) SetConfig Uses

func (a *Agent) SetConfig(c *Config)

Config returns the agent's config.

func (*Agent) SetTags Uses

func (a *Agent) SetTags(tags map[string]string) error

func (*Agent) Start Uses

func (a *Agent) Start() error

func (*Agent) StartServer Uses

func (a *Agent) StartServer()

func (*Agent) Stop Uses

func (a *Agent) Stop() error

Stop stops an agent, if the agent is a server and is running for election stop running for election, if this server was the leader this will force the cluster to elect a new leader and start a new scheduler. If this is a server and has the scheduler started stop it, ignoring if this server was participating in leader election or not (local storage). Then actually leave the cluster.

type Config Uses

type Config struct {
    NodeName              string `mapstructure:"node-name"`
    BindAddr              string `mapstructure:"bind-addr"`
    HTTPAddr              string `mapstructure:"http-addr"`
    Backend               store.Backend
    BackendMachines       []string `mapstructure:"backend-machine"`
    BackendUsername       string   `mapstructure:"backend-username"`
    BackendPassword       string   `mapstructure:"backend-password"`
    BackendTLS            bool     `mapstructure:"backend-tls"`
    Profile               string
    Interface             string
    AdvertiseAddr         string            `mapstructure:"advertise-addr"`
    Tags                  map[string]string `mapstructure:"tags"`
    SnapshotPath          string            `mapstructure:"snapshot-path"`
    ReconnectInterval     time.Duration     `mapstructure:"reconnect-interval"`
    ReconnectTimeout      time.Duration     `mapstructure:"reconnect-timeout"`
    TombstoneTimeout      time.Duration     `mapstructure:"tombstone-timeout"`
    DisableNameResolution bool              `mapstructure:"disable-name-resolution"`
    KeyringFile           string            `mapstructure:"keyring-file"`
    RejoinAfterLeave      bool              `mapstructure:"rejoin-after-leave"`
    Server                bool
    EncryptKey            string   `mapstructure:"encrypt"`
    StartJoin             []string `mapstructure:"join"`
    Keyspace              string
    RPCPort               int    `mapstructure:"rpc-port"`
    AdvertiseRPCPort      int    `mapstructure:"advertise-rpc-port"`
    LogLevel              string `mapstructure:"log-level"`

    MailHost          string `mapstructure:"mail-host"`
    MailPort          uint16 `mapstructure:"mail-port"`
    MailUsername      string `mapstructure:"mail-username"`
    MailPassword      string `mapstructure:"mail-password"`
    MailFrom          string `mapstructure:"mail-from"`
    MailPayload       string `mapstructure:"mail-payload"`
    MailSubjectPrefix string `mapstructure:"mail-subject-prefix"`

    WebhookURL     string   `mapstructure:"webhook-url"`
    WebhookPayload string   `mapstructure:"webhook-payload"`
    WebhookHeaders []string `mapstructure:"webhook-headers"`

    // DogStatsdAddr is the address of a dogstatsd instance. If provided,
    // metrics will be sent to that instance
    DogStatsdAddr string `mapstructure:"dog-statsd-addr"`
    // DogStatsdTags are the global tags that should be sent with each packet to dogstatsd
    // It is a list of strings, where each string looks like "my_tag_name:my_tag_value"
    DogStatsdTags []string `mapstructure:"dog-statsd-tags"`
    StatsdAddr    string   `mapstructure:"statsd-addr"`

Config stores all configuration options for the dkron package.

func DefaultConfig Uses

func DefaultConfig() *Config

func (*Config) AddrParts Uses

func (c *Config) AddrParts(address string) (string, int, error)

AddrParts returns the parts of the BindAddr that should be used to configure Serf.

func (*Config) EncryptBytes Uses

func (c *Config) EncryptBytes() ([]byte, error)

EncryptBytes returns the encryption key configured.

func (*Config) NetworkInterface Uses

func (c *Config) NetworkInterface() (*net.Interface, error)

NetworkInterface is used to get the associated network interface from the configured value

type Cron Uses

type Cron interface {
    Schedule(schedule cron.Schedule, cmd cron.Job)
    Entries() []*cron.Entry
    AddFunc(spec string, cmd func()) error
    AddJob(spec string, cmd cron.Job) error
    AddTimezoneSensitiveJob(spec, timezone string, cmd cron.Job) error

type DkronGRPCClient Uses

type DkronGRPCClient interface {
    Connect(string) (*grpc.ClientConn, error)
    CallExecutionDone(string, *Execution) error
    CallGetJob(string, string) (*Job, error)
    Leave(string) error

func NewGRPCClient Uses

func NewGRPCClient(dialOpt grpc.DialOption) DkronGRPCClient

type DkronGRPCServer Uses

type DkronGRPCServer interface {
    Serve() error

func NewGRPCServer Uses

func NewGRPCServer(agent *Agent) DkronGRPCServer

NewRPCServe creates and returns an instance of an RPCServer implementation

type ExecList Uses

type ExecList []*Execution

ExecList stores a slice of Executions. This slice can be sorted to provide a time ordered slice of Executions.

func (ExecList) Len Uses

func (el ExecList) Len() int

func (ExecList) Less Uses

func (el ExecList) Less(i, j int) bool

func (ExecList) Swap Uses

func (el ExecList) Swap(i, j int)

type ExecuteRequest Uses

type ExecuteRequest struct {
    JobName              string            `protobuf:"bytes,1,opt,name=job_name,json=jobName,proto3" json:"job_name,omitempty"`
    Config               map[string]string `protobuf:"bytes,2,rep,name=config,proto3" json:"config,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
    XXX_NoUnkeyedLiteral struct{}          `json:"-"`
    XXX_unrecognized     []byte            `json:"-"`
    XXX_sizecache        int32             `json:"-"`

func (*ExecuteRequest) Descriptor Uses

func (*ExecuteRequest) Descriptor() ([]byte, []int)

func (*ExecuteRequest) GetConfig Uses

func (m *ExecuteRequest) GetConfig() map[string]string

func (*ExecuteRequest) GetJobName Uses

func (m *ExecuteRequest) GetJobName() string

func (*ExecuteRequest) ProtoMessage Uses

func (*ExecuteRequest) ProtoMessage()

func (*ExecuteRequest) Reset Uses

func (m *ExecuteRequest) Reset()

func (*ExecuteRequest) String Uses

func (m *ExecuteRequest) String() string

func (*ExecuteRequest) XXX_DiscardUnknown Uses

func (m *ExecuteRequest) XXX_DiscardUnknown()

func (*ExecuteRequest) XXX_Marshal Uses

func (m *ExecuteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ExecuteRequest) XXX_Merge Uses

func (m *ExecuteRequest) XXX_Merge(src proto.Message)

func (*ExecuteRequest) XXX_Size Uses

func (m *ExecuteRequest) XXX_Size() int

func (*ExecuteRequest) XXX_Unmarshal Uses

func (m *ExecuteRequest) XXX_Unmarshal(b []byte) error

type ExecuteResponse Uses

type ExecuteResponse struct {
    Output               []byte   `protobuf:"bytes,1,opt,name=output,proto3" json:"output,omitempty"`
    Error                string   `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`

func (*ExecuteResponse) Descriptor Uses

func (*ExecuteResponse) Descriptor() ([]byte, []int)

func (*ExecuteResponse) GetError Uses

func (m *ExecuteResponse) GetError() string

func (*ExecuteResponse) GetOutput Uses

func (m *ExecuteResponse) GetOutput() []byte

func (*ExecuteResponse) ProtoMessage Uses

func (*ExecuteResponse) ProtoMessage()

func (*ExecuteResponse) Reset Uses

func (m *ExecuteResponse) Reset()

func (*ExecuteResponse) String Uses

func (m *ExecuteResponse) String() string

func (*ExecuteResponse) XXX_DiscardUnknown Uses

func (m *ExecuteResponse) XXX_DiscardUnknown()

func (*ExecuteResponse) XXX_Marshal Uses

func (m *ExecuteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ExecuteResponse) XXX_Merge Uses

func (m *ExecuteResponse) XXX_Merge(src proto.Message)

func (*ExecuteResponse) XXX_Size Uses

func (m *ExecuteResponse) XXX_Size() int

func (*ExecuteResponse) XXX_Unmarshal Uses

func (m *ExecuteResponse) XXX_Unmarshal(b []byte) error

type Execution Uses

type Execution struct {
    // Name of the job this executions refers to.
    JobName string `json:"job_name,omitempty"`

    // Start time of the execution.
    StartedAt time.Time `json:"started_at,omitempty"`

    // When the execution finished running.
    FinishedAt time.Time `json:"finished_at,omitempty"`

    // If this execution executed succesfully.
    Success bool `json:"success,omitempty"`

    // Partial output of the execution.
    Output []byte `json:"output,omitempty"`

    // Node name of the node that run this execution.
    NodeName string `json:"node_name,omitempty"`

    // Execution group to what this execution belongs to.
    Group int64 `json:"group,omitempty"`

    // Retry attempt of this execution.
    Attempt uint `json:"attempt,omitempty"`

Execution type holds all of the details of a specific Execution.

func NewExecution Uses

func NewExecution(jobName string) *Execution

NewExecution creates a new execution.

func NewExecutionFromProto Uses

func NewExecutionFromProto(edr *proto.ExecutionDoneRequest) *Execution

NewExecutionFromProto maps a proto.ExecutionDoneRequest to an Execution object

func (*Execution) GetGroup Uses

func (e *Execution) GetGroup() string

func (*Execution) Key Uses

func (e *Execution) Key() string

Key wil generate the execution Id for an execution.

func (*Execution) ToProto Uses

func (e *Execution) ToProto() *proto.ExecutionDoneRequest

type ExecutionProcessor Uses

type ExecutionProcessor interface {
    // Main plugin method, will be called when an execution is done.
    Process(args *ExecutionProcessorArgs) Execution

ExecutionProcessor is an interface that wraps the Process method. Plugins must implement this interface.

type ExecutionProcessorArgs Uses

type ExecutionProcessorArgs struct {
    // The execution to pass to the processor
    Execution Execution
    // The configuration for this plugin call
    Config PluginConfig

ExecutionProcessorArgs holds the Execution and PluginConfig for an ExecutionProcessor.

type Executor Uses

type Executor interface {
    Execute(args *ExecuteRequest) (*ExecuteResponse, error)

Executor is the interface that we're exposing as a plugin.

type ExecutorClient Uses

type ExecutorClient interface {
    Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (*ExecuteResponse, error)

ExecutorClient is the client API for Executor service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to

func NewExecutorClient Uses

func NewExecutorClient(cc *grpc.ClientConn) ExecutorClient

type ExecutorPluginConfig Uses

type ExecutorPluginConfig map[string]string

ExecutorPluginConfig is the plugin config

type ExecutorServer Uses

type ExecutorServer interface {
    Execute(context.Context, *ExecuteRequest) (*ExecuteResponse, error)

ExecutorServer is the server API for Executor service.

type GRPCClient Uses

type GRPCClient struct {
    // contains filtered or unexported fields

func (*GRPCClient) CallExecutionDone Uses

func (grpcc *GRPCClient) CallExecutionDone(addr string, execution *Execution) error

func (*GRPCClient) CallGetJob Uses

func (grpcc *GRPCClient) CallGetJob(addr, jobName string) (*Job, error)

func (*GRPCClient) Connect Uses

func (grpcc *GRPCClient) Connect(addr string) (*grpc.ClientConn, error)

func (*GRPCClient) Leave Uses

func (grpcc *GRPCClient) Leave(addr string) error

type GRPCServer Uses

type GRPCServer struct {
    // contains filtered or unexported fields

func (*GRPCServer) ExecutionDone Uses

func (grpcs *GRPCServer) ExecutionDone(ctx context.Context, execDoneReq *proto.ExecutionDoneRequest) (*proto.ExecutionDoneResponse, error)

func (*GRPCServer) GetJob Uses

func (grpcs *GRPCServer) GetJob(ctx context.Context, getJobReq *proto.GetJobRequest) (*proto.GetJobResponse, error)

func (*GRPCServer) Leave Uses

func (grpcs *GRPCServer) Leave(ctx context.Context, in *empty.Empty) (*empty.Empty, error)

func (*GRPCServer) Serve Uses

func (grpcs *GRPCServer) Serve() error

type HCLogAdapter Uses

type HCLogAdapter struct {
    Log  logrus.FieldLogger
    Name string

HCLogAdapter implements the hclog interface, and wraps it around a Logrus entry

func (*HCLogAdapter) CreateEntry Uses

func (a *HCLogAdapter) CreateEntry(args []interface{}) *logrus.Entry

func (*HCLogAdapter) Debug Uses

func (a *HCLogAdapter) Debug(msg string, args ...interface{})

func (*HCLogAdapter) Error Uses

func (a *HCLogAdapter) Error(msg string, args ...interface{})

func (*HCLogAdapter) Info Uses

func (a *HCLogAdapter) Info(msg string, args ...interface{})

func (*HCLogAdapter) IsDebug Uses

func (a *HCLogAdapter) IsDebug() bool

func (*HCLogAdapter) IsError Uses

func (a *HCLogAdapter) IsError() bool

func (*HCLogAdapter) IsInfo Uses

func (a *HCLogAdapter) IsInfo() bool

func (*HCLogAdapter) IsTrace Uses

func (a *HCLogAdapter) IsTrace() bool

func (*HCLogAdapter) IsWarn Uses

func (a *HCLogAdapter) IsWarn() bool

func (*HCLogAdapter) Named Uses

func (a *HCLogAdapter) Named(name string) hclog.Logger

func (*HCLogAdapter) ResetNamed Uses

func (a *HCLogAdapter) ResetNamed(name string) hclog.Logger

func (*HCLogAdapter) SetLevel Uses

func (a *HCLogAdapter) SetLevel(hclog.Level)

func (*HCLogAdapter) StandardLogger Uses

func (a *HCLogAdapter) StandardLogger(opts *hclog.StandardLoggerOptions) *golog.Logger

StandardLogger is meant to return a stldib Logger type which wraps around hclog. It does this by providing an io.Writer and instantiating a new Logger. It then tries to interpret the log level by parsing the message.

Since we are not using `hclog` in a generic way, and I cannot find any calls to this method from go-plugin, we will poorly support this method. Rather than pull in all of hclog writer parsing logic, pass it a Logrus writer, and hardcode the level to INFO.

Apologies to those who find themselves here.

func (*HCLogAdapter) Trace Uses

func (*HCLogAdapter) Trace(_ string, _ ...interface{})

HCLog has one more level than we do. As such, we will never set trace level.

func (*HCLogAdapter) Warn Uses

func (a *HCLogAdapter) Warn(msg string, args ...interface{})

func (*HCLogAdapter) With Uses

func (a *HCLogAdapter) With(args ...interface{}) hclog.Logger

type HTTPTransport Uses

type HTTPTransport struct {
    Engine *gin.Engine
    // contains filtered or unexported fields

HTTPTransport stores pointers to an agent and a gin Engine.

func NewTransport Uses

func NewTransport(a *Agent) *HTTPTransport

NewTransport creates an HTTPTransport with a bound agent.

func (*HTTPTransport) APIRoutes Uses

func (h *HTTPTransport) APIRoutes(r *gin.RouterGroup)

APIRoutes registers the api routes on the gin RouterGroup.

func (*HTTPTransport) MetaMiddleware Uses

func (h *HTTPTransport) MetaMiddleware() gin.HandlerFunc

MetaMiddleware adds middleware to the gin Context.

func (*HTTPTransport) ServeHTTP Uses

func (h *HTTPTransport) ServeHTTP()

type Job Uses

type Job struct {
    // Job name. Must be unique, acts as the id.
    Name string `json:"name"`

    // The timezone where the cron expression will be evaluated in.
    // Empty means local time.
    Timezone string `json:"timezone"`

    // Cron expression for the job. When to run the job.
    Schedule string `json:"schedule"`

    // Owner of the job.
    Owner string `json:"owner"`

    // Owner email of the job.
    OwnerEmail string `json:"owner_email"`

    // Number of successful executions of this job.
    SuccessCount int `json:"success_count"`

    // Number of errors running this job.
    ErrorCount int `json:"error_count"`

    // Last time this job executed succesful.
    LastSuccess time.Time `json:"last_success"`

    // Last time this job failed.
    LastError time.Time `json:"last_error"`

    // Is this job disabled?
    Disabled bool `json:"disabled"`

    // Tags of the target servers to run this job against.
    Tags map[string]string `json:"tags"`

    // Pointer to the calling agent.
    Agent *Agent `json:"-"`

    // Number of times to retry a job that failed an execution.
    Retries uint `json:"retries"`

    // Jobs that are dependent upon this one will be run after this job runs.
    DependentJobs []string `json:"dependent_jobs"`

    // Job id of job that this job is dependent upon.
    ParentJob string `json:"parent_job"`

    // Processors to use for this job
    Processors map[string]PluginConfig `json:"processors"`

    // Concurrency policy for this job (allow, forbid)
    Concurrency string `json:"concurrency"`

    // Executor plugin to be used in this job
    Executor string `json:"executor"`

    // Executor args
    ExecutorConfig ExecutorPluginConfig `json:"executor_config"`

    // Computed job status
    Status string `json:"status"`

    // Computed next execution
    Next time.Time `json:"next"`
    // contains filtered or unexported fields

Job descibes a scheduled Job.

func NewJobFromProto Uses

func NewJobFromProto(in *proto.GetJobResponse) *Job

func (*Job) GetNext Uses

func (j *Job) GetNext() (time.Time, error)

GetNext returns the job's next schedule from now

func (*Job) GetParent Uses

func (j *Job) GetParent() (*Job, error)

GetParent returns the parent job of a job

func (*Job) GetStatus Uses

func (j *Job) GetStatus() string

Status returns the status of a job whether it's running, succeded or failed

func (*Job) Lock Uses

func (j *Job) Lock() error

Lock the job in store

func (*Job) Run Uses

func (j *Job) Run()

Run the job

func (*Job) String Uses

func (j *Job) String() string

Friendly format a job

func (*Job) Unlock Uses

func (j *Job) Unlock() error

Unlock the job in store

type JobOptions Uses

type JobOptions struct {
    ComputeStatus bool
    Tags          map[string]string `json:"tags"`

type Notifier Uses

type Notifier struct {
    Config         *Config
    Job            *Job
    Execution      *Execution
    ExecutionGroup []*Execution

func Notification Uses

func Notification(config *Config, execution *Execution, exGroup []*Execution, job *Job) *Notifier

func (*Notifier) Send Uses

func (n *Notifier) Send()

type PluginConfig Uses

type PluginConfig map[string]interface{}

PluginConfig holds a map of the plugin configuration data structure.

type Plugins Uses

type Plugins struct {
    Processors map[string]ExecutionProcessor
    Executors  map[string]Executor

type ProcessorFactory Uses

type ProcessorFactory func() (ExecutionProcessor, error)

ProcessorFactory is a function type that creates a new instance of a processor.

type RunQueryParam Uses

type RunQueryParam struct {
    Execution *Execution `json:"execution"`
    RPCAddr   string     `json:"rpc_addr"`

type Scheduler Uses

type Scheduler struct {
    Cron    Cron
    Started bool

func NewScheduler Uses

func NewScheduler() *Scheduler

func (*Scheduler) GetEntry Uses

func (s *Scheduler) GetEntry(job *Job) *cron.Entry

func (*Scheduler) Restart Uses

func (s *Scheduler) Restart(jobs []*Job)

func (*Scheduler) Start Uses

func (s *Scheduler) Start(jobs []*Job)

func (*Scheduler) Stop Uses

func (s *Scheduler) Stop()

type Storage Uses

type Storage interface {
    SetJob(job *Job, copyDependentJobs bool) error
    AtomicJobPut(job *Job, prevJobKVPair *store.KVPair) (bool, error)
    GetJobs(options *JobOptions) ([]*Job, error)
    GetJob(name string, options *JobOptions) (*Job, error)
    GetJobWithKVPair(name string, options *JobOptions) (*Job, *store.KVPair, error)
    DeleteJob(name string) (*Job, error)
    GetExecutions(jobName string) ([]*Execution, error)
    GetLastExecutionGroup(jobName string) ([]*Execution, error)
    GetExecutionGroup(execution *Execution) ([]*Execution, error)
    GetGroupedExecutions(jobName string) (map[int64][]*Execution, []int64, error)
    SetExecution(execution *Execution) (string, error)
    DeleteExecutions(jobName string) error
    GetLeader() []byte
    LeaderKey() string
    Healthy() error
    Client() store.Store

type Store Uses

type Store struct {
    // contains filtered or unexported fields

func NewStore Uses

func NewStore(backend store.Backend, machines []string, a *Agent, keyspace string, config *store.Config) *Store

func (*Store) AtomicJobPut Uses

func (s *Store) AtomicJobPut(job *Job, prevJobKVPair *store.KVPair) (bool, error)

func (*Store) Client Uses

func (s *Store) Client() store.Store

func (*Store) DeleteExecutions Uses

func (s *Store) DeleteExecutions(jobName string) error

Removes all executions of a job

func (*Store) DeleteJob Uses

func (s *Store) DeleteJob(name string) (*Job, error)

func (*Store) GetExecutionGroup Uses

func (s *Store) GetExecutionGroup(execution *Execution) ([]*Execution, error)

GetExecutionGroup returns all executions in the same group of a given execution

func (*Store) GetExecutions Uses

func (s *Store) GetExecutions(jobName string) ([]*Execution, error)

func (*Store) GetGroupedExecutions Uses

func (s *Store) GetGroupedExecutions(jobName string) (map[int64][]*Execution, []int64, error)

Returns executions for a job grouped and with an ordered index to facilitate access.

func (*Store) GetJob Uses

func (s *Store) GetJob(name string, options *JobOptions) (*Job, error)

Get a job

func (*Store) GetJobWithKVPair Uses

func (s *Store) GetJobWithKVPair(name string, options *JobOptions) (*Job, *store.KVPair, error)

func (*Store) GetJobs Uses

func (s *Store) GetJobs(options *JobOptions) ([]*Job, error)

GetJobs returns all jobs

func (*Store) GetLastExecutionGroup Uses

func (s *Store) GetLastExecutionGroup(jobName string) ([]*Execution, error)

func (*Store) GetLeader Uses

func (s *Store) GetLeader() []byte

Retrieve the leader from the store

func (*Store) Healthy Uses

func (s *Store) Healthy() error

func (*Store) LeaderKey Uses

func (s *Store) LeaderKey() string

Retrieve the leader key used in the KV store to store the leader node

func (*Store) SetExecution Uses

func (s *Store) SetExecution(execution *Execution) (string, error)

SetExecution Save a new execution and returns the key of the new saved item or an error.

func (*Store) SetJob Uses

func (s *Store) SetJob(job *Job, copyDependentJobs bool) error

Store a job

type Transport Uses

type Transport interface {

Transport is the interface that wraps the ServeHTTP method.



Package dkron imports 56 packages (graph) and is imported by 4 packages. Updated 2019-07-10. Refresh now. Tools for package owners.