Skip to content

Commit 28a9023

Browse files
committed
adapt abstract store interface
1 parent 7f0b238 commit 28a9023

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

docs/protocol/core/v3.0.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,22 @@ one such pair for any given `key`. I.e., a store is a mapping from
11911191
keys to values. It is also assumed that keys are case sensitive, i.e.,
11921192
the keys "foo" and "FOO" are different.
11931193

1194+
To read and write partial values, a `range` specifies two integers
1195+
`range_start` and `range_length`, that specify a part of the value
1196+
starting at byte `range_start` (inclusive) and having a length of
1197+
`range_length` bytes. `range_length` may be none, indicating all
1198+
available data until the end of the referenced value. For example
1199+
`range` ``[0, none]`` specifies the full value. Stores that do not
1200+
support partial access can still answer the requests using cutouts
1201+
of full values. It is recommended that the implementation of the
1202+
``get_multi``, ``set_multi`` and ``remove_multi`` methods is made
1203+
optional, providing fallbacks for them by default. However, it is
1204+
recommended to supply those operations where possible for efficiency.
1205+
Also, the ``get``, ``set`` and ``erase`` can easily be mapped onto
1206+
their `multi` counterparts. Therefore, it is also recommended to
1207+
supply fallbacks for those if the `multi` operations can be implemented.
1208+
An entity containing those fallbacks could be named ``MultiStore``.
1209+
11941210
The store interface also defines some operations involving
11951211
`prefixes`. In the context of this interface, a prefix is a string
11961212
containing only characters that are valid for use in `keys` and ending
@@ -1209,18 +1225,38 @@ A **readable store** supports the following operation:
12091225
| Parameters: `key`
12101226
| Output: `value`
12111227
1228+
``get_multi`` - Retrieve possibly partial `values` from given `key_ranges`.
1229+
1230+
| Parameters: `key_ranges`: ordered set of `key`, `range` pairs,
1231+
| a `key` may occur multiple times with different `ranges`
1232+
| Output: list of `values`, in the order of the `key_ranges`
1233+
12121234
A **writeable store** supports the following operations:
12131235

12141236
``set`` - Store a (`key`, `value`) pair.
12151237

12161238
| Parameters: `key`, `value`
12171239
| Output: none
12181240
1241+
``set_multi`` - Store `values` at a given `key`, starting at byte `range_start`.
1242+
1243+
| Parameters: `key_start_values`: set of `key`,
1244+
| `range_start`, `value` triples, a `key` may occur multiple
1245+
| times with different `range_starts`, `range_starts` with
1246+
| length of the respective `value` must not specify overlapping
1247+
| ranges for the same `key`
1248+
| Output: none
1249+
12191250
``erase`` - Erase the given key/value pair from the store.
12201251

12211252
| Parameters: `key`
12221253
| Output: none
12231254
1255+
``erase_multi`` - Erase the given key/value pair from the store.
1256+
1257+
| Parameters: `keys`: set of `keys`
1258+
| Output: none
1259+
12241260
``erase_prefix`` - Erase all keys with the given prefix from the store:
12251261

12261262
| Parameter: `prefix`

0 commit comments

Comments
 (0)