Documentation
¶
Index ¶
- type BlockAllocator
- type BlockFile
- func (bf *BlockFile) AccessBlock(tag interface{}, index BlockIndex, accessFunc func(data []byte) (bool, error)) error
- func (bf *BlockFile) AccessBlockMeta(index BlockIndex, accessFunc func(meta []byte) (bool, error)) error
- func (bf *BlockFile) Allocate(tag interface{}) (BlockIndex, error)
- func (bf *BlockFile) Close() error
- func (bf *BlockFile) FlushBlock(ikey interface{}, tag interface{}, buf []byte) (interface{}, error)
- func (bf *BlockFile) Free(index BlockIndex) error
- func (bf *BlockFile) GetBlockSize() int
- func (bf *BlockFile) GetCache() *blockcache.BlockCache
- func (bf *BlockFile) GetMetaDataSize() int
- func (bf *BlockFile) GetNumBlocks() (BlockIndex, error)
- func (bf *BlockFile) Init()
- func (bf *BlockFile) IsBlockReadOnly(index BlockIndex) bool
- func (bf *BlockFile) Open(path string, perm os.FileMode) error
- func (bf *BlockFile) Read(index BlockIndex, buf []byte) ([]byte, error)
- func (bf *BlockFile) ReadAt(index BlockIndex, off, sz int, buf []byte) ([]byte, error)
- func (bf *BlockFile) SyncTag(tag interface{}) error
- func (bf *BlockFile) Write(tag interface{}, index BlockIndex, buf []byte) error
- func (bf *BlockFile) WriteAt(tag interface{}, index BlockIndex, off int, buf []byte) error
- type BlockIndex
- type BlockOverlayAllocator
- func (bf *BlockOverlayAllocator) AccessBlock(tag interface{}, index BlockIndex, ...) error
- func (bf *BlockOverlayAllocator) AccessBlockMeta(index BlockIndex, accessFunc func(meta []byte) (modified bool, err error)) error
- func (bf *BlockOverlayAllocator) Allocate(tag interface{}) (BlockIndex, error)
- func (bf *BlockOverlayAllocator) Close() error
- func (bf *BlockOverlayAllocator) Free(index BlockIndex) error
- func (bf *BlockOverlayAllocator) GetBlockSize() int
- func (bf *BlockOverlayAllocator) GetCache() *blockcache.BlockCache
- func (bf *BlockOverlayAllocator) GetMetaDataSize() int
- func (bf *BlockOverlayAllocator) GetNumBlocks() (BlockIndex, error)
- func (bf *BlockOverlayAllocator) Init(roAllocator, wrAllocator BlockAllocator) error
- func (bf *BlockOverlayAllocator) IsBlockReadOnly(index BlockIndex) bool
- func (bf *BlockOverlayAllocator) Read(index BlockIndex, buf []byte) ([]byte, error)
- func (bf *BlockOverlayAllocator) ReadAt(index BlockIndex, off, sz int, buf []byte) ([]byte, error)
- func (bf *BlockOverlayAllocator) SyncTag(tag interface{}) error
- func (bf *BlockOverlayAllocator) Write(tag interface{}, index BlockIndex, buf []byte) error
- func (bf *BlockOverlayAllocator) WriteAt(tag interface{}, index BlockIndex, off int, buf []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockAllocator ¶
type BlockAllocator interface {
GetBlockSize() int
GetMetaDataSize() int
GetNumBlocks() (BlockIndex, error)
GetCache() *blockcache.BlockCache
Close() error
Allocate(tag interface{}) (BlockIndex, error)
Free(index BlockIndex) error
Read(index BlockIndex, buf []byte) ([]byte, error)
ReadAt(index BlockIndex, off, sz int, buf []byte) ([]byte, error)
Write(tag interface{}, index BlockIndex, buf []byte) error
WriteAt(tag interface{}, index BlockIndex, off int, buf []byte) error
SyncTag(tag interface{}) error
AccessBlock(tag interface{}, index BlockIndex, accessFunc func(data []byte) (modified bool, err error)) error
AccessBlockMeta(index BlockIndex, accessFunc func(meta []byte) (modified bool, err error)) error
IsBlockReadOnly(index BlockIndex) bool
}
type BlockFile ¶
type BlockFile struct {
MetaDataSize int
Cache *blockcache.BlockCache
File *os.File
// Number of blocks to "pre-allocate" upon initialization. These blocks will
// be numbered 1, 2, ..., `PreAllocatedBlocks`. Note that 0 is always a
// special block used internally and should never be used.
PreAllocatedBlocks BlockIndex
// contains filtered or unexported fields
}
func (*BlockFile) AccessBlock ¶
func (*BlockFile) AccessBlockMeta ¶
func (*BlockFile) Allocate ¶
func (bf *BlockFile) Allocate(tag interface{}) (BlockIndex, error)
Allocate a new block and returns the index. The index is a positive int64 that will never exceed the maximum number of simultaneously allocated blocks.
func (*BlockFile) FlushBlock ¶
func (*BlockFile) Free ¶
func (bf *BlockFile) Free(index BlockIndex) error
Free a block and allow it to be allocated in the future.
func (*BlockFile) GetBlockSize ¶
func (*BlockFile) GetCache ¶
func (bf *BlockFile) GetCache() *blockcache.BlockCache
func (*BlockFile) GetMetaDataSize ¶
func (*BlockFile) GetNumBlocks ¶
func (bf *BlockFile) GetNumBlocks() (BlockIndex, error)
func (*BlockFile) IsBlockReadOnly ¶
func (bf *BlockFile) IsBlockReadOnly(index BlockIndex) bool
func (*BlockFile) Open ¶
Opens the passed blockfile, creating it if necessary using `perm` permissions.
func (*BlockFile) Read ¶
func (bf *BlockFile) Read(index BlockIndex, buf []byte) ([]byte, error)
Read an entire block into the passed buffer. If the buffer is not large enough (or nil) a new array will be allocated and returned.
func (*BlockFile) ReadAt ¶
Read part of a block into the passed buffer. If the buffer is not large enough (or nil) a new array will be allocated and returned.
type BlockIndex ¶
type BlockIndex = int64
func Duplicate ¶
func Duplicate(tag interface{}, bf BlockAllocator, index BlockIndex, onlyIfReadOnly bool) (BlockIndex, error)
type BlockOverlayAllocator ¶
type BlockOverlayAllocator struct {
// contains filtered or unexported fields
}
func (*BlockOverlayAllocator) AccessBlock ¶
func (bf *BlockOverlayAllocator) AccessBlock(tag interface{}, index BlockIndex, accessFunc func(data []byte) (modified bool, err error)) error
func (*BlockOverlayAllocator) AccessBlockMeta ¶
func (bf *BlockOverlayAllocator) AccessBlockMeta(index BlockIndex, accessFunc func(meta []byte) (modified bool, err error)) error
func (*BlockOverlayAllocator) Allocate ¶
func (bf *BlockOverlayAllocator) Allocate(tag interface{}) (BlockIndex, error)
func (*BlockOverlayAllocator) Close ¶
func (bf *BlockOverlayAllocator) Close() error
func (*BlockOverlayAllocator) Free ¶
func (bf *BlockOverlayAllocator) Free(index BlockIndex) error
func (*BlockOverlayAllocator) GetBlockSize ¶
func (bf *BlockOverlayAllocator) GetBlockSize() int
func (*BlockOverlayAllocator) GetCache ¶
func (bf *BlockOverlayAllocator) GetCache() *blockcache.BlockCache
func (*BlockOverlayAllocator) GetMetaDataSize ¶
func (bf *BlockOverlayAllocator) GetMetaDataSize() int
func (*BlockOverlayAllocator) GetNumBlocks ¶
func (bf *BlockOverlayAllocator) GetNumBlocks() (BlockIndex, error)
func (*BlockOverlayAllocator) Init ¶
func (bf *BlockOverlayAllocator) Init(roAllocator, wrAllocator BlockAllocator) error
func (*BlockOverlayAllocator) IsBlockReadOnly ¶
func (bf *BlockOverlayAllocator) IsBlockReadOnly(index BlockIndex) bool
func (*BlockOverlayAllocator) Read ¶
func (bf *BlockOverlayAllocator) Read(index BlockIndex, buf []byte) ([]byte, error)
func (*BlockOverlayAllocator) ReadAt ¶
func (bf *BlockOverlayAllocator) ReadAt(index BlockIndex, off, sz int, buf []byte) ([]byte, error)
func (*BlockOverlayAllocator) SyncTag ¶
func (bf *BlockOverlayAllocator) SyncTag(tag interface{}) error
func (*BlockOverlayAllocator) Write ¶
func (bf *BlockOverlayAllocator) Write(tag interface{}, index BlockIndex, buf []byte) error
func (*BlockOverlayAllocator) WriteAt ¶
func (bf *BlockOverlayAllocator) WriteAt(tag interface{}, index BlockIndex, off int, buf []byte) error
Click to show internal directories.
Click to hide internal directories.