utils#

Utility functions for IRDL.

irdl.utils._fits_in_memory(ingest_path: Path) bool#

Check if a file can be loaded into available RAM.

Needed when an entire dataset is loaded into memory.

Parameters:
ingest_pathPath

Path to the ingestable file.

Returns:
fitsbool

True if the file fits into available RAM with headroom.

Hard-link a file, falling back to copy.

irdl.utils._preserve_permissions(source_path: Path, target_path: Path) None#

Copy permission bits from one file to another.

Parameters:
source_pathPath

Existing file whose permission bits should be reused.

target_pathPath

Existing file that should receive the same permission bits.

irdl.utils._validate_hash_registry(provider_name: str, registry: object) None#

Validate the common flat hash-registry schema.

Parameters:
provider_namestr

Provider identifier used in error messages.

registryobject

Parsed JSON payload to validate.

Raises:
ValueError

If the registry does not match the required flat dict[str, str] schema.

irdl.utils.load_hash_registry(provider_name: str) dict[str, str]#

Load and validate a packaged provider hash registry.

Parameters:
provider_namestr

Provider identifier used to resolve <provider_name>_hashes.json from irdl/registry/ package data.

Returns:
dict

Flat mapping of provider-relative paths to sha256:... digests.