27 lines
580 B
Go
27 lines
580 B
Go
package deliver
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
// Job is a fanout unit. ExcludeDevice is the sender device. NotMailbox matches BFF NotSaveIch.
|
|
type Job struct {
|
|
MsgID int64
|
|
Cmd uint16
|
|
ConversationID int64
|
|
FromUserID int64
|
|
FromDeviceID uint64
|
|
ExcludeDevice uint64
|
|
NotPush bool
|
|
NotMailbox bool
|
|
Payload []byte
|
|
}
|
|
|
|
type Queue interface {
|
|
Push(ctx context.Context, job *Job) error
|
|
Take(ctx context.Context, timeout time.Duration) (*Job, error)
|
|
Ack(ctx context.Context, job *Job) error
|
|
RequeueStale(ctx context.Context) error
|
|
}
|