Public API
This page documents Orleans.Lattice.Schema 10.5.0, in the documentation for Orleans.Lattice 10.5.0 (release line 10.5), built 2026-12-05. It is also published as markdown, with every table and list, at api.md, and llms.txt lists every page.The package provides opt-in schema enforcement and value versioning, a serializable transform representation, durable schema stores and host-side administration. The package guide introduces the independent opt-ins. The exact public declarations below include every explicitly declared member and overload; policy and versioning semantics are described in their topic guides.
Registration and administration
Register AddLatticeSchemaEnforcement and/or AddLatticeSchemaVersioning after AddLattice. When both are present they may be registered in either order; validation always runs before envelope stamping. See configuration for all eight option properties and the registration-only merge observer.
ILatticeSchemaAdmin, ILatticeSchemaVersionAdmin and ILatticeSchemaRemediationAdmin are trusted host-side control services, not independently authorized remote endpoints. Put caller-facing changes behind the Schema facade. ILatticeSchemaComplianceAdmin scans via the ordinary data plane, so caller read authority still applies.
The public store contracts persist policies, version configuration and dead-letter rows. LatticeSchemaReservedTrees exposes the reserved names and guard helpers. Replacing a store is a storage composition decision, not a grant to mutate schema from an untrusted caller.
Policies, validation and transforms
LatticeSchemaPolicy contains ordered rules and its per-tree strict flag. LatticeSchemaPolicyValidator compiles the policy once, rejects invalid configuration at construction, and returns the first failure reason from validation or null on success. Strip a schema envelope before validating a stored versioned value: policies judge the body bytes, not the envelope header. Cluster enforcement does this itself: it judges an already-enveloped value by the body a reader is served, upcast to the target.
LatticeValueTransform, predicate/constant/value-kind models and transform translation/evaluation helpers describe portable remediation and upcasting work. A custom ILatticeValueTransform is resolved through ILatticeValueTransformRegistry; it is not silently embedded as executable code in the portable representation. See value transforms.
Version and operation contracts
LatticeSchemaEnvelope provides tag inspection and body extraction. The exact wire format is distinct from a schema's JSON layout. ILatticeSchemaRegistry and its builder define registered schema versions/upcaster chains. ILatticeSchemaVersionAdmin governs each tree's target; advancing the target is monotonic and does not eagerly rewrite every existing value. LatticeSchemaRuntimeRegistration is the append-only, tree-scoped runtime catalog the Schema facade reads and registers: version Descriptors, migration hops as LatticeSchemaRuntimeUpcaster records (a schema family, a source version, a strictly greater destination version, and exactly one declarative Transform or host-installed TransformId), and the discovery-only SupportedTransformIds. A registered hop is data, never executable code. LatticeSchemaViolationException implements the core ILatticeValueValidationFault, so a transport can recognise a policy refusal (its Code is schema-policy) without referencing this package.
Remediation and eager migration use resumable shadow-build/cutover work with reports/phases; caller cancellation of a request is not proof that durable work was undone. Compliance scans and operation result/status helpers expose tracked progress through the public operation contracts. See enforcement and versioning.
Related
Public declaration reference
The following inventory includes directly declared public members and overloads, enum values, and record positional members. Inherited framework members and compiler-generated record equality helpers are not additional package operations. Each source link identifies the declaration that defines its signature.
Orleans.Lattice.Schema.ILatticeSchemaAdmin
Source (line 10).
public interface ILatticeSchemaAdmin
Task SetPolicyAsync(string treeId, LatticeSchemaPolicy policy, CancellationToken cancellationToken = default)Task<bool> ClearPolicyAsync(string treeId, CancellationToken cancellationToken = default)Task<LatticeSchemaPolicy?> GetPolicyAsync(string treeId, CancellationToken cancellationToken = default)IAsyncEnumerable<LatticeSchemaDeadLetterEntry> ListDeadLettersAsync(string treeId, CancellationToken cancellationToken = default)Task<int> CountDeadLettersAsync(string treeId, CancellationToken cancellationToken = default)
Orleans.Lattice.Schema.ILatticeSchemaComplianceAdmin
Source (line 11).
public interface ILatticeSchemaComplianceAdmin
Task<LatticeSchemaComplianceReport> ScanComplianceAsync( string treeId, CancellationToken cancellationToken = default)
Orleans.Lattice.Schema.ILatticeSchemaDeadLetterStore
Source (line 11).
public interface ILatticeSchemaDeadLetterStore
Task AppendAsync(string treeId, LatticeSchemaDeadLetterEntry entry, CancellationToken cancellationToken = default)IAsyncEnumerable<LatticeSchemaDeadLetterEntry> ListAsync(string treeId, CancellationToken cancellationToken = default)Task<int> CountAsync(string treeId, CancellationToken cancellationToken = default)
Orleans.Lattice.Schema.ILatticeSchemaPolicyStore
Source (line 11).
public interface ILatticeSchemaPolicyStore
Task SetPolicyAsync(string treeId, LatticeSchemaPolicy policy, CancellationToken cancellationToken = default)Task<LatticeSchemaPolicy?> GetPolicyAsync(string treeId, CancellationToken cancellationToken = default)Task<bool> ClearPolicyAsync(string treeId, CancellationToken cancellationToken = default)IAsyncEnumerable<KeyValuePair<string, LatticeSchemaPolicy>> ListPoliciesAsync(CancellationToken cancellationToken = default)
Orleans.Lattice.Schema.ILatticeSchemaRegistry
Source (line 17).
public interface ILatticeSchemaRegistry
bool TryGetDescriptor(uint schemaId, uint version, out LatticeSchemaDescriptor descriptor)bool CanUpcast(uint schemaId, uint fromVersion, uint toVersion)byte[] Upcast(uint schemaId, uint fromVersion, uint toVersion, byte[] body)
Orleans.Lattice.Schema.ILatticeSchemaRemediationAdmin
Source (line 28).
public interface ILatticeSchemaRemediationAdmin
Task<LatticeSchemaRemediationReport> RemediateAsync( string treeId, LatticeValueTransform transform, LatticeSchemaPolicy targetPolicy, CancellationToken cancellationToken = default)Task<LatticeSchemaRemediationReport> GetRemediationStatusAsync( string treeId, CancellationToken cancellationToken = default)
Orleans.Lattice.Schema.ILatticeSchemaVersionAdmin
Source (line 19).
public interface ILatticeSchemaVersionAdmin
Task SetVersionConfigAsync( string treeId, LatticeSchemaVersionConfig config, CancellationToken cancellationToken = default)Task<LatticeSchemaVersionConfig?> GetVersionConfigAsync( string treeId, CancellationToken cancellationToken = default)Task<LatticeSchemaVersionConfig> AdvanceTargetVersionAsync( string treeId, uint newTargetVersion, CancellationToken cancellationToken = default)Task<LatticeSchemaRemediationReport> AdvanceAndMigrateAsync( string treeId, uint newTargetVersion, CancellationToken cancellationToken = default)Task<LatticeSchemaRemediationReport> MigrateToTargetVersionAsync( string treeId, CancellationToken cancellationToken = default)Task<bool> ClearVersionConfigAsync(string treeId, CancellationToken cancellationToken = default)
Orleans.Lattice.Schema.ILatticeSchemaVersionProvider
Source (line 9).
public interface ILatticeSchemaVersionProvider
bool StrictIngestEnabled { get; }ValueTask<LatticeSchemaVersionConfig?> GetConfigAsync(string treeId, CancellationToken cancellationToken = default)void Invalidate(string treeId)
Orleans.Lattice.Schema.ILatticeSchemaVersionStore
Source (line 13).
public interface ILatticeSchemaVersionStore
Task SetConfigAsync(string treeId, LatticeSchemaVersionConfig config, CancellationToken cancellationToken = default)Task<LatticeSchemaVersionConfig?> GetConfigAsync(string treeId, CancellationToken cancellationToken = default)Task<bool> ClearConfigAsync(string treeId, CancellationToken cancellationToken = default)IAsyncEnumerable<KeyValuePair<string, LatticeSchemaVersionConfig>> ListConfigsAsync( CancellationToken cancellationToken = default)
Orleans.Lattice.Schema.ILatticeValueTransform
Source (line 19).
public interface ILatticeValueTransform
string Id { get; }byte[] Transform(byte[] value)
Orleans.Lattice.Schema.ILatticeValueTransformRegistry
Source (line 8).
public interface ILatticeValueTransformRegistry
bool TryGet(string id, out ILatticeValueTransform? transform)ILatticeValueTransform Get(string id)
Orleans.Lattice.Schema.LatticeComputeOperator
Source (line 11).
public enum LatticeComputeOperator : byte
Concat = 0Coalesce = 1
Orleans.Lattice.Schema.LatticeSchemaComplianceReport
Source (line 18).
public readonly record struct LatticeSchemaComplianceReport
public required string TreeId { get; init; }public required bool HasPolicy { get; init; }public required int CompliantCount { get; init; }public required int NonCompliantCount { get; init; }public required int ScannedCount { get; init; }public required IReadOnlyList<LatticeSchemaComplianceRuleCount> RuleBreakdown { get; init; }public int RuleCount { get; init; }public static LatticeSchemaComplianceReport Ungoverned(string treeId)
Orleans.Lattice.Schema.LatticeSchemaComplianceRuleCount
Source (line 10).
public readonly record struct LatticeSchemaComplianceRuleCount
public required string Reason { get; init; }public required int Count { get; init; }
Orleans.Lattice.Schema.LatticeSchemaDeadLetterEntry
Source (line 14).
public sealed class LatticeSchemaDeadLetterEntry
public LatticeSchemaDeadLetterEntry( string key, byte[] valuePreview, int valueByteLength, string reason, LatticeSchemaDeadLetterSource source, DateTimeOffset timestampUtc)public string Key { get; }public byte[] ValuePreviewpublic int ValueByteLength { get; }public string Reason { get; }public LatticeSchemaDeadLetterSource Source { get; }public DateTimeOffset TimestampUtc { get; }public string? OriginClusterId { get; init; }public HybridLogicalClock? SourceHlc { get; init; }
Orleans.Lattice.Schema.LatticeSchemaDeadLetterSource
Source (line 8).
public enum LatticeSchemaDeadLetterSource : byte
Replication = 0Restore = 1LocalRejected = 2
Orleans.Lattice.Schema.LatticeSchemaDescriptor
Source (line 10).
public readonly record struct LatticeSchemaDescriptor
public LatticeSchemaDescriptor(uint schemaId, uint version, string name)public uint SchemaId { get; }public uint Version { get; }public string Name { get; }
Orleans.Lattice.Schema.LatticeSchemaEncodingKind
Source (line 8).
public enum LatticeSchemaEncodingKind : byte
Utf8 = 0Json = 1MaxByteLength = 2
Orleans.Lattice.Schema.LatticeSchemaEnforcementOptions
Source (line 10).
public sealed class LatticeSchemaEnforcementOptions
public bool StrictIngest { get; set; }public bool ValidateCrdtMergeResults { get; set; }public int DeadLetterPreviewMaxBytes { get; set; }public TimeSpan PropagationInterval { get; set; }public TimeSpan AliasReservationWaitTimeout { get; set; }
Orleans.Lattice.Schema.LatticeSchemaEnforcementServiceCollectionExtensions
Source (line 19).
public static class LatticeSchemaEnforcementServiceCollectionExtensions
public static ISiloBuilder AddLatticeSchemaEnforcement( this ISiloBuilder builder, Action<LatticeSchemaEnforcementOptions>? configure = null)public static ISiloBuilder ConfigureLatticeSchemaEnforcement( this ISiloBuilder builder, Action<LatticeSchemaEnforcementOptions> configure)
Orleans.Lattice.Schema.LatticeSchemaEnvelope
Source (line 38).
public static class LatticeSchemaEnvelope
public const byte Magicpublic const byte FormatVersionpublic const int HeaderLengthpublic static bool IsEnveloped(ReadOnlySpan<byte> value)public static byte[] Encode(uint schemaId, uint version, ReadOnlySpan<byte> body)public static bool TryReadHeader(ReadOnlySpan<byte> value, out uint schemaId, out uint version)public static byte[] StripToBody(byte[] value)
Orleans.Lattice.Schema.LatticeSchemaPolicy
Source (line 15).
public sealed class LatticeSchemaPolicy
public LatticeSchemaPolicy(IReadOnlyList<LatticeSchemaRule> rules, bool strictIngest = false)public IReadOnlyList<LatticeSchemaRule> Rules { get; }public bool StrictIngest { get; }
Orleans.Lattice.Schema.LatticeSchemaPolicyValidator
Source (line 16).
public sealed class LatticeSchemaPolicyValidator
public LatticeSchemaPolicyValidator(LatticeSchemaPolicy policy)public LatticeSchemaPolicy Policy { get; }public int RuleCountpublic string? Validate(byte[] value)public string? ValidateRule(int ruleIndex, byte[] value)
Orleans.Lattice.Schema.LatticeSchemaRegistryBuilder
Source (line 15).
public sealed class LatticeSchemaRegistryBuilder
public LatticeSchemaRegistryBuilder AddSchema(uint schemaId, uint version, string name)public LatticeSchemaRegistryBuilder AddUpcaster( uint schemaId, uint fromVersion, uint toVersion, LatticeValueTransform transform)public LatticeSchemaRegistryBuilder AddUpcaster( uint schemaId, uint fromVersion, uint toVersion, string transformId)public LatticeSchemaRegistryBuilder AddUpcaster(LatticeSchemaUpcaster upcaster)public ILatticeSchemaRegistry Build(ILatticeValueTransformRegistry? transformRegistry = null)
Orleans.Lattice.Schema.LatticeSchemaRemediation
Source (line 28).
public static class LatticeSchemaRemediation
public static async Task<LatticeSchemaRemediationOutcome> DryRunAsync( IAsyncEnumerable<KeyValuePair<string, byte[]>> entries, LatticeValueTransform transform, LatticeSchemaPolicy candidatePolicy, int previewMaxBytes = 4096, CancellationToken cancellationToken = default)
Orleans.Lattice.Schema.LatticeSchemaRemediationOutcome
Source (line 18).
public readonly record struct LatticeSchemaRemediationOutcome
public bool Succeeded { get; }public int ScannedCount { get; }public string? OffendingKey { get; }public string? Reason { get; }public byte[]? OffendingValuePreview { get; }public static LatticeSchemaRemediationOutcome Success(int scannedCount)public static LatticeSchemaRemediationOutcome Aborted( int scannedCount, string offendingKey, string reason, byte[] offendingValuePreview)public bool Equals(LatticeSchemaRemediationOutcome other)public override int GetHashCode()
Orleans.Lattice.Schema.LatticeSchemaRemediationPhase
Source (line 10).
public enum LatticeSchemaRemediationPhase
Idle = 0DryRun = 1Build = 2Cutover = 3Completed = 4Aborted = 5Cancelled = 6
Orleans.Lattice.Schema.LatticeSchemaRemediationReport
Source (line 14).
public readonly record struct LatticeSchemaRemediationReport
public LatticeSchemaRemediationPhase Phase { get; init; }public bool InProgress { get; init; }public int ScannedCount { get; init; }public string? OffendingKey { get; init; }public string? Reason { get; init; }public byte[]? OffendingValuePreview { get; init; }public string? DestinationTreeId { get; init; }public string? OperationId { get; init; }public bool Succeededpublic bool DidAbortpublic bool WasCancelledpublic static LatticeSchemaRemediationReport Idle { get; }public static LatticeSchemaRemediationReport InFlight( LatticeSchemaRemediationPhase phase, int scannedCount, string? destinationTreeId, string? operationId)public static LatticeSchemaRemediationReport Completed( int scannedCount, string destinationTreeId, string operationId)public static LatticeSchemaRemediationReport Aborted( int scannedCount, string offendingKey, string reason, byte[] offendingValuePreview, string operationId)public static LatticeSchemaRemediationReport Cancelled(int scannedCount, string operationId)public bool Equals(LatticeSchemaRemediationReport other)public override int GetHashCode()
Orleans.Lattice.Schema.LatticeSchemaReservedTrees
Source (line 11).
public static class LatticeSchemaReservedTrees
public static string Prefixpublic static string PolicyTreeIdpublic static string DeadLetterTreeIdpublic static string VersionConfigTreeIdpublic static bool IsReserved(string treeId)public static void ThrowIfReserved(string treeId, string? paramName = null)
Orleans.Lattice.Schema.LatticeSchemaRule
Source (line 16).
public readonly record struct LatticeSchemaRule
public LatticeSchemaRuleKind Kind { get; init; }public LatticePredicateNode? Predicate { get; init; }public string? RegexPattern { get; init; }public string? MemberPath { get; init; }public LatticeSchemaEncodingKind EncodingKind { get; init; }public int? MaxByteLength { get; init; }public string? Description { get; init; }public static LatticeSchemaRule Structured(LatticePredicateNode predicate, string? description = null)public static LatticeSchemaRule Regex(string pattern, string? memberPath = null, string? description = null)public static LatticeSchemaRule Utf8(string? description = null)public static LatticeSchemaRule Json(string? description = null)public static LatticeSchemaRule MaxLength(int maxByteLength, string? description = null)
Orleans.Lattice.Schema.LatticeSchemaRuleKind
Source (line 7).
public enum LatticeSchemaRuleKind : byte
Structured = 0Regex = 1Encoding = 2
Orleans.Lattice.Schema.LatticeSchemaRuntimeRegistration
Source (line 7).
public sealed record LatticeSchemaRuntimeRegistration
public LatticeSchemaDescriptor[] Descriptors { get; init; }public LatticeSchemaRuntimeUpcaster[] Upcasters { get; init; }public string[] SupportedTransformIds { get; init; }
Orleans.Lattice.Schema.LatticeSchemaRuntimeUpcaster
Source (line 4).
public sealed record LatticeSchemaRuntimeUpcaster
public uint SchemaId { get; init; }public uint FromVersion { get; init; }public uint ToVersion { get; init; }public LatticeValueTransform? Transform { get; init; }public string? TransformId { get; init; }
Orleans.Lattice.Schema.LatticeSchemaServiceCollectionExtensions
Source (line 14).
public static class LatticeSchemaServiceCollectionExtensions
public static IServiceCollection AddLatticeValueTransform( this IServiceCollection services, ILatticeValueTransform transform)public static IServiceCollection AddLatticeValueTransform<TTransform>(this IServiceCollection services) where TTransform : class, ILatticeValueTransformpublic static ISiloBuilder AddLatticeValueTransform( this ISiloBuilder builder, ILatticeValueTransform transform)public static ISiloBuilder AddLatticeValueTransform<TTransform>(this ISiloBuilder builder) where TTransform : class, ILatticeValueTransform
Orleans.Lattice.Schema.LatticeSchemaUpcaster
Source (line 19).
public sealed class LatticeSchemaUpcaster
public uint SchemaId { get; }public uint FromVersion { get; }public uint ToVersion { get; }public string? TransformIdpublic static LatticeSchemaUpcaster FromTransform( uint schemaId, uint fromVersion, uint toVersion, LatticeValueTransform transform)public static LatticeSchemaUpcaster FromTransformId( uint schemaId, uint fromVersion, uint toVersion, string transformId)public byte[] Apply(byte[] body, ILatticeValueTransformRegistry? transformRegistry)
Orleans.Lattice.Schema.LatticeSchemaVersionConfig
Source (line 20).
public readonly record struct LatticeSchemaVersionConfig
public LatticeSchemaVersionConfig(uint schemaId, uint targetVersion, bool strictIngest = false)public uint SchemaId { get; init; }public uint TargetVersion { get; init; }public bool StrictIngest { get; init; }
Orleans.Lattice.Schema.LatticeSchemaVersioningOptions
Source (line 11).
public sealed class LatticeSchemaVersioningOptions
public bool StrictIngest { get; set; }public int DeadLetterPreviewMaxBytes { get; set; }public TimeSpan PropagationInterval { get; set; }
Orleans.Lattice.Schema.LatticeSchemaVersioningServiceCollectionExtensions
Source (line 21).
public static class LatticeSchemaVersioningServiceCollectionExtensions
public static ISiloBuilder AddLatticeSchemaVersioning( this ISiloBuilder builder, Action<LatticeSchemaRegistryBuilder>? configureRegistry = null, Action<LatticeSchemaVersioningOptions>? configureOptions = null)public static ISiloBuilder ConfigureLatticeSchemaVersioning( this ISiloBuilder builder, Action<LatticeSchemaVersioningOptions> configure)
Orleans.Lattice.Schema.LatticeSchemaViolationException
Source (line 27).
public sealed class LatticeSchemaViolationException : InvalidOperationException, ILatticeValueValidationFault
public string Codepublic string TreeId { get; }public string Key { get; }public string Reason { get; }public LatticeSchemaViolationException()public LatticeSchemaViolationException(string message)public LatticeSchemaViolationException(string message, Exception innerException)public LatticeSchemaViolationException(string treeId, string key, string reason)
Orleans.Lattice.Schema.LatticeValueTransform
Source (line 25).
public readonly record struct LatticeValueTransform
public LatticeValueTransformKind Kind { get; init; }public string? MemberPath { get; init; }public string? ToPath { get; init; }public LatticeConstant Constant { get; init; }public LatticePredicateNode Condition { get; init; }public LatticeComputeOperator ComputeOperator { get; init; }public LatticeValueTransform[]? Children { get; init; }public bool Equals(LatticeValueTransform other)public override int GetHashCode()public static LatticeValueTransform Passthrough(params LatticeValueTransform[] operations)public static LatticeValueTransform SetMember(string path, LatticeValueTransform valueExpression)public static LatticeValueTransform DropMember(string path)public static LatticeValueTransform RenameMember(string fromPath, string toPath)public static LatticeValueTransform Member(string path)public static LatticeValueTransform Const(LatticeConstant constant)public static LatticeValueTransform Conditional( LatticePredicateNode condition, LatticeValueTransform thenExpression, LatticeValueTransform elseExpression)public static LatticeValueTransform Compute(LatticeComputeOperator op, params LatticeValueTransform[] operands)
Orleans.Lattice.Schema.LatticeValueTransformEvaluation
Source (line 18).
public static class LatticeValueTransformEvaluation
public static byte[] Evaluate(byte[]? value, in LatticeValueTransform transform)
Orleans.Lattice.Schema.LatticeValueTransformKind
Source (line 18).
public enum LatticeValueTransformKind : byte
Passthrough = 0SetMember = 1DropMember = 2RenameMember = 3Member = 4Constant = 5Conditional = 6Compute = 7
Orleans.Lattice.Schema.LatticeValueTransformTranslator
Source (line 27).
public static class LatticeValueTransformTranslator
public static LatticeValueTransform Translate<T>(Expression<Func<T, T>> transform)public static LatticeValueTransform Translate<TOld, TNew>(Expression<Func<TOld, TNew>> transform)
Orleans.Lattice.Schema.SchemaComplianceScanOperation
Source (line 16).
public static class SchemaComplianceScanOperation
public const string Kindpublic const string CountingPhasepublic const string ScanningPhasepublic const string EntriesUnit
Orleans.Lattice.Schema.SchemaComplianceScanResults
Source (line 13).
public static class SchemaComplianceScanResults
public const string TreeIdKeypublic const string HasPolicyKeypublic const string CompliantCountKeypublic const string NonCompliantCountKeypublic const string ScannedCountKeypublic const string RuleCountKeypublic const string FailureReasonCountKeypublic const string RulePrefixpublic static IReadOnlyDictionary<string, string> ToResultMap(LatticeSchemaComplianceReport report)public static bool TryReadReport(IReadOnlyDictionary<string, string> result, out LatticeSchemaComplianceReport report)
Orleans.Lattice.Schema.SchemaOperationKinds
Source (line 8).
public static class SchemaOperationKinds
public const string Prefixpublic const string Remediationpublic const string Migrationpublic const string AdvanceAndMigrate
Orleans.Lattice.Schema.SchemaOperationPhases
Source (line 8).
public static class SchemaOperationPhases
public const string Advancepublic const string DryRunpublic const string Buildpublic const string Cutoverpublic const string WaitingForAliasOperationpublic const string ValuesUnit
Orleans.Lattice.Schema.SchemaOperationResultKeys
Source (line 9).
public static class SchemaOperationResultKeys
public const string Outcomepublic const string ValuesProcessedpublic const string OffendingKeypublic const string Reasonpublic const string RemediationOperationIdpublic const string Completedpublic const string Abortedpublic const string Cancelledpublic const string Superseded