pub struct RepoManager {
pub remotes: Vec<String>,
pub locals: Vec<String>,
pub remote_map: BTreeMap<String, RemotePath>,
pub download_path: PathBuf,
pub download_backend: Rc<Box<dyn DownloadBackend>>,
pub callback: Rc<RefCell<dyn Callback>>,
}Expand description
Remote package management
Fields§
§remotes: Vec<String>http sources
locals: Vec<String>file sources
remote_map: BTreeMap<String, RemotePath>detailed http + file sources
download_path: PathBuf§download_backend: Rc<Box<dyn DownloadBackend>>§callback: Rc<RefCell<dyn Callback>>Implementations§
Source§impl RepoManager
impl RepoManager
pub fn new( callback: Rc<RefCell<dyn Callback>>, download_backend: Box<dyn DownloadBackend>, ) -> Self
Sourcepub fn set_download_path(&mut self, path: PathBuf)
pub fn set_download_path(&mut self, path: PathBuf)
override from default
Sourcepub fn update_remotes(
&mut self,
target: &str,
install_path: &Path,
) -> Result<(), Error>
pub fn update_remotes( &mut self, target: &str, install_path: &Path, ) -> Result<(), Error>
read [install_path]/etc/pkg.d with specified target. Will reset existing remotes / locals list.
Sourcepub fn add_remote(&mut self, url: &str, target: &str) -> Result<(), Error>
pub fn add_remote(&mut self, url: &str, target: &str) -> Result<(), Error>
Add a remote target. The domain url will be used as a host (unique identifier).
Sourcepub fn add_local(
&mut self,
host: &str,
path: &str,
target: &str,
pubkey_dir: &Path,
) -> Result<(), Error>
pub fn add_local( &mut self, host: &str, path: &str, target: &str, pubkey_dir: &Path, ) -> Result<(), Error>
Add a local directory target. Specify a host as a unique identifier.
pub fn get_local_path(&self, remote: &String, file: &str, ext: &str) -> PathBuf
Sourcepub fn download(
&self,
file: &str,
len: Option<u64>,
dest: &mut DownloadBackendWriter,
) -> Result<String, Error>
pub fn download( &self, file: &str, len: Option<u64>, dest: &mut DownloadBackendWriter, ) -> Result<String, Error>
Download to dest and report which remotes it’s downloaded from.
Sourcepub fn local_search(
&self,
file: &str,
) -> Result<Option<(String, PathBuf)>, Error>
pub fn local_search( &self, file: &str, ) -> Result<Option<(String, PathBuf)>, Error>
Locate and return path and report which locals it’s downloaded from.
Sourcepub fn get_package_pkgar(
&self,
package: &PackageName,
len_hint: u64,
) -> Result<(PathBuf, &RemotePath), Error>
pub fn get_package_pkgar( &self, package: &PackageName, len_hint: u64, ) -> Result<(PathBuf, &RemotePath), Error>
Download a pkgar file to the download path. Wrapper to sync_pkgar().
Sourcepub fn get_package_toml(
&self,
package: &PackageName,
) -> Result<(String, String), Error>
pub fn get_package_toml( &self, package: &PackageName, ) -> Result<(String, String), Error>
Fetch a toml file. Wrapper to sync_toml() with notifies fetch callback.
Trait Implementations§
Source§impl Clone for RepoManager
impl Clone for RepoManager
Auto Trait Implementations§
impl Freeze for RepoManager
impl !RefUnwindSafe for RepoManager
impl !Send for RepoManager
impl !Sync for RepoManager
impl Unpin for RepoManager
impl UnsafeUnpin for RepoManager
impl !UnwindSafe for RepoManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more