package base
Import Path
github.com/hibiken/asynq/internal/base (on go.dev )
Dependency Relation
imports 13 packages , and imported by 3 packages
Package-Level Type Names (total 11)
/* sort by: alphabet | popularity */
type Broker (interface)
Broker is a message broker that supports operations to manage task queues.
See rdb.RDB as a reference implementation.
Methods (total 28 )
( Broker) AddToGroup (ctx context .Context , msg *TaskMessage , gname string ) error
Group aggregation related methods
( Broker) AddToGroupUnique (ctx context .Context , msg *TaskMessage , groupKey string , ttl time .Duration ) error
( Broker) AggregationCheck (qname, gname string , t time .Time , gracePeriod, maxDelay time .Duration , maxSize int ) (aggregationSetID string , err error )
( Broker) Archive (ctx context .Context , msg *TaskMessage , errMsg string ) error
( Broker) CancelationPubSub () (*redis .PubSub , error )
Cancelation related methods
// TODO: Need to decouple from redis to support other brokers
( Broker) ClearServerState (host string , pid int , serverID string ) error
( Broker) Close () error
( Broker) DeleteAggregationSet (ctx context .Context , qname, gname, aggregationSetID string ) error
( Broker) DeleteExpiredCompletedTasks (qname string ) error
Task retention related method
( Broker) Dequeue (qnames ...string ) (*TaskMessage , time .Time , error )
( Broker) Done (ctx context .Context , msg *TaskMessage ) error
( Broker) Enqueue (ctx context .Context , msg *TaskMessage ) error
( Broker) EnqueueUnique (ctx context .Context , msg *TaskMessage , ttl time .Duration ) error
( Broker) ExtendLease (qname string , ids ...string ) (time .Time , error )
( Broker) ForwardIfReady (qnames ...string ) error
( Broker) ListGroups (qname string ) ([]string , error )
( Broker) ListLeaseExpired (cutoff time .Time , qnames ...string ) ([]*TaskMessage , error )
Lease related methods
( Broker) MarkAsComplete (ctx context .Context , msg *TaskMessage ) error
( Broker) Ping () error
( Broker) PublishCancelation (id string ) error
( Broker) ReadAggregationSet (qname, gname, aggregationSetID string ) ([]*TaskMessage , time .Time , error )
( Broker) ReclaimStaleAggregationSets (qname string ) error
( Broker) Requeue (ctx context .Context , msg *TaskMessage ) error
( Broker) Retry (ctx context .Context , msg *TaskMessage , processAt time .Time , errMsg string , isFailure bool ) error
( Broker) Schedule (ctx context .Context , msg *TaskMessage , processAt time .Time ) error
( Broker) ScheduleUnique (ctx context .Context , msg *TaskMessage , processAt time .Time , ttl time .Duration ) error
( Broker) WriteResult (qname, id string , data []byte ) (n int , err error )
( Broker) WriteServerState (info *ServerInfo , workers []*WorkerInfo , ttl time .Duration ) error
State snapshot related methods
Implemented By (at least one exported )
*github.com/hibiken/asynq/internal/rdb.RDB
Implements (at least 2 )
Broker : github.com/prometheus/common/expfmt.Closer
Broker : io.Closer
type TaskInfo (struct)
TaskInfo describes a task message and its metadata.
Fields (total 4 )
Message *TaskMessage
NextProcessAt time .Time
Result []byte
State TaskState
As Outputs Of (at least 8 )
func github.com/hibiken/asynq/internal/rdb.(*RDB ).GetTaskInfo (qname, id string ) (*TaskInfo , error )
func github.com/hibiken/asynq/internal/rdb.(*RDB ).ListActive (qname string , pgn rdb .Pagination ) ([]*TaskInfo , error )
func github.com/hibiken/asynq/internal/rdb.(*RDB ).ListAggregating (qname, gname string , pgn rdb .Pagination ) ([]*TaskInfo , error )
func github.com/hibiken/asynq/internal/rdb.(*RDB ).ListArchived (qname string , pgn rdb .Pagination ) ([]*TaskInfo , error )
func github.com/hibiken/asynq/internal/rdb.(*RDB ).ListCompleted (qname string , pgn rdb .Pagination ) ([]*TaskInfo , error )
func github.com/hibiken/asynq/internal/rdb.(*RDB ).ListPending (qname string , pgn rdb .Pagination ) ([]*TaskInfo , error )
func github.com/hibiken/asynq/internal/rdb.(*RDB ).ListRetry (qname string , pgn rdb .Pagination ) ([]*TaskInfo , error )
func github.com/hibiken/asynq/internal/rdb.(*RDB ).ListScheduled (qname string , pgn rdb .Pagination ) ([]*TaskInfo , error )
type TaskMessage (struct)
TaskMessage is the internal representation of a task with additional metadata fields.
Serialized data of this type gets written to redis.
Fields (total 14 )
CompletedAt int64
CompletedAt is the time the task was processed successfully in Unix time,
the number of seconds elapsed since January 1, 1970 UTC.
Use zero to indicate no value.
Deadline int64
Deadline specifies the deadline for the task in Unix time,
the number of seconds elapsed since January 1, 1970 UTC.
If task processing doesn't complete before the deadline, the task will be retried
if retry count is remaining. Otherwise it will be moved to the archive.
Use zero to indicate no deadline.
ErrorMsg string
ErrorMsg holds the error message from the last failure.
GroupKey string
GroupKey holds the group key used for task aggregation.
Empty string indicates no aggregation is used for this task.
ID string
ID is a unique identifier for each task.
LastFailedAt int64
Time of last failure in Unix time,
the number of seconds elapsed since January 1, 1970 UTC.
Use zero to indicate no last failure
Payload []byte
Payload holds data needed to process the task.
Queue string
Queue is a name this message should be enqueued to.
Retention int64
Retention specifies the number of seconds the task should be retained after completion.
Retried int
Retried is the number of times we've retried this task so far.
Retry int
Retry is the max number of retry for this task.
Timeout int64
Timeout specifies timeout in seconds.
If task processing doesn't complete within the timeout, the task will be retried
if retry count is remaining. Otherwise it will be moved to the archive.
Use zero to indicate no timeout.
Type string
Type indicates the kind of the task to be performed.
UniqueKey string
UniqueKey holds the redis key used for uniqueness lock for this task.
Empty string indicates that no uniqueness lock was used.
As Outputs Of (at least 7 )
func DecodeMessage (data []byte ) (*TaskMessage , error )
func Broker .Dequeue (qnames ...string ) (*TaskMessage , time .Time , error )
func Broker .ListLeaseExpired (cutoff time .Time , qnames ...string ) ([]*TaskMessage , error )
func Broker .ReadAggregationSet (qname, gname, aggregationSetID string ) ([]*TaskMessage , time .Time , error )
func github.com/hibiken/asynq/internal/rdb.(*RDB ).Dequeue (qnames ...string ) (msg *TaskMessage , leaseExpirationTime time .Time , err error )
func github.com/hibiken/asynq/internal/rdb.(*RDB ).ListLeaseExpired (cutoff time .Time , qnames ...string ) ([]*TaskMessage , error )
func github.com/hibiken/asynq/internal/rdb.(*RDB ).ReadAggregationSet (qname, gname, setID string ) ([]*TaskMessage , time .Time , error )
As Inputs Of (at least 24 )
func EncodeMessage (msg *TaskMessage ) ([]byte , error )
func Broker .AddToGroup (ctx context .Context , msg *TaskMessage , gname string ) error
func Broker .AddToGroupUnique (ctx context .Context , msg *TaskMessage , groupKey string , ttl time .Duration ) error
func Broker .Archive (ctx context .Context , msg *TaskMessage , errMsg string ) error
func Broker .Done (ctx context .Context , msg *TaskMessage ) error
func Broker .Enqueue (ctx context .Context , msg *TaskMessage ) error
func Broker .EnqueueUnique (ctx context .Context , msg *TaskMessage , ttl time .Duration ) error
func Broker .MarkAsComplete (ctx context .Context , msg *TaskMessage ) error
func Broker .Requeue (ctx context .Context , msg *TaskMessage ) error
func Broker .Retry (ctx context .Context , msg *TaskMessage , processAt time .Time , errMsg string , isFailure bool ) error
func Broker .Schedule (ctx context .Context , msg *TaskMessage , processAt time .Time ) error
func Broker .ScheduleUnique (ctx context .Context , msg *TaskMessage , processAt time .Time , ttl time .Duration ) error
func github.com/hibiken/asynq/internal/context.New (base context .Context , msg *TaskMessage , deadline time .Time ) (context .Context , context .CancelFunc )
func github.com/hibiken/asynq/internal/rdb.(*RDB ).AddToGroup (ctx context .Context , msg *TaskMessage , groupKey string ) error
func github.com/hibiken/asynq/internal/rdb.(*RDB ).AddToGroupUnique (ctx context .Context , msg *TaskMessage , groupKey string , ttl time .Duration ) error
func github.com/hibiken/asynq/internal/rdb.(*RDB ).Archive (ctx context .Context , msg *TaskMessage , errMsg string ) error
func github.com/hibiken/asynq/internal/rdb.(*RDB ).Done (ctx context .Context , msg *TaskMessage ) error
func github.com/hibiken/asynq/internal/rdb.(*RDB ).Enqueue (ctx context .Context , msg *TaskMessage ) error
func github.com/hibiken/asynq/internal/rdb.(*RDB ).EnqueueUnique (ctx context .Context , msg *TaskMessage , ttl time .Duration ) error
func github.com/hibiken/asynq/internal/rdb.(*RDB ).MarkAsComplete (ctx context .Context , msg *TaskMessage ) error
func github.com/hibiken/asynq/internal/rdb.(*RDB ).Requeue (ctx context .Context , msg *TaskMessage ) error
func github.com/hibiken/asynq/internal/rdb.(*RDB ).Retry (ctx context .Context , msg *TaskMessage , processAt time .Time , errMsg string , isFailure bool ) error
func github.com/hibiken/asynq/internal/rdb.(*RDB ).Schedule (ctx context .Context , msg *TaskMessage , processAt time .Time ) error
func github.com/hibiken/asynq/internal/rdb.(*RDB ).ScheduleUnique (ctx context .Context , msg *TaskMessage , processAt time .Time , ttl time .Duration ) error
Package-Level Functions (total 39)
Package-Level Variables (only one)
Package-Level Constants (total 14)
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .