queue

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2025 License: AGPL-3.0, AGPL-3.0-or-later Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	ID  ItemID         `json:"id"`
	TS  int64          `json:"ts"`
	Msg *models.MsgOut `json:"msg"`
}

Item wraps things that can be put in an outbox

type ItemID

type ItemID string

type Outbox

type Outbox struct {
	ChannelUUID models.ChannelUUID
	ChatID      models.ChatID
}

Outbox is channel + chat ID pair that we can send to

func (Outbox) String

func (q Outbox) String() string

type Outboxes

type Outboxes struct {
	KeyBase    string
	InstanceID string
}

func (*Outboxes) AddMessage

func (o *Outboxes) AddMessage(rc redis.Conn, ch *models.Channel, chatID models.ChatID, m *models.MsgOut) error

AddMessage adds a message to the outbox for the given chat id

func (*Outboxes) ReadReady

func (o *Outboxes) ReadReady(rc redis.Conn) (map[Outbox]*Item, error)

ReadReady returns the oldest item for each outbox that this instance is ready to send for

func (*Outboxes) RecordSent

func (o *Outboxes) RecordSent(rc redis.Conn, ch *models.Channel, chatID models.ChatID, itemID ItemID) (bool, error)

func (*Outboxes) SetReady

func (o *Outboxes) SetReady(rc redis.Conn, ch *models.Channel, chatID models.ChatID, ready bool) error

SetReady records that this instance is ready to send messages to the given chat id

Jump to

Keyboard shortcuts

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