storage

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMFile

func CreateMFile(path string, size uint64) error

Types

type MFile

type MFile struct {
	// contains filtered or unexported fields
}

func CreateOrOpenMFile

func CreateOrOpenMFile(path string, size uint64, blkSize uint64) (*MFile, error)

func OpenMFile

func OpenMFile(path string, blkSize uint64) (*MFile, error)

func (*MFile) Close

func (m *MFile) Close() error

func (*MFile) Flush

func (m *MFile) Flush() error

func (*MFile) GetBlock

func (m *MFile) GetBlock(n uint64) []byte

GetBlock returns the n-th block as a byte slice, including any trailing zero padding. The returned bytes are from the underlying mmap'd buffer and will be invalid after a call to Close().

func (*MFile) NumBlocks

func (m *MFile) NumBlocks() uint64

NumBlocks returns the total capacity of the file in blocks.

func (*MFile) WriteBlock

func (m *MFile) WriteBlock(n uint64, data []byte) error

WriteBlock writes data to the n-th block in the file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL