using System; using System.IO; namespace StellaOps.Scanner.Surface.FS; /// /// Configuration settings for the manifest store. /// public sealed class SurfaceManifestStoreOptions { /// /// Gets or sets the root directory used to persist manifest payloads. When null, /// the value falls back to the surface cache root. /// public string? RootDirectory { get; set; } /// /// Gets or sets the URI scheme emitted for manifest pointers. /// public string Scheme { get; set; } = "cas"; /// /// Gets or sets the bucket name portion of manifest URIs. /// public string Bucket { get; set; } = "surface-cache"; /// /// Gets or sets the prefix used before tenant segments within manifest URIs. /// public string Prefix { get; set; } = "manifests"; internal string ResolveRoot(SurfaceCacheOptions cacheOptions) { var root = RootDirectory; if (string.IsNullOrWhiteSpace(root)) { root = Path.Combine(cacheOptions.ResolveRoot(), "manifests"); } return root!; } internal string ToUri(string tenantSegment, string digestHex) => $"{Scheme}://{Bucket}/{Prefix}/{tenantSegment}/{digestHex[..2]}/{digestHex[2..4]}/{digestHex}.json"; }