Lyo.FileMetadataStore
2.0.0
dotnet add package Lyo.FileMetadataStore --version 2.0.0
NuGet\Install-Package Lyo.FileMetadataStore -Version 2.0.0
<PackageReference Include="Lyo.FileMetadataStore" Version="2.0.0" />
<PackageVersion Include="Lyo.FileMetadataStore" Version="2.0.0" />
<PackageReference Include="Lyo.FileMetadataStore" />
paket add Lyo.FileMetadataStore --version 2.0.0
#r "nuget: Lyo.FileMetadataStore, 2.0.0"
#:package Lyo.FileMetadataStore@2.0.0
#addin nuget:?package=Lyo.FileMetadataStore&version=2.0.0
#tool nuget:?package=Lyo.FileMetadataStore&version=2.0.0
Lyo.FileMetadataStore
File identity without the bytes. Large systems split:
- 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:
FileMetadataStore.Postgres(OLTP schema, including optional audit/multipart/download-access adjunct stores).FileMetadataStore.Sqlite(embedded / local-dev SQLite, same adjunct services as Postgres).
See also
Lyo.FileStorageuses metadata for duplication + encryption bridging.
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.Abstractions10.0.5(direct, microsoft)Microsoft.Extensions.Logging.Abstractions10.0.5(direct, microsoft)Microsoft.Extensions.Options.DataAnnotations10.0.5(direct, microsoft)System.Text.Json10.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.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.Extensions.Configuration.Binder10.0.5(transitive, microsoft)Microsoft.Extensions.Options.ConfigurationExtensions10.0.5(transitive, microsoft)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.Threading.Tasks.Extensions4.6.3(transitive, microsoft, netstandard2.0)
| Product | Versions 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. |
-
.NETStandard 2.0
- Lyo.Common.Metadata (>= 2.0.0)
- Lyo.Compression (>= 2.0.0)
- Lyo.Configuration (>= 2.0.0)
- Lyo.Encryption (>= 2.0.0)
- Lyo.Hashing (>= 2.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.5)
- System.Text.Json (>= 10.0.5)
-
net10.0
- Lyo.Common.Metadata (>= 2.0.0)
- Lyo.Compression (>= 2.0.0)
- Lyo.Configuration (>= 2.0.0)
- Lyo.Encryption (>= 2.0.0)
- Lyo.Hashing (>= 2.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.5)
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.