~james/core

core/shuttle/src/cache/write_proxy.rs -rw-r--r-- 511 bytes
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 14 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use crate::host_proxy::VsockTcpProxy;
use anyhow::Result;

pub struct WriteCacheProxy {
    inner: VsockTcpProxy,
}

impl WriteCacheProxy {
    pub async fn start(host_cid: u32, host_port: u32) -> Result<Option<Self>> {
        if host_port == 0 {
            return Ok(None);
        }

        let inner =
            VsockTcpProxy::start("write cache proxy", "127.0.0.1:0", host_cid, host_port).await?;
        Ok(Some(Self { inner }))
    }

    pub fn url(&self) -> &str {
        self.inner.url()
    }
}