/vault/delete/{channel}
Kind 7: a key deleted; ok or an error, in exactly one message.
The ask is kind 7 on /requests:
[7][key …]
The server answers on /vault/delete/{channel} by sending exactly one
message and closing the connection. A path that the proxy or the server closes cleanly with no message
before the close states that the ask was not served. An abrupt end of the
path leaves the operation failed, and the proxy does not ask it
again, as Vault provides.
The ask is defined by diverge-provider-sdk/src/shared/containers/vault/delete/request/request.rs:
//! Remove a key. Answered `Ok` whether or not it existed — the state
use std::convert::Infallible;
use super::super::super::RequestError;
use crate::encode::{Encode, Writer};
/// Remove a key. Answered `Ok` whether or not it existed — the state
/// asked for is the state that results.
///
/// ```text
/// [key: utf8…]
/// ```
///
/// The key is the whole payload: nothing follows it, so nothing
/// delimits it. Answered with one
/// [`response::Frame`](super::super::response::Frame).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Request<'a> {
/// The key.
pub key: &'a str,
}
impl Encode for Request<'_> {
/// [`Infallible`]: bytes copied.
type Error = Infallible;
fn encode(&self, out: &mut Writer<'_>) -> Result<(), Infallible> {
out.extend_from_slice(self.key.as_bytes());
Ok(())
}
}
impl<'a> Request<'a> {
/// Decode from the bytes after the ask's kind. The key borrows
/// from `bytes`.
pub fn decode(bytes: &'a [u8]) -> Result<Self, RequestError> {
std::str::from_utf8(bytes)
.map(|key| Request { key })
.map_err(|_| RequestError::KeyUtf8)
}
}
The answer is the frame defined on Vault: a first byte of 0 states that the operation was done; a first byte of 1 is followed by a message stating why it was not.