pub(crate) type Nfs2Client = nfs_v2::Nfs2Client<crate::proto::transport::PooledTransport>;
pub(crate) const DEFAULT_MACHINENAME: &str = "nfswolf";
pub(crate) trait PooledNfs2 {
#[expect(dead_code, reason = "API parity with PooledNfs3; needed when v2 circuit breaker consumers land")]
fn host(&self) -> std::net::SocketAddr;
fn uid(&self) -> u32;
fn gid(&self) -> u32;
fn machinename(&self) -> &str;
fn with_credential(&self, credential: crate::proto::auth::Credential, uid: u32, gid: u32) -> Self;
}
impl PooledNfs2 for Nfs2Client {
fn host(&self) -> std::net::SocketAddr {
self.transport().addr()
}
fn uid(&self) -> u32 {
self.transport().uid()
}
fn gid(&self) -> u32 {
self.transport().gid()
}
fn machinename(&self) -> &str {
match self.transport().credential() {
crate::proto::auth::Credential::Sys(a) => &a.machinename,
crate::proto::auth::Credential::None => DEFAULT_MACHINENAME,
}
}
fn with_credential(&self, credential: crate::proto::auth::Credential, uid: u32, gid: u32) -> Self {
Self::new(self.transport().with_credential(credential, uid, gid))
}
}