Struct libalpm::Alpm
[−]
[src]
pub struct Alpm { /* fields omitted */ }
A handle on an alpm instance
Note that I have NOT checked whether the interface is threadsafe, so it's best to use only one instance of Alpm at present (doing your own synchronization if you want to share between threads). Also, callbacks must be stored in global state, so if they are changed for one they will be changed for all.
Methods
impl Alpm
[src]
fn new(root: &str, db_path: &str) -> AlpmResult<Alpm>
Get a handle on the alpm instance defined by the given root/db_path
fn with_options(options: &Options) -> AlpmResult<Alpm>
Creates an alpm instance with the given options.
TODO will only be implemented after the rest of the library is finished.
fn error(&self) -> Option<Error>
Gets the current (last) error status. Most functions use this internally to get the error type to return, so there isn't much need to use this externally.
fn log_action<T, U>(&self, prefix: &str, msg: &str) -> AlpmResult<()>
Logs a message using alpm's built in logging functionality.
TODO test if all prefixes are allowed, or just DEBUG etc., & test generally
fn fetch_pkgurl(&self, url: &str) -> AlpmResult<PathBuf>
Fetch a remote pkg from the given URL and return its path.
fn log_function<F>(&self, func: F) where
F: FnMut(LogLevels, String) + Send + 'static,
F: FnMut(LogLevels, String) + Send + 'static,
Set the callback called when a log message is received.
fn clear_log_function(&self)
Clears the log callback.
fn file_download_progress_function<F>(&self, func: F) where
F: FnMut(&str, u64, u64) + Send + 'static,
F: FnMut(&str, u64, u64) + Send + 'static,
Set the callback called to report progress on downloading a file.
fn clear_file_download_progress_function(&self)
Clears the file download progress callback.
fn total_download_progress_function<F>(&self, func: F) where
F: FnMut(u64) + Send + 'static,
F: FnMut(u64) + Send + 'static,
Set the callback called to report progress on total download
fn clear_total_download_progress_function(&self)
Clears the total download progress callback.
unsafe fn fetch_function<F>(&self, func: F) where
F: FnMut(&str, &str, bool) -> DownloadResult + Send + 'static,
F: FnMut(&str, &str, bool) -> DownloadResult + Send + 'static,
Set the callback called to download a file.
Providing this function is optional and it is recommended that you don't set it (and use the built-in fetch fn). This could be useful e.g. if you are behind a complicated proxy or want to use something other than http to fetch.
Safety
Note that if you supply this function, you promise that if you return DownloadResult::Ok, the requested file is correctly located in the given location.
A panic in the function will cause DownloadResult::Err to be sent to the underlying libalpm (i.e. not undefined behaviour).
TODO investigate whether safe to relax 'static bound
fn clear_fetch_function(&self)
Clears the file download callback, falling back to built-in fetch functionality.
fn event_function<F>(&self, func: F) where
F: FnMut(Event) + Send + 'static,
F: FnMut(Event) + Send + 'static,
Sets the function called when an event occurs
fn clear_event_function(&self)
Clears the file download callback, falling back to built-in fetch functionality.
fn question_function<F>(&self, func: F) where
F: FnMut() + Send + 'static,
F: FnMut() + Send + 'static,
Sets the function called when a question needs answering (todo i think)
fn clear_question_function(&self)
Clears the function called when a question needs answering (todo i think)
fn progress_function<F>(&self, func: F) where
F: FnMut() + Send + 'static,
F: FnMut() + Send + 'static,
Sets the function called to show operation progress
fn clear_progress_function(&self)
Clears the function called to show operation progress
fn root<'a>(&'a self) -> &'a str
Get the root path used in this instance of alpm
The api doesn't make clear the lifetime of the result, so I am conservative (same goes for db_path)
fn db_path<'a>(&'a self) -> &'a str
Get the database path used in this instance of alpm
fn lockfile<'a>(&'a self) -> &'a str
Get the lockfile path used in this instance of alpm
fn cache_dirs(&self) -> Vec<&str>
Gets a list of the cache directories in use by this instance of alpm
fn set_cache_dirs(&self)
Sets a list of the cache directories in use by this instance of alpm
fn add_cache_dir(&self)
Adds a cache directory for use by this instance of alpm
fn remove_cache_dir(&self)
Removes a cache directory in use by this instance of alpm
fn hook_dirs(&self)
Gets a list of the hook directories in use by this instance of alpm
fn set_hook_dirs(&self)
Sets a list of the hook directories in use by this instance of alpm
fn add_hook_dir(&self)
Adds a hook directory for use by this instance of alpm
fn remove_hook_dir(&self)
Removes a hook directory in use by this instance of alpm
fn log_file(&self)
Gets the log file location used by this instance of alpm.
fn set_log_file(&self)
Sets the log file location used by this instance of alpm.
fn gpg_dir(&self)
Gets the path to alpm's GnuPG home directory
fn set_gpg_dir(&self)
Sets the path to alpm's GnuPG home directory
fn use_syslog(&self)
Gets whether this instance of alpm should log events to syslog
fn set_use_syslog(&self)
Sets whether this instance of alpm should log events to syslog
fn no_upgrades(&self)
Gets a list of the packages that should not be upgraded.
fn set_no_upgrades(&self)
Sets a list of the packages that should not be upgraded.
fn add_no_upgrade(&self)
Adds a package to the list that should not be upgraded.
fn remove_no_upgrade(&self)
Removes a package from the list that should not be upgraded.
fn ignore_pkgs(&self)
Gets a list of the packages that should be ignored.
fn set_ignore_pkgs(&self)
Sets a list of the packages that should be ignored.
fn add_ignore_pkg(&self)
Adds a package to the list that should be ignored.
fn remove_ignore_pkg(&self)
Removes a package from the list that should be ignored.
fn ignore_groups(&self)
Gets a list of the groups that should be ignored.
fn set_ignore_groups(&self)
Sets a list of the groups that should be ignored.
fn add_ignore_group(&self)
Adds a group to the list that should be ignored.
fn remove_ignore_group(&self)
Removes a group from the list that should be ignored.
fn assume_installed(&self)
Gets a list of the dependencies that should be ignored by a sys-upgrade.
fn set_assume_installed(&self)
Sets a list of the dependencies that should be ignored by a sys-upgrade.
fn add_assume_installed(&self)
Adds a package to the list of dependencies that should be ignored by a sys-upgrade.
fn remove_assume_installed(&self)
Removes a package from the list of dependencies that should be ignored by a sys-upgrade.
fn arch(&self) -> Option<&str>
Gets the targeted architecture.
fn set_arch(&self, arch: &str) -> AlpmResult<()>
Sets the targeted architecture.
fn delta_ratio(&self) -> f64
Gets the delta ratio
fn set_delta_ratio(&self, r: f64) -> AlpmResult<()>
Sets the targeted architecture
fn check_space(&self) -> bool
Gets whether alpm will check disk space before operations
fn set_check_space(&self, check: bool) -> AlpmResult<()>
Sets the targeted architecture
fn db_extension(&self) -> &str
Gets the registered database extension used on the filesystem
fn set_db_extension(&self, ext: &str) -> AlpmResult<()>
Sets the targeted architecture
fn default_sign_level(&self) -> SigLevel
Gets the default signing level
fn set_default_sign_level(&self, s: SigLevel) -> AlpmResult<()>
Sets the default signing level
fn local_file_sign_level(&self) -> SigLevel
Gets the default signing level
fn set_local_file_sign_level(&self, s: SigLevel) -> AlpmResult<()>
Sets the default signing level
fn remote_file_sign_level(&self) -> SigLevel
Gets the default signing level
fn set_remote_file_sign_level(&self, s: SigLevel) -> AlpmResult<()>
Sets the default signing level
fn local_db<'a>(&'a self) -> Db<'a>
Get the local database instance.
fn sync_dbs<'a>(&'a self) -> Vec<Db<'a>>
Get a list of remote databases registered.
fn register_sync_db<'a>(
&'a self,
treename: &str,
level: SigLevel
) -> AlpmResult<Db<'a>>
&'a self,
treename: &str,
level: SigLevel
) -> AlpmResult<Db<'a>>
Register a sync db (remote db). You will need to attach servers to the db to be able to sync
fn init_transaction(
self,
flags: TransactionFlags
) -> Result<Transaction, (Error, Alpm)>
self,
flags: TransactionFlags
) -> Result<Transaction, (Error, Alpm)>
Start a package modification transaction