Skip to main content

DcpServer

Struct DcpServer 

Source
pub struct DcpServer {
    pub context: Arc<DcpContext>,
    pub config: ServerConfig,
    pub metrics: Arc<Metrics>,
    /* private fields */
}
Expand description

DCP Server

Fields§

§context: Arc<DcpContext>

Shared context

§config: ServerConfig

Server configuration

§metrics: Arc<Metrics>

Performance metrics

Implementations§

Source§

impl DcpServer

Source

pub fn new( router: BinaryTrieRouter, context: DcpContext, config: ServerConfig, ) -> Self

Create a new DCP server

Source

pub fn security_audit(&self) -> SecurityAuditLog

Get structured security audit receipts.

Source

pub fn create_session(&self) -> Result<Arc<Session>, DCPError>

Create a new session

Source

pub fn get_session(&self, id: u64) -> Option<Arc<Session>>

Get a session by ID

Source

pub fn remove_session(&self, id: u64) -> Option<Arc<Session>>

Remove a session

Source

pub fn session_count(&self) -> usize

Get active session count

Source

pub fn invoke( &self, tool_id: u16, args: &SharedArgs<'_>, ) -> Result<ToolResult, DCPError>

Invoke a tool by ID.

Raw invocation is deny-by-default. Use invoke_authorized with the negotiated capability manifest for execution.

Source

pub fn invoke_authorized( &self, capabilities: &CapabilityManifest, tool_id: u16, args: &SharedArgs<'_>, ) -> Result<ToolResult, SecurityError>

Invoke a tool only when the negotiated capabilities allow it.

Source

pub fn invoke_signed_authorized( &self, capabilities: &CapabilityManifest, invocation: &SignedInvocation, public_key: &[u8; 32], nonce_store: &mut NonceStore, args: &SharedArgs<'_>, ) -> Result<ToolResult, SecurityError>

Invoke a signed tool call only when signature, args hash, negotiated capabilities, schema validation, and replay protection all pass.

Source

pub fn invoke_by_name( &self, name: &str, args: &SharedArgs<'_>, ) -> Result<ToolResult, DCPError>

Invoke a tool by name (for MCP compatibility).

Raw name-based invocation is deny-by-default. Use invoke_by_name_authorized after capability negotiation.

Source

pub fn invoke_by_name_authorized( &self, capabilities: &CapabilityManifest, name: &str, args: &SharedArgs<'_>, ) -> Result<ToolResult, SecurityError>

Invoke a named tool only when negotiated capabilities allow it.

Source

pub fn upgrade_session(&self, session_id: u64) -> Result<(), DCPError>

Upgrade a session from MCP to DCP

Source

pub fn cleanup_expired_sessions(&self) -> usize

Clean up expired sessions

Source

pub fn server_info(&self) -> ServerInfo

Get server info

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V