Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseFunc ¶
CloseFunc defines the way to release underlying bytes. This makes it easy to use normal non-mmapped bytes for test.
type Factory ¶
type Factory interface { io.Closer // AcquirePage acquires a mapped page with specific index from the factory AcquirePage(index int64) (MappedPage, error) // GetPage returns a mapped page with specific index GetPage(index int64) (MappedPage, bool) // TruncatePages truncates expired page by index(page id). TruncatePages(index int64) // Size returns the total page size Size() int64 }
Factory represents mapped page manage factory
type MappedPage ¶
type MappedPage interface { // FilePath returns mapped filePath FilePath() string // WriteBytes writes bytes data into buffer WriteBytes(data []byte, offset int) // ReadBytes reads bytes data from buffer ReadBytes(offset, length int) []byte // PutUint64 puts uint64 into buffer PutUint64(value uint64, offset int) // ReadUint64 reads uint64 from buffer ReadUint64(offset int) uint64 // PutUint32 puts uint32 into buffer PutUint32(value uint32, offset int) // ReadUint32 reads uint32 from buffer ReadUint32(offset int) uint32 // PutUint8 puts uint8 into buffer PutUint8(value uint8, offset int) // ReadUint8 reads uint8 from buffer ReadUint8(offset int) uint8 // Sync syncs page to persist storage Sync() error // Close releases underlying bytes Close() error // Closed returns if the mmap bytes is closed Closed() bool // Size returns the size of underlying bytes Size() int }
MappedPage represents a holder for mmap bytes, one MappedPage corresponds to a mapped file.
func NewMappedPage ¶
func NewMappedPage(fileName string, size int) (MappedPage, error)
NewMappedPage returns a new MappedPage wrapping the give bytes.
Click to show internal directories.
Click to hide internal directories.