glance_store.common.utils module¶
System-level utilities and helper functions.
- glance_store.common.utils.chunkiter(fp, chunk_size=65536)¶
Return an iterator to a file-like obj which yields fixed size chunks
- Parameters:
fp – a file-like object
chunk_size – maximum size of chunk
- glance_store.common.utils.chunkreadable(iter, chunk_size=65536)¶
Wrap a readable iterator with a reader yielding chunks of a preferred size, otherwise leave iterator unchanged.
- Parameters:
iter – an iter which may also be readable
chunk_size – maximum size of chunk
- glance_store.common.utils.get_hasher(hash_algo, usedforsecurity=True)¶
Returns the required hasher, given the hashing algorithm. This is primarily to ensure that the hash algorithm is correctly chosen when executed on a FIPS enabled system
- Parameters:
hash_algo – hash algorithm requested
usedforsecurity – whether the hashes are used in a security context
- glance_store.common.utils.is_uuid_like(val)¶
Returns validation of a value as a UUID.
For our purposes, a UUID is a canonical form string: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa