queue

package
v0.0.0-...-ea11ed4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2018 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CleanChannelJob describes channel cleanup requests
	CleanChannelJob = "CleanChannelRequests"
	// DelayedDeleteJob describes delayed delete requests
	DelayedDeleteJob = "DelayedDeleteRequests"
)

Functions

This section is empty.

Types

type CleanChannelOpts

type CleanChannelOpts struct {
	Messages bool `json:"delete_messages"`
	Files    bool `json:"delete_files"`
	Bots     bool `json:"delete_bot_messages"`
}

CleanChannelOpts encapsulates all the options for a clean channel command set

type CleanChannelRequest

type CleanChannelRequest struct {
	Token   string           `json:"token"`
	Channel string           `json:"channel_id"`
	UserID  string           `json:"user_id"`
	Options CleanChannelOpts `json:"command_options"`
}

CleanChannelRequest is the struct for doing a channel cleanup

type DelayedDeleteRequest

type DelayedDeleteRequest struct {
	Token     string `json:"token"`
	Channel   string `json:"channel_id"`
	Timestamp string `json:"ts"`
}

DelayedDeleteRequest is the struct for doing a delayed delete

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

Queue is a job queue to pass messages between the web thread and workers

func NewQueue

func NewQueue(dbURL *url.URL) (*Queue, error)

NewQueue initializes and creates a new message passing queue

func (*Queue) Close

func (q *Queue) Close()

Close cleanups up the queue

func (*Queue) InitWorkerPool

func (q *Queue) InitWorkerPool(numWorkers int)

InitWorkerPool initializes a worker pool to do work

func (*Queue) QueueCleanChannel

func (q *Queue) QueueCleanChannel(token, channel, userID string, options CleanChannelOpts) error

QueueCleanChannel enqueues a cleanup channel job

func (*Queue) QueueDelayedDelete

func (q *Queue) QueueDelayedDelete(token, channel, ts string, runAt time.Time) error

QueueDelayedDelete enqueues a delayed message delete job

func (*Queue) StartWorkers

func (q *Queue) StartWorkers()

StartWorkers starts up the worker pool

Jump to

Keyboard shortcuts

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