Lyo.FileMetadataStore.Postgres 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Lyo.FileMetadataStore.Postgres --version 1.0.0
                    
NuGet\Install-Package Lyo.FileMetadataStore.Postgres -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Lyo.FileMetadataStore.Postgres" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lyo.FileMetadataStore.Postgres" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Lyo.FileMetadataStore.Postgres" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Lyo.FileMetadataStore.Postgres --version 1.0.0
                    
#r "nuget: Lyo.FileMetadataStore.Postgres, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Lyo.FileMetadataStore.Postgres@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Lyo.FileMetadataStore.Postgres&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Lyo.FileMetadataStore.Postgres&version=1.0.0
                    
Install as a Cake Tool

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; __EFMigrationsHistory is rooted here. - ConnectionString — required. - EnableAutoMigrations (via IPostgresMigrationConfig) — when true, AddPostgresMigrations<FileMetadataStoreDbContext, PostgresFileMetadataStoreOptions>() runs migrations at host start through Lyo.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.EntityFrameworkCore 10.0.5 — (direct, microsoft)
  • Microsoft.EntityFrameworkCore.Design 10.0.5 — (direct, microsoft)
  • Microsoft.Extensions.Configuration.Binder 10.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.Cryptography 2.6.2 — (transitive, third-party, netstandard2.0)
  • EasyCompressor 2.1.0 — (transitive, third-party)
  • Konscious.Security.Cryptography.Argon2 1.3.1 — (transitive, third-party)
  • Microsoft.Bcl.AsyncInterfaces 10.0.5 — (transitive, microsoft, netstandard2.0)
  • Microsoft.EntityFrameworkCore.Relational 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.DependencyInjection.Abstractions 10.0.5 — (transitive, microsoft, net10.0, netstandard2.0)
  • Microsoft.Extensions.Hosting.Abstractions 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Logging.Abstractions 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Options 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Options.ConfigurationExtensions 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Options.DataAnnotations 10.0.5 — (transitive, microsoft)
  • Npgsql.EntityFrameworkCore.PostgreSQL 10.0.3 — (transitive, third-party)
  • System.Buffers 4.6.1 — (transitive, microsoft, netstandard2.0)
  • System.IO.Hashing 10.0.5 — (transitive, microsoft, net10.0)
  • System.Memory 4.6.3 — (transitive, microsoft, netstandard2.0)
  • System.Text.Json 10.0.5 — (transitive, microsoft, netstandard2.0)
  • System.Threading.Tasks.Extensions 4.6.3 — (transitive, microsoft, netstandard2.0)
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 36 8/18/2026
1.0.0 61 8/16/2026