diff options
-rw-r--r-- | OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs | 291 |
1 files changed, 186 insertions, 105 deletions
diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs index 4a9615d..ce9a448 100644 --- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs +++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
55 | 55 | ||
56 | ///<summary> | 56 | ///<summary> |
57 | /// AutoBackupModule: save OAR region backups to disk periodically | 57 | /// AutoBackupModule: save OAR region backups to disk periodically |
58 | /// </summary> | 58 | /// </summary> |
59 | /// <remarks> | 59 | /// <remarks> |
60 | /// Config Settings Documentation. | 60 | /// Config Settings Documentation. |
61 | /// At the TOP LEVEL, e.g. in OpenSim.ini, we have the following options: | 61 | /// At the TOP LEVEL, e.g. in OpenSim.ini, we have the following options: |
@@ -96,7 +96,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
96 | /// AutoBackupAgentThreshold: int. Default: 10. Upper bound on # of agents in region required for BusyCheck heuristics to pass. | 96 | /// AutoBackupAgentThreshold: int. Default: 10. Upper bound on # of agents in region required for BusyCheck heuristics to pass. |
97 | /// If the number of agents is greater than this value, don't take a backup right now | 97 | /// If the number of agents is greater than this value, don't take a backup right now |
98 | /// Save memory by setting low initial capacities. Minimizes impact in common cases of all regions using same interval, and instances hosting 1 ~ 4 regions. | 98 | /// Save memory by setting low initial capacities. Minimizes impact in common cases of all regions using same interval, and instances hosting 1 ~ 4 regions. |
99 | /// Also helps if you don't want AutoBackup at all. | 99 | /// Also helps if you don't want AutoBackup at all. |
100 | /// </remarks> | 100 | /// </remarks> |
101 | public class AutoBackupModule : ISharedRegionModule | 101 | public class AutoBackupModule : ISharedRegionModule |
102 | { | 102 | { |
@@ -110,17 +110,18 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
110 | new Dictionary<Timer, List<IScene>>(1); | 110 | new Dictionary<Timer, List<IScene>>(1); |
111 | private readonly Dictionary<double, Timer> m_timers = new Dictionary<double, Timer>(1); | 111 | private readonly Dictionary<double, Timer> m_timers = new Dictionary<double, Timer>(1); |
112 | 112 | ||
113 | private delegate T DefaultGetter<T>(string settingName, T defaultValue); | ||
113 | private bool m_enabled; | 114 | private bool m_enabled; |
114 | 115 | ||
115 | /// <summary> | 116 | /// <summary> |
116 | /// Whether the shared module should be enabled at all. NOT the same as m_Enabled in AutoBackupModuleState! | 117 | /// Whether the shared module should be enabled at all. NOT the same as m_Enabled in AutoBackupModuleState! |
117 | /// </summary> | 118 | /// </summary> |
118 | private bool m_closed; | 119 | private bool m_closed; |
119 | 120 | ||
120 | private IConfigSource m_configSource; | 121 | private IConfigSource m_configSource; |
121 | 122 | ||
122 | /// <summary> | 123 | /// <summary> |
123 | /// Required by framework. | 124 | /// Required by framework. |
124 | /// </summary> | 125 | /// </summary> |
125 | public bool IsSharedModule | 126 | public bool IsSharedModule |
126 | { | 127 | { |
@@ -129,25 +130,25 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
129 | 130 | ||
130 | #region ISharedRegionModule Members | 131 | #region ISharedRegionModule Members |
131 | 132 | ||
132 | /// <summary> | 133 | /// <summary> |
133 | /// Identifies the module to the system. | 134 | /// Identifies the module to the system. |
134 | /// </summary> | 135 | /// </summary> |
135 | string IRegionModuleBase.Name | 136 | string IRegionModuleBase.Name |
136 | { | 137 | { |
137 | get { return "AutoBackupModule"; } | 138 | get { return "AutoBackupModule"; } |
138 | } | 139 | } |
139 | 140 | ||
140 | /// <summary> | 141 | /// <summary> |
141 | /// We don't implement an interface, this is a single-use module. | 142 | /// We don't implement an interface, this is a single-use module. |
142 | /// </summary> | 143 | /// </summary> |
143 | Type IRegionModuleBase.ReplaceableInterface | 144 | Type IRegionModuleBase.ReplaceableInterface |
144 | { | 145 | { |
145 | get { return null; } | 146 | get { return null; } |
146 | } | 147 | } |
147 | 148 | ||
148 | /// <summary> | 149 | /// <summary> |
149 | /// Called once in the lifetime of the module at startup. | 150 | /// Called once in the lifetime of the module at startup. |
150 | /// </summary> | 151 | /// </summary> |
151 | /// <param name="source">The input config source for OpenSim.ini.</param> | 152 | /// <param name="source">The input config source for OpenSim.ini.</param> |
152 | void IRegionModuleBase.Initialise(IConfigSource source) | 153 | void IRegionModuleBase.Initialise(IConfigSource source) |
153 | { | 154 | { |
@@ -184,8 +185,8 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
184 | m_log.Debug(abms.ToString()); | 185 | m_log.Debug(abms.ToString()); |
185 | } | 186 | } |
186 | 187 | ||
187 | /// <summary> | 188 | /// <summary> |
188 | /// Called once at de-init (sim shutting down). | 189 | /// Called once at de-init (sim shutting down). |
189 | /// </summary> | 190 | /// </summary> |
190 | void IRegionModuleBase.Close() | 191 | void IRegionModuleBase.Close() |
191 | { | 192 | { |
@@ -198,17 +199,17 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
198 | this.StopAllTimers(); | 199 | this.StopAllTimers(); |
199 | } | 200 | } |
200 | 201 | ||
201 | /// <summary> | 202 | /// <summary> |
202 | /// Currently a no-op for AutoBackup because we have to wait for region to be fully loaded. | 203 | /// Currently a no-op for AutoBackup because we have to wait for region to be fully loaded. |
203 | /// </summary> | 204 | /// </summary> |
204 | /// <param name="scene"></param> | 205 | /// <param name="scene"></param> |
205 | void IRegionModuleBase.AddRegion(Scene scene) | 206 | void IRegionModuleBase.AddRegion(Scene scene) |
206 | { | 207 | { |
207 | } | 208 | } |
208 | 209 | ||
209 | /// <summary> | 210 | /// <summary> |
210 | /// Here we just clean up some resources and stop the OAR backup (if any) for the given scene. | 211 | /// Here we just clean up some resources and stop the OAR backup (if any) for the given scene. |
211 | /// </summary> | 212 | /// </summary> |
212 | /// <param name="scene">The scene (region) to stop performing AutoBackup on.</param> | 213 | /// <param name="scene">The scene (region) to stop performing AutoBackup on.</param> |
213 | void IRegionModuleBase.RemoveRegion(Scene scene) | 214 | void IRegionModuleBase.RemoveRegion(Scene scene) |
214 | { | 215 | { |
@@ -237,10 +238,10 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
237 | } | 238 | } |
238 | } | 239 | } |
239 | 240 | ||
240 | /// <summary> | 241 | /// <summary> |
241 | /// Most interesting/complex code paths in AutoBackup begin here. | 242 | /// Most interesting/complex code paths in AutoBackup begin here. |
242 | /// We read lots of Nini config, maybe set a timer, add members to state tracking Dictionaries, etc. | 243 | /// We read lots of Nini config, maybe set a timer, add members to state tracking Dictionaries, etc. |
243 | /// </summary> | 244 | /// </summary> |
244 | /// <param name="scene">The scene to (possibly) perform AutoBackup on.</param> | 245 | /// <param name="scene">The scene to (possibly) perform AutoBackup on.</param> |
245 | void IRegionModuleBase.RegionLoaded(Scene scene) | 246 | void IRegionModuleBase.RegionLoaded(Scene scene) |
246 | { | 247 | { |
@@ -260,8 +261,8 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
260 | m_log.Debug((abms == null ? "DEFAULT" : abms.ToString())); | 261 | m_log.Debug((abms == null ? "DEFAULT" : abms.ToString())); |
261 | } | 262 | } |
262 | 263 | ||
263 | /// <summary> | 264 | /// <summary> |
264 | /// Currently a no-op. | 265 | /// Currently a no-op. |
265 | /// </summary> | 266 | /// </summary> |
266 | void ISharedRegionModule.PostInitialise() | 267 | void ISharedRegionModule.PostInitialise() |
267 | { | 268 | { |
@@ -269,12 +270,12 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
269 | 270 | ||
270 | #endregion | 271 | #endregion |
271 | 272 | ||
272 | /// <summary> | 273 | /// <summary> |
273 | /// Set up internal state for a given scene. Fairly complex code. | 274 | /// Set up internal state for a given scene. Fairly complex code. |
274 | /// When this method returns, we've started auto-backup timers, put members in Dictionaries, and created a State object for this scene. | 275 | /// When this method returns, we've started auto-backup timers, put members in Dictionaries, and created a State object for this scene. |
275 | /// </summary> | 276 | /// </summary> |
276 | /// <param name="scene">The scene to look at.</param> | 277 | /// <param name="scene">The scene to look at.</param> |
277 | /// <param name="parseDefault">Whether this call is intended to figure out what we consider the "default" config (applied to all regions unless overridden by per-region settings).</param> | 278 | /// <param name="parseDefault">Whether this call is intended to figure out what we consider the "default" config (applied to all regions unless overridden by per-region settings).</param> |
278 | /// <returns>An AutoBackupModuleState contains most information you should need to know relevant to auto-backup, as applicable to a single region.</returns> | 279 | /// <returns>An AutoBackupModuleState contains most information you should need to know relevant to auto-backup, as applicable to a single region.</returns> |
279 | private AutoBackupModuleState ParseConfig(IScene scene, bool parseDefault) | 280 | private AutoBackupModuleState ParseConfig(IScene scene, bool parseDefault) |
280 | { | 281 | { |
@@ -299,16 +300,16 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
299 | } | 300 | } |
300 | 301 | ||
301 | // Read the config settings and set variables. | 302 | // Read the config settings and set variables. |
303 | IConfig regionConfig = (scene != null ? scene.Config.Configs[sRegionName] : null); | ||
302 | IConfig config = this.m_configSource.Configs["AutoBackupModule"]; | 304 | IConfig config = this.m_configSource.Configs["AutoBackupModule"]; |
303 | if (config == null) | 305 | if (config == null) |
304 | { | 306 | { |
305 | // defaultState would be disabled too if the section doesn't exist. | 307 | // defaultState would be disabled too if the section doesn't exist. |
306 | state = this.m_defaultState; | 308 | state = this.m_defaultState; |
307 | m_log.Info("[AUTO BACKUP]: Region " + sRegionLabel + " is NOT AutoBackup enabled."); | ||
308 | return state; | 309 | return state; |
309 | } | 310 | } |
310 | 311 | ||
311 | bool tmpEnabled = config.GetBoolean(prepend + "AutoBackup", this.m_defaultState.Enabled); | 312 | bool tmpEnabled = ResolveBoolean("AutoBackup", this.m_defaultState.Enabled, config, regionConfig); |
312 | if (state == null && tmpEnabled != this.m_defaultState.Enabled) | 313 | if (state == null && tmpEnabled != this.m_defaultState.Enabled) |
313 | //Varies from default state | 314 | //Varies from default state |
314 | { | 315 | { |
@@ -332,8 +333,8 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
332 | 333 | ||
333 | // Borrow an existing timer if one exists for the same interval; otherwise, make a new one. | 334 | // Borrow an existing timer if one exists for the same interval; otherwise, make a new one. |
334 | double interval = | 335 | double interval = |
335 | config.GetDouble(prepend + "AutoBackupInterval", this.m_defaultState.IntervalMinutes)* | 336 | this.ResolveDouble("AutoBackupInterval", this.m_defaultState.IntervalMinutes, |
336 | 60000.0; | 337 | config, regionConfig) * 60000.0; |
337 | if (state == null && interval != this.m_defaultState.IntervalMinutes*60000.0) | 338 | if (state == null && interval != this.m_defaultState.IntervalMinutes*60000.0) |
338 | { | 339 | { |
339 | state = new AutoBackupModuleState(); | 340 | state = new AutoBackupModuleState(); |
@@ -400,8 +401,8 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
400 | } | 401 | } |
401 | } | 402 | } |
402 | 403 | ||
403 | bool tmpBusyCheck = config.GetBoolean(prepend + "AutoBackupBusyCheck", | 404 | bool tmpBusyCheck = ResolveBoolean("AutoBackupBusyCheck", |
404 | this.m_defaultState.BusyCheck); | 405 | this.m_defaultState.BusyCheck, config, regionConfig); |
405 | if (state == null && tmpBusyCheck != this.m_defaultState.BusyCheck) | 406 | if (state == null && tmpBusyCheck != this.m_defaultState.BusyCheck) |
406 | { | 407 | { |
407 | state = new AutoBackupModuleState(); | 408 | state = new AutoBackupModuleState(); |
@@ -413,8 +414,8 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
413 | } | 414 | } |
414 | 415 | ||
415 | // Set file naming algorithm | 416 | // Set file naming algorithm |
416 | string stmpNamingType = config.GetString(prepend + "AutoBackupNaming", | 417 | string stmpNamingType = ResolveString("AutoBackupNaming", |
417 | this.m_defaultState.NamingType.ToString()); | 418 | this.m_defaultState.NamingType.ToString(), config, regionConfig); |
418 | NamingType tmpNamingType; | 419 | NamingType tmpNamingType; |
419 | if (stmpNamingType.Equals("Time", StringComparison.CurrentCultureIgnoreCase)) | 420 | if (stmpNamingType.Equals("Time", StringComparison.CurrentCultureIgnoreCase)) |
420 | { | 421 | { |
@@ -445,8 +446,8 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
445 | state.NamingType = tmpNamingType; | 446 | state.NamingType = tmpNamingType; |
446 | } | 447 | } |
447 | 448 | ||
448 | string tmpScript = config.GetString(prepend + "AutoBackupScript", | 449 | string tmpScript = ResolveString("AutoBackupScript", |
449 | this.m_defaultState.Script); | 450 | this.m_defaultState.Script, config, regionConfig); |
450 | if (state == null && tmpScript != this.m_defaultState.Script) | 451 | if (state == null && tmpScript != this.m_defaultState.Script) |
451 | { | 452 | { |
452 | state = new AutoBackupModuleState(); | 453 | state = new AutoBackupModuleState(); |
@@ -457,7 +458,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
457 | state.Script = tmpScript; | 458 | state.Script = tmpScript; |
458 | } | 459 | } |
459 | 460 | ||
460 | string tmpBackupDir = config.GetString(prepend + "AutoBackupDir", "."); | 461 | string tmpBackupDir = ResolveString("AutoBackupDir", ".", config, regionConfig); |
461 | if (state == null && tmpBackupDir != this.m_defaultState.BackupDir) | 462 | if (state == null && tmpBackupDir != this.m_defaultState.BackupDir) |
462 | { | 463 | { |
463 | state = new AutoBackupModuleState(); | 464 | state = new AutoBackupModuleState(); |
@@ -491,10 +492,90 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
491 | return state; | 492 | return state; |
492 | } | 493 | } |
493 | 494 | ||
494 | /// <summary> | 495 | /// <summary> |
495 | /// Called when any auto-backup timer expires. This starts the code path for actually performing a backup. | 496 | /// Helper function for ParseConfig. |
496 | /// </summary> | 497 | /// </summary> |
497 | /// <param name="sender"></param> | 498 | /// <param name="settingName"></param> |
499 | /// <param name="defaultValue"></param> | ||
500 | /// <param name="global"></param> | ||
501 | /// <param name="local"></param> | ||
502 | /// <returns></returns> | ||
503 | private bool ResolveBoolean(string settingName, bool defaultValue, IConfig global, IConfig local) | ||
504 | { | ||
505 | if(local != null) | ||
506 | { | ||
507 | return local.GetBoolean(settingName, global.GetBoolean(settingName, defaultValue)); | ||
508 | } | ||
509 | else | ||
510 | { | ||
511 | return global.GetBoolean(settingName, defaultValue); | ||
512 | } | ||
513 | } | ||
514 | |||
515 | /// <summary> | ||
516 | /// Helper function for ParseConfig. | ||
517 | /// </summary> | ||
518 | /// <param name="settingName"></param> | ||
519 | /// <param name="defaultValue"></param> | ||
520 | /// <param name="global"></param> | ||
521 | /// <param name="local"></param> | ||
522 | /// <returns></returns> | ||
523 | private double ResolveDouble(string settingName, double defaultValue, IConfig global, IConfig local) | ||
524 | { | ||
525 | if (local != null) | ||
526 | { | ||
527 | return local.GetDouble(settingName, global.GetDouble(settingName, defaultValue)); | ||
528 | } | ||
529 | else | ||
530 | { | ||
531 | return global.GetDouble(settingName, defaultValue); | ||
532 | } | ||
533 | } | ||
534 | |||
535 | /// <summary> | ||
536 | /// Helper function for ParseConfig. | ||
537 | /// </summary> | ||
538 | /// <param name="settingName"></param> | ||
539 | /// <param name="defaultValue"></param> | ||
540 | /// <param name="global"></param> | ||
541 | /// <param name="local"></param> | ||
542 | /// <returns></returns> | ||
543 | private int ResolveInt(string settingName, int defaultValue, IConfig global, IConfig local) | ||
544 | { | ||
545 | if (local != null) | ||
546 | { | ||
547 | return local.GetInt(settingName, global.GetInt(settingName, defaultValue)); | ||
548 | } | ||
549 | else | ||
550 | { | ||
551 | return global.GetInt(settingName, defaultValue); | ||
552 | } | ||
553 | } | ||
554 | |||
555 | /// <summary> | ||
556 | /// Helper function for ParseConfig. | ||
557 | /// </summary> | ||
558 | /// <param name="settingName"></param> | ||
559 | /// <param name="defaultValue"></param> | ||
560 | /// <param name="global"></param> | ||
561 | /// <param name="local"></param> | ||
562 | /// <returns></returns> | ||
563 | private string ResolveString(string settingName, string defaultValue, IConfig global, IConfig local) | ||
564 | { | ||
565 | if (local != null) | ||
566 | { | ||
567 | return local.GetString(settingName, global.GetString(settingName, defaultValue)); | ||
568 | } | ||
569 | else | ||
570 | { | ||
571 | return global.GetString(settingName, defaultValue); | ||
572 | } | ||
573 | } | ||
574 | |||
575 | /// <summary> | ||
576 | /// Called when any auto-backup timer expires. This starts the code path for actually performing a backup. | ||
577 | /// </summary> | ||
578 | /// <param name="sender"></param> | ||
498 | /// <param name="e"></param> | 579 | /// <param name="e"></param> |
499 | private void HandleElapsed(object sender, ElapsedEventArgs e) | 580 | private void HandleElapsed(object sender, ElapsedEventArgs e) |
500 | { | 581 | { |
@@ -554,9 +635,9 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
554 | } | 635 | } |
555 | } | 636 | } |
556 | 637 | ||
557 | /// <summary> | 638 | /// <summary> |
558 | /// Save an OAR, register for the callback for when it's done, then call the AutoBackupScript (if applicable). | 639 | /// Save an OAR, register for the callback for when it's done, then call the AutoBackupScript (if applicable). |
559 | /// </summary> | 640 | /// </summary> |
560 | /// <param name="scene"></param> | 641 | /// <param name="scene"></param> |
561 | private void DoRegionBackup(IScene scene) | 642 | private void DoRegionBackup(IScene scene) |
562 | { | 643 | { |
@@ -585,25 +666,25 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
585 | iram.ArchiveRegion(savePath, guid, null); | 666 | iram.ArchiveRegion(savePath, guid, null); |
586 | } | 667 | } |
587 | 668 | ||
588 | /// <summary> | 669 | /// <summary> |
589 | /// Called by the Event Manager when the OnOarFileSaved event is fired. | 670 | /// Called by the Event Manager when the OnOarFileSaved event is fired. |
590 | /// </summary> | 671 | /// </summary> |
591 | /// <param name="guid"></param> | 672 | /// <param name="guid"></param> |
592 | /// <param name="message"></param> | 673 | /// <param name="message"></param> |
593 | void EventManager_OnOarFileSaved(Guid guid, string message) | 674 | void EventManager_OnOarFileSaved(Guid guid, string message) |
594 | { | 675 | { |
595 | // Ignore if the OAR save is being done by some other part of the system | 676 | // Ignore if the OAR save is being done by some other part of the system |
596 | if (m_pendingSaves.ContainsKey(guid)) | 677 | if (m_pendingSaves.ContainsKey(guid)) |
597 | { | 678 | { |
598 | AutoBackupModuleState abms = m_states[(m_pendingSaves[guid])]; | 679 | AutoBackupModuleState abms = m_states[(m_pendingSaves[guid])]; |
599 | ExecuteScript(abms.Script, abms.LiveRequests[guid]); | 680 | ExecuteScript(abms.Script, abms.LiveRequests[guid]); |
600 | m_pendingSaves.Remove(guid); | 681 | m_pendingSaves.Remove(guid); |
601 | abms.LiveRequests.Remove(guid); | 682 | abms.LiveRequests.Remove(guid); |
602 | } | 683 | } |
603 | } | 684 | } |
604 | 685 | ||
605 | /// <summary>This format may turn out to be too unwieldy to keep... | 686 | /// <summary>This format may turn out to be too unwieldy to keep... |
606 | /// Besides, that's what ctimes are for. But then how do I name each file uniquely without using a GUID? | 687 | /// Besides, that's what ctimes are for. But then how do I name each file uniquely without using a GUID? |
607 | /// Sequential numbers, right? We support those, too!</summary> | 688 | /// Sequential numbers, right? We support those, too!</summary> |
608 | private static string GetTimeString() | 689 | private static string GetTimeString() |
609 | { | 690 | { |
@@ -642,12 +723,12 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
642 | } | 723 | } |
643 | } | 724 | } |
644 | 725 | ||
645 | /// <summary> | 726 | /// <summary> |
646 | /// If the time dilation right at this instant is less than the threshold specified in AutoBackupDilationThreshold (default 0.5), | 727 | /// If the time dilation right at this instant is less than the threshold specified in AutoBackupDilationThreshold (default 0.5), |
647 | /// then we return false and trip the busy heuristic's "too busy" path (i.e. don't save an OAR). | 728 | /// then we return false and trip the busy heuristic's "too busy" path (i.e. don't save an OAR). |
648 | /// AutoBackupDilationThreshold is a _LOWER BOUND_. Lower Time Dilation is bad, so if you go lower than our threshold, it's "too busy". | 729 | /// AutoBackupDilationThreshold is a _LOWER BOUND_. Lower Time Dilation is bad, so if you go lower than our threshold, it's "too busy". |
649 | /// </summary> | 730 | /// </summary> |
650 | /// <param name="region"></param> | 731 | /// <param name="region"></param> |
651 | /// <returns>Returns true if we're not too busy; false means we've got worse time dilation than the threshold.</returns> | 732 | /// <returns>Returns true if we're not too busy; false means we've got worse time dilation than the threshold.</returns> |
652 | private bool RunTimeDilationHeuristic(IScene region) | 733 | private bool RunTimeDilationHeuristic(IScene region) |
653 | { | 734 | { |
@@ -657,12 +738,12 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
657 | regionName + ".AutoBackupDilationThreshold", 0.5f); | 738 | regionName + ".AutoBackupDilationThreshold", 0.5f); |
658 | } | 739 | } |
659 | 740 | ||
660 | /// <summary> | 741 | /// <summary> |
661 | /// If the root agent count right at this instant is less than the threshold specified in AutoBackupAgentThreshold (default 10), | 742 | /// If the root agent count right at this instant is less than the threshold specified in AutoBackupAgentThreshold (default 10), |
662 | /// then we return false and trip the busy heuristic's "too busy" path (i.e., don't save an OAR). | 743 | /// then we return false and trip the busy heuristic's "too busy" path (i.e., don't save an OAR). |
663 | /// AutoBackupAgentThreshold is an _UPPER BOUND_. Higher Agent Count is bad, so if you go higher than our threshold, it's "too busy". | 744 | /// AutoBackupAgentThreshold is an _UPPER BOUND_. Higher Agent Count is bad, so if you go higher than our threshold, it's "too busy". |
664 | /// </summary> | 745 | /// </summary> |
665 | /// <param name="region"></param> | 746 | /// <param name="region"></param> |
666 | /// <returns>Returns true if we're not too busy; false means we've got more agents on the sim than the threshold.</returns> | 747 | /// <returns>Returns true if we're not too busy; false means we've got more agents on the sim than the threshold.</returns> |
667 | private bool RunAgentLimitHeuristic(IScene region) | 748 | private bool RunAgentLimitHeuristic(IScene region) |
668 | { | 749 | { |
@@ -685,12 +766,12 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
685 | } | 766 | } |
686 | } | 767 | } |
687 | 768 | ||
688 | /// <summary> | 769 | /// <summary> |
689 | /// Run the script or executable specified by the "AutoBackupScript" config setting. | 770 | /// Run the script or executable specified by the "AutoBackupScript" config setting. |
690 | /// Of course this is a security risk if you let anyone modify OpenSim.ini and they want to run some nasty bash script. | 771 | /// Of course this is a security risk if you let anyone modify OpenSim.ini and they want to run some nasty bash script. |
691 | /// But there are plenty of other nasty things that can be done with an untrusted OpenSim.ini, such as running high threat level scripting functions. | 772 | /// But there are plenty of other nasty things that can be done with an untrusted OpenSim.ini, such as running high threat level scripting functions. |
692 | /// </summary> | 773 | /// </summary> |
693 | /// <param name="scriptName"></param> | 774 | /// <param name="scriptName"></param> |
694 | /// <param name="savePath"></param> | 775 | /// <param name="savePath"></param> |
695 | private static void ExecuteScript(string scriptName, string savePath) | 776 | private static void ExecuteScript(string scriptName, string savePath) |
696 | { | 777 | { |
@@ -719,10 +800,10 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
719 | } | 800 | } |
720 | } | 801 | } |
721 | 802 | ||
722 | /// <summary> | 803 | /// <summary> |
723 | /// Called if a running script process writes to stderr. | 804 | /// Called if a running script process writes to stderr. |
724 | /// </summary> | 805 | /// </summary> |
725 | /// <param name="sender"></param> | 806 | /// <param name="sender"></param> |
726 | /// <param name="e"></param> | 807 | /// <param name="e"></param> |
727 | private static void HandleProcErrorDataReceived(object sender, DataReceivedEventArgs e) | 808 | private static void HandleProcErrorDataReceived(object sender, DataReceivedEventArgs e) |
728 | { | 809 | { |
@@ -730,8 +811,8 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
730 | " is yacking on stderr: " + e.Data); | 811 | " is yacking on stderr: " + e.Data); |
731 | } | 812 | } |
732 | 813 | ||
733 | /// <summary> | 814 | /// <summary> |
734 | /// Quickly stop all timers from firing. | 815 | /// Quickly stop all timers from firing. |
735 | /// </summary> | 816 | /// </summary> |
736 | private void StopAllTimers() | 817 | private void StopAllTimers() |
737 | { | 818 | { |
@@ -742,11 +823,11 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
742 | this.m_closed = true; | 823 | this.m_closed = true; |
743 | } | 824 | } |
744 | 825 | ||
745 | /// <summary> | 826 | /// <summary> |
746 | /// Determine the next unique filename by number, for "Sequential" AutoBackupNamingType. | 827 | /// Determine the next unique filename by number, for "Sequential" AutoBackupNamingType. |
747 | /// </summary> | 828 | /// </summary> |
748 | /// <param name="dirName"></param> | 829 | /// <param name="dirName"></param> |
749 | /// <param name="regionName"></param> | 830 | /// <param name="regionName"></param> |
750 | /// <returns></returns> | 831 | /// <returns></returns> |
751 | private static string GetNextFile(string dirName, string regionName) | 832 | private static string GetNextFile(string dirName, string regionName) |
752 | { | 833 | { |
@@ -760,12 +841,12 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
760 | return uniqueFile.FullName; | 841 | return uniqueFile.FullName; |
761 | } | 842 | } |
762 | 843 | ||
763 | /// <summary> | 844 | /// <summary> |
764 | /// Top-level method for creating an absolute path to an OAR backup file based on what naming scheme the user wants. | 845 | /// Top-level method for creating an absolute path to an OAR backup file based on what naming scheme the user wants. |
765 | /// </summary> | 846 | /// </summary> |
766 | /// <param name="regionName">Name of the region to save.</param> | 847 | /// <param name="regionName">Name of the region to save.</param> |
767 | /// <param name="baseDir">Absolute or relative path to the directory where the file should reside.</param> | 848 | /// <param name="baseDir">Absolute or relative path to the directory where the file should reside.</param> |
768 | /// <param name="naming">The naming scheme for the file name.</param> | 849 | /// <param name="naming">The naming scheme for the file name.</param> |
769 | /// <returns></returns> | 850 | /// <returns></returns> |
770 | private static string BuildOarPath(string regionName, string baseDir, NamingType naming) | 851 | private static string BuildOarPath(string regionName, string baseDir, NamingType naming) |
771 | { | 852 | { |
@@ -792,11 +873,11 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup | |||
792 | return null; | 873 | return null; |
793 | } | 874 | } |
794 | 875 | ||
795 | /// <summary> | 876 | /// <summary> |
796 | /// Helper function for Sequential file naming type (see BuildOarPath and GetNextFile). | 877 | /// Helper function for Sequential file naming type (see BuildOarPath and GetNextFile). |
797 | /// </summary> | 878 | /// </summary> |
798 | /// <param name="dirName"></param> | 879 | /// <param name="dirName"></param> |
799 | /// <param name="regionName"></param> | 880 | /// <param name="regionName"></param> |
800 | /// <returns></returns> | 881 | /// <returns></returns> |
801 | private static long GetNextOarFileNumber(string dirName, string regionName) | 882 | private static long GetNextOarFileNumber(string dirName, string regionName) |
802 | { | 883 | { |