Documentation ¶
Index ¶
- Constants
- Variables
- func CheckEntryType(t EType) error
- func IsExpired(ttl int64) bool
- func LeftTTl(ttl int64) time.Duration
- func MarshalEntry(entry Entry) ([]byte, error)
- func MarshalHeader(header Header) ([]byte, int, error)
- func NewTTL(ttl time.Duration) int64
- func Validate(entry Entry) error
- type BinaryEntry
- type EType
- type Entry
- type Header
- type HeaderMarshaler
- type HeaderUnmarshaler
- type Marshaler
- type Serializer
- type UnMarshaler
Constants ¶
View Source
const MaxHeaderSize = 1 + binary.MaxVarintLen64*2 + binary.MaxVarintLen32*2
MaxHeaderSize | 31 B | +------+------+----------+--------+----------+---------+---------+ | type | ttl | txn_id | key_sz | value_sz | key | value | +------+------+----------+--------+----------+---------+---------+ | 1 B | 10 B | 10 B | 5 B | 5 B | unfixed | unfixed | +------+------+----------+--------+----------+---------+---------+
Variables ¶
Functions ¶
func CheckEntryType ¶
func IsExpired ¶
IsExpired if ttl is 0, represents of persistent only if ttl > 0, entry has live time
func MarshalEntry ¶
Types ¶
type BinaryEntry ¶
type BinaryEntry struct{}
BinaryEntry Binary data format
func (BinaryEntry) MarshalEntry ¶
func (d BinaryEntry) MarshalEntry(entry Entry) ([]byte, error)
func (BinaryEntry) MarshalHeader ¶
func (d BinaryEntry) MarshalHeader(header Header) ([]byte, int, error)
func (BinaryEntry) UnMarshalEntry ¶
func (d BinaryEntry) UnMarshalEntry(bytes []byte) (Entry, error)
func (BinaryEntry) UnMarshalHeader ¶
func (d BinaryEntry) UnMarshalHeader(raws []byte) (Header, int, error)
type HeaderMarshaler ¶
type HeaderUnmarshaler ¶
type Serializer ¶
type Serializer interface { Marshaler UnMarshaler HeaderMarshaler HeaderUnmarshaler }
type UnMarshaler ¶
Click to show internal directories.
Click to hide internal directories.