Skip to content

Engine → Assets

cooked_blob.h

A blob with its bytes. Owns everything it holds.

Structs

File Description
cooked_blob A blob with its bytes. Owns everything it holds.
cooked_blob_header Fixed header of a cooked blob.

Functions

Public

hash_bytes

[[nodiscard]] CONJURE_API u64 hash_bytes(
    std::span<const std::byte> bytes) noexcept;

64-bit content hash used for payloads, source files and pack contents.

make_cooked_blob

[[nodiscard]] CONJURE_API cooked_blob make_cooked_blob(
    cooked_blob_header header,
    std::vector<asset_id> dependencies,
    std::vector<std::byte> payload);

Builds a consistent blob from its parts: payloadHash, payloadSize and dependencyCount are derived from the payload and the dependency list.

parse_cooked_blob

[[nodiscard]] CONJURE_API core::result<cooked_blob> parse_cooked_blob(
    std::span<const std::byte> bytes);

Parses and validates a blob: magic, format version, declared sizes against the buffer and the payload hash. Anything wrong is CACHE_CORRUPT.

[[nodiscard]] CONJURE_API core::result<cooked_blob> parse_cooked_blob(
    std::vector<std::byte> &&bytes);

Same validation as the span overload; the buffer becomes the payload, with no second allocation (the bytes in front of the payload are shifted out in place).

parse_cooked_blob_header

[[nodiscard]] CONJURE_API core::result<cooked_blob_header> parse_cooked_blob_header(
    std::span<const std::byte> bytes);

Parses only the header. CACHE_CORRUPT for a short buffer, bad magic or unknown format.

write_cooked_blob

[[nodiscard]] CONJURE_API std::vector<std::byte> write_cooked_blob(
    const cooked_blob &blob);

Serialises a blob. The header's derived fields are recomputed first so the output is always self-consistent.