Lyo.FileMetadataStore.Postgres
1.0.1
dotnet add package Lyo.FileMetadataStore.Postgres --version 1.0.1
NuGet\Install-Package Lyo.FileMetadataStore.Postgres -Version 1.0.1
<PackageReference Include="Lyo.FileMetadataStore.Postgres" Version="1.0.1" />
<PackageVersion Include="Lyo.FileMetadataStore.Postgres" Version="1.0.1" />
<PackageReference Include="Lyo.FileMetadataStore.Postgres" />
paket add Lyo.FileMetadataStore.Postgres --version 1.0.1
#r "nuget: Lyo.FileMetadataStore.Postgres, 1.0.1"
#:package Lyo.FileMetadataStore.Postgres@1.0.1
#addin nuget:?package=Lyo.FileMetadataStore.Postgres&version=1.0.1
#tool nuget:?package=Lyo.FileMetadataStore.Postgres&version=1.0.1
Lyo.FileMetadataStore.Postgres
OLTP IFileMetadataStore plus adjunct services used by richer file pipelines:
PostgresFileMetadataStore
Implements transactional CRUD for canonical metadata rows (SaveMetadataAsync upserts, FindByHashAsync leverages indexed digest columns—verify migration indices before huge imports, FindByKeyIdAndVersion powers rotation reporting). Rows support logical delete via nullable deleted_at; GetMetadataAsync, duplicate hash lookup, and key-rotation enumeration ignore tombstoned rows. Physical blob lifecycle remains owned by Lyo.FileStorage.
Registers as scoped in many hosts so each ASP.NET HTTP request obtains its own FileMetadataStoreDbContext lifecycle (prevent accidental cross-request state).
Auxiliary stores
Implementations packaged here also cover:
| Type | Implements | Purpose | |-------------------------------------------|------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | PostgresFileAuditSink | IFileAuditEventHandler | Persists immutable audit timelines for uploads/downloads/deletes surfaced by Lyo.FileStorage. | | PostgresMultipartUploadSessionStore | IMultipartUploadSessionStore | Tracks staged multipart uploads (part manifests, TTL cleanup policies). | | PostgresStagedFileUploadStore | IStagedFileUploadStore | Persists in-flight staged uploads in staged_file_upload until commit into file_metadata. | | PostgresFileDownloadAccessService | IFileDownloadAccessService | Issues and consumes opaque, time-boxed download tokens — used by hosts that wrap presigned reads with their own access audit (CreateFileDownloadAccessLinkRequest / ConsumeFileDownloadAccessLinkResult). |
Health
PostgresFileMetadataStore implements Lyo.Health.IHealth (HealthCheckName = "PostgresFileMetadataStore"): a lightweight SELECT 1-style probe via the EF Core context that surfaces connection issues without scanning rows.
Options — PostgresFileMetadataStoreOptions
SectionName(PostgresFileMetadataStore) — default appsettings section. -Schema(filemetadata) — Postgres schema;__EFMigrationsHistoryis rooted here. -ConnectionString— required. -EnableAutoMigrations(viaIPostgresMigrationConfig) — when true,AddPostgresMigrations<FileMetadataStoreDbContext, PostgresFileMetadataStoreOptions>()runs migrations at host start throughLyo.Postgres.
DI panorama (Extensions highlights)
| Extension | Purpose | |-------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | AddFileMetadataStoreDbContext(connectionString) / (Action<DbContextOptionsBuilder>) | Register the FileMetadataStoreDbContext only (no store). | | AddFileMetadataStoreDbContextFactory(Action<PostgresFileMetadataStoreOptions>) / (PostgresFileMetadataStoreOptions) | Register only the EF DbContext factory + auto-migrations through Lyo.Postgres. | | AddFileMetadataStoreDbContextFactoryFromConfiguration(configuration, sectionName) | Same, but bound from a configuration section. | | AddPostgresFileMetadataStore() / (Action<DbContextOptionsBuilder>) / (connectionString) | Register PostgresFileMetadataStore + IFileMetadataStore (scoped). | | AddPostgresFileMetadataStoreKeyed(keyName, Action<DbContextOptionsBuilder>) / (keyName, connectionString) | Keyed registration; both PostgresFileMetadataStore and IFileMetadataStore are exposed under keyName. | | AddPostgresFileMetadataStoreKeyed(keyName) | Returns a PostgresFileMetadataStoreBuilder (ConfigurePostgresFileStore, Build()) that merges configuration sections + programmatic overrides — essential for gateways hosting per-tenant metadata silos. | | AddPostgresFileAuditSink() | Adds PostgresFileAuditSink as scoped IFileAuditEventHandler. | | AddPostgresMultipartUploadSessionStore() | Adds the Postgres IMultipartUploadSessionStore. Builder usually does this for you when no session store is registered yet. | | AddPostgresStagedFileUploadStore() | Adds PostgresStagedFileUploadStore as scoped IStagedFileUploadStore. Builder registers this when no staged store is present yet. | | AddPostgresFileDownloadAccessService() | Adds PostgresFileDownloadAccessService and IFileDownloadAccessService. |
Logs via ILogger<PostgresFileMetadataStore> at Debug/Warning levels for forensic tracing.
Failure handling
Translates Postgres unique violations (23505) into predictable outcomes where possible (duplicate hash insert collisions). Inspect catch scopes before mapping to 409 Conflict externally.
Migrations / schema coupling
Changing column layout requires coordinated releases with Lyo.FileStorage expectations (serialized JSON blobs evolve carefully—additive fields preferred).
See also
Dependencies
Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).
Lyo.Exceptions— (direct, lyo)Lyo.FileMetadataStore— (direct, lyo)Lyo.FileStorage— (direct, lyo)Lyo.Health— (direct, lyo)Lyo.Lock— (direct, lyo)Lyo.Postgres— (direct, lyo)Microsoft.EntityFrameworkCore10.0.5— (direct, microsoft)Microsoft.EntityFrameworkCore.Design10.0.5— (direct, microsoft)Microsoft.Extensions.Configuration.Binder10.0.5— (direct, microsoft)Lyo.Common— (transitive, lyo)Lyo.Compression— (transitive, lyo)Lyo.ContentThreatScan— (transitive, lyo)Lyo.Encryption— (transitive, lyo)Lyo.Hashing— (transitive, lyo)Lyo.IO.Temp— (transitive, lyo)Lyo.KeyStore— (transitive, lyo)Lyo.Metrics— (transitive, lyo)Lyo.Result— (transitive, lyo)Lyo.Streams— (transitive, lyo)BouncyCastle.Cryptography2.6.2— (transitive, third-party, netstandard2.0)EasyCompressor2.1.0— (transitive, third-party)Konscious.Security.Cryptography.Argon21.3.1— (transitive, third-party)Microsoft.Bcl.AsyncInterfaces10.0.5— (transitive, microsoft, netstandard2.0)Microsoft.EntityFrameworkCore.Relational10.0.5— (transitive, microsoft)Microsoft.Extensions.DependencyInjection.Abstractions10.0.5— (transitive, microsoft, net10.0, netstandard2.0)Microsoft.Extensions.Hosting.Abstractions10.0.5— (transitive, microsoft)Microsoft.Extensions.Logging.Abstractions10.0.5— (transitive, microsoft)Microsoft.Extensions.Options10.0.5— (transitive, microsoft)Microsoft.Extensions.Options.ConfigurationExtensions10.0.5— (transitive, microsoft)Microsoft.Extensions.Options.DataAnnotations10.0.5— (transitive, microsoft)Npgsql.EntityFrameworkCore.PostgreSQL10.0.3— (transitive, third-party)System.Buffers4.6.1— (transitive, microsoft, netstandard2.0)System.IO.Hashing10.0.5— (transitive, microsoft, net10.0)System.Memory4.6.3— (transitive, microsoft, netstandard2.0)System.Text.Json10.0.5— (transitive, microsoft, netstandard2.0)System.Threading.Tasks.Extensions4.6.3— (transitive, microsoft, netstandard2.0)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Lyo.Exceptions (>= 1.0.1)
- Lyo.FileMetadataStore (>= 1.0.1)
- Lyo.FileStorage (>= 1.0.1)
- Lyo.Health (>= 1.0.1)
- Lyo.Lock (>= 1.0.1)
- Lyo.Postgres (>= 1.0.1)
- Microsoft.EntityFrameworkCore (>= 10.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.