Back to index

obnam  1.1
__init__.py
Go to the documentation of this file.
00001 # Copyright (C) 2009-2011  Lars Wirzenius
00002 #
00003 # This program is free software: you can redistribute it and/or modify
00004 # it under the terms of the GNU General Public License as published by
00005 # the Free Software Foundation, either version 3 of the License, or
00006 # (at your option) any later version.
00007 #
00008 # This program is distributed in the hope that it will be useful,
00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 # GNU General Public License for more details.
00012 #
00013 # You should have received a copy of the GNU General Public License
00014 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
00015 
00016 
00017 import cliapp
00018 
00019 
00020 __version__ = '1.1'
00021 
00022 
00023 
00024 # Import _obnam if it is there. We need to be able to do things without
00025 # it, especially at build time, while we're generating manual pages.
00026 # If _obnam is not there, substitute a dummy that throws an exception
00027 # if used.
00028 class DummyExtension(object):
00029     def __getattr__(self, name):
00030         raise Exception('Trying to use _obnam, but that was not found.')
00031 try:
00032     import _obnam
00033 except ImportError:
00034     _obnam = DummyExtension()
00035 
00036 from pluginmgr import PluginManager
00037 
00038 
00039 class Error(cliapp.AppException):
00040     pass
00041 
00042 
00043 DEFAULT_NODE_SIZE = 256 * 1024 # benchmarked on 2011-09-01
00044 DEFAULT_CHUNK_SIZE = 1024 * 1024 # benchmarked on 2011-09-01
00045 DEFAULT_UPLOAD_QUEUE_SIZE = 1024
00046 DEFAULT_LRU_SIZE = 500
00047 DEFAULT_CHUNKIDS_PER_GROUP = 1024
00048 DEFAULT_NAGIOS_WARN_AGE = '27h'
00049 DEFAULT_NAGIOS_CRIT_AGE = '8d'
00050 
00051 # The following values have been determined empirically on a laptop
00052 # with an encrypted ext4 filesystem. Other values might be better for
00053 # other situations.
00054 IDPATH_DEPTH = 3
00055 IDPATH_BITS = 12
00056 IDPATH_SKIP = 13
00057 
00058 # Maximum identifier for clients, chunks, files, etc. This is the largest
00059 # unsigned 64-bit value. In various places we assume 64-bit field sizes
00060 # for on-disk data structures.
00061 MAX_ID = 2**64 - 1
00062 
00063 
00064 option_group = {
00065     'perf': 'Performance tweaking',
00066     'devel': 'Development of Obnam itself',
00067 }
00068 
00069 
00070 from sizeparse import SizeSyntaxError, UnitNameError, ByteSizeParser
00071 
00072 from encryption import (generate_symmetric_key,
00073                         encrypt_symmetric,
00074                         decrypt_symmetric,
00075                         get_public_key,
00076                         Keyring,
00077                         SecretKeyring,
00078                         encrypt_with_keyring,
00079                         decrypt_with_secret_keys,
00080                         SymmetricKeyCache)
00081 
00082 from hooks import Hook, MissingFilterError, FilterHook, HookManager
00083 from pluginbase import ObnamPlugin
00084 from vfs import VirtualFileSystem, VfsFactory, VfsTests
00085 from vfs_local import LocalFS
00086 from metadata import (read_metadata, set_metadata, Metadata, metadata_fields,
00087                       metadata_verify_fields, encode_metadata, decode_metadata)
00088 from repo_tree import RepositoryTree
00089 from chunklist import ChunkList
00090 from clientlist import ClientList
00091 from checksumtree import ChecksumTree
00092 from clientmetadatatree import ClientMetadataTree
00093 from lockmgr import LockManager
00094 from repo import Repository, LockFail, BadFormat
00095 from forget_policy import ForgetPolicy
00096 from app import App
00097 
00098 __all__ = locals()