Documentation ¶
Index ¶
Constants ¶
const ( PersistenceWritetrough persistenceType = 0 PersistenceWriteback persistenceType = 1 PersistenceNone persistenceType = 2 )
Persistence types (must be the same as in queueproto)
const ( DeliveryAnyone deliveryType = 0 DeliveryEveryone deliveryType = 1 DeliveryEveryoneNowAndFuture deliveryType = 2 )
Delivery types (must be the same as in queueproto)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ForeachFunc ¶
ForeachFunc is a type of func to be passed to Foreach method
type StatusType ¶
type StatusType int8
StatusType is a type for the task statuses
const ( StatusQueued StatusType = 0 StatusAccepted StatusType = 1 StatusDone StatusType = 2 StatusTimedout StatusType = 3 StatusAborted StatusType = 4 StatusDismissed StatusType = 5 StatusDispatched StatusType = 6 StatusInProgress StatusType = 8 StatusToRemove StatusType = -1 StatusAcceptTimeout StatusType = -2 StatusProcessTimeout StatusType = -3 )
Status values (must be the same as in queueproto)
type Storage ¶
Storage is a simple RWLock protected map
func NewStorage ¶
func NewStorage() *Storage
NewStorage creates a new task storage struct with the internal map initialised
func (*Storage) Foreach ¶
func (s *Storage) Foreach(f ForeachFunc) int
Foreach executes the function provided for each task in the storage
type Task ¶
type Task struct { Queue string Subject string Originator string Timeout time.Duration Persistence persistenceType Delivery deliveryType Ack Acks Payload []byte Status StatusType CTime time.Time Sequence int64 // contains filtered or unexported fields }
Task as it will be serialized to DB
func NewTask ¶
func NewTask(protoTask *queueproto.QueueTask) *Task
NewTask builds a task from queueproto.QueueTask. Just in case we will have to change proto and DB scheme independently
func (*Task) ChangeExpire ¶
ChangeExpire changes the task expire timer
func (*Task) ChangeStatus ¶
func (t *Task) ChangeStatus(status StatusType)
ChangeStatus changes the task status (surprise)
func (*Task) ChangeStatusAndExpire ¶
func (t *Task) ChangeStatusAndExpire(status StatusType, expire *time.Timer)
ChangeStatusAndExpire changes the task status and expire (surprise)