Documentation ¶
Index ¶
- Variables
- func MarshalFragment(frag Fragment) ([]byte, error)
- type AppendCallback
- type AppendContext
- type Appender
- type ArchivedCallback
- type ArchivedListener
- type Block
- type BytesValue
- type CommitAppendCallback
- type EmptyEntry
- 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
- type Entry
- type EntryExt
- type EntryExtWrapper
- 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
- type Fragment
- type FragmentMarshaler
- type OnExtensionAttributeFunc
- type OnOptionalAttributeFunc
- 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
- type Raw
- type Reader
- type SeekKeyFlag
- type Seeker
- type Snapshoter
- type Statistics
- type TwoPCAppender
- type Value
- type ValueMarshaler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotEnoughSpace = errors.New("not enough space") ErrFull = errors.New("full") ErrNotLeader = errors.New("not leader") ErrExceeded = errors.New("the offset exceeded") ErrOnEnd = errors.New("the offset on end") ErrNotSupported = errors.New("not supported") )
View Source
var ErrSnapshotOutOfOrder = errors.New("the snapshot is out of order")
Functions ¶
func MarshalFragment ¶
Types ¶
type AppendCallback ¶
type AppendContext ¶
type Appender ¶
type Appender interface {
Append(ctx context.Context, entries []Entry, cb AppendCallback)
}
type ArchivedCallback ¶
type ArchivedCallback func(stat Statistics)
func (ArchivedCallback) OnArchived ¶
func (f ArchivedCallback) OnArchived(stat Statistics)
type ArchivedListener ¶
type ArchivedListener interface {
OnArchived(stat Statistics)
}
type BytesValue ¶
type BytesValue []byte
func (BytesValue) Size ¶
func (bv BytesValue) Size() int
func (BytesValue) Value ¶
func (bv BytesValue) Value() []byte
type CommitAppendCallback ¶
type CommitAppendCallback = func()
type EmptyEntry ¶
type EmptyEntry struct{}
func (*EmptyEntry) Get ¶
func (e *EmptyEntry) Get(ordinal int) interface{}
func (*EmptyEntry) GetBytes ¶
func (e *EmptyEntry) GetBytes(ordinal int) []byte
func (*EmptyEntry) GetExtensionAttribute ¶
func (e *EmptyEntry) GetExtensionAttribute([]byte) []byte
func (*EmptyEntry) GetInt64 ¶
func (e *EmptyEntry) GetInt64(ordinal int) int64
func (*EmptyEntry) GetString ¶
func (e *EmptyEntry) GetString(ordinal int) string
func (*EmptyEntry) GetUint16 ¶
func (e *EmptyEntry) GetUint16(ordinal int) uint16
func (*EmptyEntry) GetUint64 ¶
func (e *EmptyEntry) GetUint64(ordinal int) uint64
func (*EmptyEntry) RangeExtensionAttributes ¶
func (e *EmptyEntry) RangeExtensionAttributes(ordinal ExtensionAttributeCallback)
type EmptyEntryExt ¶
type EmptyEntryExt struct {
EmptyEntry
}
func (*EmptyEntryExt) ExtensionAttributeCount ¶
func (e *EmptyEntryExt) ExtensionAttributeCount() int
func (*EmptyEntryExt) OptionalAttributeCount ¶
func (e *EmptyEntryExt) OptionalAttributeCount() int
func (*EmptyEntryExt) RangeOptionalAttributes ¶
func (e *EmptyEntryExt) RangeOptionalAttributes(ordinal OptionalAttributeCallback)
type Entry ¶
type Entry interface { Get(ordinal int) interface{} GetBytes(ordinal int) []byte GetString(ordinal int) string GetUint16(ordinal int) uint16 GetUint64(ordinal int) uint64 GetInt64(ordinal int) int64 GetTime(ordinal int) time.Time GetExtensionAttribute([]byte) []byte RangeExtensionAttributes(cb ExtensionAttributeCallback) }
Entry is a record of data stored in a Block. An Entry has some optional attributes and arbitrary extension attributes.
type EntryExt ¶
type EntryExt interface { Entry OptionalAttributeCount() int ExtensionAttributeCount() int RangeOptionalAttributes(cb OptionalAttributeCallback) }
type EntryExtWrapper ¶
type EntryExtWrapper struct {
E EntryExt
}
func (*EntryExtWrapper) ExtensionAttributeCount ¶
func (w *EntryExtWrapper) ExtensionAttributeCount() int
func (*EntryExtWrapper) Get ¶
func (w *EntryExtWrapper) Get(ordinal int) interface{}
func (*EntryExtWrapper) GetBytes ¶
func (w *EntryExtWrapper) GetBytes(ordinal int) []byte
func (*EntryExtWrapper) GetExtensionAttribute ¶
func (w *EntryExtWrapper) GetExtensionAttribute(attr []byte) []byte
func (*EntryExtWrapper) GetInt64 ¶
func (w *EntryExtWrapper) GetInt64(ordinal int) int64
func (*EntryExtWrapper) GetString ¶
func (w *EntryExtWrapper) GetString(ordinal int) string
func (*EntryExtWrapper) GetUint16 ¶
func (w *EntryExtWrapper) GetUint16(ordinal int) uint16
func (*EntryExtWrapper) GetUint64 ¶
func (w *EntryExtWrapper) GetUint64(ordinal int) uint64
func (*EntryExtWrapper) OptionalAttributeCount ¶
func (w *EntryExtWrapper) OptionalAttributeCount() int
func (*EntryExtWrapper) RangeExtensionAttributes ¶
func (w *EntryExtWrapper) RangeExtensionAttributes(cb ExtensionAttributeCallback)
func (*EntryExtWrapper) RangeOptionalAttributes ¶
func (w *EntryExtWrapper) RangeOptionalAttributes(cb OptionalAttributeCallback)
type Fragment ¶
Fragment is a fragment of a block.
The layout of `Fragment` is:
┌───────────────────────────────────┬───────────────────────────────────┐ │ Offset(8) │ Payload ... │ └───────────────────────────────────┴───────────────────────────────────┘
All values little-endian
+00 8B Offset +08 Payload
func NewFragment ¶
type FragmentMarshaler ¶
type OnExtensionAttributeFunc ¶
func (OnExtensionAttributeFunc) OnAttribute ¶
func (f OnExtensionAttributeFunc) OnAttribute(attr []byte, val Value)
type OnOptionalAttributeFunc ¶
type OnOptionalAttributeFunc func(ordinal int, val interface{})
func (OnOptionalAttributeFunc) OnAttribute ¶
func (f OnOptionalAttributeFunc) OnAttribute(ordinal int, val interface{})
func (OnOptionalAttributeFunc) OnBytes ¶
func (f OnOptionalAttributeFunc) OnBytes(ordinal int, val []byte)
func (OnOptionalAttributeFunc) OnInt64 ¶
func (f OnOptionalAttributeFunc) OnInt64(ordinal int, val int64)
func (OnOptionalAttributeFunc) OnString ¶
func (f OnOptionalAttributeFunc) OnString(ordinal int, val string)
func (OnOptionalAttributeFunc) OnTime ¶
func (f OnOptionalAttributeFunc) OnTime(ordinal int, val time.Time)
func (OnOptionalAttributeFunc) OnUint16 ¶
func (f OnOptionalAttributeFunc) OnUint16(ordinal int, val uint16)
func (OnOptionalAttributeFunc) OnUint64 ¶
func (f OnOptionalAttributeFunc) OnUint64(ordinal int, val uint64)
type OptionalAttributeCallback ¶
type OptionalAttributeCallback interface { OnBytes(ordinal int, val []byte) OnString(ordinal int, val string) OnUint16(ordinal int, val uint16) OnUint64(ordinal int, val uint64) OnInt64(ordinal int, val int64) OnTime(ordinal int, val time.Time) // TODO(james.yin): more types OnAttribute(ordinal int, val interface{}) }
type SeekKeyFlag ¶
type SeekKeyFlag uint64
const ( SeekKeyExact SeekKeyFlag = iota SeekKeyOrNext SeekKeyOrPrev SeekAfterKey SeekBeforeKey SeekPrefix SeekPrefixLast SeekPrefixLastOrPrev )
type Snapshoter ¶
type Statistics ¶
type Statistics struct { ID vanus.ID Capacity uint64 Archived bool EntryNum uint32 EntrySize uint64 // FirstEntryStime is the millisecond timestamp when the first Entry will be written to Block. FirstEntryStime int64 // LastEntryStime is the millisecond timestamp when the last Entry will be written to Block. LastEntryStime int64 }
type TwoPCAppender ¶
type TwoPCAppender interface { NewAppendContext(last Fragment) AppendContext PrepareAppend(ctx context.Context, appendCtx AppendContext, entries ...Entry) ([]int64, Fragment, bool, error) PrepareArchive(ctx context.Context, appendCtx AppendContext) (Fragment, error) CommitAppend(ctx context.Context, frag Fragment, cb CommitAppendCallback) }
type ValueMarshaler ¶
Click to show internal directories.
Click to hide internal directories.