aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorSean McNamara2011-02-26 22:09:19 -0500
committerSean McNamara2011-02-26 22:09:19 -0500
commit34b6904939dd551aafa68ea8e02dc5177d395b3b (patch)
tree4d31f7646047695190ccc1d7acda0518642bad54 /OpenSim/Region/OptionalModules
parentStart the timer. (Could it be that simple?) (diff)
downloadopensim-SC_OLD-34b6904939dd551aafa68ea8e02dc5177d395b3b.zip
opensim-SC_OLD-34b6904939dd551aafa68ea8e02dc5177d395b3b.tar.gz
opensim-SC_OLD-34b6904939dd551aafa68ea8e02dc5177d395b3b.tar.bz2
opensim-SC_OLD-34b6904939dd551aafa68ea8e02dc5177d395b3b.tar.xz
First working commit of AutoBackupModule.
It seems to do something! Heuristics are still TODO, but this is alpha 1.
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs34
1 files changed, 23 insertions, 11 deletions
diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
index 77126c7..e3686ac 100644
--- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
+++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
@@ -281,7 +281,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
281 tim.Elapsed += HandleElapsed; 281 tim.Elapsed += HandleElapsed;
282 tim.AutoReset = true; 282 tim.AutoReset = true;
283 tim.Start(); 283 tim.Start();
284 m_log.Debug("[AUTO BACKUP MODULE]: New timer for " + interval + " msec for region " + sRegionName); 284 //m_log.Debug("[AUTO BACKUP MODULE]: New timer for " + interval + " msec for region " + sRegionName);
285 } 285 }
286 286
287 //Add the current region to the list of regions tied to this timer. 287 //Add the current region to the list of regions tied to this timer.
@@ -292,6 +292,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
292 else 292 else
293 { 293 {
294 List<IScene> scns = new List<IScene>(1); 294 List<IScene> scns = new List<IScene>(1);
295 scns.Add(scene);
295 timerMap.Add(st.GetTimer(), scns); 296 timerMap.Add(st.GetTimer(), scns);
296 } 297 }
297 298
@@ -343,6 +344,10 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
343 { 344 {
344 bool heuristicsRun = false; 345 bool heuristicsRun = false;
345 bool heuristicsPassed = false; 346 bool heuristicsPassed = false;
347 if(!timerMap.ContainsKey((Timer) sender))
348 {
349 m_log.Debug("Code-up error: timerMap doesn't contain timer " + sender.ToString());
350 }
346 foreach(IScene scene in timerMap[(Timer)sender]) 351 foreach(IScene scene in timerMap[(Timer)sender])
347 { 352 {
348 AutoBackupModuleState state = states[scene]; 353 AutoBackupModuleState state = states[scene];
@@ -352,16 +357,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
352 if((heuristics && heuristicsRun && heuristicsPassed) 357 if((heuristics && heuristicsRun && heuristicsPassed)
353 || !heuristics) 358 || !heuristics)
354 { 359 {
355 IRegionArchiverModule iram = scene.RequestModuleInterface<IRegionArchiverModule>(); 360 doRegionBackup(scene);
356 string savePath = BuildOarPath(scene.RegionInfo.RegionName, state.GetBackupDir(), state.GetNamingType());
357 m_log.Debug("[AUTO BACKUP MODULE]: savePath = " + savePath);
358 if(savePath == null)
359 {
360 m_log.Warn("savePath is null in HandleElapsed");
361 continue;
362 }
363 iram.ArchiveRegion(savePath, null);
364 ExecuteScript(state.GetScript(), savePath);
365 } 361 }
366 //Heuristics are on; ran but we're too busy -- keep going. Maybe another region will have heuristics off! 362 //Heuristics are on; ran but we're too busy -- keep going. Maybe another region will have heuristics off!
367 else if(heuristics && heuristicsRun && !heuristicsPassed) 363 else if(heuristics && heuristicsRun && !heuristicsPassed)
@@ -375,9 +371,25 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
375 heuristicsRun = true; 371 heuristicsRun = true;
376 if(!heuristicsPassed) 372 if(!heuristicsPassed)
377 continue; 373 continue;
374 doRegionBackup(scene);
378 } 375 }
379 } 376 }
380 } 377 }
378
379 void doRegionBackup(IScene scene)
380 {
381 AutoBackupModuleState state = states[scene];
382 IRegionArchiverModule iram = scene.RequestModuleInterface<IRegionArchiverModule>();
383 string savePath = BuildOarPath(scene.RegionInfo.RegionName, state.GetBackupDir(), state.GetNamingType());
384 //m_log.Debug("[AUTO BACKUP MODULE]: savePath = " + savePath);
385 if(savePath == null)
386 {
387 m_log.Warn("[AUTO BACKUP MODULE]: savePath is null in HandleElapsed");
388 return;
389 }
390 iram.ArchiveRegion(savePath, null);
391 ExecuteScript(state.GetScript(), savePath);
392 }
381 393
382 string IRegionModuleBase.Name { 394 string IRegionModuleBase.Name {
383 get { 395 get {