Documentation ¶
Index ¶
- Variables
- func Madvise(b []byte, readahead bool) error
- func Mmap(fd *os.File, writable bool, size int64) ([]byte, error)
- func Msync(b []byte) error
- func Munmap(b []byte) error
- func SyncDir(dir string) error
- type MmapFile
- func (m *MmapFile) AllocateSlice(sz, offset int) ([]byte, int, error)
- func (m *MmapFile) Bytes(off, sz int) ([]byte, error)
- func (m *MmapFile) Close(maxSz int64) error
- func (m *MmapFile) Delete() error
- func (m *MmapFile) NewReader(offset int) io.Reader
- func (m *MmapFile) Slice(offset int) []byte
- func (m *MmapFile) Sync() error
- func (m *MmapFile) Truncate(maxSz int64) error
- type Source
Constants ¶
This section is empty.
Variables ¶
var NewFile = errors.New("Create a new file")
Functions ¶
func Madvise ¶
Madvise uses the madvise system call to give advise about the use of memory when using a slice that is memory-mapped to a file. Set the readahead flag to false if page references are expected in random order.
Types ¶
type MmapFile ¶
MmapFile represents an mmapd file and includes both the buffer to the data and the file descriptor.
func OpenMmapFile ¶
OpenMmapFile opens an existing file or creates a new file. If the file is created, it would truncate the file to maxSz. In both cases, it would mmap the file to maxSz and returned it. In case the file is created, z.NewFile is returned.
func OpenMmapFileUsing ¶
func (*MmapFile) AllocateSlice ¶
AllocateSlice allocates a slice of the given size at the given offset.
func (*MmapFile) Bytes ¶
Bytes returns data starting from offset off of size sz. If there's not enough data, it would return nil slice and io.EOF.