feat(call): implement CallConnection with imported-ops overlay (Layer 2) and call/subscribe/abort methods
Implements CallConnection in src/protocol/connection.rs representing an established alknet/call connection (either direction). Holds the Layer 2 imported-ops overlay (ADR-024) as Arc<RwLock<HashMap>>. - register_imported / register_imported_all add to the connection overlay - overlay_env returns an OperationEnv dispatching to imported ops; contains() returns true only for ops in the overlay - call() opens a stream, sends call.requested, registers in PendingRequestMap, spawns a stream reader, resolves on first call.responded - subscribe() sends call.requested and yields call.responded until call.completed/call.aborted via a SubscriptionStream wrapping the mpsc receiver - abort() sends call.aborted for the request ID and removes the pending entry - connection drop drops the overlay (no explicit deregistration needed) Exposes MockConnection trait and Connection::from_mock in alknet-core so cross-crate tests can construct mock connections without real QUIC. Removes two unused test helpers in env.rs that triggered dead-code warnings under -D warnings. Adds parking_lot dep for the overlay RwLock and pending Mutex. 9 new connection tests (102 total in alknet-call). Clippy clean.
This commit is contained in:
@@ -199,30 +199,6 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
fn external_spec(name: &str, acl: AccessControl) -> OperationSpec {
|
||||
OperationSpec::new(
|
||||
name,
|
||||
OperationType::Query,
|
||||
Visibility::External,
|
||||
serde_json::json!({}),
|
||||
serde_json::json!({}),
|
||||
vec![],
|
||||
acl,
|
||||
)
|
||||
}
|
||||
|
||||
fn internal_spec(name: &str, acl: AccessControl) -> OperationSpec {
|
||||
OperationSpec::new(
|
||||
name,
|
||||
OperationType::Query,
|
||||
Visibility::Internal,
|
||||
serde_json::json!({}),
|
||||
serde_json::json!({}),
|
||||
vec![],
|
||||
acl,
|
||||
)
|
||||
}
|
||||
|
||||
fn echo_handler() -> crate::registry::registration::Handler {
|
||||
make_handler(
|
||||
|input, context| async move { ResponseEnvelope::ok(context.request_id, input) },
|
||||
|
||||
Reference in New Issue
Block a user