///
/// Is basically just a filter-iter for pbs_datastore::ListNamespacesRecursive including access and
/// optional owner checks.
-pub struct ListAccessibleBackupGroups {
+pub struct ListAccessibleBackupGroups<'a> {
store: Arc<DataStore>,
- auth_id: Option<Authid>,
+ auth_id: Option<&'a Authid>,
user_info: Arc<CachedUserInfo>,
state: Option<ListGroups>,
ns_iter: ListNamespacesRecursive,
}
-impl ListAccessibleBackupGroups {
+impl <'a> ListAccessibleBackupGroups<'a> {
// TODO: builder pattern
pub fn new(
store: Arc<DataStore>,
ns: BackupNamespace,
max_depth: usize,
- auth_id: Option<Authid>,
+ auth_id: Option<&'a Authid>,
) -> Result<Self, Error> {
let ns_iter = ListNamespacesRecursive::new_max_depth(Arc::clone(&store), ns, max_depth)?;
Ok(ListAccessibleBackupGroups {
}
}
-impl Iterator for ListAccessibleBackupGroups {
+impl <'a> Iterator for ListAccessibleBackupGroups<'a> {
type Item = Result<BackupGroup, Error>;
fn next(&mut self) -> Option<Self::Item> {
upid: &UPID,
ns: BackupNamespace,
max_depth: Option<usize>,
- owner: Option<Authid>,
+ owner: Option<&Authid>,
filter: Option<&dyn Fn(&BackupManifest) -> bool>,
) -> Result<Vec<String>, Error> {
let mut errors = Vec::new();