Lyo.FileMetadataStore 2.0.0

dotnet add package Lyo.FileMetadataStore --version 2.0.0
                    
NuGet\Install-Package Lyo.FileMetadataStore -Version 2.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" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lyo.FileMetadataStore" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Lyo.FileMetadataStore" />
                    
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 --version 2.0.0
                    
#r "nuget: Lyo.FileMetadataStore, 2.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@2.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&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Lyo.FileMetadataStore&version=2.0.0
                    
Install as a Cake Tool

Lyo.FileMetadataStore

File identity without the bytes. Large systems split:

  1. Blob storage (Lyo.FileStorage). Throughput, multipart uploads, CDN URLs. 2. Metadata OLTP (this abstraction). Dedupe fingerprints, encryption key ids, multipart session pointers, archival flags.

Depend on IFileMetadataStore only where you manipulate canonical Guid file identifiers.

Methods

Operation Responsibility
GetMetadataAsync(Guid fileId) Yields FileStoreResult. Throws FileNotFoundException if the row is missing or logically deleted. Soft delete keeps tombstones out of this path.
SaveMetadataAsync(Guid, FileStoreResult) Insert or overwrite the row keyed by fileId. Implementations require uniqueness on hash and external keys. PostgresFileMetadataStore maps those fields into columns.
DeleteMetadataAsync(Guid) Soft-delete: sets DeletedAt and Availability=Deleted while keeping the row. Returns false if missing or already deleted. GetMetadataAsync and FindByHashAsync skip tombstones.
PurgeMetadataAsync(Guid) Hard-delete the metadata row, or the .meta JSON on the local store. Idempotent. Returns false when no record existed. Lyo.FileStorage.DeleteFileAsync(..., FileDeletionMode.RemoveObjectAndPurgeMetadata) uses this for retention and governance.
FindByHashAsync(byte[] hash) Shortcut for duplicate detection. Soft-deleted rows are ignored. Often paired with Lyo.Hashing.
FindByKeyIdAndVersionAsync(string keyId, string? keyVersion) For key-rotation audits. Only active (not soft-deleted) metadata that references a KMS/KEK logical key/version pair.

When storage has it, FileStoreResult exposes optional DeletedAt (UTC). Callers treat metadata without that stamp as active. GetMetadataAsync and FindByHashAsync skip tombstones, and Workbench QueryProject listings do the same.

FileAvailability states

Availability on FileStoreResult.Availability (hosts set scan-related states after ingest processing):

State Meaning
Available The default. Reads, presigned URLs, and direct downloads are allowed.
PendingScan Host-set while ingest processing (for example ContentThreatScan) is pending. Reads throw FileNotAvailableException unless AllowReadQuarantinedForAdmin is set.
PendingDirectUpload BeginDirectUploadAsync has issued a PUT URL; CompleteDirectUploadAsync has not finalized yet.
Quarantined Host-set when content should not be generally readable. Storage policy may still allow admin-only reads.
Rejected Host-set or policy hard-rejected the content. Reads always fail.
Deleted Logical tombstone (DeletedAt is set). Reads fail and listings omit the row. Soft-delete sets this rather than leaving Available.

DekMigrationResult

What Lyo.FileStorage MigrateDeksAsync / RotateDeksAsync returns. Per-file outcomes include Updated, Skipped, and Failed counts plus the failure list, so operators can re-run a key rotation against only the failing subset.

Local file metadata store DI

For single-host scenarios, Lyo.FileMetadataStore.LocalFileMetadataStore is the JSON-backed implementation. Register it through Extensions:

Extension Notes
services.AddLocalFileMetadataStore(string rootDirectoryPath) Direct path.
services.AddLocalFileMetadataStore(Func<IServiceProvider, string> resolveRoot) Resolves the path lazily (handy for tests or DI-derived paths).
services.AddLocalFileMetadataStoreFromConfiguration(IConfiguration, sectionName = LocalFileMetadataStoreOptions.SectionName) Bind LocalFileMetadataStoreOptions (RootDirectoryPath).
services.AddLocalFileMetadataStoreKeyed(string keyName, string rootDirectoryPath) Keyed registration that exposes both LocalFileMetadataStore and IFileMetadataStore.
services.AddLocalFileMetadataStoreKeyed(string keyName) Yields a LocalFileMetadataStoreBuilder for fluent options/section-based wiring (ConfigureLocalFileStore(...), Build()).

Download access (DownloadAccess/)

Time-boxed download links are store-agnostic, so the contracts sit here instead of in each backend:

Type Role
IFileDownloadAccessService Mint and redeem opaque download tokens. Postgres and SQLite packages implement this.
CreateFileDownloadAccessLinkRequest / CreateFileDownloadAccessLinkResult Link request (file, expiry, max uses, audit context) and the issued token.
ConsumeFileDownloadAccessLinkResult + FileDownloadAccessConsumeFailureReason Redemption outcome, with a typed reason (expired, exhausted, unknown, ...) instead of a bare false.
FileDownloadAccessToken Token mechanics shared by every backend: Create() (32 secure random bytes plus its hash), TryHash, URL-safe Encode / Decode, and LockKey(tokenHash) for the distributed lock that makes single-use redemption race-free.

Only the hash is persisted; the raw token exists solely in the Create result and in the inbound redemption request.

Architecture

Unless you orchestrate compensations, treat metadata writes as eventually consistent relative to blob existence (Save blob, then Save metadata. If the latter fails, delete the blob).

For multi-tenant systems, prepend the tenant key to logical file ids outside the interface, or add partitioning columns inside concrete stores.

Concrete implementations:

See also

Dependencies

Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).

  • Lyo.Common.Metadata (direct, lyo)
  • Lyo.Compression (direct, lyo)
  • Lyo.Configuration (direct, lyo)
  • Lyo.Encryption (direct, lyo)
  • Lyo.Hashing (direct, lyo)
  • Microsoft.Extensions.DependencyInjection.Abstractions 10.0.5 (direct, microsoft)
  • Microsoft.Extensions.Logging.Abstractions 10.0.5 (direct, microsoft)
  • Microsoft.Extensions.Options.DataAnnotations 10.0.5 (direct, microsoft)
  • System.Text.Json 10.0.5 (direct, microsoft, netstandard2.0)
  • Lyo.Common.Core (transitive, lyo)
  • Lyo.Exceptions (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.Extensions.Configuration.Binder 10.0.5 (transitive, microsoft)
  • Microsoft.Extensions.Options.ConfigurationExtensions 10.0.5 (transitive, microsoft)
  • 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.Threading.Tasks.Extensions 4.6.3 (transitive, microsoft, netstandard2.0)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (8)

Showing the top 5 NuGet packages that depend on Lyo.FileMetadataStore:

Package Downloads
Lyo.FileStorage

File storage service interface and base implementation for file operations.

Lyo.FileStorage.Web.Components

Reusable Blazor components for file storage: upload/save, path tree browser, DEK/KEK migration and rotation, metadata/expected-storage browser grids.

Lyo.FileMetadataStore.Postgres

PostgreSQL implementation of the Lyo FileMetadataStore service using Entity Framework Core.

Lyo.FileStorage.S3

S3-compatible file storage (AWS S3, Backblaze B2, MinIO, etc.) for the Lyo FileStorage service using AWSSDK.S3.

Lyo.FileMetadataStore.Sqlite

SQLite implementation of the Lyo FileMetadataStore service using Entity Framework Core.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 88 9/9/2026
1.0.13 209 8/25/2026
1.0.11 214 8/23/2026
1.0.9 246 8/22/2026
1.0.7 266 8/22/2026
1.0.6 232 8/20/2026
1.0.4 244 8/20/2026
1.0.3 208 8/19/2026
1.0.2 239 8/19/2026
1.0.1 217 8/18/2026
1.0.0 208 8/16/2026