Asyncfs
asyncfs
Async byte access for omfiles: HTTP pages with memory and disk caches, or a mirror.
omfiles reads an archive file through an fsspec-like object exposing
_cat_file/_size. Its reads are tiny and many, so :class:PagedAsyncFS
serves them from aligned pages (one download per page, shared by concurrent
readers), kept in memory and, for files that no longer change, on disk
(:class:DiskPages). :class:LocalAsyncFS reads a local mirror directly.
DiskPages
dataclass
Where :class:PagedAsyncFS keeps the pages of immutable files.
Source code in packages/barograph-met/src/baro/met/asyncfs.py
at(cache, location, cacheable)
classmethod
Pages of the files under location (a URL) whose path passes cacheable.
Source code in packages/barograph-met/src/baro/met/asyncfs.py
LocalAsyncFS
The same interface over a local mirror directory.
Source code in packages/barograph-met/src/baro/met/asyncfs.py
PagedAsyncFS
Async fsspec-like object for omfiles (_cat_file/_size), with a page cache.
omfiles issues one range request per internal data chunk, and archive
chunks are tiny (1 latitude row x 14 longitudes, a few hundred bytes).
Requests are therefore served from aligned pages of page_size bytes
(a page holds several whole latitude rows); concurrent requests for the
same page share one download. This trades a few extra bytes for ~50x fewer
round trips, which dominate the cost.
Files for which immutable(path) is false may be rewritten upstream:
their version (size and ETag) is re-checked after :data:REVALIDATE_S
seconds and pages are keyed by it, so a read never mixes two versions.
Source code in packages/barograph-met/src/baro/met/asyncfs.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |