oasis_core_runtime/host/
log_manager.rs1use std::collections::BTreeMap;
2
3use async_trait::async_trait;
4
5use crate::protocol::Protocol;
6
7use super::{host_rpc_call, Error};
8
9pub const LOCAL_RPC_ENDPOINT_LOG_MANAGER: &str = "log-manager";
11
12pub const METHOD_LOG_GET: &str = "LogGet";
14
15#[allow(clippy::double_must_use)]
17#[async_trait]
18pub trait LogManager: Send + Sync {
19 async fn log_get(&self, args: LogGetRequest) -> Result<LogGetResponse, Error>;
23}
24
25#[allow(clippy::double_must_use)]
26#[async_trait]
27impl LogManager for Protocol {
28 async fn log_get(&self, args: LogGetRequest) -> Result<LogGetResponse, Error> {
29 host_rpc_call(self, LOCAL_RPC_ENDPOINT_LOG_MANAGER, METHOD_LOG_GET, args).await
30 }
31}
32
33#[derive(Clone, Debug, Default, cbor::Encode, cbor::Decode)]
37pub struct LogGetRequest {
38 pub labels: BTreeMap<String, String>,
40 pub component_id: String,
42 #[cbor(optional)]
45 pub since: u64,
46}
47
48#[derive(Clone, Debug, Default, cbor::Encode, cbor::Decode)]
50pub struct LogGetResponse {
51 pub logs: Vec<String>,
53}