summaryrefslogtreecommitdiff
path: root/rdiff-backup/rdiff_backup/Globals.py
diff options
context:
space:
mode:
authorben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-07-16 05:16:42 +0000
committerben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-07-16 05:16:42 +0000
commit4c8440ee71ba819c7327913870a615186ef8d386 (patch)
tree5d4d811680e1b3fd0a3393de3d49eb9cae116481 /rdiff-backup/rdiff_backup/Globals.py
parent6efc3610e37994c38a70cf32266e1e495035fbd3 (diff)
downloadrdiff-backup-4c8440ee71ba819c7327913870a615186ef8d386.tar.gz
Various changes to 0.9.3, see CHANGELOG
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@157 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup/Globals.py')
-rw-r--r--rdiff-backup/rdiff_backup/Globals.py45
1 files changed, 42 insertions, 3 deletions
diff --git a/rdiff-backup/rdiff_backup/Globals.py b/rdiff-backup/rdiff_backup/Globals.py
index 0fc08f5..bf4a977 100644
--- a/rdiff-backup/rdiff_backup/Globals.py
+++ b/rdiff-backup/rdiff_backup/Globals.py
@@ -85,9 +85,6 @@ isbackup_writer = None
# Connection of the backup writer
backup_writer = None
-# True if this process is the client invoked by the user
-isclient = None
-
# Connection of the client
client_conn = None
@@ -171,6 +168,22 @@ select_source, select_mirror = None, None
# object. Access is provided to increment error counts.
ITRB = None
+# Percentage of time to spend sleeping. None means never sleep.
+sleep_ratio = None
+
+# security_level has 4 values and controls which requests from remote
+# systems will be honored. "all" means anything goes. "read-only"
+# means that the requests must not write to disk. "update-only" means
+# that requests shouldn't destructively update the disk (but normal
+# incremental updates are OK). "minimal" means only listen to a few
+# basic requests.
+security_level = "all"
+
+# If this is set, it indicates that the remote connection should only
+# deal with paths inside of restrict_path.
+restrict_path = None
+
+
def get(name):
"""Return the value of something in this module"""
return globals()[name]
@@ -199,6 +212,32 @@ def set_integer(name, val):
"received %s instead." % (name, val))
set(name, intval)
+def set_float(name, val, min = None, max = None, inclusive = 1):
+ """Like set, but make sure val is float within given bounds"""
+ def error():
+ s = "Variable %s must be set to a float" % (name,)
+ if min is not None and max is not None:
+ s += " between %s and %s " % (min, max)
+ if inclusive: s += "inclusive"
+ else: s += "not inclusive"
+ elif min is not None or max is not None:
+ if inclusive: inclusive_string = "or equal to "
+ else: inclusive_string = ""
+ if min is not None:
+ s += " greater than %s%s" % (inclusive_string, min)
+ else: s+= " less than %s%s" % (inclusive_string, max)
+ Log.FatalError(s)
+
+ try: f = float(val)
+ except ValueError: error()
+ if min is not None:
+ if inclusive and f < min: error()
+ elif not inclusive and f <= min: error()
+ if max is not None:
+ if inclusive and f > max: error()
+ elif not inclusive and f >= max: error()
+ set(name, f)
+
def get_dict_val(name, key):
"""Return val from dictionary in this class"""
return globals()[name][key]