use std::io::{Read, Write};
use std::path::{Path, PathBuf};
use remotefs::File;
use remotefs::fs::{Metadata, UnixPex};
use super::HostResult;
pub trait HostBridge {
fn connect(&mut self) -> HostResult<()>;
fn disconnect(&mut self) -> HostResult<()>;
fn is_connected(&mut self) -> bool;
fn is_localhost(&self) -> bool;
fn pwd(&mut self) -> HostResult<PathBuf>;
fn change_wrkdir(&mut self, new_dir: &Path) -> HostResult<PathBuf>;
fn mkdir(&mut self, dir_name: &Path) -> HostResult<()> {
self.mkdir_ex(dir_name, false)
}
fn mkdir_ex(&mut self, dir_name: &Path, ignore_existing: bool) -> HostResult<()>;
fn remove(&mut self, entry: &File) -> HostResult<()>;
fn rename(&mut self, entry: &File, dst_path: &Path) -> HostResult<()>;
fn copy(&mut self, entry: &File, dst: &Path) -> HostResult<()>;
fn stat(&mut self, path: &Path) -> HostResult<File>;
fn exists(&mut self, path: &Path) -> HostResult<bool>;
fn list_dir(&mut self, path: &Path) -> HostResult<Vec<File>>;
fn setstat(&mut self, path: &Path, metadata: &Metadata) -> HostResult<()>;
fn exec(&mut self, cmd: &str) -> HostResult<String>;
fn symlink(&mut self, src: &Path, dst: &Path) -> HostResult<()>;
fn chmod(&mut self, path: &Path, pex: UnixPex) -> HostResult<()>;
fn open_file(&mut self, file: &Path) -> HostResult<Box<dyn Read + Send>>;
fn create_file(
&mut self,
file: &Path,
metadata: &Metadata,
) -> HostResult<Box<dyn Write + Send>>;
fn finalize_write(&mut self, writer: Box<dyn Write + Send>) -> HostResult<()>;
}