Pin CultNet publish-after-commit, add write-routed interop, update contract status
- NetworkingTests.CultNetPutInsideCommitPublishesOnlyAfterCommit: a record staged in a batch reaches no CultNet observer before the store commits; a put made while staging is its own write. Chosen over refusing CultNet writes inside a batch, which would need ambient "inside a batch" state. - Interop peer mode write-routed <catalog.cc> <run.cc>: cultcache.interop-note routes to the catalog file, cultcache.interop-run-note to the run file, one record each. - store-composition contract: the C# column reads implemented for routing, attach, schema, lookups, globals, batch and conditional commit; overwriting a store is open, remove, upsert, flush. persistence-format: C# implements batch and conditional commit. - tests README lists the new suites. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
245eef6fb7
commit
03a71ebd66
5 changed files with 111 additions and 17 deletions
|
|
@ -16,10 +16,18 @@ static async Task<int> ProgramMainAsync(string[] args)
|
|||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
throw new InvalidOperationException("Expected mode: write | read");
|
||||
throw new InvalidOperationException("Expected mode: write | read | write-routed <catalog.cc> <run.cc>");
|
||||
}
|
||||
|
||||
var mode = args[0];
|
||||
if (mode == "write-routed")
|
||||
{
|
||||
if (args.Length != 3)
|
||||
throw new InvalidOperationException("Expected: write-routed <catalog.cc> <run.cc>");
|
||||
WriteRouted(args[1], args[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
var options = ParseArgs(args.Skip(1).ToArray());
|
||||
var file = RequireArg(options, "file");
|
||||
switch (mode)
|
||||
|
|
@ -69,6 +77,32 @@ static async Task ReadAsync(string file)
|
|||
WriteJsonLine(note);
|
||||
}
|
||||
|
||||
// Two routed single-file stores: each file is a complete single-store snapshot holding only its own type.
|
||||
static void WriteRouted(string catalogFile, string runFile)
|
||||
{
|
||||
using var cache = new CultCache();
|
||||
cache.AddBackingStore(new SingleFileMessagePackBackingStore(catalogFile), typeof(CultCacheInteropNote));
|
||||
cache.AddBackingStore(new SingleFileMessagePackBackingStore(runFile), typeof(CultCacheInteropRunNote));
|
||||
var note = new CultCacheInteropNote
|
||||
{
|
||||
DocumentId = "note:csharp-routed",
|
||||
AuthorRuntimeId = "csharp",
|
||||
Title = "csharp wrote a routed catalog note",
|
||||
Body = "One home store per document type.",
|
||||
Tags = ["csharp", "routed"]
|
||||
};
|
||||
var runNote = new CultCacheInteropRunNote
|
||||
{
|
||||
DocumentId = "run-note:csharp-routed",
|
||||
AuthorRuntimeId = "csharp",
|
||||
Body = "The run store holds only run records."
|
||||
};
|
||||
cache.UpsertAsync(note, new CultRecordHandle<CultCacheInteropNote>(new CultRecordKey(note.DocumentId)));
|
||||
cache.UpsertAsync(runNote, new CultRecordHandle<CultCacheInteropRunNote>(new CultRecordKey(runNote.DocumentId)));
|
||||
cache.FlushAllBackingStores();
|
||||
WriteJsonLine(note);
|
||||
}
|
||||
|
||||
static CultCache BuildCache(string file)
|
||||
{
|
||||
var cache = new CultCache();
|
||||
|
|
@ -132,3 +166,13 @@ public sealed class CultCacheInteropNote
|
|||
[Key(4)] public string Body { get; set; } = string.Empty;
|
||||
[Key(5)] public string[] Tags { get; set; } = Array.Empty<string>();
|
||||
}
|
||||
|
||||
[CultDocument("cultcache.interop-run-note", "cultcache.interop_run_note.v1")]
|
||||
[MessagePackObject]
|
||||
public sealed class CultCacheInteropRunNote
|
||||
{
|
||||
[Key(0)] public string SchemaVersion { get; set; } = "cultcache.interop_run_note.v1";
|
||||
[Key(1)] [CultName] public string DocumentId { get; set; } = string.Empty;
|
||||
[Key(2)] public string AuthorRuntimeId { get; set; } = string.Empty;
|
||||
[Key(3)] public string Body { get; set; } = string.Empty;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue