queuebox

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var QueueStatusList = []QueueStatus{Working, Paused}

QueueStatusList TODO

QueueStatusMap TODO

Functions

func MustNewMinuteWindow

func MustNewMinuteWindow() *average.SlidingWindow

MustNewMinuteWindow TODO

func QueueIDFromRedisKey

func QueueIDFromRedisKey(key string) (qid sth.QueueID, err error)

QueueIDFromRedisKey TODO

func QueueIDFromString

func QueueIDFromString(key string) (qid sth.QueueID, err error)

QueueIDFromString TODO

func RedisKeyFromQueueID

func RedisKeyFromQueueID(qid sth.QueueID) string

RedisKeyFromQueueID TODO

func WindowTotal

func WindowTotal(window *average.SlidingWindow, second time.Duration) int64

WindowTotal TODO

Types

type CallByQueue

type CallByQueue func(*Queue) (sth.Result, error)

CallByQueue TODO

type Queue

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

Queue TODO

func NewQueue

func NewQueue(box *QueueBox, id sth.QueueID) *Queue

NewQueue TODO

func (*Queue) Clear

func (queue *Queue) Clear(erase bool) (result sth.Result, err error)

Clear TODO

func (*Queue) Dequeuing

func (queue *Queue) Dequeuing() int64

Dequeuing TODO

func (*Queue) ID

func (queue *Queue) ID() sth.QueueID

ID TODO

func (*Queue) Info

func (queue *Queue) Info() sth.Result

Info TODO

func (*Queue) ItemID

func (queue *Queue) ItemID() uint64

ItemID TODO

func (*Queue) Pop

func (queue *Queue) Pop() (req *request.Request, qsize int64, err error)

Pop TODO

func (*Queue) Push

func (queue *Queue) Push(request *request.Request) (result sth.Result, err error)

Push TODO

func (*Queue) QueueSize

func (queue *Queue) QueueSize() int64

QueueSize TODO

func (*Queue) Queuing

func (queue *Queue) Queuing() int64

Queuing TODO

func (*Queue) SetStatus

func (queue *Queue) SetStatus(newStatus QueueStatus) (err error)

SetStatus TODO

func (*Queue) Status

func (queue *Queue) Status() QueueStatus

Status TODO

func (*Queue) Sync

func (queue *Queue) Sync() (result sth.Result, err error)

Sync TODO

func (*Queue) View

func (queue *Queue) View(start int64, end int64) (result sth.Result, err error)

View TODO

type QueueBox

type QueueBox struct {
	*serv.Serv

	*utils.BulkLock
	// contains filtered or unexported fields
}

QueueBox TODO

func New

func New(serv *serv.Serv, client *redis.Client, reqWrapper *reqwrap.RequestWrapper) *QueueBox

New TODO

func (*QueueBox) ClearQueue

func (box *QueueBox) ClearQueue(qid sth.QueueID) (sth.Result, error)

ClearQueue TODO

func (*QueueBox) DeleteQueue

func (box *QueueBox) DeleteQueue(qid sth.QueueID) (sth.Result, error)

DeleteQueue TODO

func (*QueueBox) Info

func (box *QueueBox) Info() (result sth.Result)

Info TODO

func (*QueueBox) Load

func (box *QueueBox) Load() (err error)

Load TODO

func (*QueueBox) OnStart

func (box *QueueBox) OnStart(context.Context) error

OnStart TODO

func (*QueueBox) OnStop

func (box *QueueBox) OnStop(context.Context) error

OnStop TODO

func (*QueueBox) PauseQueue

func (box *QueueBox) PauseQueue(qid sth.QueueID) (sth.Result, error)

PauseQueue TODO

func (*QueueBox) PopRequest

func (box *QueueBox) PopRequest(qid sth.QueueID) (req *request.Request, err error)

PopRequest TODO

func (*QueueBox) PushRequest

func (box *QueueBox) PushRequest(req *request.Request) (result sth.Result, err error)

PushRequest TODO

func (*QueueBox) QueueInfo

func (box *QueueBox) QueueInfo(qid sth.QueueID) (sth.Result, error)

QueueInfo TODO

func (*QueueBox) Queues

func (box *QueueBox) Queues(k int) sth.Result

Queues TODO

func (*QueueBox) ResumeQueue

func (box *QueueBox) ResumeQueue(qid sth.QueueID) (sth.Result, error)

ResumeQueue TODO

func (*QueueBox) SetStatus

func (box *QueueBox) SetStatus(qid sth.QueueID, newStatus QueueStatus) (sth.Result, error)

SetStatus TODO

func (*QueueBox) Stats

func (box *QueueBox) Stats() *Stats

Stats TODO

func (*QueueBox) SyncQueue

func (box *QueueBox) SyncQueue(qid sth.QueueID, force bool) (result sth.Result, err error)

SyncQueue TODO

func (*QueueBox) ViewQueue

func (box *QueueBox) ViewQueue(qid sth.QueueID, start int64, end int64) (result sth.Result, err error)

ViewQueue TODO

func (*QueueBox) ViewQueues

func (box *QueueBox) ViewQueues(k int, start int, status QueueStatus) sth.Result

ViewQueues TODO

type QueueStatus

type QueueStatus int

QueueStatus TODO

const (
	Working QueueStatus // working
	Paused              // paused
)

QueueStatus enum

func (QueueStatus) MarshalJSON

func (s QueueStatus) MarshalJSON() ([]byte, error)

MarshalJSON TODO

func (QueueStatus) String

func (i QueueStatus) String() string

func (*QueueStatus) UnmarshalJSON

func (s *QueueStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type Stats

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

Stats TODO

func NewStats

func NewStats() *Stats

NewStats TODO

func (*Stats) IncrRequestNum

func (stats *Stats) IncrRequestNum(d int64) int64

IncrRequestNum TODO

func (*Stats) RequestNum

func (stats *Stats) RequestNum() int64

RequestNum TODO

func (*Stats) Stats

func (stats *Stats) Stats() sth.Result

Stats TODO

func (*Stats) UpdateInput

func (stats *Stats) UpdateInput(d int64)

UpdateInput TODO

func (*Stats) UpdateOutput

func (stats *Stats) UpdateOutput(d int64)

UpdateOutput TODO

Jump to

Keyboard shortcuts

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