class
Bakelite::Volume
- Bakelite::Volume
- Reference
- Object
Overview
Represents an isolated virtual filesystem volume. Volumes manage their own file registry, mount prefix, priority, and default storage policies.
Defined in:
bakelite/dsl/verify_archive_builder.crbakelite/volume.cr
Constructors
Class Method Summary
-
.normalize_path(path : String | Path) : String
Normalizes directory separators to forward slashes and strips leading/trailing slashes.
Instance Method Summary
-
#[](rel_path : String) : Item
Array access alias for get.
-
#[]?(rel_path : String) : Item | Nil
Nilable array access alias for get?.
-
#add(item : Item) : Item
Registers an item into this volume.
-
#content_address : String
Canonical content address URI for this volume's manifest ("sha256:
"). -
#content_manifest : Hash(String, String)
Returns a deterministically sorted mapping of normalized relative file paths to SHA-256 hex digests.
- #default_chunk_size : UInt32
- #default_chunk_size=(default_chunk_size : UInt32)
- #default_compression : CompressionType
- #default_compression=(default_compression : CompressionType)
-
#each_file(&block : Item -> ) : Nil
Iterates over all items in this volume.
-
#empty? : Bool
Checks if this volume has no files.
-
#extract(destination_dir : Path | String, overwrite : Bool = true) : Int32
Extracts all files from this volume into destination_dir on disk.
-
#extract_folder(prefix : String, destination_dir : Path | String, overwrite : Bool = true) : Int32
Extracts a subfolder matching prefix into destination_dir.
-
#files : Array(String)
Returns all relative virtual file paths registered in this volume.
-
#files_with_prefix(prefix : String) : Array(String)
Returns all relative paths starting with the given prefix.
-
#find_all_by_sha256(digest : String) : Array(Item)
Finds all items in this volume matching a SHA-256 content address (in deterministic path order).
-
#find_by_sha256(digest : String) : Item | Nil
Finds the first item (in deterministic lexicographical path order) matching a SHA-256 content address.
-
#get(rel_path : String) : Item
Fetches an item by relative path inside this volume.
-
#get?(rel_path : String) : Item | Nil
Fetches an item by relative path inside this volume, returning nil if missing.
-
#get_by_sha256(digest : String) : Item
Fetches an item by its SHA-256 content address, raising KeyError if not found.
-
#get_by_sha256?(digest : String) : Item | Nil
Alias for find_by_sha256.
-
#glob(pattern : String, & : Item -> ) : Nil
Matches files using glob patterns (e.g.
-
#glob(pattern : String) : Array(Item)
Returns an array of items matching the glob pattern.
-
#has_file?(rel_path : String) : Bool
Checks if a relative path exists in this volume.
-
#has_sha256?(digest : String) : Bool
Checks whether an item with the given SHA-256 content address exists in this volume.
- #items : Hash(String, Item)
-
#manifest_sha256 : String
Computes a deterministic SHA-256 manifest digest over all files in this volume.
- #mount_point : String
- #mount_point=(new_mount : String)
- #mount_prefix_with_slash : String
- #name : String
- #priority : Int32
- #priority=(priority : Int32)
-
#sha256 : String
Alias for manifest_sha256.
-
#size : Int32
Total number of files in this volume.
-
#verify_archive(raise_on_error : Bool = false, expected_digests : Hash(String, String) | Nil = nil, expected_manifest_sha256 : String | Nil = nil, strict : Bool = false) : Core::VerificationReport
Verifies the SHA-256 and CRC32 integrity of all items in this volume.
- #verify_archive(raise_on_error : Bool = false, &) : Core::VerificationReport
- #verify_archive! : Core::VerificationReport
- #verify_archive!(&) : Core::VerificationReport
Constructor Detail
Class Method Detail
Normalizes directory separators to forward slashes and strips leading/trailing slashes.
Instance Method Detail
Canonical content address URI for this volume's manifest ("sha256:
Returns a deterministically sorted mapping of normalized relative file paths to SHA-256 hex digests.
Extracts all files from this volume into destination_dir on disk.
Extracts a subfolder matching prefix into destination_dir.
Returns all relative paths starting with the given prefix.
Finds all items in this volume matching a SHA-256 content address (in deterministic path order).
Finds the first item (in deterministic lexicographical path order) matching a SHA-256 content address.
Fetches an item by relative path inside this volume. Raises KeyError if missing.
Fetches an item by relative path inside this volume, returning nil if missing.
Fetches an item by its SHA-256 content address, raising KeyError if not found.
Matches files using glob patterns (e.g. "**/.png", "textures/").
Returns an array of items matching the glob pattern.
Checks whether an item with the given SHA-256 content address exists in this volume.
Computes a deterministic SHA-256 manifest digest over all files in this volume. Order-independent: identical files produce an identical 64-character hex digest.
Verifies the SHA-256 and CRC32 integrity of all items in this volume.