Versions in this module Expand all Collapse all v1 v1.4.2 Feb 15, 2026 Changes in this version + const CurrentVersion + const DefaultIndexInterval + const EntryFlagCompressed + const EntryFlagEncrypted + const EntryFlagHeaders + const EntryFlagNone + const EntryFlagPriority + const EntryFlagTTL + const EntryHeaderSize + const EntryTypeCheckpoint + const EntryTypeData + const EntryTypeTombstone + const FormatVersion1 + const IndexEntrySize + const IndexHeaderSize + const IndexMagic + const MaxDecompressedSize + const MetadataMagic + const PriorityHigh + const PriorityLow + const PriorityMedium + const SegmentFlagCompressed + const SegmentFlagEncrypted + const SegmentFlagNone + const SegmentHeaderSize + const SegmentMagic + func CompressPayload(payload []byte, compression CompressionType, level int) ([]byte, error) + func ComputeCRC32C(data []byte) uint32 + func DecompressPayload(payload []byte, compression CompressionType) ([]byte, error) + func ShouldCompress(originalSize, compressedSize, minSize int) bool + func VerifyCRC32C(data []byte, expected uint32) bool + func WriteIndexFile(path string, idx *Index) error + func WriteMetadata(path string, meta *QueueMetadata) error + func WriteSegmentHeader(path string, header *SegmentHeader) error + type CompressionType uint8 + const CompressionGzip + const CompressionNone + func (c CompressionType) String() string + type Entry struct + Compression CompressionType + ExpiresAt int64 + Flags uint8 + Headers map[string]string + Length uint32 + MsgID uint64 + Payload []byte + Priority uint8 + Timestamp int64 + Type uint8 + func Unmarshal(r io.Reader) (*Entry, error) + func (e *Entry) IsExpired(now int64) bool + func (e *Entry) Marshal() []byte + func (e *Entry) TotalSize() int + func (e *Entry) Validate() error + type Index struct + Entries []*IndexEntry + Header *IndexHeader + func NewIndex(baseID uint64) *Index + func ReadIndex(r io.Reader) (*Index, error) + func ReadIndexFile(path string) (*Index, error) + func (idx *Index) Add(entry *IndexEntry) + func (idx *Index) Find(messageID uint64) *IndexEntry + func (idx *Index) WriteTo(w io.Writer) (int64, error) + type IndexEntry struct + FileOffset uint64 + MessageID uint64 + Timestamp int64 + func UnmarshalIndexEntry(r io.Reader) (*IndexEntry, error) + func (e *IndexEntry) Marshal() []byte + type IndexHeader struct + BaseID uint64 + EntryCount uint64 + HeaderCRC uint32 + Magic uint32 + Reserved uint32 + Version uint16 + func NewIndexHeader(baseID uint64) *IndexHeader + func UnmarshalIndexHeader(r io.Reader) (*IndexHeader, error) + func (h *IndexHeader) Marshal() []byte + func (h *IndexHeader) Validate() error + type MetadataFile struct + func NewMetadataFile(path string) *MetadataFile + func (mf *MetadataFile) Read() (*QueueMetadata, error) + func (mf *MetadataFile) Write(meta *QueueMetadata) error + type PriorityIndex struct + func NewPriorityIndex() *PriorityIndex + func (pi *PriorityIndex) Clear() + func (pi *PriorityIndex) Count() int + func (pi *PriorityIndex) CountByPriority(priority uint8) int + func (pi *PriorityIndex) Get(offset uint64) *PriorityIndexEntry + func (pi *PriorityIndex) Insert(offset uint64, position uint32, priority uint8, timestamp int64) + func (pi *PriorityIndex) NextInPriority(priority uint8, afterOffset uint64) (uint64, bool) + func (pi *PriorityIndex) OldestInPriority(priority uint8) *PriorityIndexEntry + func (pi *PriorityIndex) Remove(offset uint64) + type PriorityIndexEntry struct + Offset uint64 + Position uint32 + Priority uint8 + Timestamp int64 + type QueueMetadata struct + AckCount uint64 + AckOffset uint64 + ActiveSegmentID uint64 + LastAckTime int64 + LastCompactTime int64 + LastWriteTime int64 + MessageCount uint64 + OldestSegmentID uint64 + ReadOffset uint64 + Version uint16 + WriteOffset uint64 + func NewQueueMetadata() *QueueMetadata + func ReadFrom(r io.Reader) (*QueueMetadata, error) + func ReadMetadata(path string) (*QueueMetadata, error) + func ReadMetadataOrCreate(path string) (*QueueMetadata, error) + func UnmarshalMetadata(data []byte) (*QueueMetadata, error) + func (m *QueueMetadata) Marshal() ([]byte, error) + func (m *QueueMetadata) Validate() error + func (m *QueueMetadata) WriteTo(w io.Writer) (int64, error) + type SegmentHeader struct + BaseOffset uint64 + CreatedAt int64 + Flags uint16 + HeaderCRC uint32 + Magic uint32 + MaxMsgID uint64 + MinMsgID uint64 + Reserved [20]byte + Version uint16 + func NewSegmentHeader(baseOffset uint64) *SegmentHeader + func ReadSegmentHeader(path string) (*SegmentHeader, error) + func UnmarshalSegmentHeader(r io.Reader) (*SegmentHeader, error) + func (h *SegmentHeader) Marshal() []byte + func (h *SegmentHeader) Validate() error