GamesList { games }
},
+ AlterGame { name, insns, how} => {
+ let name = InstanceName {
+ scope: cs.get_scope()?.clone(),
+ scoped_name: name
+ };
+ let gref = Instance::lookup_by_name(&name)?;
+ let mut g = gref.lock()?;
+ execute_for_game(cs, &mut g, insns, how)?
+ },
+
}
}
SetScope { scope: ManagementScope },
CreateGame { name: String, insns: Vec<MgmtGameInstruction> },
ListGames { all: Option<bool>, },
+ AlterGame {
+ name: String, insns: Vec<MgmtGameInstruction>,
+ how: MgmtGameUpdateMode,
+ },
}
#[derive(Debug,Serialize,Deserialize)]
NoScope,
AlreadyExists,
GameBeingDestroyed,
+ GameNotFound,
GameCorrupted,
LimitExceeded,
SVGProcessingFailed(#[from] SVGProcessingError),
gref
}
+ #[throws(MgmtError)]
+ pub fn lookup_by_name(name: &InstanceName) -> InstanceRef {
+ GLOBAL.games.read().unwrap()
+ .get(name)
+ .ok_or(MgmtError::GameNotFound)?
+ .clone()
+ }
+
pub fn destroy(mut g: InstanceGuard) {
g.c.live = false;
// remove the files