• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

iotaledger / iota / 25296832342

01 May 2026 11:47AM UTC coverage: 63.173% (-0.01%) from 63.186%
25296832342

push

github

web-flow
feat(iota-rest-kv): add object before version support (#11311)

# Description of change

Adds an optional `?before_version=<bool>` query parameter to the object
retrieval routes of `iota-rest-kv`. When `true`, the server returns the
highest stored object version **strictly less than** the version encoded
in the request key, instead of the exact-version match.

This unblocks callers that know the `ObjectID` but not the exact version
(e.g. resolving a past object state) from using the REST KV store.
Previously only exact-version lookups were possible.

### Implementation details

- **Query parameter over dedicated route.** The existing routes are
generic over `item_type` (`/{item_type}` and `/{item_type}/{key}`).
Adding a dedicated route for this one retrieval mode would introduce an
object-only special case in an otherwise uniform route table. Expressing
the mode as an optional query parameter keeps the routes generic and
makes the feature backward-compatible by default. This also aligns with
common REST guidance: the resource is the same (`/ob/{key}` or `/ob`),
only the retrieval mode changes, which is the canonical use case for a
query parameter rather than a new path.
- **Validation in a custom extractor.** A `BeforeVersionQuery` extractor
reads the flag and, when `true`, enforces that the item type is `ob`.
Everything else is rejected with `400 Bad Request` before the handler
runs. This keeps route handlers focused on business logic.
- **Supported routes.** Both `GET /{item_type}/{key}` and `POST
/{item_type}` accept the parameter. When absent it defaults to `false`,
so existing callers are unaffected.
- **Batch semantics.** The response is a BCS-serialized
`Vec<Option<Bytes>>` that preserves the order of the input `keys`.
`Some(bytes)` is the highest version strictly below the requested one;
`None` means not found.
- **Edge case.** `before_version=true` with a key at version 0 returns
`None`.
- **BigTable scan.** Implemented as a single reverse `r... (continued)

0 of 102 new or added lines in 3 files covered. (0.0%)

112 existing lines in 18 files now uncovered.

156077 of 247061 relevant lines covered (63.17%)

459440.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.13
/crates/iota-core/src/execution_cache/writeback_cache.rs


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc