Documentation ¶
Index ¶
- Constants
- func InitialJournalRegion(writer io.Writer, sector block.BlockSize)
- type BufferedIter
- type DeleteRange
- type DeleteRecord
- type DequeueIter
- type EmbedRecord
- type EndOfRecords
- type GoToFront
- type JournalEntry
- type JournalHeaderRegion
- type JournalNvmBuffer
- func (jb *JournalNvmBuffer) BlockSize() block.BlockSize
- func (jb *JournalNvmBuffer) Capacity() uint64
- func (jb *JournalNvmBuffer) Close() error
- func (jb *JournalNvmBuffer) Flush() error
- func (jb *JournalNvmBuffer) Position() uint64
- func (jb *JournalNvmBuffer) RawSize() int64
- func (jb *JournalNvmBuffer) Read(buf []byte) (n int, err error)
- func (jb *JournalNvmBuffer) Seek(offset int64, whence int) (int64, error)
- func (jb *JournalNvmBuffer) Split(p uint64) (nvm.NonVolatileMemory, nvm.NonVolatileMemory, error)
- func (jb *JournalNvmBuffer) Sync() error
- func (jb *JournalNvmBuffer) Write(buf []byte) (n int, err error)
- type JournalRecord
- type JournalRegion
- func (journal *JournalRegion) GcAllEntries(index *lumpindex.LumpIndex)
- func (journal *JournalRegion) GetEmbededData(embeded portion.JournalPortion) (buf []byte, err error)
- func (journal *JournalRegion) JournalEntries() (uint64, uint64, uint64, []JournalEntry)
- func (journal *JournalRegion) RecordDelete(index *lumpindex.LumpIndex, id lump.LumpId) error
- func (journal *JournalRegion) RecordDeleteRange(index *lumpindex.LumpIndex, start, end lump.LumpId) error
- func (journal *JournalRegion) RecordEmbed(index *lumpindex.LumpIndex, id lump.LumpId, data []byte) error
- func (journal *JournalRegion) RecordPut(index *lumpindex.LumpIndex, id lump.LumpId, data portion.DataPortion) error
- func (journal *JournalRegion) RestoreIndex(index *lumpindex.LumpIndex)
- func (journal *JournalRegion) RunSideJobOnce(index *lumpindex.LumpIndex)
- func (journal *JournalRegion) SetAutomaticGcMode(gc bool)
- func (journal *JournalRegion) Sync()
- func (Journal *JournalRegion) Usage() uint64
- type JournalRingBuffer
- func (ring *JournalRingBuffer) BufferedIter() BufferedIter
- func (ring *JournalRingBuffer) Capacity() uint64
- func (ring *JournalRingBuffer) DequeueIter() DequeueIter
- func (ring *JournalRingBuffer) DoStoreUsage()
- func (ring *JournalRingBuffer) Enqueue(record JournalRecord) (jportion portion.JournalPortion, err error)
- func (ring *JournalRingBuffer) Flush() error
- func (ring *JournalRingBuffer) Head() uint64
- func (ring *JournalRingBuffer) ReadEmbededBuffer(position uint64, data []byte) (err error)
- func (ring *JournalRingBuffer) ReadIter() ReadIter
- func (ring *JournalRingBuffer) ReleaseBytesUntil(head uint64)
- func (ring *JournalRingBuffer) Sync() error
- func (ring *JournalRingBuffer) Tail() uint64
- func (ring *JournalRingBuffer) Usage() uint64
- type PutRecord
- type ReadIter
- type SeekableReader
Constants ¶
View Source
const ( TAG_END_OF_RECORDS byte = 0 TAG_GO_TO_FRONT byte = 1 TAG_PUT byte = 3 TAG_EMBED byte = 4 TAG_DELETE byte = 5 TAG_DELETE_RANGE byte = 6 )
View Source
const ( RECORD_HEADER_SIZE = 1 + 4 // TAG size + Checksum size LUMPID_SIZE = 8 LENGTH_SIZE = 2 PORTION_SIZE = 5 END_OF_RECORDS_SIZE = 1 + 4 //Tag Size + Checksum size //GO_TO_FRONT and END_OF_RECORD EMBEDDED_DATA_OFFSET = RECORD_HEADER_SIZE + LUMPID_SIZE + LENGTH_SIZE )
View Source
const ( GC_COUNT_IN_SIDE_JOB = 64 //performance related GC_QUEUE_SIZE = 0x2000 SYNC_INTERVAL = 0x2000 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BufferedIter ¶
type BufferedIter struct {
// contains filtered or unexported fields
}
Use buffer and update tail
func (BufferedIter) Close ¶
func (iter BufferedIter) Close()
func (BufferedIter) PopFront ¶
func (iter BufferedIter) PopFront() (entry JournalEntry, err error)
Update the ring.tail
type DeleteRange ¶
func (DeleteRange) CheckSum ¶
func (record DeleteRange) CheckSum() uint32
func (DeleteRange) ExternalSize ¶
func (record DeleteRange) ExternalSize() uint32
func (DeleteRange) Tag ¶
func (record DeleteRange) Tag() byte
type DeleteRecord ¶
func (DeleteRecord) CheckSum ¶
func (record DeleteRecord) CheckSum() uint32
func (DeleteRecord) ExternalSize ¶
func (record DeleteRecord) ExternalSize() uint32
func (DeleteRecord) Tag ¶
func (record DeleteRecord) Tag() byte
type DequeueIter ¶
type DequeueIter struct {
// contains filtered or unexported fields
}
No buffer and update head
func (DequeueIter) PopFront ¶
func (iter DequeueIter) PopFront() (entry JournalEntry, err error)
type EmbedRecord ¶
func (EmbedRecord) CheckSum ¶
func (record EmbedRecord) CheckSum() uint32
func (EmbedRecord) ExternalSize ¶
func (record EmbedRecord) ExternalSize() uint32
func (EmbedRecord) Tag ¶
func (record EmbedRecord) Tag() byte
type EndOfRecords ¶
type EndOfRecords struct{}
func (EndOfRecords) CheckSum ¶
func (record EndOfRecords) CheckSum() uint32
func (EndOfRecords) ExternalSize ¶
func (record EndOfRecords) ExternalSize() uint32
func (EndOfRecords) Tag ¶
func (record EndOfRecords) Tag() byte
type JournalEntry ¶
type JournalEntry struct { Start address.Address Record JournalRecord }
func (JournalEntry) End ¶
func (entry JournalEntry) End() uint64
type JournalHeaderRegion ¶
type JournalHeaderRegion struct {
// contains filtered or unexported fields
}
func NewJournalHeadRegion ¶
func NewJournalHeadRegion(nvm nvm.NonVolatileMemory) *JournalHeaderRegion
func (*JournalHeaderRegion) ReadFrom ¶
func (headerRegion *JournalHeaderRegion) ReadFrom() (head uint64, err error)
func (*JournalHeaderRegion) WriteTo ¶
func (headerRegion *JournalHeaderRegion) WriteTo(head uint64) (err error)
type JournalNvmBuffer ¶
type JournalNvmBuffer struct {
// contains filtered or unexported fields
}
func NewJournalNvmBuffer ¶
func NewJournalNvmBuffer(nvm nvm.NonVolatileMemory) *JournalNvmBuffer
func (*JournalNvmBuffer) BlockSize ¶
func (jb *JournalNvmBuffer) BlockSize() block.BlockSize
func (*JournalNvmBuffer) Capacity ¶
func (jb *JournalNvmBuffer) Capacity() uint64
func (*JournalNvmBuffer) Close ¶
func (jb *JournalNvmBuffer) Close() error
func (*JournalNvmBuffer) Flush ¶
func (jb *JournalNvmBuffer) Flush() error
func (*JournalNvmBuffer) Position ¶
func (jb *JournalNvmBuffer) Position() uint64
func (*JournalNvmBuffer) RawSize ¶
func (jb *JournalNvmBuffer) RawSize() int64
func (*JournalNvmBuffer) Read ¶
func (jb *JournalNvmBuffer) Read(buf []byte) (n int, err error)
Direct Read
func (*JournalNvmBuffer) Seek ¶
func (jb *JournalNvmBuffer) Seek(offset int64, whence int) (int64, error)
func (*JournalNvmBuffer) Split ¶
func (jb *JournalNvmBuffer) Split(p uint64) (nvm.NonVolatileMemory, nvm.NonVolatileMemory, error)
func (*JournalNvmBuffer) Sync ¶
func (jb *JournalNvmBuffer) Sync() error
implement NonVolatileNVM interface
type JournalRecord ¶
type JournalRecord interface { WriteTo(io.Writer) error ExternalSize() uint32 CheckSum() uint32 Tag() byte }
func ReadRecordFrom ¶
func ReadRecordFrom(reader io.Reader) (JournalRecord, error)
All the io.Read() should be io.ReadExact(), which means in parser, we expect read up 10 bytes, It must return 10 bytes, no more no less.
type JournalRegion ¶
type JournalRegion struct {
// contains filtered or unexported fields
}
func OpenJournalRegion ¶
func OpenJournalRegion(nvm nvm.NonVolatileMemory) (*JournalRegion, error)
func (*JournalRegion) GcAllEntries ¶
func (journal *JournalRegion) GcAllEntries(index *lumpindex.LumpIndex)
maybe sync
func (*JournalRegion) GetEmbededData ¶
func (journal *JournalRegion) GetEmbededData(embeded portion.JournalPortion) (buf []byte, err error)
func (*JournalRegion) JournalEntries ¶
func (journal *JournalRegion) JournalEntries() (uint64, uint64, uint64, []JournalEntry)
func (*JournalRegion) RecordDelete ¶
func (*JournalRegion) RecordDeleteRange ¶
func (*JournalRegion) RecordEmbed ¶
func (journal *JournalRegion) RecordEmbed(index *lumpindex.LumpIndex, id lump.LumpId, data []byte) error
WARNING: this will update the INDEX
func (*JournalRegion) RecordPut ¶
func (journal *JournalRegion) RecordPut(index *lumpindex.LumpIndex, id lump.LumpId, data portion.DataPortion) error
Write Journal, Update Index
func (*JournalRegion) RestoreIndex ¶
func (journal *JournalRegion) RestoreIndex(index *lumpindex.LumpIndex)
func (*JournalRegion) RunSideJobOnce ¶
func (journal *JournalRegion) RunSideJobOnce(index *lumpindex.LumpIndex)
func (*JournalRegion) SetAutomaticGcMode ¶
func (journal *JournalRegion) SetAutomaticGcMode(gc bool)
func (*JournalRegion) Sync ¶
func (journal *JournalRegion) Sync()
type JournalRingBuffer ¶
type JournalRingBuffer struct {
// contains filtered or unexported fields
}
func NewJournalRingBuffer ¶
func NewJournalRingBuffer(nvm *JournalNvmBuffer, head uint64) *JournalRingBuffer
func (*JournalRingBuffer) BufferedIter ¶
func (ring *JournalRingBuffer) BufferedIter() BufferedIter
Use Buffer and update tail
func (*JournalRingBuffer) Capacity ¶
func (ring *JournalRingBuffer) Capacity() uint64
func (*JournalRingBuffer) DequeueIter ¶
func (ring *JournalRingBuffer) DequeueIter() DequeueIter
User Buffer and update head
func (*JournalRingBuffer) Enqueue ¶
func (ring *JournalRingBuffer) Enqueue(record JournalRecord) (jportion portion.JournalPortion, err error)
only return embeded JournalPortion
func (*JournalRingBuffer) Flush ¶
func (ring *JournalRingBuffer) Flush() error
func (*JournalRingBuffer) Head ¶
func (ring *JournalRingBuffer) Head() uint64
func (*JournalRingBuffer) ReadEmbededBuffer ¶
func (ring *JournalRingBuffer) ReadEmbededBuffer(position uint64, data []byte) (err error)
func (*JournalRingBuffer) ReadIter ¶
func (ring *JournalRingBuffer) ReadIter() ReadIter
No buffer and update nothing
func (*JournalRingBuffer) ReleaseBytesUntil ¶
func (ring *JournalRingBuffer) ReleaseBytesUntil(head uint64)
func (*JournalRingBuffer) Sync ¶
func (ring *JournalRingBuffer) Sync() error
func (*JournalRingBuffer) Tail ¶
func (ring *JournalRingBuffer) Tail() uint64
type PutRecord ¶
type PutRecord struct { LumpID lump.LumpId DataPortion portion.DataPortion }
func (PutRecord) ExternalSize ¶
Click to show internal directories.
Click to hide internal directories.