Merge lp:~jderose/filestore/docs-update into lp:filestore

Proposed by Jason Gerard DeRose
Status: Merged
Merged at revision: 231
Proposed branch: lp:~jderose/filestore/docs-update
Merge into: lp:filestore
Diff against target: 194 lines (+96/-13)
2 files modified
doc/conf.py (+1/-1)
doc/filestore.rst (+95/-12)
To merge this branch: bzr merge lp:~jderose/filestore/docs-update
Reviewer Review Type Date Requested Status
dmedia Dev Pending
Review via email: mp+84924@code.launchpad.net

Description of the change

Updates the docs in a few places where they no longer reflected the current API.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'doc/conf.py'
--- doc/conf.py 2011-11-09 00:46:01 +0000
+++ doc/conf.py 2011-12-08 11:35:30 +0000
@@ -48,7 +48,7 @@
48# built documents.48# built documents.
49#49#
50# The short X.Y version.50# The short X.Y version.
51version = '11.11'51version = '11.12'
52# The full version, including alpha/beta/rc tags.52# The full version, including alpha/beta/rc tags.
53release = version53release = version
5454
5555
=== modified file 'doc/filestore.rst'
--- doc/filestore.rst 2011-09-22 10:42:13 +0000
+++ doc/filestore.rst 2011-12-08 11:35:30 +0000
@@ -99,7 +99,7 @@
99 A ``bytes`` instance containing the concatenated leaf-hashes99 A ``bytes`` instance containing the concatenated leaf-hashes
100100
101101
102.. class:: Stat(id, size, mtime)102.. class:: Stat(id, name, size, mtime)
103103
104 Returned by :meth:`FileStore.stat()`, yielded by :meth:`FileStore.__iter__()`.104 Returned by :meth:`FileStore.stat()`, yielded by :meth:`FileStore.__iter__()`.
105105
@@ -107,6 +107,10 @@
107107
108 The dmedia file ID108 The dmedia file ID
109109
110 .. attribute:: name
111
112 The absolute path of the file as returned by :meth:`FileStore.path()`
113
110 .. attribute:: size114 .. attribute:: size
111115
112 The file-size in bytes as reported by the file-system116 The file-size in bytes as reported by the file-system
@@ -135,7 +139,7 @@
135139
136.. class:: Batch(files, size, count)140.. class:: Batch(files, size, count)
137141
138 Returned by :func:`scandir()`.142 Returned by :func:`scandir()`, argument for :func:`batch_import_iter()`.
139143
140 .. attribute:: files144 .. attribute:: files
141145
@@ -164,16 +168,12 @@
164 A ``bytes`` instance with the leaf content168 A ``bytes`` instance with the leaf content
165169
166170
167.. class:: StatVFS(avail, size, used)171.. class:: StatVFS(size, used, avail, readonly, frsize)
168172
169 Returned by :meth:`FileStore.statvfs()`.173 Returned by :func:`statvfs()` and :meth:`FileStore.statvfs()`.
170174
171 All sizes are in bytes:175 All sizes are in bytes:
172176
173 .. attribute:: avail
174
175 Free space available to non-privileged users
176
177 .. attribute:: size177 .. attribute:: size
178178
179 Total file-system size179 Total file-system size
@@ -182,6 +182,20 @@
182182
183 Space consumed by existing files on file-system183 Space consumed by existing files on file-system
184184
185 .. attribute:: avail
186
187 Free space available to non-privileged users
188
189 .. attribute:: readonly
190
191 ``True`` if filesystem is mounted read-only
192
193 .. attribute:: frsize
194
195 Block-size from ``os.statvfs()``, useful for deciding if an import batch
196 will fit in a given :class:`FileStore`
197
198
185199
186200
187Exceptions201Exceptions
@@ -512,7 +526,7 @@
512 Read leaves from all files in *batch* and put them into the *queue*.526 Read leaves from all files in *batch* and put them into the *queue*.
513527
514528
515.. function:: batch_import_iter(batch, *filestores)529.. function:: batch_import_iter(batch, *filestores, callback=None)
516530
517 Import the files in *batch* into one or more destination *filestores*.531 Import the files in *batch* into one or more destination *filestores*.
518532
@@ -546,19 +560,86 @@
546 code in dmedia. However, the empty file does not get copied into the target560 code in dmedia. However, the empty file does not get copied into the target
547 *filestores*.561 *filestores*.
548562
563 If you supply the *callback* keyword argument, it must be a callable that
564 takes two arguments, like this:
565
566 >>> def progress(count, size):
567 ... print(count, size)
568
569 Where *count* is the number of files that have been completely imported, and
570 *size* is total bytes thus far imported.
571
572 The callback is called at the end of processing each file, plus whenever the
573 next 128 MiB (16 leaves) have been completed and at least one more leaf
574 remains.
575
576 For example, say you have a batch with one file and the file is exactly 33
577 leaves in size (264 MiB). The callback would be called 3 times, like this:
578
579 >>> MiB = 1024 * 1024
580 >>> progress(0, 128 * MiB)
581 0 134217728
582 >>> progress(0, 256 * MiB)
583 0 268435456
584 >>> progress(1, 264 * MiB)
585 1 276824064
586
587
588
589Misc functions
590--------------
591
592
593.. function:: ensuredir(dirname)
594
595 Ensure that *dirname* exists, is a directory, and is not a symlink.
596
597 This function is used by :meth:`FileStore.init_dirs()`.
598
599
600.. function:: statvfs(pathname)
601
602 Return usage information for filesystem containing *pathname*.
603
604 This takes the information from ``os.statvfs()`` and presents it in a
605 slightly higher-level way more fitting for filestore and Dmedia. A
606 :class:`StatVFS` namedtuple is returned with the following attributes:
607
608 * size - the filesystem size in bytes
609 * used - space in bytes consumed by existing files
610 * avail - space in bytes available to non-privileged users
611 * readonly - ``True`` if filesystem is mounted read-only
612 * frsize - filesystem block size
613
614 This function is used by :meth:`FileStore.statvfs()`.
615
549616
550617
551The :class:`FileStore` class618The :class:`FileStore` class
552----------------------------619----------------------------
553620
554621
555.. class:: FileStore(parentdir)622.. class:: FileStore(parentdir, _id=None, copies=0)
556623
557 Arranges files in a special layout according to their content-hash.624 Arranges files in a special layout according to their content-hash.
558625
559 .. attribute:: parentdir626 .. attribute:: parentdir
560627
561 The parent directory provided when this instance was created.628 The parent directory provided when instance was created.
629
630 .. attribute:: id
631
632 ID of file-store provided when instance was created.
633
634 This can be used by higher-level code like Dmedia, but is ignored by the
635 :class:`FileStore` itself.
636
637 .. attribute:: copies
638
639 Durability of file-store as provided when instance was created.
640
641 This can be used by higher-level code like Dmedia, but is ignored by the
642 :class:`FileStore` itself.
562643
563 .. attribute:: basedir644 .. attribute:: basedir
564645
@@ -585,7 +666,9 @@
585666
586 >>> fs = FileStore('/home/jderose') #doctest: +SKIP667 >>> fs = FileStore('/home/jderose') #doctest: +SKIP
587 >>> fs.statvfs() #doctest: +SKIP668 >>> fs.statvfs() #doctest: +SKIP
588 StatVFS(avail=1791768784896, size=1936526733312, used=46388051968)669 StatVFS(size=1965511450624, used=812883484672, avail=1054258069504, readonly=False, frsize=4096)
670
671 This method uses the :func:`statvfs()` function.
589672
590673
591 .. method:: catch_traversal(untrusted)674 .. method:: catch_traversal(untrusted)

Subscribers

People subscribed via source and target branches