Compze.Teventive.MemoryImageStateStore 0.6.0-alpha

Prefix Reserved
This is a prerelease version of Compze.Teventive.MemoryImageStateStore.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Compze.Teventive.MemoryImageStateStore --version 0.6.0-alpha
                    
NuGet\Install-Package Compze.Teventive.MemoryImageStateStore -Version 0.6.0-alpha
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Compze.Teventive.MemoryImageStateStore" Version="0.6.0-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Compze.Teventive.MemoryImageStateStore" Version="0.6.0-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Compze.Teventive.MemoryImageStateStore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Compze.Teventive.MemoryImageStateStore --version 0.6.0-alpha
                    
#r "nuget: Compze.Teventive.MemoryImageStateStore, 0.6.0-alpha"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Compze.Teventive.MemoryImageStateStore@0.6.0-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Compze.Teventive.MemoryImageStateStore&version=0.6.0-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Compze.Teventive.MemoryImageStateStore&version=0.6.0-alpha&prerelease
                    
Install as a Cake Tool

Compze.Teventive.MemoryImageStateStore

The memory image state store: a memory image of Compze taggregates. Every taggregate is held in memory for the container's life, and rebuilt at the store's start from a snapshot of each, which its storage keeps: it keeps taggregates as their state, not their history.

What is Compze?

Compze is a .NET framework for building expressive domains through Teventive programming and Typermedia APIs. Learn more

What's in this package?

  • The memory image state store — composed with MemoryImageStateStore(...), it keeps the taggregate classes declared for it in memory, and in JSON files, or in a database's tables, if they are declared.
  • JSON files — StoredInJsonFiles(...): a file for each taggregate, in a folder for each class, written with Compze's serializer of snapshots, and a unit of work's files written all or none. Compze.Teventive.MemoryImageStateStore.MemoryPack adds a cache to start from, so a start reads only the files changed since. ITaggregateJsonFiles gives the path and text of each taggregate's file, identifies a taggregate by its file path, and restores a taggregate from file text such as an earlier version from source control. For specifications, OnAFileSystemInMemory(), in the Testing namespace, puts the files on a file system in memory, read and changed through IFileSystemInMemory, with no disk I/O.
  • A database's tables — StoredInTheDomainDatabase(...): a row for each taggregate in the domain database, holding its class by a name declared for it and its snapshot as Compze's serializer of snapshots writes it, beside the store's SQL layer from Compze.Teventive.MemoryImageStateStore.Sqlite, .MicrosoftSql, .PostgreSql or .MySql. A unit of work commits as one database transaction, with whatever else it writes to the database, such as an exactly-once endpoint's inbox and outbox.
  • Compze's serializer — the files and rows hold what Compze's serializer of snapshots writes, which the container registers, such as with NewtonsoftTaggregateSnapshotSerializer() of Compze.Serialization.Newtonsoft: a snapshot is a consumer's type, serialized as Compze serializes every consumer's type it keeps. A polymorphic value in a snapshot is written with the type map's TypeId for its type, so its type needs a mapping and can be renamed freely; the snapshot type itself needs none.
  • One memory image at a time — the store is built to be fast for one process: what it holds in memory is what its storage holds, so every read reads memory. Its first load takes its storage's lock, and holds it until the container is disposed: for files, a file in the store's own folder, released by the operating system when the process dies; for tables, a process lock of the domain database, the kind an exactly-once endpoint holds, released by the database when the holder's process dies. A second memory image, in another process, on another machine, or in another container of the same process, is refused at its first load with a TimeoutException naming the holder: what for, which process, on which machine, and since when. WaitingForAnotherMemoryImageToReleaseTheStorage(atMost) has it wait for the holder instead, for a hand-over between processes; Compze doesn't tell the holder that another waits. Disposing the container refuses every use of the store from then on, and releases the lock only once no write of the store can still land: a unit of work that is committing as disposing begins commits first, and one that isn't yet rolls back.
  • Reloads and rewrites — IMemoryImageStateStore.LoadFromStorage() loads the files or rows again and reports which taggregates another program added, changed or removed, comparing state as the store writes it, so snapshot types need no equality, and for files only the files changed since the store last read or wrote them. IMemoryImageStateStore.WriteAllToStorage() writes every file or row anew, as one commit, after a change to the snapshot types or to the serializer.
  • Units of work with private copies — each unit of work changes its own copy of a taggregate, holding its lock until it completes, and the copy becomes the committed instance when it commits.
  • Synchronous dispatch — the tevents a unit of work's taggregates publish are dispatched as each publish cascade ends, once the taggregate's invariants hold, so participation handlers run inside the domain call and the unit of work's transaction.
  • Indexes defined by state — ITaggregateIndex<TTaggregate, TKey> files taggregates under keys their state gives, in no particular order, and reads its own unit of work's changes. A store has one index for each pair of taggregate class and key type, and a key function reads only the taggregate's own state.
  • Every taggregate of a class — ITaggregateStoreBulkReader.ReferencesToAll<TTaggregate>(), in no particular order.
  • What holding everything costs — its memory is the whole data set, and it loads every taggregate at its first use, on that use's thread: call LoadFromStorage() at the application's start to choose when. A failure after a commit's journal is written stops the process (Environment.FailFast), and the next start finishes the commit. The files are written, not flushed to the disk. Its waits, for a taggregate's lock and between a load and the units of work, give up after 30 seconds.

The interfaces it implements, ITaggregateStoreReader, ITaggregateStoreBulkReader and ITaggregateStoreUpdater, are in Compze.Teventive.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Compze.Teventive.MemoryImageStateStore:

Package Downloads
Compze.Teventive.MemoryImageStateStore.PostgreSql

The PostgreSQL tables of Compze's memory image state store: PgSqlMemoryImageStateStoreSqlLayer(), for a memory image state store kept in the tables of a PostgreSQL domain database, which one memory image at a time uses.

Compze.Teventive.MemoryImageStateStore.MySql

The MySQL tables of Compze's memory image state store: MySqlMemoryImageStateStoreSqlLayer(), for a memory image state store kept in the tables of a MySQL domain database, which one memory image at a time uses.

Compze.Teventive.MemoryImageStateStore.MicrosoftSql

The SQL Server tables of Compze's memory image state store: MsSqlMemoryImageStateStoreSqlLayer(), for a memory image state store kept in the tables of a SQL Server domain database, which one memory image at a time uses.

Compze.Teventive.MemoryImageStateStore.Sqlite

The SQLite tables of Compze's memory image state store: SqliteMemoryImageStateStoreSqlLayer(), for a memory image state store kept in the tables of a SQLite domain database, which one memory image at a time uses.

Compze.Teventive.MemoryImageStateStore.MemoryPack

A MemoryPack cache for Compze.Teventive.MemoryImageStateStore's JSON files, so a memory image state store kept in files starts from the cache and reads only the files changed since.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.9.9-alpha 0 12/5/2026
0.9.8-alpha 0 12/5/2026
0.9.7-alpha 0 12/5/2026
0.9.6-alpha 8 12/5/2026
0.9.5-alpha 22 12/5/2026
0.9.4-alpha 51 12/5/2026
0.9.3-alpha 80 12/5/2026
0.9.2-alpha 75 12/4/2026
0.9.1-alpha 53 12/4/2026
0.9.0-alpha 66 12/4/2026
0.8.0-alpha 69 12/4/2026
0.7.1-alpha 74 12/3/2026
0.7.0-alpha 166 12/2/2026
0.6.0-alpha 119 12/1/2026
0.5.0-alpha 85 12/1/2026
0.4.5-alpha 97 11/29/2026
0.4.4-alpha 96 11/28/2026
0.4.3-alpha 94 11/28/2026
0.4.2-alpha 97 11/28/2026
0.4.1-alpha 61 11/27/2026
Loading failed

- **`ITaggregateJsonFiles` gives a taggregate's file text and restores a taggregate from it.** `FileTextOf(taggregate)` gives the exact text the store would write for the supplied instance. `TaggregateFromFileText(taggregateClass, text)` restores a new instance from that text, including an earlier version from source control, with the same strict reading as loading a file. Both use the store's registered snapshot serializer.
- **Requires newer minor versions of other Compze packages:** Compze.Abstractions 0.7.0-alpha (was 0.6.0-alpha). Upgrading to this version upgrades each package listed here too, so their changelogs apply to this upgrade as well.