MC::ListBundles { game } => {
let ag = AccountsGuard::lock();
let gref = Instance::lookup_by_name_unauth(&game)?;
- let bundles = gref.lock_bundles();
let mut igu = gref.lock()?;
- let (_ig, auth) = cs.check_acl(&ag, &mut igu, PCH::Instance,
- TP_ACCESS_BUNDLES)?;
- let bundles = bundles.by(auth);
- let bundles = bundles.list();
+ let (ig, _) = cs.check_acl(&ag, &mut igu, PCH::Instance,
+ TP_ACCESS_BUNDLES)?;
+ let bundles = ig.bundle_list.clone();
MR::Bundles { bundles }
}
MC::DownloadBundle { game, id } => {
Err(LoadError::IE(ie)) => throw!(ie),
};
- *slot = Some(Note { kind: id.kind, state })
+ *slot = Some(Note { kind: id.kind, state });
+ ib.update_mgmt_list(ig);
}
#[throws(IncorporateError)]
})
}
- pub fn list(&self) -> MgmtBundleList {
- self.iter().map(|(id, state)| {
+ fn update_mgmt_list(&self, ig: &mut Instance) {
+ ig.bundle_list = self.iter().map(|(id, state)| {
(id, state.clone())
}).collect()
}
}
}
debug!("loaded bundles {} {:?}", &ig.name, ib);
+ ib.update_mgmt_list(ig);
ib
}
let file = BufWriter::new(file);
let file = DigestWrite::new(file);
let instance = ig.name.clone();
+ self.update_mgmt_list(ig);
Uploading { file, instance, id }
}
}
pub tokens_clients: TokenRegistry<ClientId>,
pub acl: LoadedAcl<TablePermission>,
pub links: Arc<LinksTable>,
+ pub bundle_list: MgmtBundleList, // copy for easy access
}
pub struct PlayerRecord {
tokens_players: default(),
tokens_clients: default(),
links: default(),
+ bundle_list: default(),
};
let c = InstanceContainer {
clients: default(),
tokens_clients: default(),
tokens_players: default(),
+ bundle_list: default(), // set by load_game_bundles
};
let b = InstanceBundles::load_game_bundles(&mut g)?;