sigil-execution · anvil
Source declarations, signatures and documentation for anvil.
Source: sigil/node/sigil-execution/src/anvil.rs. SHA-256: d731bbc4f575e5c1cb4dd03229dfe16898b1f1532e3f3455e16be16aee42b868.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
anvil::AnvilHostFunction
ANVIL host function categories — operations that WASM modules can invoke.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "function", content = "params")]
pub enum AnvilHostFunction {
// -- State access --
/// Read a value from the zone's key-value state tree.
StateGet {
/// Key to read.
key: Vec<u8>,
},
/// Write a value to the zone's key-value state tree.
StateSet {
/// Key to write.
key: Vec<u8>,
/// Value to store.
value: Vec<u8>,
},
/// Delete a key from the zone's state tree.
StateDelete {
/// Key to remove.
key: Vec<u8>,
},
// -- Cross-zone messaging --
/// Send a message to another Organization Zone.
SendMessage {
/// Target zone identifier.
target_zone: String,
/// Serialized message payload.
payload: Vec<u8>,
},
// -- Identity queries --
/// Resolve an OAS DID to its document.
ResolveIdentity {
/// The DID to resolve.
did: String,
},
/// Verify the lineage chain of an OAS DID.
VerifyLineage {
/// The DID whose lineage to verify.
did: String,
},
// -- Compute dispatch (feature-gated) --
/// Dispatch a compute request to an external provider.
#[cfg(feature = "compute")]
DispatchCompute {
/// The compute provider's DID.
provider_did: String,
/// Serialized compute request.
request: Vec<u8>,
},
// -- Logging --
/// Emit a log message from the WASM module.
Log {
/// Log severity level.
level: LogLevel,
/// Log message content.
message: String,
},
}Source line: 11.
anvil::LogLevel
Log severity levels for ANVIL Log host function.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum LogLevel {
/// Detailed debugging information.
Debug,
/// General informational messages.
Info,
/// Potentially harmful situations.
Warn,
/// Error conditions.
Error,
}Source line: 77.
anvil::AnvilResult
Result of an ANVIL host function call.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum AnvilResult {
/// A value was returned (e.g., from StateGet or ResolveIdentity).
Value(Vec<u8>),
/// The operation succeeded but produced no return value.
Void,
/// The operation failed.
Error(AnvilError),
}Source line: 90.
anvil::AnvilError
Errors that can occur during an ANVIL host function call.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum AnvilError {
/// The requested key does not exist in the zone state.
KeyNotFound(String),
/// The caller does not have permission for this operation.
PermissionDenied(String),
/// An argument was malformed or out of range.
InvalidArgument(String),
/// Gas was exhausted during the host function call.
OutOfGas,
/// The target zone was not found (for cross-zone messaging).
ZoneNotFound(String),
/// The cross-zone message queue is full.
MessageQueueFull,
}Source line: 101.