Skip to main content

Module adapter

Module adapter 

Source
Expand description

The StorageAdapter trait.

Shaped by two consumers, not one. Building against Mongo alone bakes Mongo-isms into the interface and the Postgres port then fights it, which is what produced the 55 catalogued divergences upstream. The rule: if a method can only be implemented sensibly for one backend, the trait is wrong.

Three consequences visible in the signatures below:

  • No $ operators and no BSON. Queries are an AST the adapter lowers. Postgres cannot lower a raw Mongo query document, so accepting one here would be the first Mongo-ism.
  • Schema is passed in, not fetched. The adapter does not own a schema cache. A caller that already resolved the schema for a request threads it down, which is what keeps one request from evaluating half its work under two different schemas.
  • Updates are an op AST, not a row. Increment is not a value; expressing it as one is how 0.1.0 came to store {"__op":"Increment"} as a literal object.

Structs§

SchemaIndex
One entry of the schema API’s indexes block: a name, and the key document under it.
WriteResult
What a write returns.

Enums§

AddFieldOutcome
What happened when a field type was reserved.

Traits§

StorageAdapter
Storage operations.

Type Aliases§

Row
A row as stored: Parse-format values, no backend encoding.