store

package
v0.0.0-...-8c44216 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const JobDone = "done"

JobDone - the job was processed without issues by the worker

View Source
const JobErrored = "errored"

JobErrored - the job was processed but issues happen so it need a rerun

View Source
const JobInProgress = "in-progress"

JobInProgress - the job was taken by a worker and being worked out

View Source
const JobPending = "pending"

JobPending - the job is in the queue ready to be taken by one of the available worker

View Source
const WorkerAvailable = "available"

WorkerAvailable -

View Source
const WorkerBusy = "busy"

WorkerBusy -

Variables

View Source
var Queues []Queue

Queues - Contain all the stored queues

View Source
var Sessions []User

Sessions - all the sessions

Functions

func LoadConfigFromFile

func LoadConfigFromFile(path string)

LoadConfigFromFile -

func LoadConfigFromString

func LoadConfigFromString(yamlConfig string)

LoadConfigFromString -

func UpdateSession

func UpdateSession(user User)

UpdateSession -

Types

type Config

type Config struct {
	Groups        []Group
	Users         []User
	Host          string
	Port          int
	JobTimeout    int    `yaml:"job_timeout"`
	WebPort       int    `yaml:"web_port"`
	DelayPolicy   string `yaml:"delay_policy"`
	LogLevel      string `yaml:"log_level"`
	TestMode      bool   `yaml:"test_mode"`
	AllowDispatch bool   `yaml:"allow_dispatch"`
}

Config -

var Options Config

Options -

type Group

type Group struct {
	Slug string
}

Group - A organization, namespace

type Job

type Job struct {
	ID                  string
	State               string
	Type                string
	Payload             string
	Attempts            int
	StartedProcessingAt time.Time
	EndProcessingAt     time.Time
	Queue               Queue
	Group               Group
}

Job -

func FindJob

func FindJob(id string) (Job, error)

FindJob - find a job in all the queues

func (Job) Delete

func (job Job) Delete() error

Delete - Will delete a job

func (Job) Expire

func (job Job) Expire(timeout int) error

Expire - Will delete a job after a timeout in seconds

func (Job) Update

func (job Job) Update() error

Update - Update a job

type Queue

type Queue struct {
	ID            string
	Slug          string
	Group         Group
	RecurrentJobs []RecurrentJob
	Jobs          []Job
	Workers       []User
}

Queue -

func FindQueue

func FindQueue(id string) (Queue, error)

FindQueue - Will find a queue with a id

func FindQueueBySlug

func FindQueueBySlug(slugToFind string, group Group, create bool) (Queue, error)

FindQueueBySlug - Will find a queue with a slug in a group

If create flag set to true, the queue will be created

func ListQueue

func ListQueue(group Group) []Queue

ListQueue - Return all queues in a group

func (Queue) Delete

func (queue Queue) Delete() error

Delete - Will delete a queue

func (Queue) Update

func (queue Queue) Update() error

Update -

func (Queue) UpdateAndKeep

func (queue Queue) UpdateAndKeep(toKeepFields []string) error

UpdateAndKeep - Will update a queue

type RecurrentJob

type RecurrentJob struct {
	EntryID        int
	Queue          Queue
	Type           string
	CronExpression string
}

RecurrentJob -

func FindRecurrentJob

func FindRecurrentJob(id int) (RecurrentJob, error)

FindRecurrentJob - Find a reccurent job by id

func FindRecurrentJobByType

func FindRecurrentJobByType(queue Queue, jobType string) (RecurrentJob, error)

FindRecurrentJobByType - Find a reccurent job by id

func (RecurrentJob) Delete

func (job RecurrentJob) Delete() error

Delete - Delete a reccurent job

func (RecurrentJob) Update

func (job RecurrentJob) Update() error

Update - Update a reccurent job

type User

type User struct {
	Username     string
	Password     string
	Groups       []string
	Addr         string
	CurrentGroup Group
	Conn         net.Conn
	Status       string
}

User -

func FindSession

func FindSession(conn net.Conn) User

FindSession - will return a user object for this session

Jump to

Keyboard shortcuts

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