Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockFile ¶
type BlockFile interface { io.Closer // Alloc should allocate 'n' new sequential blocks and return the id of the // first block and slice pointer to the first block. Alloc(n int) (id int, slice []byte, err error) // Slice returns a slice of the memory mapped region starting at the block // with the given id. Alloc() calls may invalidate the returned slice. It // is caller's responsibility to co-ordinate Alloc() and Slice() calls. Slice(id int) ([]byte, error) // Info returns information about the block file state/configuration. Info() (name string, count, blockSz int, readOnly bool) }
BlockFile provides facilities for low-level paged I/O on memory mapped, random access files. BlockFile is NOT safe for concurrent use. BlockFile gives direct access to memory mapped region and incorrect usage can cause segfaults or unexpected behaviors.
type InMem ¶
type InMem struct {
// contains filtered or unexported fields
}
InMem implements an ephemeral BlockFile using in-memory byte slice. This implementation of BlockFile is meant for testing only.
type OnDisk ¶
type OnDisk struct {
// contains filtered or unexported fields
}
OnDisk implements a memory mapped BlockFile using an on-disk file.
func (*OnDisk) Alloc ¶
Alloc will allocate 'n' sequential blocks and return the first id and slice to the first block.
Click to show internal directories.
Click to hide internal directories.