mmap

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2015 License: MIT Imports: 4 Imported by: 0

README

mmap

GoDoc

Package mmap provides a simplified interface to using mmap on linux/unix systems.

Documentation

Overview

Package mmap provides a simplified interface to using mmap on linux/unix systems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mmap

type Mmap struct {
	// The underlying file handle. It will be cleaned up with Close().
	File *os.File

	// The byte array of the mmaped file.
	Buf []byte
}

Mmap represents a single mapped file. It uses mmap to store the data. Sync() and Close() should be used to ensure data integrity. Since the actual byte array is available, no locking is done at this level.

func New

func New(name string, perms os.FileMode, flags int, size int64, private bool) (*Mmap, error)

New maps a new file. If size > 0, then the file is increased to the given size if it is not already at least that size. The flags and perms are passed when opening the file and determine how the mmap will be opened. If private it true, then the map will be private.

func (*Mmap) Close

func (m *Mmap) Close() error

Close closes the associated mmap and file handles for this mmap. It should not be used after this.

func (*Mmap) Sync

func (m *Mmap) Sync() error

Sync ensures that any unwritten changes to the buffer are written to disk. It will block until completed or an error occurs.

Jump to

Keyboard shortcuts

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