Lyo.FileMetadataStore.Postgres
1.0.9
dotnet add package Lyo.FileMetadataStore.Postgres --version 1.0.9
NuGet\Install-Package Lyo.FileMetadataStore.Postgres -Version 1.0.9
<PackageReference Include="Lyo.FileMetadataStore.Postgres" Version="1.0.9" />
<PackageVersion Include="Lyo.FileMetadataStore.Postgres" Version="1.0.9" />
<PackageReference Include="Lyo.FileMetadataStore.Postgres" />
paket add Lyo.FileMetadataStore.Postgres --version 1.0.9
#r "nuget: Lyo.FileMetadataStore.Postgres, 1.0.9"
#:package Lyo.FileMetadataStore.Postgres@1.0.9
#addin nuget:?package=Lyo.FileMetadataStore.Postgres&version=1.0.9
#tool nuget:?package=Lyo.FileMetadataStore.Postgres&version=1.0.9
Lyo.FileMetadataStore.Postgres
OLTP IFileMetadataStore plus adjunct services used by richer file pipelines.
PostgresFileMetadataStore
Transactional CRUD for canonical metadata rows. SaveMetadataAsync upserts. FindByHashAsync uses indexed digest columns. Check those migration indices before huge imports. FindByKeyIdAndVersion drives rotation reporting. Rows support logical delete via nullable deleted_at. GetMetadataAsync, duplicate hash lookup, and key-rotation enumeration ignore tombstoned rows. Physical blob lifecycle stays with Lyo.FileStorage.
Register as scoped so each ASP.NET HTTP request gets its own FileMetadataStoreDbContext. Do not share a context across requests.
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 SELECT 1-style probe via the EF Core context. Reports 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 through Lyo.Postgres.
DI. Extensions
| 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. Used by 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 and Warning.
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 should grow additively.
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.9)
- Lyo.FileMetadataStore (>= 1.0.9)
- Lyo.FileStorage (>= 1.0.9)
- Lyo.Health (>= 1.0.9)
- Lyo.Lock (>= 1.0.9)
- Lyo.Postgres (>= 1.0.9)
- 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.