pod

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const RedisConfigKey = "rq:pod:conf"

RedisConfigKey TODO

View Source
const RedisPausedQueuesKey = "rq:pod:paused"

RedisPausedQueuesKey TODO

View Source
const RedisQueueKeyPrefix = "rq:q:"

RedisQueueKeyPrefix TODO

Variables

QueueStatusList TODO

QueueStatusMap TODO

StatusMap TODO

Functions

func MustNewMinuteWindow added in v0.0.8

func MustNewMinuteWindow() *average.SlidingWindow

MustNewMinuteWindow TODO

func RedisKeyFromQueueID

func RedisKeyFromQueueID(qid QueueID) string

RedisKeyFromQueueID TODO

func WindowTotal added in v0.0.8

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

WindowTotal TODO

Types

type CallByQueue added in v0.0.8

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

CallByQueue TODO

type ExceedLimitError added in v0.0.3

type ExceedLimitError string

ExceedLimitError TODO

func (ExceedLimitError) Error added in v0.0.3

func (e ExceedLimitError) Error() string

type Limiter added in v0.0.3

type Limiter struct {
}

Limiter TODO

func NewLimiter added in v0.0.3

func NewLimiter(pod *Pod) *Limiter

NewLimiter TODO

func (*Limiter) AllowedNewRequest added in v0.0.3

func (limiter *Limiter) AllowedNewRequest(request *request.Request) error

AllowedNewRequest TODO

type Pod

type Pod struct {
	Client  *redis.Client
	Process *process.Process

	*sync.RWMutex
	// contains filtered or unexported fields
}

Pod TODO

func NewPod

func NewPod(conf *viper.Viper, client *redis.Client) (pod *Pod)

NewPod creates RQ object

func (*Pod) AddRequest

func (pod *Pod) AddRequest(rawReq *request.RawRequest) (Result, error)

AddRequest TODO

func (*Pod) ClearQueue

func (pod *Pod) ClearQueue(qid QueueID) (Result, error)

ClearQueue TODO

func (*Pod) DeleteQueue

func (pod *Pod) DeleteQueue(qid QueueID) (Result, error)

DeleteQueue TODO

func (*Pod) ForceSyncQueue

func (pod *Pod) ForceSyncQueue(qid QueueID) (Result, error)

ForceSyncQueue TODO

func (*Pod) GetRequest

func (pod *Pod) GetRequest(qid QueueID) (req *request.Request, err error)

GetRequest TODO

func (*Pod) Info

func (pod *Pod) Info() (result Result, err error)

Info TODO

func (*Pod) OnStart added in v0.0.3

func (pod *Pod) OnStart() (err error)

OnStart TODO

func (*Pod) OnStop added in v0.0.3

func (pod *Pod) OnStop() (err error)

OnStop TODO

func (*Pod) Pause

func (pod *Pod) Pause() (Result, error)

Pause TODO

func (*Pod) PauseQueue

func (pod *Pod) PauseQueue(qid QueueID) (Result, error)

PauseQueue TODO

func (*Pod) QueueInfo

func (pod *Pod) QueueInfo(qid QueueID) (Result, error)

QueueInfo TODO

func (*Pod) Queues added in v0.0.5

func (pod *Pod) Queues(k int) (Result, error)

Queues TODO

func (*Pod) Resume

func (pod *Pod) Resume() (Result, error)

Resume TODO

func (*Pod) ResumeQueue

func (pod *Pod) ResumeQueue(qid QueueID) (Result, error)

ResumeQueue TODO

func (*Pod) SyncQueue

func (pod *Pod) SyncQueue(qid QueueID) (Result, error)

SyncQueue TODO

func (*Pod) ViewQueue

func (pod *Pod) ViewQueue(qid QueueID, start int64, end int64) (Result, error)

ViewQueue TODO

func (*Pod) ViewQueues added in v0.0.5

func (pod *Pod) ViewQueues(k int, start int, status QueueStatus) (Result, error)

ViewQueues TODO

type Queue

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

Queue TODO

func NewQueue

func NewQueue(pod *Pod, id QueueID, status QueueStatus) *Queue

NewQueue TODO

func (*Queue) Clear

func (queue *Queue) Clear() (result Result, err error)

Clear TODO

func (*Queue) Dequeuing

func (queue *Queue) Dequeuing() int64

Dequeuing TODO

func (*Queue) Get

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

Get TODO

func (*Queue) Idle

func (queue *Queue) Idle() bool

Idle TODO

func (*Queue) Info

func (queue *Queue) Info() Result

Info TODO

func (*Queue) Put

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

Put 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(status QueueStatus) (err error)

SetStatus TODO

func (*Queue) SetStatusOn added in v0.0.14

func (queue *Queue) SetStatusOn(newStatus QueueStatus, on QueueStatus) (err error)

SetStatusOn TODO

func (*Queue) Status

func (queue *Queue) Status() QueueStatus

Status TODO

func (*Queue) Sync

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

Sync TODO

func (*Queue) View

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

View TODO

type QueueBox

type QueueBox struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

QueueBox TODO

func NewQueueBox

func NewQueueBox(pod *Pod) *QueueBox

NewQueueBox TODO

func (*QueueBox) AddRequest added in v0.0.8

func (box *QueueBox) AddRequest(qid QueueID, req *request.Request) (result Result, err error)

AddRequest TODO

func (*QueueBox) ClearQueue added in v0.0.8

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

ClearQueue TODO

func (*QueueBox) DeleteIdleQueue added in v0.0.8

func (box *QueueBox) DeleteIdleQueue(qid QueueID) error

DeleteIdleQueue TODO

func (*QueueBox) DeleteQueue added in v0.0.8

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

DeleteQueue TODO

func (*QueueBox) GetRequest added in v0.0.8

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

GetRequest TODO

func (*QueueBox) Info

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

Info TODO

func (*QueueBox) LoadPaused added in v0.0.12

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

LoadPaused TODO

func (*QueueBox) LoadQueues added in v0.0.8

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

LoadQueues TODO

func (*QueueBox) QueueInfo added in v0.0.8

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

QueueInfo TODO

func (*QueueBox) Queues added in v0.0.5

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

Queues TODO

func (*QueueBox) QueuesNum added in v0.0.8

func (box *QueueBox) QueuesNum(status QueueStatus) int

QueuesNum TODO

func (*QueueBox) SetStatus added in v0.0.12

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

SetStatus TODO

func (*QueueBox) SyncQueue added in v0.0.8

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

SyncQueue TODO

func (*QueueBox) ViewQueue added in v0.0.8

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

ViewQueue TODO

func (*QueueBox) ViewQueues added in v0.0.5

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

ViewQueues TODO

type QueueID

type QueueID struct {
	Host   string `json:"host"`
	Port   string `json:"port"`
	Scheme string `json:"scheme"`
}

QueueID TODO

func CreateQueueID

func CreateQueueID(host, port, scheme string) QueueID

CreateQueueID TODO

func QueueIDFromRedisKey

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

QueueIDFromRedisKey TODO

func QueueIDFromRequest

func QueueIDFromRequest(req *request.Request) QueueID

QueueIDFromRequest TODO

func QueueIDFromString added in v0.0.12

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

QueueIDFromString TODO

func (QueueID) ItemID added in v0.0.3

func (qid QueueID) ItemID() uint64

ItemID TODO

func (QueueID) MarshalJSON

func (qid QueueID) MarshalJSON() ([]byte, error)

MarshalJSON TODO

func (QueueID) String

func (qid QueueID) String() string

type QueueNotExistError

type QueueNotExistError string

QueueNotExistError TODO

func (QueueNotExistError) Error

func (e QueueNotExistError) Error() string

type QueueStatus

type QueueStatus int

QueueStatus type

const (
	QueueInit    QueueStatus // init
	QueueWorking             // working
	QueuePaused              // paused
	QueueRemoved             // removed
)

QueueStatus enum

func (QueueStatus) MarshalJSON added in v0.0.16

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

MarshalJSON TODO

func (*QueueStatus) UnmarshalJSON added in v0.0.16

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

UnmarshalJSON TODO

type Result

type Result map[string]interface{}

Result TODO

type ResultAndErrorFunc added in v0.0.12

type ResultAndErrorFunc func() (Result, error)

ResultAndErrorFunc TODO

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() 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

type Status

type Status int

Status type

const (
	Init      Status // init
	Preparing        // preparing
	Working          // working
	Paused           // paused
	Stopping         //stopping
	Stopped          //stopped
)

Status enum

func (Status) MarshalJSON added in v0.0.16

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

MarshalJSON TODO

func (*Status) UnmarshalJSON added in v0.0.16

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

UnmarshalJSON TODO

type UnavailableError

type UnavailableError string

UnavailableError TODO

func (UnavailableError) Error

func (e UnavailableError) Error() string

Jump to

Keyboard shortcuts

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