weave-strand · policy
Source declarations, signatures and documentation for policy.
Source: sigil/weave/models/strand/src/policy.rs. SHA-256: 114bd9e3647e5e523fc6728905bcfab5dc3c1c994df23bb218cc98560a977cd7.
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.
Module condition:
#[cfg(feature = "policy-hooks")]policy::StrandPolicy
Strand policy hook for append operations
#[cfg(feature = "policy-hooks")]
pub trait StrandPolicy: Send + Sync + 'static {
/// Decide if a block can be appended
fn can_append(&self, writer_public_key: &[u8; 32], data: &[u8]) -> bool;
}Source line: 4.
policy::AllowAllPolicy
Allow-all default policy for convenience
#[cfg(feature = "policy-hooks")]
pub struct AllowAllPolicy;Source line: 10.
policy::TRACE_POLICY
Global policy instance (optional)
#[cfg(feature = "policy-hooks")]
pub static TRACE_POLICY: OnceCell<Box<dyn StrandPolicy>>;Source line: 19.
policy::set_strand_policy
Set the global strand policy. Returns Err if already set.
#[cfg(feature = "policy-hooks")]
pub fn set_strand_policy(policy: Box<dyn StrandPolicy>) -> Result<(), Box<dyn StrandPolicy>>;Source line: 22.