Documentation ¶
Index ¶
- Constants
- Variables
- type DataRegion
- func (region *DataRegion) Get(dataPortion portion.DataPortion) (lump.LumpData, error)
- func (region *DataRegion) GetSize(dataPortion portion.DataPortion) (size uint32, err error)
- func (region *DataRegion) GetWithOffset(dataPortion portion.DataPortion, startOffset uint32, length uint32) ([]byte, error)
- func (region *DataRegion) Put(data lump.LumpData) (portion.DataPortion, error)
- func (region *DataRegion) Release(portion portion.DataPortion)
- func (region *DataRegion) Update(dataPortion portion.DataPortion, startOffset uint32, payload []byte) error
- type JournalSnapshot
- type Storage
- func (store *Storage) Close()
- func (store *Storage) CreateSnapshot() error
- func (store *Storage) Delete(lumpid lump.LumpId) (updated bool, size uint32, err error)
- func (store *Storage) DeleteSnapshot() error
- func (store *Storage) GenerateEmptyId() (id lump.LumpId, have bool)
- func (store *Storage) Get(lumpid lump.LumpId) ([]byte, error)
- func (store *Storage) GetAllocationStatus() []float64
- func (store *Storage) GetSize(lumpid lump.LumpId) (size uint32, err error)
- func (store *Storage) GetSizeOnDisk(lumpid lump.LumpId) (size uint32, err error)
- func (store *Storage) GetSnapshotReader() (*nvm.SnapshotReader, error)
- func (store *Storage) GetWithOffset(lumpId lump.LumpId, startOffset uint32, length uint32) ([]byte, error)
- func (store *Storage) Header() nvm.StorageHeader
- func (store *Storage) JournalGC()
- func (store *Storage) JournalSnapshot() JournalSnapshot
- func (store *Storage) JournalSync()
- func (store *Storage) List() []lump.LumpId
- func (store *Storage) ListRange(start, end lump.LumpId) []lump.LumpId
- func (store *Storage) MaxId() (lump.LumpId, bool)
- func (store *Storage) MinId() (lump.LumpId, bool)
- func (store *Storage) Put(lumpid lump.LumpId, lumpdata lump.LumpData) (updated bool, err error)
- func (store *Storage) PutEmbed(lumpid lump.LumpId, data []byte) (updated bool, err error)
- func (store *Storage) PutWithOffset(lumpid lump.LumpId, lumpdata lump.LumpData, startOffset uint32, ...) (err error)
- func (store *Storage) RunSideJobOnce()
- func (store *Storage) SetAutomaticGcMode(gc bool)
- func (store *Storage) Usage() StorageUsage
- type StorageUsage
Constants ¶
const ( MAJOR_VERSION uint16 = 1 MINOR_VERSION uint16 = 1 MAX_JOURNAL_REGION_SIZE uint64 = (1 << 40) - 1 MAX_DATA_REGION_SIZE uint64 = MAX_JOURNAL_REGION_SIZE * uint64(block.MIN) )
const (
LUMP_DATA_TRAILER_SIZE = 2
)
Variables ¶
var (
MAGIC_NUMBER = [4]byte{'l', 'u', 's', 'f'}
)
Functions ¶
This section is empty.
Types ¶
type DataRegion ¶
type DataRegion struct {
// contains filtered or unexported fields
}
func NewDataRegion ¶
func NewDataRegion(alloc allocator.DataPortionAlloc, nvm nvm.NonVolatileMemory) *DataRegion
func (*DataRegion) Get ¶
func (region *DataRegion) Get(dataPortion portion.DataPortion) (lump.LumpData, error)
func (*DataRegion) GetSize ¶
func (region *DataRegion) GetSize(dataPortion portion.DataPortion) (size uint32, err error)
func (*DataRegion) GetWithOffset ¶
func (region *DataRegion) GetWithOffset(dataPortion portion.DataPortion, startOffset uint32, length uint32) ([]byte, error)
more friendly data portion read. only read up user required data. the returned bytes could be less than length
func (*DataRegion) Put ¶
func (region *DataRegion) Put(data lump.LumpData) (portion.DataPortion, error)
WARNING: this PUT would CHANGE (data *lump.LumpData),
func (*DataRegion) Release ¶
func (region *DataRegion) Release(portion portion.DataPortion)
func (*DataRegion) Update ¶
func (region *DataRegion) Update(dataPortion portion.DataPortion, startOffset uint32, payload []byte) error
type JournalSnapshot ¶
type JournalSnapshot struct { UnreleasedHead uint64 Head uint64 Tail uint64 Entries []journal.JournalEntry }
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func CreateCannylsStorage ¶
func OpenCannylsStorage ¶
func (*Storage) CreateSnapshot ¶ added in v0.2.0
func (*Storage) DeleteSnapshot ¶ added in v0.2.0
func (*Storage) GenerateEmptyId ¶
func (*Storage) GetAllocationStatus ¶
return value: len([]float) no more than 12800 points, each point is 4MB
func (*Storage) GetSizeOnDisk ¶
Note the returned size is not accurate size of object, but aligned to block size. For accurate object size, use GetSize, which requires a disk IO.
func (*Storage) GetSnapshotReader ¶ added in v0.2.0
func (store *Storage) GetSnapshotReader() (*nvm.SnapshotReader, error)
func (*Storage) GetWithOffset ¶
func (*Storage) Header ¶
func (store *Storage) Header() nvm.StorageHeader
func (*Storage) JournalSnapshot ¶
func (store *Storage) JournalSnapshot() JournalSnapshot
func (*Storage) JournalSync ¶
func (store *Storage) JournalSync()
func (*Storage) PutWithOffset ¶
func (store *Storage) PutWithOffset(lumpid lump.LumpId, lumpdata lump.LumpData, startOffset uint32, reservation uint32) (err error)
Put object with offset and space reservation. For object creation, object size is max(reservation, startOffset + len(lumpdata)); for object update, `reservation` is ignored since space is already allocated, and return error when write offset exceeds reserved object size. Untouched space are zeroed.
func (*Storage) RunSideJobOnce ¶
func (store *Storage) RunSideJobOnce()
func (*Storage) SetAutomaticGcMode ¶
func (*Storage) Usage ¶
func (store *Storage) Usage() StorageUsage