Lyo.FileMetadataStore
1.0.7
See the version list below for details.
dotnet add package Lyo.FileMetadataStore --version 1.0.7
NuGet\Install-Package Lyo.FileMetadataStore -Version 1.0.7
<PackageReference Include="Lyo.FileMetadataStore" Version="1.0.7" />
<PackageVersion Include="Lyo.FileMetadataStore" Version="1.0.7" />
<PackageReference Include="Lyo.FileMetadataStore" />
paket add Lyo.FileMetadataStore --version 1.0.7
#r "nuget: Lyo.FileMetadataStore, 1.0.7"
#:package Lyo.FileMetadataStore@1.0.7
#addin nuget:?package=Lyo.FileMetadataStore&version=1.0.7
#tool nuget:?package=Lyo.FileMetadataStore&version=1.0.7
Lyo.FileMetadataStore
File identity without bytes. Large systems split:
- Blob storage (Lyo.FileStorage). Throughput, multipart uploads, scanners, CDN URLs. 2. Metadata OLTP (this abstraction). Dedupe fingerprints, encryption key ids, multipart session pointers, archival flags.
Clients depend on IFileMetadataStore only where they manipulate canonical Guid file identifiers.
Methods
| Operation | Responsibility |
|---|---|
| GetMetadataAsync(Guid fileId) | Returns FileStoreResult. FileNotFoundException when the row is missing or logically deleted. Soft delete hides tombstones here. |
| SaveMetadataAsync(Guid, FileStoreResult) | Insert or overwrite the row keyed by fileId. Implementations enforce uniqueness on hash and external keys. PostgresFileMetadataStore maps fields into columns. |
| DeleteMetadataAsync(Guid) | Soft-delete: sets DeletedAt and Availability=Deleted, row retained. Returns false if missing or already deleted. GetMetadataAsync and FindByHashAsync omit tombstones. |
| PurgeMetadataAsync(Guid) | Hard-delete the metadata row, or the .meta JSON for the local store. Idempotent. Returns false when there was no record. Used by Lyo.FileStorage.DeleteFileAsync(..., FileDeletionMode.RemoveObjectAndPurgeMetadata) for retention and governance. |
| FindByHashAsync(byte[] hash) | Duplicate detection shortcut. Ignores soft-deleted rows. Often combined with Lyo.Hashing. |
| FindByKeyIdAndVersionAsync(string keyId, string? keyVersion) | Key rotation audits. Active (not soft-deleted) metadata only, referencing a KMS/KEK logical key/version pair. |
FileStoreResult exposes optional DeletedAt (UTC) when present in storage. Callers treat metadata without it as active. GetMetadataAsync and FindByHashAsync omit tombstones. Workbench QueryProject listings also omit tombstones.
FileAvailability states
FileStoreResult.Availability propagates content gating decisions from the storage pipeline:
| State | Meaning |
|---|---|
| Available | Default; reads / presigned URLs / direct downloads are permitted. |
| PendingScan | Saved but awaiting a malware/policy scan; FileNotAvailableException on read unless AllowReadQuarantinedForAdmin is set. |
| PendingDirectUpload | Direct-upload BeginDirectUploadAsync has issued a PUT URL but CompleteDirectUploadAsync has not finalized. |
| Quarantined | A scan flagged the content. Admin-only read may be allowed by storage policy. |
| Rejected | A scan or policy hard-rejected the content; reads always fail. |
| Deleted | Logical tombstone (DeletedAt is set). Reads fail; listings omit the row. Soft-delete sets this instead of leaving Available. |
DekMigrationResult
Returned by MigrateDeksAsync / RotateDeksAsync in Lyo.FileStorage. Records per-file outcomes including 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
Lyo.FileMetadataStore.LocalFileMetadataStore is a JSON-backed implementation for single-host scenarios. Registered through Extensions:
| Extension | Notes |
|---|---|
services.AddLocalFileMetadataStore(string rootDirectoryPath) |
Direct path. |
services.AddLocalFileMetadataStore(Func<IServiceProvider, string> resolveRoot) |
Lazy path resolution (useful for tests or DI-derived paths). |
services.AddLocalFileMetadataStoreFromConfiguration(IConfiguration, sectionName = LocalFileMetadataStoreOptions.SectionName) |
Bind LocalFileMetadataStoreOptions (RootDirectoryPath). |
services.AddLocalFileMetadataStoreKeyed(string keyName, string rootDirectoryPath) |
Keyed registration with both LocalFileMetadataStore and IFileMetadataStore exposed. |
services.AddLocalFileMetadataStoreKeyed(string keyName) |
Returns a LocalFileMetadataStoreBuilder for fluent options/section-based wiring (ConfigureLocalFileStore(...), Build()). |
Architecture
Treat metadata writes as eventually consistent relative to blob existence unless you orchestrate compensations (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/staged-upload adjunct stores).FileMetadataStore.Sqlite(embedded / local-dev SQLite, same adjunct services as Postgres, includingstaged_file_upload).
See also
Lyo.FileStorageconsumes metadata for duplication + encryption bridging.
Dependencies
Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).
Lyo.Common(direct, lyo)Lyo.Compression(direct, lyo)Lyo.Encryption(direct, lyo)Lyo.Hashing(direct, lyo)Microsoft.Extensions.Configuration.Binder10.0.5(direct, microsoft)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.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.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 (>= 1.0.6)
- Lyo.Compression (>= 1.0.6)
- Lyo.Encryption (>= 1.0.6)
- Lyo.Hashing (>= 1.0.6)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
- 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 (>= 1.0.6)
- Lyo.Compression (>= 1.0.6)
- Lyo.Encryption (>= 1.0.6)
- Lyo.Hashing (>= 1.0.6)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
- 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.AzureBlob
Azure Blob Storage-backed implementation of the Lyo.FileStorage IFileStorageService (package name uses the Blob abstraction; implementation uses Azure.Storage.Blobs). |
|
|
Lyo.FileStorage.Sftp
SFTP-backed IFileStorageService using Lyo.Sftp.Client (physical IO only; no multipart/presign in v1). |
|
|
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. |
GitHub repositories
This package is not used by any popular GitHub repositories.