1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
mod pool;
mod global;
mod client;
mod types;

pub use types::{
    ErebusRequestType,
    ObjectCacheRequest,
    UrlCacheRequest,
    ErebusPackedRequest,
    ErebusResponse,
    ObjectCacheResponse,
    UrlCacheResponse,
};

use futures_util::{SinkExt, StreamExt};
use serde::{Deserialize, Serialize};
use std::future::Future;

pub async fn object_cache(
    request: ObjectCacheRequest,
) -> Result<ObjectCacheResponse, Box<dyn std::error::Error>> {
    let x = global::EREBUS_CACHE_POOL.get_instance();
    let mut y = x.lock().await;

    y.object_cache(request).await
}

pub async fn url_cache(
    request: UrlCacheRequest,
) -> Result<UrlCacheResponse, Box<dyn std::error::Error>> {
    let x = global::EREBUS_CACHE_POOL.get_instance();
    let mut y = x.lock().await;

    y.url_cache(request).await
}