record

package
v0.0.0-...-2ff194a Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderSize = 1 + 4 + 4 + md5.Size
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	Type       Type
	KeyLength  uint32
	DataLength uint32
	Checksum   []byte
}

func NewHeader

func NewHeader(b []byte) (*Header, error)

func (*Header) BodySize

func (h *Header) BodySize() int64

func (*Header) FromReader

func (h *Header) FromReader(reader io.Reader) error

func (Header) Marshal

func (h Header) Marshal() []byte

func (*Header) Unmarshal

func (h *Header) Unmarshal(b []byte) error

type Record

type Record struct {
	Header     *Header
	ExpiatedAt *time.Time
	Key        string
	Value      []byte
}

func NewRecord

func NewRecord(key string, value []byte, ttl *time.Duration) *Record

func (*Record) FromReader

func (r *Record) FromReader(reader io.Reader) error

func (*Record) Marshal

func (r *Record) Marshal() []byte

func (Record) Size

func (r Record) Size() int64

func (Record) Valid

func (r Record) Valid() bool

type Type

type Type int8
const (
	TypePersistence Type = iota
	TypeTTL
)

Jump to

Keyboard shortcuts

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