Documentation
¶
Overview ¶
Package mmap provides a way to memory-map a file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReaderAt ¶
type ReaderAt struct {
// contains filtered or unexported fields
}
ReaderAt reads a memory-mapped file.
Like any io.ReaderAt, clients can execute parallel ReadAt calls, but it is not safe to call Close and reading methods concurrently.
func Open ¶
Open opens the named file with one metadata read. Close releases its mapping and descriptor.
func OpenWithInfo ¶ added in v0.2.3
OpenWithInfo opens the named file using metadata already collected by the caller. The caller keeps the file stable while it is read. A nil info obtains metadata from the opened descriptor.
func (*ReaderAt) Close ¶
Close releases the mapping and then the descriptor it was created from. It is idempotent: a second call releases nothing, and an empty mapping still closes the descriptor it retains.
func (*ReaderAt) File ¶ added in v0.2.1
File returns the descriptor the mapping was created from, or nil once the reader is closed. The reader owns that descriptor for its whole lifecycle: Close removes the mapping and then closes it, so a caller that still needs the descriptor keeps the reader open until it is done. It must also keep the reader reachable, because the finalizer closes the descriptor once the reader is unreachable, and holding only the returned *os.File does not keep the reader alive.