Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type Dalga
- type Job
- type JobKey
- type JobManager
- func (m *JobManager) Cancel(path, body string) error
- func (m *JobManager) Get(path, body string) (*Job, error)
- func (m *JobManager) Running() int
- func (m *JobManager) Schedule(path, body string, oneOff, immediate bool, firstRun *time.Time, ...) (*Job, error)
- func (m *JobManager) Total() (int64, error)
- func (m *JobManager) Trigger(path, body string) (*Job, error)
Constants ¶
View Source
const Version = "1.0.0"
Variables ¶
View Source
var ( ErrExist = errors.New("job already exists") ErrNotExist = errors.New("job does not exist") )
View Source
var DefaultConfig = Config{
MySQL: mysqlConfig{
Host: "127.0.0.1",
Port: 3306,
DB: "test",
Table: "dalga",
User: "root",
Password: "",
},
Listen: listenConfig{
Host: "127.0.0.1",
Port: 34006,
},
Endpoint: endpointConfig{
BaseURL: "http://127.0.0.1:5000/",
Timeout: 10,
},
}
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Jobs jobsConfig MySQL mysqlConfig Listen listenConfig Endpoint endpointConfig Redis redisConfig }
func (*Config) LoadFromFile ¶
type Dalga ¶
type Dalga struct { Jobs *JobManager // contains filtered or unexported fields }
func (*Dalga) CreateTable ¶
CreateTable creates the table for storing jobs on database.
func (*Dalga) NotifyReady ¶
func (d *Dalga) NotifyReady() <-chan struct{}
NotifyReady returns a channel that will be closed when Dalga is ready to accept HTTP requests.
type Job ¶
type Job struct { JobKey // Interval is the duration between each POST to the endpoint. // Interval is 0 for one-off jobs. Interval time.Duration // NextRun is the next run time of the job, stored in UTC. NextRun time.Time }
Job is the record stored in jobs table. Primary key for the table is JobKey.
func (*Job) MarshalJSON ¶
func (*Job) OneOff ¶
OneOff returns true for one-off jobs. One-off jobs are stored with 0 interval on jobs table.
type JobManager ¶
type JobManager struct {
// contains filtered or unexported fields
}
func (*JobManager) Cancel ¶
func (m *JobManager) Cancel(path, body string) error
Cancel deletes the job with path and body.
func (*JobManager) Get ¶
func (m *JobManager) Get(path, body string) (*Job, error)
Get returns the job with path and body.
func (*JobManager) Running ¶
func (m *JobManager) Running() int
Running returns the number of running jobs currently.
func (*JobManager) Schedule ¶
func (m *JobManager) Schedule(path, body string, oneOff, immediate bool, firstRun *time.Time, interval *time.Duration) (*Job, error)
Schedule inserts a new job to the table or replaces existing one. Returns the created or replaced job.
func (*JobManager) Total ¶
func (m *JobManager) Total() (int64, error)
Total returns the count of all jobs in jobs table.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/code.google.com/p/gcfg
Package gcfg reads "INI-style" text-based configuration files with "name=value" pairs grouped into sections (gcfg files).
|
Package gcfg reads "INI-style" text-based configuration files with "name=value" pairs grouped into sections (gcfg files). |
_workspace/src/code.google.com/p/gcfg/scanner
Package scanner implements a scanner for gcfg configuration text.
|
Package scanner implements a scanner for gcfg configuration text. |
_workspace/src/code.google.com/p/gcfg/token
Package token defines constants representing the lexical tokens of the gcfg configuration syntax and basic operations on tokens (printing, predicates).
|
Package token defines constants representing the lexical tokens of the gcfg configuration syntax and basic operations on tokens (printing, predicates). |
_workspace/src/code.google.com/p/gcfg/types
Package types defines helpers for type conversions.
|
Package types defines helpers for type conversions. |
_workspace/src/github.com/bmizerany/pat
Package pat implements a simple URL pattern muxer
|
Package pat implements a simple URL pattern muxer |
_workspace/src/github.com/cenkalti/backoff
Package backoff implements backoff algorithms for retrying operations.
|
Package backoff implements backoff algorithms for retrying operations. |
_workspace/src/github.com/fzzy/radix/redis/resp
This package provides an easy to use interface for creating and parsing messages encoded in the REdis Serialization Protocol (RESP).
|
This package provides an easy to use interface for creating and parsing messages encoded in the REdis Serialization Protocol (RESP). |
_workspace/src/github.com/go-sql-driver/mysql
Go MySQL Driver - A MySQL-Driver for Go's database/sql package The driver should be used via the database/sql package: import "database/sql" import _ "github.com/go-sql-driver/mysql" db, err := sql.Open("mysql", "user:password@/dbname") See https://github.com/go-sql-driver/mysql#usage for details
|
Go MySQL Driver - A MySQL-Driver for Go's database/sql package The driver should be used via the database/sql package: import "database/sql" import _ "github.com/go-sql-driver/mysql" db, err := sql.Open("mysql", "user:password@/dbname") See https://github.com/go-sql-driver/mysql#usage for details |
Click to show internal directories.
Click to hide internal directories.