Documentation
¶
Index ¶
- Constants
- func MessageKey(userID int64, queueName string, index int64) string
- func QueueListKey(userID int64) string
- func QueueMaxIDKey(userID int64, queueName string) string
- func SquadKey(userID int64, queueName string, squadName string) string
- type HTTPStatus
- type HTTPStatusMeta
- type Incrementer
- type KV
- type Message
- type NodeInfo
- type NodeRequestParams
- type NodeSlice
- type Queue
- type Squad
- type UserAuth
- type Watcher
Constants ¶
View Source
const (
// NodesKey for the nodes info storage key
NodesKey = "sqs.nodes"
)
View Source
const SquadKeyPrefix = "sqs.squad"
SquadKeyPrefix prefix of the storage key for squad
Variables ¶
This section is empty.
Functions ¶
func MessageKey ¶
MessageKey for message storage key
func QueueMaxIDKey ¶
QueueMaxIDKey for record the max id has been distributed
Types ¶
type HTTPStatus ¶
type HTTPStatus struct {
HTTPStatusMeta
Data interface{} `json:"data"`
}
HTTPStatus contains handleGetStatus of a failed request
type HTTPStatusMeta ¶
HTTPStatusMeta for a http response body data structure
type Incrementer ¶
type Incrementer interface {
// Increment try to increment the current value of the key.
// It will returns non-nil error if current value exists but not a number string or
// failed to increment by resource race.
// result is the result value of the key if the increment succeed.
Increment(key string, number int) (result int64, err error)
}
Incrementer defines increment a integer value in a transaction
type KV ¶
type KV interface {
Get(key string) (string, error)
Put(key string, value string) error
Delete(key string) error
}
KV defines underlying key/value database
type Message ¶
type Message struct {
UserID int64 `json:"-"`
QueueName string `json:"-"`
Content string `json:"content"`
Index int64 `json:"message_id"`
}
Message contains info
type NodeRequestParams ¶
type NodeRequestParams struct {
Token string `json:"token"`
QueueName string `json:"queue_name"`
SquadName string `json:"squad_name,omitempty"`
}
NodeRequestParams contains the basic info of every request
type Squad ¶
type Squad struct {
Name string
UserID int64
QueueName string
ReceivedMessageID int64
RecentPushedAt time.Time
}
Squad is a record for one queue processed index
Click to show internal directories.
Click to hide internal directories.