storage

package
v0.0.0-...-eb7ac2c Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const MAGIC_NUMBER = 0x01535156 // VQS (0x56 0x51 0x53) Followed By 0x01 (version 1) in reversed order becase we use little endianness

Variables

View Source
var (
	DATA_BUFFER_SIZE         uint32 = 128 << 20
	MMAP_BUFFER_SIZE         uint32 = 1 << 20
	META_FILE_SIZE           uint32 = 1 << 20
	META_FILE_META_DATA_SIZE uint32 = uint32(unsafe.Sizeof(Meta{})) // 36 as of now
)

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	DataType string
	Value    []byte
}

type Message

type Message struct {
	Id               string
	Body             string
	Attributes       map[string]Attribute
	SystemAttributes map[string]Attribute
	DelaySeconds     uint16
}

func NewMessage

func NewMessage(delaySeconds uint16, body string) *Message

type Meta

type Meta struct {
	MagicNum               uint32
	CapacityLeft           uint32
	Count                  uint32
	ReadOffset             uint32
	WriteOffset            uint32
	MaxMessageSize         uint32
	MessageRetentionPeriod uint32
	MessageWaitSeconds     uint16
	DelaySeconds           uint16
	VisibilityTimeout      uint16
	HeaderMetaMarker       uint16 // TODO: this is not used yet
}

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue(queueName string) (*Queue, error)

func (*Queue) Pop

func (q *Queue) Pop() (*Message, error)

func (*Queue) Push

func (q *Queue) Push(msg *Message) error

type Queues

type Queues struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func LoadQueues

func LoadQueues() *Queues

func (*Queues) CloseQueues

func (qs *Queues) CloseQueues()

func (*Queues) CreateDefaultQueue

func (qs *Queues) CreateDefaultQueue(queueName string) (*Queue, error)

func (*Queues) CreateQueue

func (qs *Queues) CreateQueue(name string, delaySeconds uint16, maxMsgSize uint32, messageRetentionPeriod uint32, receiveMessageWaitTime uint16, defaultVisiblityTimeout uint16, tags *[][2]string) (*Queue, error)

func (*Queues) GetQueue

func (qs *Queues) GetQueue(queueName string) (*Queue, error)

Jump to

Keyboard shortcuts

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