Ejemplo n.º 1
0
 def catalog(self):
     path = '%s/catalog' % self.path
     fields = get_register_fields()
     try:
         return Catalog(path, fields, read_only=True)
     except (DatabaseError, DatabaseOpeningError):
         return None
Ejemplo n.º 2
0
 def catalog(self):
     path = '%s/catalog' % self.path
     fields = get_register_fields()
     try:
         return Catalog(path, fields, read_only=True)
     except (DatabaseError, DatabaseOpeningError):
         return None
Ejemplo n.º 3
0
Archivo: rw.py Proyecto: nkhine/itools
def make_database(path, size_min, size_max, fields=None, backend=None):
    """Create a new empty database if the given path does not exists or
    is a folder.
    """
    path = lfs.get_absolute_path(path)
    if fields is None:
        fields = get_register_fields()
    # Init backend
    backend_cls = backends_registry[backend]
    backend_cls.init_backend(path, fields)
    # Ok
    return RWDatabase(path, size_min, size_max)
Ejemplo n.º 4
0
Archivo: rw.py Proyecto: hforge/itools
def make_database(path, size_min, size_max, fields=None, backend=None):
    """Create a new empty database if the given path does not exists or
    is a folder.
    """
    path = lfs.get_absolute_path(path)
    if fields is None:
        fields = get_register_fields()
    # Init backend
    backend_cls = backends_registry[backend]
    backend_cls.init_backend(path, fields)
    # Ok
    return RWDatabase(path, size_min, size_max)
Ejemplo n.º 5
0
Archivo: ro.py Proyecto: hforge/itools
 def __init__(self, path=None, size_min=4800, size_max=5200, backend='lfs'):
     # Init path
     self.path = path
     # Init backend
     self.backend_cls = backends_registry[backend]
     # The "git add" arguments
     self.added = set()
     self.changed = set()
     self.removed = set()
     self.has_changed = False
     # Fields
     self.fields = get_register_fields()
     # init backend
     self.backend = self.backend_cls(self.path, self.fields, self.read_only)
     # A mapping from key to handler
     self.cache = LRUCache(size_min, size_max, automatic=False)
Ejemplo n.º 6
0
Archivo: ro.py Proyecto: nkhine/itools
 def __init__(self, path=None, size_min=4800, size_max=5200, backend='lfs'):
     # Init path
     self.path = path
     # Init backend
     self.backend_cls = backends_registry[backend]
     # The "git add" arguments
     self.added = set()
     self.changed = set()
     self.removed = set()
     self.has_changed = False
     # Fields
     self.fields = get_register_fields()
     # init backend
     self.backend = self.backend_cls(self.path, self.fields, self.read_only)
     # A mapping from key to handler
     self.cache = LRUCache(size_min, size_max, automatic=False)
Ejemplo n.º 7
0
def make_git_database(path, size_min, size_max, fields=None):
    """Create a new empty Git database if the given path does not exists or
    is a folder.

    If the given path is a folder with content, the Git archive will be
    initialized and the content of the folder will be added to it in a first
    commit.
    """
    path = lfs.get_absolute_path(path)
    # Git init
    open_worktree('%s/database' % path, init=True)
    # The catalog
    if fields is None:
        fields = get_register_fields()
    catalog = make_catalog('%s/catalog' % path, fields)
    # Ok
    database = RWDatabase(path, size_min, size_max)
    database.catalog = catalog
    return database
Ejemplo n.º 8
0
def make_git_database(path, size_min, size_max, fields=None):
    """Create a new empty Git database if the given path does not exists or
    is a folder.

    If the given path is a folder with content, the Git archive will be
    initialized and the content of the folder will be added to it in a first
    commit.
    """
    path = lfs.get_absolute_path(path)
    # Git init
    open_worktree('%s/database' % path, init=True)
    # The catalog
    if fields is None:
        fields = get_register_fields()
    catalog = make_catalog('%s/catalog' % path, fields)
    # Ok
    database = RWDatabase(path, size_min, size_max)
    database.catalog = catalog
    return database
Ejemplo n.º 9
0
Archivo: ro.py Proyecto: Ramel/itools
 def get_catalog(self):
     path = '%s/catalog' % self.path
     fields = get_register_fields()
     root = self.get_resource('/', soft=True)
     return Catalog(path, fields, read_only=self.read_only, root=root)
Ejemplo n.º 10
0
 def catalog(self):
     path = '%s/catalog' % self.path
     return Catalog(path, get_register_fields())
Ejemplo n.º 11
0
 def catalog(self):
     path = '%s/catalog' % self.path
     return Catalog(path, get_register_fields())