@@ -177,6 +177,94 @@ Any configuration parameters for the write strategy must not be part of the meta
177177they need to be configured at runtime, as this is implementation specific.
178178
179179
180+ API implementation
181+ ------------------
182+
183+ The section below defines an implementation of the
184+ :ref: `abstract-store-interface ` in terms of the operations of this
185+ storage transformer as a ``StoreWithPartialAccess ``.
186+ The term `underlying store ` references either the next storage transformer
187+ in the stack or the actual store if this transformer is the last one in the
188+ stack. Any operations with keys not starting with ``data/root `` are simply
189+ relayed to the underlying store and not described explicitly.
190+
191+ * ``get_partial_values(key_ranges) -> values ``:
192+ For each referenced key, request the indices from the underlying store using
193+ ``get_partial_values ``. For each `key `, `range ` pair in in `key_ranges `,
194+ check if the chunk exists by checking if the index offset and length
195+ are both ``2^64 - 1 ``. For existing keys, request the actual chunks by
196+ their ranges as read from the index using ``get_partial_values ``.
197+ This operation should be implemented using two ``get_partial_values ``
198+ operations on the underlying store, one for retrieving the indices and
199+ one for retrieving existing chunks.
200+
201+ * ``set_partial_values(key_start_values) `` :
202+ For each referenced key, check if all available chunks in a shard are
203+ referenced. In this case a shard can be constructed according to the
204+ `Binary shard format `_ directly.
205+ For all other keys, request the indices from the underlying store using
206+ ``get_partial_values ``. All chunks that are not updated completely and
207+ exist according to the index (index offset and length are both
208+ ``2^64 - 1 ``) need to be read via ``get_partial_values `` from the
209+ underlying store. For simplification purposes a shard may also be read
210+ completely, combining the previous two `get ` operations into one.
211+ Based on the existing chunks and value ranges that need to be updated
212+ new shards are constructed according to the `Binary shard format `_.
213+ All shards that need to be updated must now be set via ``set `` or
214+ ``set_partial_values(key_start_values) ``, depending one the chosen
215+ writing strategy provided by the implementation.
216+ Specialized store implementations that allow appending to a storage
217+ object may only need to read the index to update it.
218+
219+ * ``erase_values(keys) `` :
220+ For each referenced key, check if all available chunks in a shard are
221+ referenced. In this case the full shard is removed using ``erase_values ``
222+ on the underlying store.
223+ For all other keys, request the indices from the underlying
224+ store using ``get_partial_values ``. Update the index using and offset and
225+ length of ``2^64 - 1 `` to mark missing chunks. The updated index may be
226+ be written in-place using ``set_partial_values(key_start_values) ``,
227+ or a larger rewrite of the shard may be done including the index update,
228+ but also removing value ranges corresponding to the erased chunks.
229+
230+ * ``erase_prefix() `` : If the prefix contains a part of the chunk-grid
231+ key, this part is translated to the referenced shard and contained chunks.
232+ For affected shards where all contained chunks are erased the prefix is
233+ rewritten to the corresponding shard key and the operation is relayed to
234+ the underlying store.
235+ For all shards where only some chunks are erased the affected chunks
236+ are removed by invoking the operation ``erase_values `` on this
237+ storage transformer with the respective chunk keys.
238+
239+ * ``list() ``: See ``list_prefix `` with the prefix ``/ ``.
240+
241+ * ``list_prefix(prefix) `` : If the prefix contains a part of the chunk-grid
242+ key, this part is translated to the referenced shard and contained chunks.
243+ Then, ``list_prefix `` is called on the underlying store with the translated
244+ prefix. For all listed shards request the indices from the underlying store
245+ using ``get_partial_values ``. Existing chunks, where the index offset or
246+ length are not ``2^64 - 1 `` are then listed by their original key.
247+
248+ * ``list_dir(prefix) `` : If the prefix contains a part of the chunk-grid
249+ key, this part is translated to the referenced shard and contained chunks.
250+ Then, ``list_dir `` is called on the underlying store with the translated
251+ prefix. For all *retrieved prefixes * (not full keys) with partial shard keys,
252+ the corresponding original prefixes covering all possible chunks in the shard
253+ are listed. For *retrieved full keys * the the indices from the underlying store
254+ are requested using ``get_partial_values ``. Existing chunks, where the index
255+ offset or length are not ``2^64 - 1 `` are then listed by their original key.
256+
257+ .. note ::
258+ Not all listed prefixes must necessarily contain keys, as shard prefixes with
259+ partially available chunks return prefixes for all possible chunks without
260+ verifying their exisence for performance reasons. Listing those prefixes
261+ is still safe as some chunks in their corresponding shard exist, but not
262+ necessarily in the requested prefix, possibly leading to empty responses.
263+ Please note, this only applies for returned prefixes, *not * for full keys
264+ referencing storage objects. Returned full keys always reflect the actually
265+ available chunks and are safe to request.
266+
267+
180268References
181269==========
182270
0 commit comments