interfaces

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const OpDel = 2

OpDel identifier for delete data from storage

View Source
const OpSet = 1

OpSet identifier for set data into storeage

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel interface {
	SendContent(method amqp.Method, message *amqp.Message) *amqp.Error
	SendMethod(method amqp.Method)
	NextDeliveryTag() uint64
	AddUnackedMessage(dTag uint64, cTag string, queue string, message *amqp.Message)
}

Channel represents base channel public interface

type Consumer

type Consumer interface {
	Consume() bool
	Tag() string
	Cancel()
}

Consumer represents base consumer public interface

type DbStorage

type DbStorage interface {
	Set(key string, value []byte) (err error)
	Del(key string) (err error)
	Get(key string) (value []byte, err error)
	Iterate(fn func(key []byte, value []byte))
	IterateByPrefix(prefix []byte, limit uint64, fn func(key []byte, value []byte)) uint64
	IterateByPrefixFrom(prefix []byte, from []byte, limit uint64, fn func(key []byte, value []byte)) uint64
	DeleteByPrefix(prefix []byte)
	KeysByPrefixCount(prefix []byte) uint64
	ProcessBatch(batch []*Operation) (err error)
	Close() error
}

DbStorage represent base db storage interface

type MsgStorage

type MsgStorage interface {
	Del(message *amqp.Message, queue string) error
	PurgeQueue(queue string)
	Add(message *amqp.Message, queue string) error
	Update(message *amqp.Message, queue string) error
	IterateByQueueFromMsgID(queue string, msgID uint64, limit uint64, fn func(message *amqp.Message)) uint64
	GetQueueLength(queue string) uint64
}

MsgStorage represent interface for messages storage

type Operation

type Operation struct {
	Key   string
	Value []byte
	Op    byte
}

Operation represents structure to set/del from storage

Jump to

Keyboard shortcuts

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