Versions in this module Expand all Collapse all v0 v0.9.0 Sep 7, 2023 v0.8.0 Apr 17, 2023 Changes in this version + var ErrExceeded = errors.New("the offset exceeded") + var ErrFull = errors.New("full") + var ErrNotEnoughSpace = errors.New("not enough space") + var ErrNotLeader = errors.New("not leader") + var ErrNotSupported = errors.New("not supported") + var ErrOnEnd = errors.New("the offset on end") + var ErrSnapshotOutOfOrder = errors.New("the snapshot is out of order") + func MarshalFragment(frag Fragment) ([]byte, error) + type AppendCallback = func(seqs []int64, err error) + type AppendContext interface + Archived func() bool + WriteOffset func() int64 + type Appender interface + Append func(ctx context.Context, entries []Entry, cb AppendCallback) + type ArchivedCallback func(stat Statistics) + func (f ArchivedCallback) OnArchived(stat Statistics) + type ArchivedListener interface + OnArchived func(stat Statistics) + type Block interface + ID func() vanus.ID + type BytesValue []byte + func (bv BytesValue) Size() int + func (bv BytesValue) Value() []byte + type CommitAppendCallback = func() + type EmptyEntry struct + func (e *EmptyEntry) Get(ordinal int) interface{} + func (e *EmptyEntry) GetBytes(ordinal int) []byte + func (e *EmptyEntry) GetExtensionAttribute([]byte) []byte + func (e *EmptyEntry) GetInt64(ordinal int) int64 + func (e *EmptyEntry) GetString(ordinal int) string + func (e *EmptyEntry) GetTime(ordinal int) time.Time + func (e *EmptyEntry) GetUint16(ordinal int) uint16 + func (e *EmptyEntry) GetUint64(ordinal int) uint64 + func (e *EmptyEntry) RangeExtensionAttributes(ordinal ExtensionAttributeCallback) + type EmptyEntryExt struct + func (e *EmptyEntryExt) ExtensionAttributeCount() int + func (e *EmptyEntryExt) OptionalAttributeCount() int + func (e *EmptyEntryExt) RangeOptionalAttributes(ordinal OptionalAttributeCallback) + type Entry interface + Get func(ordinal int) interface{} + GetBytes func(ordinal int) []byte + GetExtensionAttribute func([]byte) []byte + GetInt64 func(ordinal int) int64 + GetString func(ordinal int) string + GetTime func(ordinal int) time.Time + GetUint16 func(ordinal int) uint16 + GetUint64 func(ordinal int) uint64 + RangeExtensionAttributes func(cb ExtensionAttributeCallback) + type EntryExt interface + ExtensionAttributeCount func() int + OptionalAttributeCount func() int + RangeOptionalAttributes func(cb OptionalAttributeCallback) + type EntryExtWrapper struct + E EntryExt + func (w *EntryExtWrapper) ExtensionAttributeCount() int + func (w *EntryExtWrapper) Get(ordinal int) interface{} + func (w *EntryExtWrapper) GetBytes(ordinal int) []byte + func (w *EntryExtWrapper) GetExtensionAttribute(attr []byte) []byte + func (w *EntryExtWrapper) GetInt64(ordinal int) int64 + func (w *EntryExtWrapper) GetString(ordinal int) string + func (w *EntryExtWrapper) GetTime(ordinal int) time.Time + func (w *EntryExtWrapper) GetUint16(ordinal int) uint16 + func (w *EntryExtWrapper) GetUint64(ordinal int) uint64 + func (w *EntryExtWrapper) OptionalAttributeCount() int + func (w *EntryExtWrapper) RangeExtensionAttributes(cb ExtensionAttributeCallback) + func (w *EntryExtWrapper) RangeOptionalAttributes(cb OptionalAttributeCallback) + type ExtensionAttributeCallback interface + OnAttribute func(attr []byte, val Value) + type Fragment interface + EndOffset func() int64 + Payload func() []byte + Size func() int + StartOffset func() int64 + func NewFragment(data []byte) Fragment + type FragmentMarshaler interface + MarshalFragment func() ([]byte, error) + type OnExtensionAttributeFunc func(attr []byte, val Value) + func (f OnExtensionAttributeFunc) OnAttribute(attr []byte, val Value) + type OnOptionalAttributeFunc func(ordinal int, val interface{}) + func (f OnOptionalAttributeFunc) OnAttribute(ordinal int, val interface{}) + func (f OnOptionalAttributeFunc) OnBytes(ordinal int, val []byte) + func (f OnOptionalAttributeFunc) OnInt64(ordinal int, val int64) + func (f OnOptionalAttributeFunc) OnString(ordinal int, val string) + func (f OnOptionalAttributeFunc) OnTime(ordinal int, val time.Time) + func (f OnOptionalAttributeFunc) OnUint16(ordinal int, val uint16) + func (f OnOptionalAttributeFunc) OnUint64(ordinal int, val uint64) + type OptionalAttributeCallback interface + OnAttribute func(ordinal int, val interface{}) + OnBytes func(ordinal int, val []byte) + OnInt64 func(ordinal int, val int64) + OnString func(ordinal int, val string) + OnTime func(ordinal int, val time.Time) + OnUint16 func(ordinal int, val uint16) + OnUint64 func(ordinal int, val uint64) + type Raw interface + Close func(context.Context) error + Delete func(context.Context) error + ID func() vanus.ID + Open func(context.Context) error + Status func() Statistics + type Reader interface + Read func(ctx context.Context, seq int64, num int) ([]Entry, error) + type SeekKeyFlag uint64 + const SeekAfterKey + const SeekBeforeKey + const SeekKeyExact + const SeekKeyOrNext + const SeekKeyOrPrev + const SeekPrefix + const SeekPrefixLast + const SeekPrefixLastOrPrev + type Seeker interface + Seek func(ctx context.Context, index int64, key Entry, flag SeekKeyFlag) (int64, error) + type Snapshoter interface + ApplySnapshot func(ctx context.Context, snap Fragment) error + Snapshot func(ctx context.Context) (Fragment, error) + type Statistics struct + Archived bool + Capacity uint64 + EntryNum uint32 + EntrySize uint64 + FirstEntryStime int64 + ID vanus.ID + LastEntryStime int64 + type TwoPCAppender interface + CommitAppend func(ctx context.Context, frag Fragment, cb CommitAppendCallback) + NewAppendContext func(last Fragment) AppendContext + PrepareAppend func(ctx context.Context, appendCtx AppendContext, entries ...Entry) ([]int64, Fragment, bool, error) + PrepareArchive func(ctx context.Context, appendCtx AppendContext) (Fragment, error) + type Value interface + Size func() int + Value func() []byte + type ValueMarshaler interface + MarshalTo func(buf []byte) int