You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/tutorial.rst
+55-54
Original file line number
Diff line number
Diff line change
@@ -8,13 +8,14 @@ This text briefly introduces you to the basic design decisions and accompanying
8
8
Design
9
9
======
10
10
Per application, there must be a *MemoryManager* to be used throughout the application.
11
-
It can be configured to keep your resources within certain limits.
11
+
It can be configured to keep your resources within certain limits (see :func:`smmap.managed_mmaps()`).
12
12
13
-
To access mapped regions, you require a cursor. Cursors point to exactly one file and serve as handles into it.
13
+
To access mapped regions, you require a cursor. Cursors point to exactly one file
14
+
and serve as handles into it.
14
15
As long as it exists, the respective memory region will remain available.
15
16
16
-
For convenience, a buffer implementation is provided which handles cursors and resource allocation
17
-
behind its simple buffer like interface.
17
+
For convenience, a buffer implementation is provided (:class:`smmap.SlidingWindowMapBuffer`)
18
+
which handles cursors and resource allocation behind its simple buffer like interface.
18
19
19
20
20
21
Memory Managers
@@ -56,50 +57,48 @@ Cursors
56
57
========
57
58
*Cursors* are handles that point onto a window, i.e. a region of a file mapped into memory. From them you may obtain a buffer through which the data of that window can actually be accessed::
58
59
59
-
import smmap.test.lib
60
-
61
-
with smmap.managed_mmaps() as mman:
62
-
fc = smmap.test.lib.FileCreator(1024*1024*8, "test_file")
60
+
import smmap.test.lib as tlib
63
61
62
+
with smmap.managed_mmaps() as mman, tlib.FileCreator(1024*1024*8, "test_file") as fc:
64
63
# obtain a cursor to access some file.
65
-
c = mman.make_cursor(fc.path)
66
-
67
-
# the cursor is now associated with the file, but not yet usable
68
-
assert c.is_associated()
69
-
assert not c.is_valid()
70
-
71
-
# before you can use the cursor, you have to specify a window you want to
72
-
# access. The following just says you want as much data as possible starting
73
-
# from offset 0.
74
-
# To be sure your region could be mapped, query for validity
0 commit comments