gommap

package
Version: v0.0.0-...-e2d1e16 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2015 License: BSD-2-Clause, MIT, BSD-3-Clause Imports: 5 Imported by: 0

README

This work is based on mmap-go (BSD-style license) written by Evan Shaw.

Documentation

Overview

Package gommap allows mapping files into memory. It tries to provide a simple, reasonably portable interface, but doesn't go out of its way to abstract away every little platform detail. This specifically means:

* forked processes may or may not inherit mappings
* a file's timestamp may or may not be updated by writes through mappings
* specifying a size larger than the file's actual size can increase the file's size
* If the mapped file is being modified by another process while your program's running, don't expect consistent results between platforms

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MMap

type MMap []byte

MMap represents a file mapped into memory.

func Map

func Map(f *os.File) (MMap, error)

Map maps an entire file into memory. Note that because of runtime limitations, no file larger than about 2GB can be completely mapped into memory.

func (*MMap) Sync

func (m *MMap) Sync() error

Sync changes in memory to file

func (*MMap) Unmap

func (m *MMap) Unmap() error

Unmap deletes the memory mapped region, flushes any remaining changes, and sets m to nil. Trying to read or write any remaining references to m after Unmap is called will result in undefined behavior. Unmap should only be called on the slice value that was originally returned from a call to Map. Calling Unmap on a derived slice may cause errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL