diff --git a/src/LagoVista.Core/Interfaces/IOperationalRecord.cs b/src/LagoVista.Core/Interfaces/IOperationalRecord.cs new file mode 100644 index 00000000..4a03ab40 --- /dev/null +++ b/src/LagoVista.Core/Interfaces/IOperationalRecord.cs @@ -0,0 +1,14 @@ +namespace LagoVista.Core.Interfaces +{ + /// + /// Minimal record contract for compact, mutable operational data. + /// Operational records represent the current working state used to run the platform + /// rather than immutable activity history or document-oriented application data. + /// + public interface IOperationalRecord + { + string Id { get; set; } + string OrganizationId { get; set; } + string Organization { get; set; } + } +} diff --git a/src/LagoVista.Core/Interfaces/IOperationalRecordStore.cs b/src/LagoVista.Core/Interfaces/IOperationalRecordStore.cs new file mode 100644 index 00000000..4d3c35fc --- /dev/null +++ b/src/LagoVista.Core/Interfaces/IOperationalRecordStore.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace LagoVista.Core.Interfaces +{ + /// + /// Provider-neutral storage contract for compact, mutable operational records. + /// Implementations may use Cassandra or another backend suitable for high-cardinality + /// keyed state without exposing provider topology to callers. + /// + public interface IOperationalRecordStore + where TRecord : class, IOperationalRecord + { + Task GetAsync(OperationalRecordKey key, CancellationToken cancellationToken = default); + Task UpsertAsync(TRecord record, CancellationToken cancellationToken = default); + Task UpsertBatchAsync(IEnumerable records, CancellationToken cancellationToken = default); + Task DeleteAsync(OperationalRecordKey key, CancellationToken cancellationToken = default); + } +} diff --git a/src/LagoVista.Core/Interfaces/OperationalRecordKey.cs b/src/LagoVista.Core/Interfaces/OperationalRecordKey.cs new file mode 100644 index 00000000..a601feeb --- /dev/null +++ b/src/LagoVista.Core/Interfaces/OperationalRecordKey.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; + +namespace LagoVista.Core.Interfaces +{ + /// + /// Provider-neutral identity for an operational record. + /// Scope values describe the logical record boundary (for example repository or instance) + /// without exposing provider-specific partition, shard, table, or collection concepts. + /// + public sealed class OperationalRecordKey + { + public OperationalRecordKey(string organizationId, string id, IReadOnlyDictionary scope = null) + { + if (String.IsNullOrWhiteSpace(organizationId)) throw new ArgumentNullException(nameof(organizationId)); + if (String.IsNullOrWhiteSpace(id)) throw new ArgumentNullException(nameof(id)); + + OrganizationId = organizationId; + Id = id; + Scope = scope ?? new Dictionary(); + } + + public string OrganizationId { get; } + public string Id { get; } + public IReadOnlyDictionary Scope { get; } + } +}