krong

package
v0.0.0-...-4b8cd26 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const JOBS_TABLE_NAME = "jobs"
View Source
const USERS_TABLE_NAME = "users"

Variables

View Source
var (
	ErrProcessRunning = errors.New("process is running")
	ErrFileStale      = errors.New("pidfile exists but process is not running")
	ErrFileInvalid    = errors.New("pidfile has invalid contents")
)

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Endpoint string
	Command  string
	Secret   string
}

func (*Agent) String

func (a *Agent) String() string

type Config

type Config struct {
	LogFile string `hcl:"log_file"`
	PidFile string `hcl:"pid_file"`
	DBURL   string `hcl:"db_url"`
}
type Header struct {
	Name  string
	Value string
}

type Headers

type Headers []Header

func (*Headers) Set

func (h *Headers) Set(value string) error

func (*Headers) String

func (h *Headers) String() string

type Job

type Job struct {
	ID           int        `json:"id"`
	Name         string     `json:"name"`
	DisplayName  string     `json:"display_name"`
	Timezone     string     `json:"timezone"`
	Schedule     string     `json:"schedule"`
	Owner        int        `json:"owner"`
	SuccessCount int        `json:"success_count"`
	ErrorCount   int        `json:"error_count"`
	LastSuccess  time.Time  `json:"last_success"`
	LastError    time.Time  `json:"last_error"`
	Disabled     isset.Bool `json:"disabled"`
	Retries      int        `json:"retries"`
	Concurrency  string     `json:"concurency"`
	Status       string     `json:"status"`
	Next         time.Time  `json:"next"`
	Ephemeral    isset.Bool `json:"ephemeral"`
	ExpiresAt    time.Time  `json:"expires_at"`
	WebHook      WebHook    `json:"webhook"`
	Agent        Agent      `json:"agent"`
	Type         string     `json:"type"`
}

Job is a cron job

func NewJob

func NewJob() *Job

func (*Job) GetNext

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

func (*Job) IsValid

func (j *Job) IsValid() error

func (*Job) Run

func (j *Job) Run()

func (*Job) String

func (j *Job) String() string

type KronG

type KronG struct {
	*cron.Cron

	http.Server
	// contains filtered or unexported fields
}

func InitKronG

func InitKronG() *KronG

func (*KronG) Shutdown

func (k *KronG) Shutdown()

func (*KronG) SignalHandler

func (k *KronG) SignalHandler(signals chan os.Signal)

func (*KronG) StartServer

func (k *KronG) StartServer()

type User

type User struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	Email   string `json:"email"`
	Type    string `json:"type"`
	Address string `json:"address"`
}

User is a Krong user

func NewUser

func NewUser() *User

type WebHook

type WebHook struct {
	URL     string
	Method  string
	Headers Headers
	Payload []byte
	Timeout time.Duration
}

func (*WebHook) Run

func (w *WebHook) Run() ([]byte, string, error)

func (*WebHook) String

func (w *WebHook) String() string

Jump to

Keyboard shortcuts

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