Building Blocks
Cohesive. Storage
Cohesive.Storage stores and retrieves semantic state in terms of shapes, observations, entities, queries, repositories, streams, and backend capabilities.
The goal is not a lowest-common-denominator repository. The goal is to define storage semantics once, expose backend capabilities explicitly, and compile queries, aggregations, transitions, processes, and APIs into the best available interpretation.
Semantic Storage
Cohesive models persisted state as observations of declared shapes. Entities add identity, transitions, invariants, effects, and process participation. Repositories persist those observations and expose structured operations over them.
Application code can ask for "the selected tenant's Shipment entity" or "matching TrainingPolicy observations" instead of rebuilding storage-specific query and partition logic in each handler.
Repository Abstractions
Repositories can support point reads, writes, optimistic concurrency, field projection, batch operations, query execution, change streams, and atomic outbox commits.
Each backend advertises what it can guarantee. A blob repository might support immutable writes and point reads. Cosmos might support partition-aware writes, queries, change feed, and outbox. Search engines may support rich predicates and aggregations without being the write authority.
Queries And Aggregations
Storage uses the query and aggregation DSL from Cohesive.Relations. Predicates, field paths, windows, ordering, joins, and aggregation plans remain semantic IR until an adapter compiles them.
| Backend | Likely strengths | Capability concern |
|---|---|---|
| Cosmos DB | Partitioned operational state, point reads, change feed. | Partition policy and supported query predicates. |
| Elasticsearch / Azure AI Search | Full-text search, scoring, facets, aggregations. | Write authority and eventual consistency boundaries. |
| Relational stores | Joins, transactions, SQL analytics. | Dialect-specific lowering and schema mapping. |
| Blob / object storage | Large artifacts, immutable snapshots, manifests. | Query support and index strategy. |
| In-memory | Tests, local execution, deterministic fixtures. | Parity with production backend guarantees. |
Streams And Outbox
Storage is also how systems observe change. Cohesive.Storage includes checkpointed observation streams for entity changes and logical outbox messages.
This connects transitions, processes, integrations, projections, and search indexing without hiding durability guarantees in framework-specific code.
Backend Families
Cohesive.Storage is designed to move across object storage, table storage, Cosmos DB, Elasticsearch, Azure AI Search, relational stores, event streams, and local repositories while preserving the semantic operation model.
