forked from portalgun-io/mmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
26 lines (20 loc) · 1.08 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
Package mmap provides an interface to memory mapped files.
Memory maps can be opened as read-only with Read or read-write with Write.
To specify additional flags and a file mode use Open.
There are two different ways to work with memory maps.
They cannot be used simultaneously.
Creating a Direct accessor will fail if any Readers or Writers are open.
Creating Reader or Writer will fail if any Direct accessors are open.
The first is through direct access via a Direct, which is a pointer to a byte slice.
This lets you write directly to the mapped memory, but you will need to manage access
between go routines.
The second is through Readers and Writers.
These implement the standard interfaces from the io package and can be treated like files
while still benefitting from the improved performance of memory mapping.
You can have multiple Readers and Writers.
The map will ensure that writes don't conflict with reads. That is, the underlying map
won't change during the middle of a read.
When the map is resized via Truncate, all open Direct, Reader, and Writer objects are closed.
*/
package mmap