Documentation
¶
Overview ¶
Package blobpath maps a blob's logical name to its driver-side path according to the Store's PathTopology. Pure functions, no I/O, no side effects.
Conventions encoded here are part of the on-disk format: changing them requires a migration. The canonical layouts:
Sharded: blobs/<aa>/<bb>/<full-ref>
where aa,bb are hex chars 4..6 of the blob's hash hex.
Flat: blobs/<full-ref>
Native: rejected — Native means BlobStorage: ExternalRef
and skips the blob-path machinery entirely.
Chunk and pack paths use the same topology with different roots: "chunks/" and "packs/" instead of "blobs/". The BlobType argument selects the root.
DAG: blobpath imports only domain. It does not import core, driver, or any sibling helper.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArtifactIDFromManifestPath ¶
func ArtifactIDFromManifestPath(p string) (domain.ArtifactID, error)
ArtifactIDFromManifestPath is the manifests-side counterpart of RefFromPath. Manifest paths follow the Sharded layout exclusively (see ManifestPath); the structural validation is identical.
func ManifestPath ¶
func ManifestPath(id domain.ArtifactID) (string, error)
ManifestPath returns the driver-side path of a manifest file by ArtifactID. Manifests live under "manifests/" and follow the same shard rules as blobs — same fan-out concerns apply. There is no Flat manifest layout: even on object stores the manifest directory sees enough churn that two-level sharding pays off.
func RefFromPath ¶
RefFromPath extracts the blob ref ("<algo>-<hex>") from a driver-side blob path produced by Resolve. Both topologies are supported:
Sharded: blobs/<aa>/<bb>/<algo>-<hex> → "<algo>-<hex>" Flat: blobs/<algo>-<hex> → "<algo>-<hex>"
The function performs only structural validation — last segment shape "<algo>-<hex>" with a non-empty algo and a hex tail at least four characters long (matching shardOf's lower bound). It does NOT cross-check the segment against the topology shards; callers that need that level of paranoia (e.g. distinguishing a real orphan from an unrelated stray file under blobs/) re-run Resolve on the result and compare paths.
Used by the bootstrap Orphan Scan to map a driver-listed file back to a StoreIndex.Resolve key.
func Resolve ¶
Resolve returns the driver-side path for a blob with the given ref under the given topology and type. The result is forward- slash separated, root-relative — exactly what driver.Driver expects.
PathTopologyNative is rejected: blobs whose physical placement is "native" do not go through this resolver — they are referenced by ExternalRef URI instead, and the engine handles them through driver.Open rather than driver.Get/Put.
Types ¶
This section is empty.