Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
identical and its digest is unchanged, so this is transparent to readers and
to previously saved snapshots. Filesystems that do not support sparse files
store the blob as before.
* Expose C guest `ByteChunks` values as pointer and length arrays.
* Return typed `hl_ReturnValue` objects from C guest functions through
`hl_result_from_*` constructors.

### Removed

Expand Down
35 changes: 35 additions & 0 deletions src/hyperlight_common/src/flatbuffer_wrappers/codec.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2026 The Hyperlight Authors.

use alloc::vec::Vec;

use anyhow::Result;
use bytes::Bytes;

/// Receives external byte values while their FlatBuffer metadata is encoded.
///
/// Values are delivered in their logical order without flattening chunked
/// values. The value lifetime allows a sink to retain references until the
/// control buffer has been written, without copying payload bytes.
pub trait ExternalValueSink<'a> {
/// Receive one contiguous byte value.
fn push_bytes(&mut self, value: &'a [u8]) -> Result<()>;

/// Receive one logical byte sequence represented as chunks.
fn push_chunks(&mut self, value: &'a [Bytes]) -> Result<()>;
}

/// Supplies complete external byte values while a FlatBuffer is decoded.
///
/// Implementations must validate `length` against available input and the
/// resource budget before allocating.
pub trait ExternalValueSource {
/// Take the next external value as contiguous bytes.
fn take_bytes(&mut self, length: usize) -> Result<Vec<u8>>;

/// Take the next external value as owned byte chunks.
fn take_chunks(&mut self, length: usize) -> Result<Vec<Bytes>>;

/// Finish decoding and reject any unused external values.
fn finish(&mut self) -> Result<()>;
}
Comment thread
yoshuawuyts marked this conversation as resolved.
462 changes: 457 additions & 5 deletions src/hyperlight_common/src/flatbuffer_wrappers/function_call.rs

Large diffs are not rendered by default.

Loading
Loading