Hashbrown.AspNetCore · C# API reference
Hashbrown.AspNetCore.PostgresNativeSessionJournal
Upcoming 0.1.0-preview.2 · Unreleased
public sealed class PostgresNativeSessionJournal : Hashbrown.AspNetCore.INativeSessionBrowserRecoveryJournal, Hashbrown.AspNetCore.INativeSessionJournalShort-transaction native session ownership journal; initialize before accepting native requests.
Members
PostgresNativeSessionJournal
public PostgresNativeSessionJournal(Npgsql.NpgsqlDataSource source, Hashbrown.AspNetCore.NativeToolCatalog catalog, string compatibilityIdentity, string schema = "hashbrown", Hashbrown.AspNetCore.NativeSessionOptions? options = null);Binds an application-owned pool, trusted model identity, native format and immutable catalog independently of lookup keys.
AuthorizePublicationAsync
public System.Threading.Tasks.ValueTask<bool> AuthorizePublicationAsync(Hashbrown.AspNetCore.NativeSavedReceipt receipt, System.Threading.CancellationToken cancellationToken = default);Reserves publication only for the exact saved receipt.
CaptureApprovalBatchAsync
public System.Threading.Tasks.ValueTask<bool> CaptureApprovalBatchAsync(Hashbrown.AspNetCore.NativeSessionLease lease, Hashbrown.AspNetCore.NativeApprovalBatch capture, System.Threading.CancellationToken cancellationToken = default);Persists only genuine native request capture under the current owner.
CaptureModelCallAsync
public System.Threading.Tasks.ValueTask<bool> CaptureModelCallAsync(Hashbrown.AspNetCore.NativeSessionLease lease, Hashbrown.AspNetCore.NativeToolCall call, System.Threading.CancellationToken cancellationToken = default);Persists an actual model descriptor before native bypass sees it.
CompleteDispatchAsync
public System.Threading.Tasks.ValueTask<bool> CompleteDispatchAsync(Hashbrown.AspNetCore.NativeSessionLease lease, Hashbrown.AspNetCore.NativeToolCall call, System.Threading.CancellationToken cancellationToken = default);Records a completed dispatch under the same unexpired owner.
FailureCleanupAsync
public System.Threading.Tasks.ValueTask<bool> FailureCleanupAsync(Hashbrown.AspNetCore.NativeSessionLease lease, System.Threading.CancellationToken cancellationToken = default);Releases pre-dispatch work or retains an ambiguous effect/publication fence.
FinalizePublicationAsync
public System.Threading.Tasks.ValueTask<bool> FinalizePublicationAsync(Hashbrown.AspNetCore.NativeSavedReceipt receipt, System.Threading.CancellationToken cancellationToken = default);Releases a publication reservation after the bounded write succeeds.
GetOwnedApprovalEvidenceAsync
public System.Threading.Tasks.ValueTask<Hashbrown.AspNetCore.NativeApprovalEvidence?> GetOwnedApprovalEvidenceAsync(Hashbrown.AspNetCore.NativeSessionLease lease, System.Threading.CancellationToken cancellationToken = default);Materializes bound approval evidence only under current request authority.
GetOwnedCallAsync
public System.Threading.Tasks.ValueTask<Hashbrown.AspNetCore.NativeToolCall?> GetOwnedCallAsync(Hashbrown.AspNetCore.NativeSessionLease lease, string callId, System.Threading.CancellationToken cancellationToken = default);Reads only a captured descriptor under the current owner.
InitializeAsync
public System.Threading.Tasks.ValueTask InitializeAsync(System.Threading.CancellationToken cancellationToken = default);Initializes native schema two atomically. Drain and quiesce version-one workers before upgrading; mixed-version operation is unsupported.
InspectAsync
public System.Threading.Tasks.ValueTask<Hashbrown.AspNetCore.NativeSessionInspection?> InspectAsync(System.Collections.Generic.IReadOnlySet<string> scopes, Hashbrown.AspNetCore.NativeSessionKey key, int limit = 50, System.Threading.CancellationToken cancellationToken = default);Inspects safe metadata within server-permitted scopes.
MaintainAsync
public System.Threading.Tasks.ValueTask<int> MaintainAsync(System.Threading.CancellationToken cancellationToken = default);Runs bounded maintenance preserving selector and effect fences; PostgreSQL also reconciles expired authority for retained sessions.
Remarks
Schedule PostgreSQL maintenance for every trusted compatibility/catalog registration, with cancellation and observed failures. It uses locked database-clock checks, never executes model or tool work, and never extends private retention. Active owners remain unchanged; consumed decisions and uncertain effects remain fenced. Retained lease reconciliation is registration-specific; privacy purge is schema-wide. Backlog and scheduling govern recovery latency. Custom journals define their own maintenance behavior; implementing this interface does not imply PostgreSQL crash reconciliation or browser recovery support.
Returns
The number of distinct sessions transitioned or purged, at most the configured maintenance batch size.
ReadStatusAsync
public System.Threading.Tasks.ValueTask<Hashbrown.AspNetCore.NativeSessionStatus> ReadStatusAsync(Hashbrown.AspNetCore.NativeSessionKey key, System.Threading.CancellationToken cancellationToken = default);Reads bounded public disposition without acquiring execution authority.
ReconcileAsync
public System.Threading.Tasks.ValueTask<int> ReconcileAsync(System.Collections.Generic.IReadOnlySet<string> scopes, Hashbrown.AspNetCore.NativeSessionKey key, string actor, Hashbrown.AspNetCore.NativeSessionReconciliation request, System.Threading.CancellationToken cancellationToken = default);Terminally reconciles exact current state with immutable evidence and quiescence.
RenewAsync
public System.Threading.Tasks.ValueTask<bool> RenewAsync(Hashbrown.AspNetCore.NativeSessionLease lease, System.Threading.CancellationToken cancellationToken = default);Extends only current unexpired request authority, including saved/publication state, without changing its receipt revision.
RetireAsync
public System.Threading.Tasks.ValueTask<int> RetireAsync(System.Collections.Generic.IReadOnlySet<string> scopes, Hashbrown.AspNetCore.NativeSessionKey key, string actor, Hashbrown.AspNetCore.NativeSessionReconciliation request, System.Threading.CancellationToken cancellationToken = default);Terminally retires a selector with the same scoped operator CAS.
SaveAsync
public System.Threading.Tasks.ValueTask<Hashbrown.AspNetCore.NativeSavedReceipt?> SaveAsync(Hashbrown.AspNetCore.NativeSessionLease lease, Hashbrown.AspNetCore.NativeSessionSave save, System.Threading.CancellationToken cancellationToken = default);Atomically saves private native JSON and canonical public state, retaining ownership.
SettleApprovalRejectionAsync
public System.Threading.Tasks.ValueTask<bool> SettleApprovalRejectionAsync(Hashbrown.AspNetCore.NativeSessionLease lease, Hashbrown.AspNetCore.NativeApprovalRejection rejection, System.Threading.CancellationToken cancellationToken = default);Settles only a genuine admitted decline or cancellation without dispatch.
SettleBrowserBypassResultAsync
public System.Threading.Tasks.ValueTask<bool> SettleBrowserBypassResultAsync(Hashbrown.AspNetCore.NativeSessionLease lease, string batchId, string requestId, string callId, System.Text.Json.JsonElement result, System.Threading.CancellationToken cancellationToken = default);Settles the exact genuine interrupted browser rejection without granting a decision or dispatch.
TryAcquireAsync
public System.Threading.Tasks.ValueTask<Hashbrown.AspNetCore.NativeSessionAdmission> TryAcquireAsync(Hashbrown.AspNetCore.NativeSessionKey key, string publicRequestJson, System.Threading.CancellationToken cancellationToken = default);Validates the owned canonical prefix before allocating one fenced owner; never substitutes fresh state for a continuation.
TryAdmitApprovalBatchAsync
public System.Threading.Tasks.ValueTask<bool> TryAdmitApprovalBatchAsync(Hashbrown.AspNetCore.NativeSessionLease lease, string batchId, Hashbrown.AspNetCore.NativeApprovalAdmissionEnvelope admission, System.Threading.CancellationToken cancellationToken = default);Atomically reserves the exact complete published decision set or consumes none.
TryStartDispatchAsync
public System.Threading.Tasks.ValueTask<bool> TryStartDispatchAsync(Hashbrown.AspNetCore.NativeSessionLease lease, Hashbrown.AspNetCore.NativeToolCall call, System.Threading.CancellationToken cancellationToken = default);Commits a permanent dispatch marker before executing.