source:
trunk/src/allmydata/storage/shares.py
| Last change on this file was 1cfe843d, checked in by Alexandre Detiste <alexandre.detiste@…>, at 2024-02-22T23:40:25Z | |
|---|---|
|
|
| File size: 389 bytes | |
| Line | |
|---|---|
| 1 | """ |
| 2 | Ported to Python 3. |
| 3 | """ |
| 4 | |
| 5 | from allmydata.storage.mutable import MutableShareFile |
| 6 | from allmydata.storage.immutable import ShareFile |
| 7 | |
| 8 | def get_share_file(filename): |
| 9 | with open(filename, "rb") as f: |
| 10 | prefix = f.read(32) |
| 11 | if MutableShareFile.is_valid_header(prefix): |
| 12 | return MutableShareFile(filename) |
| 13 | # otherwise assume it's immutable |
| 14 | return ShareFile(filename) |
Note: See TracBrowser
for help on using the repository browser.
