Namespaces

Records

Functions

  • fit::result<std::string_view> CheckItemHeader (const zbi_header_t & header)

    Validates ZBI item and container headers, returning a description of the

    failure in that event. The check is agnostic of storage capacity; whether

    the encoded length is sensible is left to the caller.

    Defined at line 11 of file ../../src/lib/zbitl/checking.cc

  • std::string_view TypeName (uint32_t )

    This returns the canonical name string for this zbi_header_t.type value.

    It returns the default-constructed (empty()) string_view for unknown types.

    Defined at line 14 of file ../../src/lib/zbitl/item.cc

  • template <typename Storage>
    Image<Storage> <deduction guide for Image> (Storage )

    Deduction guide: Image img(T{}) instantiates Image

    <T

    >.

  • template <typename Storage>
    View<Storage> <deduction guide for View> (Storage )

    Deduction guide: View v(T{}) instantiates View

    <T

    >.

  • uint32_t BytesPerPixel (zbi_pixel_format_t format)

    Returns the number of bytes per pixel for a given format.

    Defined at line 15 of file ../../src/lib/zbitl/include/lib/zbitl/items/graphics.h

  • template <typename ViewError>
    std::string ViewErrorString (const ViewError & error)

    Returns an error string from a View `Error` value.

    Defined at line 17 of file ../../src/lib/zbitl/include/lib/zbitl/error-string.h

  • template <typename ViewError, typename Printer>
    void PrintViewError (const ViewError & error, Printer && printer)

    Prints an error message from a View `Error` value, where Printer is a

    callable type with a printf-like signature.

    Defined at line 22 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • zbi_header_t SanitizeHeader (zbi_header_t header)

    Modify a header so that it passes checks. This can be used to mint new

    items from a designated initializer that omits uninteresting bits.

    Defined at line 24 of file ../../src/lib/zbitl/include/lib/zbitl/checking.h

  • fit::result<std::string_view> CheckContainerHeader (const zbi_header_t & header)

    Defined at line 27 of file ../../src/lib/zbitl/checking.cc

  • template <typename Writer>
    void JsonWriteHeader (Writer && writer, const zbi_header_t & header, std::optional<uint32_t> offset)

    Takes any class compatible with the rapidjson::Writer API. This emits keys

    and values describing the header fields. It should be called after

    writer.StartObject() and before writer.EndObject(). It doesn't call those

    itself in case the caller wants to add the "contents" key (or others).

    Defined at line 29 of file ../../src/lib/zbitl/include/lib/zbitl/json.h

  • template <typename ViewCopyError>
    std::string ViewCopyErrorString (const ViewCopyError & error)

    Returns an error string from a View `CopyError` value.

    Defined at line 30 of file ../../src/lib/zbitl/include/lib/zbitl/error-string.h

  • template <typename ViewError>
    void PrintViewError (const ViewError & error, FILE * f)

    Defined at line 34 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • template <typename ViewError>
    void PrintViewError (const ViewError & error, FILE * f)

    Defined at line 34 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • template <class Zbi>
    fit::result<typename Zbi::Error> CheckBootable (Zbi zbi, uint32_t kernel_type)

    Returns empty if and only if the ZBI is bootable, otherwise an error

    string. This takes any zbitl::View type or any type that acts like it.

    Note this does not check for errors from zbi.take_error() so if Zbi is

    zbitl::View then the caller must use zbi.take_error() afterwards. This

    function always scans every item so all errors Zbi::iterator detects will

    be found. But this function's return value only indicates if the items

    that were scanned before any errors were encountered added up to a complete

    ZBI (regardless of whether there were additional items with errors).

    Defined at line 42 of file ../../src/lib/zbitl/include/lib/zbitl/checking.h

  • template <PayloadCompatibleStorage T, PayloadData U>
    std::span<T> AsSpan (U * payload, size_t len)

    It is expected that `payload` is `kStorageAlignment`-aligned in the

    following AsSpan methods (see StorageTraits below), along with `T` itself.

    This ensures that `payload` is `alignof(T)`-aligned as well, which in

    particular means that it is safe to reinterpret a `U*` as a `T*`.

    Defined at line 46 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <PayloadCompatibleStorage T, PayloadData U>
    std::span<T> AsSpan (U * payload, size_t len)

    It is expected that `payload` is `kStorageAlignment`-aligned in the

    following AsSpan methods (see StorageTraits below), along with `T` itself.

    This ensures that `payload` is `alignof(T)`-aligned as well, which in

    particular means that it is safe to reinterpret a `U*` as a `T*`.

    Defined at line 46 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <PayloadCompatibleStorage T, PayloadData U>
    std::span<T> AsSpan (U * payload, size_t len)

    It is expected that `payload` is `kStorageAlignment`-aligned in the

    following AsSpan methods (see StorageTraits below), along with `T` itself.

    This ensures that `payload` is `alignof(T)`-aligned as well, which in

    particular means that it is safe to reinterpret a `U*` as a `T*`.

    Defined at line 46 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <PayloadCompatibleStorage T, PayloadData U>
    std::span<T> AsSpan (U * payload, size_t len)

    It is expected that `payload` is `kStorageAlignment`-aligned in the

    following AsSpan methods (see StorageTraits below), along with `T` itself.

    This ensures that `payload` is `alignof(T)`-aligned as well, which in

    particular means that it is safe to reinterpret a `U*` as a `T*`.

    Defined at line 46 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <typename ViewCopyError, typename Printer>
    void PrintViewCopyError (const ViewCopyError & error, Printer && printer)

    Prints an error message from a View `CopyError` value, where Printer is a

    callable type with a printf-like signature.

    Defined at line 46 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • template <typename BootfsError>
    std::string BootfsErrorString (const BootfsError & error)

    Returns an error string from a Bootfs `Error` value.

    Defined at line 48 of file ../../src/lib/zbitl/include/lib/zbitl/error-string.h

  • template <typename T, contiguous_range R>
    std::span<T> AsSpan (R && payload)

    Defined at line 54 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <typename T, contiguous_range R>
    std::span<T> AsSpan (R && payload)

    Defined at line 54 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <typename T, contiguous_range R>
    std::span<T> AsSpan (R && payload)

    Defined at line 54 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <typename T, contiguous_range R>
    std::span<T> AsSpan (R && payload)

    Defined at line 54 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <auto* payload>
    ByteView AsBytes (const PayloadData auto * payload, size_t len)

    **NOTE:** This takes any pointer type, but the size is always in bytes.

    Consider using std::as_bytes(std::span{payload, count}) for a count of

    pointee objects instead.

    Defined at line 61 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <auto* payload>
    ByteView AsBytes (const PayloadData auto * payload, size_t len)

    **NOTE:** This takes any pointer type, but the size is always in bytes.

    Consider using std::as_bytes(std::span{payload, count}) for a count of

    pointee objects instead.

    Defined at line 61 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <auto* payload>
    ByteView AsBytes (const PayloadData auto * payload, size_t len)

    **NOTE:** This takes any pointer type, but the size is always in bytes.

    Consider using std::as_bytes(std::span{payload, count}) for a count of

    pointee objects instead.

    Defined at line 61 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <auto* payload>
    ByteView AsBytes (const PayloadData auto * payload, size_t len)

    **NOTE:** This takes any pointer type, but the size is always in bytes.

    Consider using std::as_bytes(std::span{payload, count}) for a count of

    pointee objects instead.

    Defined at line 61 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • std::string_view TypeName (const zbi_header_t & header)

    Defined at line 62 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • template <typename ViewCopyError>
    void PrintViewCopyError (const ViewCopyError & error, FILE * f)

    Defined at line 63 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • template <typename ViewCopyError>
    void PrintViewCopyError (const ViewCopyError & error, FILE * f)

    Defined at line 63 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • template <contiguous_range R>
    ByteView AsBytes (R && payload)

    Defined at line 67 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <contiguous_range R>
    ByteView AsBytes (R && payload)

    Defined at line 67 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <contiguous_range R>
    ByteView AsBytes (R && payload)

    Defined at line 67 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <contiguous_range R>
    ByteView AsBytes (R && payload)

    Defined at line 67 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • std::string_view TypeExtension (const zbi_header_t & header)

    Defined at line 68 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • ByteView AsBytes (std::string_view sv)

    Defined at line 71 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • ByteView AsBytes (std::string_view sv)

    Defined at line 71 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • bool TypeIsKernel (uint32_t type)

    Returns true for any kernel item type.

    Defined at line 73 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • template <typename BootfsError, typename Printer>
    void PrintBootfsError (const BootfsError & error, Printer && printer)

    Prints an error message from a BootfsView `Error` value, where Printer is a

    callable type with a printf-like signature.

    Defined at line 75 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • bool TypeIsKernel (const zbi_header_t & header)

    Defined at line 77 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • template <auto& payload>
    ByteView AsBytes (const PayloadData auto & payload)

    **NOTE:** Use with caution! This takes the address of the argument passed

    by reference. It should only be used as part of a complete expression that

    is consuming the ByteView so there can never be dangling pointers to a

    temporary object.

    Defined at line 77 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <auto& payload>
    ByteView AsBytes (const PayloadData auto & payload)

    **NOTE:** Use with caution! This takes the address of the argument passed

    by reference. It should only be used as part of a complete expression that

    is consuming the ByteView so there can never be dangling pointers to a

    temporary object.

    Defined at line 77 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <auto& payload>
    ByteView AsBytes (const PayloadData auto & payload)

    **NOTE:** Use with caution! This takes the address of the argument passed

    by reference. It should only be used as part of a complete expression that

    is consuming the ByteView so there can never be dangling pointers to a

    temporary object.

    Defined at line 77 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <auto& payload>
    ByteView AsBytes (const PayloadData auto & payload)

    **NOTE:** Use with caution! This takes the address of the argument passed

    by reference. It should only be used as part of a complete expression that

    is consuming the ByteView so there can never be dangling pointers to a

    temporary object.

    Defined at line 77 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • bool TypeIsStorage (const zbi_header_t & header)

    Defined at line 82 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • uint32_t UncompressedLength (const zbi_header_t & header)

    This returns the length of the item payload after decompression.

    If this is not a ZBI_TYPE_STORAGE_* item, this is just `header.length`.

    Defined at line 86 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • uint32_t AlignedPayloadLength (uint32_t content_length)

    Defined at line 90 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • std::string_view TypeExtension (uint32_t )

    This returns the canonical file name extension string for this

    zbi_header_t.type value. It returns the default-constructed (i.e. empty())

    string_view for unknown types.

    Defined at line 90 of file ../../src/lib/zbitl/item.cc

  • template <typename Writer>
    void JsonWriteItem (Writer && writer, const zbi_header_t & header, std::optional<uint32_t> offset)

    Takes any class compatible with the rapidjson::Writer API and emits a JSON

    object describing the item's header details. This omits "contents" fields.

    Defined at line 91 of file ../../src/lib/zbitl/include/lib/zbitl/json.h

  • template <typename BootfsError>
    void PrintBootfsError (const BootfsError & error, FILE * f)

    Defined at line 93 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • template <typename BootfsError>
    void PrintBootfsError (const BootfsError & error, FILE * f)

    Defined at line 93 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • uint32_t AlignedPayloadLength (const zbi_header_t & header)

    Defined at line 94 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • uint32_t AlignedItemLength (uint32_t content_length)

    Defined at line 98 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • uint32_t AlignedItemLength (const zbi_header_t & header)

    Defined at line 102 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • template <typename Writer, typename Payload, typename Contents>
    void JsonWriteItemWithContents (Writer && writer, Contents && contents, const zbi_header_t & header, Payload && payload, std::optional<uint32_t> offset)

    Takes any class compatible with the rapidjson::Writer API and emits a JSON

    object describing the item's header details. If there is a nonempty

    payload, this calls `contents(writer, key, header, payload)` and that

    should call `writer.Key(key)` and some appropriate value type if it wants

    to describe the contents; if it does nothing, the output is the same as for

    JsonWriteItem (above).

    Defined at line 105 of file ../../src/lib/zbitl/include/lib/zbitl/json.h

  • bool TypeIsStorage (uint32_t )

    Returns true for any ZBI_TYPE_STORAGE_* type.

    These share a protocol for other header fields, compression, etc.

    Defined at line 105 of file ../../src/lib/zbitl/item.cc

  • zbi_header_t ContainerHeader (uint32_t length)

    Defined at line 106 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • template <typename Writer, typename Zbi, typename Contents = JsonIgnoreContents>
    void JsonWriteZbi (Writer && writer, Zbi && zbi, std::optional<uint32_t> offset, Contents && contents)

    Defined at line 121 of file ../../src/lib/zbitl/include/lib/zbitl/json.h

  • template <PayloadData Data, StorageApi Storage>
    fit::result<typename StorageTraits<Storage>::error_type, std::reference_wrapper<const Data>> ReadSparseDataFromStorage (Storage & storage, uint32_t offset)

    zbitl::ReadSparseDataFromStorage

    <Data

    >(storage, offset) reads a single datum

    from any StorageApi object. It returns either fit::result

    <error

    _type, Data>

    or fit::result

    <error

    _type, std::reference_wrapper

    <const

    Data>>. This is

    meant to be used for things like headers that often have low locality with

    other accesses likely to be made soon.

    Defined at line 376 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <PayloadData Data, StorageApi Storage>
    fit::result<typename StorageTraits<Storage>::error_type, std::reference_wrapper<const Data>> ReadSparseDataFromStorage (Storage & storage, uint32_t offset)

    zbitl::ReadSparseDataFromStorage

    <Data

    >(storage, offset) reads a single datum

    from any StorageApi object. It returns either fit::result

    <error

    _type, Data>

    or fit::result

    <error

    _type, std::reference_wrapper

    <const

    Data>>. This is

    meant to be used for things like headers that often have low locality with

    other accesses likely to be made soon.

    Defined at line 376 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <PayloadData Data, StorageApi Storage>
    fit::result<typename StorageTraits<Storage>::error_type, Data> ReadSparseDataFromStorage (Storage & storage, uint32_t offset)

    Defined at line 396 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <typename Storage = ByteView>
    Storage StorageFromRawHeader (std::conditional_t<std::is_const_v<typename Storage::element_type>, const zbi_header_t, zbi_header_t> * zbi)

    Convert a pointer to an in-memory ZBI into a Storage type.

    We require that `zbi` is a pointer to a valid ZBI container header followed

    by its payload. Basic magic checks on the header are performed; if they

    fail, we return a Storage spanning just the header but no payload under the

    assumption that the "length" field of the header is invalid.

    The template parameter `Storage` may be any storage type that can be

    constructed with arguments the arguments (const std::byte*, size_t),

    representing the start and length of the in-memory ZBI.

    Defined at line 1352 of file ../../src/lib/zbitl/include/lib/zbitl/view.h

Concepts

template <typename T> PayloadCompatibleStorage __alignof(T) <= kStorageAlignment

Defined at line 31 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <typename T> PayloadData __alignof(T) <= ((uint32_t)(8U)) && std::is_standard_layout_v<T> && std::is_trivially_copyable_v<T> && std::is_trivially_destructible_v<T> && std::has_unique_object_representations_v<T>

These are types that might appropriately be used in ZBI item payloads.

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <typename T> ViewCopyStorageScratchAllocatorResultApi requires (T result) { typename T::value_type; requires std::same_as<fit::result<std::string_view, typename T::value_type>, T>; requires std::movable<typename T::value_type>; { result.value().get() } -> std::convertible_to<void *>; }

This is a helper concept for the return value of the callback passed to

zbitl::View

<

...>::CopyStorageItem().

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/view.h

template <class Traits, typename Storage> StorageTraitsBaseApi requires { typename Traits::error_type; requires std::copyable<typename Traits::error_type>; requires std::default_initializable<typename Traits::error_type>; typename fit::result<typename Traits::error_type>; typename Traits::payload_type; requires std::copyable<typename Traits::payload_type>; requires std::default_initializable<typename Traits::error_type>; } && requires (Storage &storage_ref, Traits::error_type error, Traits::payload_type payload) { { Traits::error_string(error) } -> std::convertible_to<std::string_view>; { Traits::Capacity(storage_ref) } -> std::same_as<fit::result<typename Traits::error_type, uint32_t>>; { Traits::Payload(storage_ref, uint32_t{}, uint32_t{}) } -> std::same_as<fit::result<typename Traits::error_type, typename Traits::payload_type>>; }

Every zbitl::StorageTraits

<Storage

> specialization must meet at least this

basic contract. However the storage works, the pointers exchanged via this

API are presumed to be `zbitl::kStorageAlignment`-aligned.

Defined at line 92 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <class Traits, typename Storage> StorageTraitsBufferedReadApi requires (Storage &storage_ref, uint32_t offset, uint32_t length) { requires StorageTraitsBaseApi<Traits, Storage>; { Traits::Read(storage_ref, *Traits::Payload(storage_ref, offset, length), length, [](ByteView contents) -> fit::result<fit::failed> {
    return fit::ok();
}) } -> std::same_as<fit::result<typename Traits::error_type, fit::result<fit::failed> >>; }

Referred to as the "buffered read".

This reads the payload indicated by a payload_type as returned by Payload

and feeds it to the callback in chunks sized for the convenience of the

storage backend. The length is guaranteed to match that passed to Payload

to fetch this payload_type value.

The callback returns some type fit::result

<E

>. Read returns

fit::result

<error

_type, fit::result

<E

>>>, yielding a storage error or the

result of the callback. If a callback returns an error, its return value

is used immediately. If a callback returns success, another callback may

be made for another chunk of the payload. If the payload is empty

(`length` == 0), there will always be a single callback made with an empty

data argument.

Defined at line 152 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <class Traits, typename Storage> StorageTraitsUnbufferedReadApi requires (Storage &storage_ref, uint32_t offset, void *buffer, uint32_t length) { requires StorageTraitsBaseApi<Traits, Storage>; { Traits::Read(storage_ref, *Traits::Payload(storage_ref, offset, length), buffer, length) } -> std::same_as<fit::result<typename Traits::error_type>>; }

Referred to as the "unbuffered read".

A specialization provides this overload if the payload can be read directly

into a provided buffer for zero-copy operation.

Defined at line 166 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <class Traits, typename Storage, typename T, bool LowLocality> StorageTraitsOneShotReadApi requires (Storage &storage_ref, uint32_t offset, uint32_t length) { requires StorageTraitsBaseApi<Traits, Storage>; requires PayloadCompatibleStorage<T>; { Traits::template Read<T, LowLocality>(storage_ref, *Traits::Payload(storage_ref, offset, length), length) } -> std::same_as<fit::result<typename Traits::error_type, std::span<const T> >>; }

Referred to as the "one-shot read".

A specialization only provides this overload if the payload can be accessed

directly in memory. If this overload is provided, then the other overloads

need not be provided. The returned view is only guaranteed valid until the

next use of the same Storage object. So it could e.g. point into a cache

that's repurposed by this or other calls made later using the same object.

One may attempt to read the data out in any particular form, parameterized

by `T`, provided that `alignof(T)

<

= kStorageAlignment`. The offset

associated with `payload` is expected to be `alignof(T)`-aligned, though

that is an invariant that the caller must keep track of.

`LowLocality` gives whether there is an expectation that adjacent data will

subsequently be read; if true, the amortized cost of the read might be

determined to be too high and storage backends might decide to perform the

read differently or not implement the method at all in this case.

Defined at line 192 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <class Traits, typename Storage> StorageTraitsApi StorageTraitsBufferedReadApi<Traits, Storage> || StorageTraitsUnbufferedReadApi<Traits, Storage> || (StorageTraitsOneShotReadApi<Traits, Storage, std::byte, true> && StorageTraitsOneShotReadApi<Traits, Storage, std::byte, false>)

Defined at line 203 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <class Traits, typename Storage> StorageTraitsWriteApi requires (Storage &storage_ref, uint32_t offset) { requires StorageTraitsApi<Traits, Storage>; { Traits::Write(storage_ref, offset, ByteView{}) } -> std::same_as<fit::result<typename Traits::error_type>>; { Traits::EnsureCapacity(storage_ref, offset) } -> std::same_as<fit::result<typename Traits::error_type>>; }

A specialization must meet this additional contract to support mutation.

Defined at line 211 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <class Traits, typename Storage> StorageTraitsUnbufferedWriteApi requires (Storage &storage_ref, uint32_t offset, uint32_t length) { requires StorageTraitsApi<Traits, Storage>; { Traits::Write(storage_ref, offset, length) } -> std::same_as<fit::result<typename Traits::error_type, void *>>; }

A specialization that satisfies StorageTraitsWriteApi can also define

additional Write overloads for optimization.

Defined at line 237 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <typename T, class Traits> StorageTraitsResultApi requires { typename T::value_type; requires std::same_as<T, fit::result<typename Traits::error_type, typename T::value_type> >; }

This is a helper concept for any fit::result

<Traits

::error_type, ...> type.

Defined at line 255 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <typename T> StorageApi requires { typename StorageTraits<std::decay_t<T> >; requires StorageTraitsApi<StorageTraits<std::decay_t<T> >, std::decay_t<T> >; }

zbitl::StorageApi is true of any type with a valid specialization.

Defined at line 262 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <typename T> WritableStorageApi requires { requires StorageApi<T>; requires StorageTraitsWriteApi<StorageTraits<std::decay_t<T> >, std::decay_t<T> >; }

zbitl::WritableStorageApi is true of any type with a specialization that

supports mutation.

Defined at line 270 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <class Traits, typename Storage> StorageTraitsCreateApi requires (Storage &storage_ref, uint32_t capacity, uint32_t initial_zero_size) { { Traits::Create(storage_ref, capacity, initial_zero_size) } -> StorageTraitsResultApi<Traits>; }

A specialization that satisfies StorageTraitsWriteApi might also support

creating new storage from whole cloth if that makes sense for the storage

type somehow.

Defined at line 279 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <typename T> StorageTraitsCloneSlopCheckApi requires (T slopcheck, uint32_t slop_bytes) { { slopcheck(slop_bytes) } -> std::convertible_to<_Bool>; }

This is a helper concept for the "slop-check" function passed to Clone.

StorageTraits

<

...>::Clone implementations can use this for their template

parameter.

Defined at line 299 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <typename T, class Traits> StorageTraitsCloneResultApi requires (T result) { requires StorageTraitsResultApi<T, Traits>; typename T::value_type::value_type; requires std::same_as<typename T::value_type, std::optional<typename T::value_type::value_type> >; typename T::value_type::value_type::first_type; typename T::value_type::value_type::second_type; requires std::same_as<typename T::value_type::value_type, std::pair<typename T::value_type::value_type::first_type, typename T::value_type::value_type::second_type> >; requires StorageApi<typename T::value_type::value_type::first_type>; requires std::same_as<typename T::value_type::value_type::second_type, uint32_t>; }

This is a helper concept for the return value of Traits::Clone, below.

Defined at line 305 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <class Traits, typename Storage, typename SlopCheck> StorageTraitsCloneApi requires (Storage &storage_ref, uint32_t offset, uint32_t length, uint32_t to_offset, SlopCheck slopcheck) { requires StorageTraitsCreateApi<Traits, Storage>; requires StorageTraitsCloneSlopCheckApi<SlopCheck>; { Traits::Clone(storage_ref, offset, length, to_offset, slopcheck) } -> StorageTraitsCloneResultApi<Traits>; }

A specialization that satisfies StorageTraitsCreateApi might also support

creating new storage by making a virtual copy ("clone") of existing storage.

Defined at line 328 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

template <typename FromStoragetypename ToStorage = FromStorage> ZeroCopyStorageApi StorageApi<FromStorage> && WritableStorageApi<ToStorage> && (StorageTraitsOneShotReadApi<StorageTraits<FromStorage>, FromStorage, std::byte, false> || (StorageTraitsUnbufferedReadApi<StorageTraits<FromStorage>, FromStorage> && StorageTraitsUnbufferedWriteApi<StorageTraits<ToStorage>, ToStorage>))

zbitl::ZeroCopyStorageApi

<FromStorage

, ToStorage> is true if there are no

copies into buffers in either direction to make the copy.

Defined at line 361 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

Variables

const std::array<unsigned int, 1 + sizeof...(_Args)> kItemTypes

Defined at line 22 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

const uint32_t kReadMinimum

Defined at line 435 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h