MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / on_copy_data

Method on_copy_data

nodedb/src/control/server/pgwire/handler/copy_handler.rs:109–126  ·  view source on GitHub ↗
(&self, client: &mut C, copy_data: CopyData)

Source from the content-addressed store, hash-verified

107#[async_trait]
108impl CopyHandler for NodeDbCopyHandler {
109 async fn on_copy_data<C>(&self, client: &mut C, copy_data: CopyData) -> PgWireResult<()>
110 where
111 C: ClientInfo + Sink<PgWireBackendMessage> + Unpin + Send + Sync,
112 C::Error: Debug,
113 PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
114 {
115 let id = conn_id(&client.socket_addr());
116 match self.restore_state.append(id, &copy_data.data) {
117 Ok(()) => Ok(()),
118 Err(e @ AppendError::NotPending) => {
119 Err(sqlstate(ss::FEATURE_NOT_SUPPORTED, &e.to_string()))
120 }
121 Err(e @ AppendError::OverCap { .. }) => {
122 self.restore_state.cancel(id);
123 Err(sqlstate(ss::PROGRAM_LIMIT_EXCEEDED, &e.to_string()))
124 }
125 }
126 }
127
128 async fn on_copy_done<C>(&self, client: &mut C, _done: CopyDone) -> PgWireResult<()>
129 where

Callers

nothing calls this directly

Calls 6

conn_idFunction · 0.85
socket_addrMethod · 0.80
to_stringMethod · 0.80
sqlstateFunction · 0.70
appendMethod · 0.45
cancelMethod · 0.45

Tested by

no test coverage detected