Implement durable typed journals, subscriptions, and Reader document connections
Add checked native journal/subscription bindings, managed-reference retention, bounded history and backpressure, atomic delivery receipts, and fenced hosting. Preserve source publication prediction and replica reconciliation; subscription attachment, controls, and delivery remain authoritative in this initial version. Connect independent manual/Gutenberg document producers to Reader bookshelves through typed adapters. Add connection inspection, shared provider selection, authoring documentation, and restart/rejection/fan-out integration coverage. Verified compiler suite (287 passed, two existing skips), Nix runtime and PostgreSQL qualification, five example assemblies, headless Reader integration, Chromium Reader integration, resource pins, formatting, and lint. No pinned workspace runtime was deployed.
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
||||
interface EventHandler<value Payload,value Parameters> id "interface:org.quixos.events:handler" revision "interface:org.quixos.events:handler@1" {
|
||||
operation handle id "events:handle" : record {event:Payload;parameters:Parameters;} -> unit {
|
||||
call id "events:handle:call" execution transaction targets [server];
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import interface EventStream;
|
||||
// Opt into the standard workspace journal conformance rule.
|
||||
interface EventStreamRecord<value Payload> id "interface:org.quixos.events:stream-record" revision "interface:org.quixos.events:stream-record@1" requires EventStream<Payload> {}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// Required server support; a checked installed implementation may additionally predict locally.
|
||||
interface EventStream<value Payload> id "interface:org.quixos.events:stream" revision "interface:org.quixos.events:stream@1" {
|
||||
operation publish id "events:publish" : Payload -> record {publication:string;} {
|
||||
call id "events:publish:call" execution transaction targets [server];
|
||||
}
|
||||
queryable value head id "events:head" : optional<uint64> {
|
||||
get id "events:head:get" execution snapshot targets [server];
|
||||
}
|
||||
operation readPage id "events:read-page" : record {after:optional<string>;limit:uint32;}
|
||||
-> record {entries:list<record {publication:string;position:uint64;payload:Payload;}>;next:optional<string>;asOfHead:optional<uint64>;} {
|
||||
call id "events:read-page:call" execution snapshot targets [server];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
import interface EventSubscription;
|
||||
interface EventSubscriptionRecord<value Payload,value Parameters> id "interface:org.quixos.events:subscription-record" revision "interface:org.quixos.events:subscription-record@1" requires EventSubscription<Payload,Parameters> {}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import interface EventStream;
|
||||
import interface EventHandler;
|
||||
type StartPosition = variant id "org.quixos.events:start@1" {
|
||||
future id "events:start:future" : unit;
|
||||
retained id "events:start:retained" : unit;
|
||||
afterCursor id "events:start:after" : string;
|
||||
};
|
||||
interface EventSubscription<value Payload,value Parameters> id "interface:org.quixos.events:subscription" revision "interface:org.quixos.events:subscription@1" {
|
||||
operation attach id "events:attach" : record {source:interface-ref<EventStream<Payload>>;handler:interface-ref<EventHandler<Payload,Parameters>>;parameters:Parameters;start:StartPosition;} -> unit {
|
||||
call id "events:attach:call" execution transaction targets [server];
|
||||
}
|
||||
queryable value status id "events:status" : record {status:string;generation:uint64;cursor:uint64;failure:optional<record {publication:string;code:string;message:string;}>;} {
|
||||
get id "events:status:get" execution snapshot targets [server];
|
||||
}
|
||||
operation pause id "events:pause" : unit -> unit {call id "events:pause:call" execution transaction targets [server];}
|
||||
operation resume id "events:resume" : unit -> unit {call id "events:resume:call" execution transaction targets [server];}
|
||||
operation retire id "events:retire" : unit -> unit {call id "events:retire:call" execution transaction targets [server];}
|
||||
}
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
fragment {
|
||||
import interface EventStream;
|
||||
import interface EventHandler;
|
||||
import interface EventSubscription;
|
||||
import interface EventStreamRecord;
|
||||
import interface EventSubscriptionRecord;
|
||||
conform<value Payload> EventStreamRecord<Payload> as EventStream<Payload> id "events:standard-stream" {
|
||||
private state Entries id "events:entries" on Self : Payload policy journal {"maxEntries":128,"maxBytes":1048576,"maxPublicationBytes":262144,"maxProtectedSubscriptions":32};
|
||||
bind publish.call to journal Entries.publish;
|
||||
bind head.get to journal Entries.head;
|
||||
bind readPage.call to journal Entries.readPage;
|
||||
}
|
||||
conform<value Payload,value Parameters> EventSubscriptionRecord<Payload,Parameters> as EventSubscription<Payload,Parameters> id "events:standard-subscription" {
|
||||
private state Delivery id "events:delivery" on Self : Parameters policy subscription(Payload);
|
||||
bind attach.call to subscription Delivery.attach;
|
||||
bind status.get to subscription Delivery.status;
|
||||
bind pause.call to subscription Delivery.pause;
|
||||
bind resume.call to subscription Delivery.resume;
|
||||
bind retire.call to subscription Delivery.retire;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user