Documentation ¶
Index ¶
- Variables
- func Auth(cmd CmdInterface)
- func CurrentSession(cmd CmdInterface)
- func Debug(cmd CmdInterface)
- func DebugJSON(cmd CmdInterface)
- func DebugParts(cmd CmdInterface)
- func DeclareRecurrentJob(cmd CmdInterface)
- func DeleteJob(cmd CmdInterface)
- func DeleteQueue(cmd CmdInterface)
- func DeleteRecurrentJobs(cmd CmdInterface)
- func Dispatch(cmd CmdInterface)
- func DispatchUniversal()
- func DispatchUniversalWithDelay(delay int)
- func Health(cmd CmdInterface)
- func Help(cmd CmdInterface)
- func ListJobs(cmd CmdInterface)
- func ListQueues(cmd CmdInterface)
- func ListRecurrentJobs(cmd CmdInterface)
- func ListSessions(cmd CmdInterface)
- func NewLine(cmd CmdInterface)
- func Ping(cmd CmdInterface)
- func ProcessRecurrentJob(cmd CmdInterface)
- func Publish(cmd CmdInterface)
- func PublishUniversal(parts map[int]string, user store.User) (string, error)
- func PurgeJobs(cmd CmdInterface)
- func PurgeWorkers(cmd CmdInterface)
- func Quit(cmd CmdInterface)
- func ReturnError(cmd CmdInterface, err string)
- func ReturnString(cmd CmdInterface, data string)
- func StopServer(cmd CmdInterface)
- func Subscribe(cmd CmdInterface)
- func Unsubscribe(cmd CmdInterface)
- func UpdateJob(cmd CmdInterface)
- func UseGroup(cmd CmdInterface)
- func UseGroupUniversal(groupRaw string, user store.User) (store.Group, error)
- type CmdDefinition
- type CmdInterface
- type DebugOutput
- type DispatchData
- type HealthOutput
- type SessionOutput
Constants ¶
This section is empty.
Variables ¶
var CmdMap = []CmdDefinition{ { Name: "AUTH", Handler: Auth, RequireAuth: false, UseGroup: false, Args: 2, Usage: "AUTH {username} {password}", Description: "Authenticate with a username and a password", }, { Name: "USE_GROUP", Handler: UseGroup, RequireAuth: true, UseGroup: false, Args: 1, Usage: "USE_GROUP {group}", Description: "Declare which group the client want to use", }, { Name: "PUBLISH", Handler: Publish, RequireAuth: true, UseGroup: true, Args: 3, Usage: "PUBLISH {queue_slug} {job_type} {job_payload}", Description: "Create a job in a queue and return the ID of the created job", }, { Name: "SUBSCRIBE", Handler: Subscribe, RequireAuth: true, UseGroup: true, Args: 1, Usage: "SUBSCRIBE {queue_slug}", Description: "Subscribe to a queue to receive jobs", }, { Name: "UNSUBSCRIBE", Handler: Unsubscribe, RequireAuth: true, UseGroup: true, Args: 1, Usage: "UNSUBSCRIBE {queue_slug}", Description: "The exact oposite of the SUBSCRIBE command", }, { Name: "LIST_QUEUES", Handler: ListQueues, RequireAuth: true, UseGroup: true, Description: "List all queues in the current group", }, { Name: "DELETE_QUEUE", Handler: DeleteQueue, RequireAuth: true, UseGroup: true, Args: 1, Usage: "DELETE_QUEUE {queue_slug}", Description: "Delete a queue", }, { Name: "PURGE_JOBS", Handler: PurgeJobs, RequireAuth: true, UseGroup: true, Args: 1, Usage: "PURGE_JOBS {queue_slug}", Description: "Delete every jobs in a queue", }, { Name: "PURGE_WORKERS", Handler: PurgeWorkers, RequireAuth: true, UseGroup: true, Args: 1, Usage: "PURGE_WORKERS {queue_slug}", Description: "Unsubscribe every worker in a queue", }, { Name: "LIST_JOBS", Handler: ListJobs, RequireAuth: true, UseGroup: true, Args: 1, Usage: "LIST_JOBS {queue_slug}", Description: "List all jobs in a queue", }, { Name: "UPDATE_JOB", Handler: UpdateJob, RequireAuth: true, UseGroup: true, Args: 2, Usage: "UPDATE_JOB {job_id} {job_status}", Description: "Set the status of a job", }, { Name: "DELETE_JOB", Handler: DeleteJob, RequireAuth: true, UseGroup: true, Args: 1, Usage: "DELETE_JOB {job_id}", Description: "Delete a job", }, { Name: "DISPATCH", Handler: Dispatch, RequireAuth: false, UseGroup: false, Description: "Will force the dispatch of jobs accross all the workers", }, { Name: "RECURRENT_JOB", Handler: DeclareRecurrentJob, RequireAuth: true, UseGroup: true, Args: 3, Usage: "RECURRENT_JOB {queue_slug} {job_type} {cron_instruction}", Description: "Declare recurrent job on a queue", }, { Name: "LIST_RECURRENT_JOBS", Handler: ListRecurrentJobs, RequireAuth: true, UseGroup: true, Args: 1, Usage: "LIST_RECURRENT_JOBS {queue_slug}", Description: "List all the recurrent jobs of a queue", }, { Name: "DELETE_RECURRENT_JOB", Handler: DeleteRecurrentJobs, RequireAuth: true, UseGroup: true, Args: 1, Usage: "DELETE_RECURRENT_JOB {job_entry_id}", Description: "Delete a recurrent job", }, { Name: "HEALTH", Handler: Health, RequireAuth: true, UseGroup: false, Description: "Get the health of this jobatator instance", }, { Name: "DEBUG_PARTS", Handler: DebugParts, RequireAuth: false, UseGroup: false, Args: -1, Description: "Dump parsed command parts", }, { Name: "DEBUG", Handler: Debug, RequireAuth: false, UseGroup: false, Description: "Dump server data in a human readable format, only work if debug is enabled", }, { Name: "DEBUG_JSON", Handler: DebugJSON, RequireAuth: false, UseGroup: false, Description: "Dump server data in a JSON format, only work if debug is enabled", }, { Name: "STOP_SERVER", Handler: StopServer, RequireAuth: false, UseGroup: false, Description: "Stop the server, only work if test_mode is enabled", }, { Name: "PING", Handler: Ping, RequireAuth: false, UseGroup: false, Description: "Check if the connexion is alive", }, { Name: "QUIT", Handler: Quit, RequireAuth: false, UseGroup: false, Description: "Disconnect from the server", }, { Name: "CURRENT_SESSION", Handler: CurrentSession, RequireAuth: true, UseGroup: false, Description: "Get current session data (user allowed groups for example)", }, { Name: "LIST_SESSIONS", Handler: ListSessions, RequireAuth: true, UseGroup: false, Description: "List all sessions in the group", }, }
CmdMap -
Functions ¶
func CurrentSession ¶
func CurrentSession(cmd CmdInterface)
CurrentSession - Get current session meta data
func DeleteRecurrentJobs ¶
func DeleteRecurrentJobs(cmd CmdInterface)
DeleteRecurrentJobs - Delete a recurrent job with a entry id in a queue
func DispatchUniversalWithDelay ¶
func DispatchUniversalWithDelay(delay int)
DispatchUniversalWithDelay -
func Health ¶
func Health(cmd CmdInterface)
Health - Get all kinds of data about the jobatator instance
func Help ¶
func Help(cmd CmdInterface)
Help - List all commands or get help about a specific command
func ListRecurrentJobs ¶
func ListRecurrentJobs(cmd CmdInterface)
ListRecurrentJobs - List all recurrent jobs in a queue
func ListSessions ¶
func ListSessions(cmd CmdInterface)
ListSessions - List all sessions in the current group
func PublishUniversal ¶
PublishUniversal - Will add a job on a queue PUBLISH queue_name job_type payload
func PurgeWorkers ¶
func PurgeWorkers(cmd CmdInterface)
PurgeWorkers - Will delete every worker in a queue (so unsubscribe all the worker from a particular queue)
func StopServer ¶
func StopServer(cmd CmdInterface)
StopServer - Will exit the server process, only work if TEST_MODE env var or config key 'test_mode' is set to true
Warning: this feature is really dangerous and open serious security risks. Use it with cares.
func Subscribe ¶
func Subscribe(cmd CmdInterface)
Subscribe - If the client is a worker, he will use this cmd to subscribe to a queue
func Unsubscribe ¶
func Unsubscribe(cmd CmdInterface)
Unsubscribe - If the client is a worker, he will use this cmd to unsubscribe from a queue
func UpdateJob ¶
func UpdateJob(cmd CmdInterface)
UpdateJob - Update the state of the job Arguments: JOB_ID, JOB_STATUS
func UseGroup ¶
func UseGroup(cmd CmdInterface)
UseGroup - will switch the session on a specific group
Types ¶
type CmdDefinition ¶
type CmdDefinition struct { Name string RequireAuth bool UseGroup bool Args int Description string Usage string Handler func(CmdInterface) }
CmdDefinition - Use to define the command
type CmdInterface ¶
CmdInterface - Passed to command handler
type DebugOutput ¶
type DebugOutput struct { Queues []store.Queue Groups []store.Group Sessions []store.User Users []store.User Host string Port int }
DebugOutput -