MAP Docs
MOAT

Internals

Crate path, key types, adjacent protocols for MOAT.

MOAT (Multi-Organization Operations & Treaties) lives in protocols/moat-lib. This page covers where to find the implementation, the key Rust types, and how it composes with adjacent protocols.

Source

PathContains
protocols/moat-lib/src/lib.rsProtocolModule impl, operation dispatch
protocols/moat-lib/src/protocol.rscore protocol logic
protocols/moat-lib/src/types.rsrequest/response types (derive schemars::JsonSchema)
protocols/moat-lib/tests/unit + integration tests
schemas/moat/v1/published JSON Schemas

ProtocolModule contract

impl ProtocolModule for MoatProtocol {
    fn protocol_name(&self) -> &'static str { "MOAT" }
    fn version(&self) -> &'static str { "v1.0.0" }

    fn operations(&self) -> Vec<&'static str> {
        vec![
            "policy_evaluation",
            "violation_detection",
            "policy_update",
            "compliance_query",
            "compliance_assertion",
        ]
    }

    async fn invoke(&self, op: &str, payload: Value, ctx: &InvokeContext)
        -> Result<Response, ProtocolError>
    {
        match op {
            "policy_evaluation" => self.policy_evaluation(payload, ctx).await,
            "violation_detection" => self.violation_detection(payload, ctx).await,
            "policy_update" => self.policy_update(payload, ctx).await,
            "compliance_query" => self.compliance_query(payload, ctx).await,
            "compliance_assertion" => self.compliance_assertion(payload, ctx).await,
            _ => Err(ProtocolError::UnknownOperation(op.into())),
        }
    }
}

Adjacent

RelationMembers
Consults
Records toMAX · MOTET · MOMENT
Subject toMAXIM · MOAT (cross-org) · MOOT (disputes)
Settled withMEAL · MANA · MADE

Status

Implemented · production-grade.

Tests

cargo test -p moat-lib --all-features

See also

On this page