ZFS Automatic Snapshot Daemon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

54 lines
1.9 KiB

''' ZFS implementation '''
from typing import Any, Tuple, Set, Mapping, Callable
from zasd.filesystem import FilesystemRegistry, FilesystemBase, FilesystemT, \
SnapshotKeyT, DispatcherMixin
class ZFSFilesystem(DispatcherMixin, FilesystemBase):
''' ZFS filesystem implementation. '''
@classmethod
def key(cls) -> str:
return 'zfs'
@classmethod
async def filesystems(cls) -> Mapping[str, FilesystemT]:
return dict()
def __init__(self):
super().__init__()
@classmethod
def configure(cls) -> Tuple[Mapping[str, Any], Callable[[Any], None]]:
glo = dict()
def configure(options):
pass
return (glo, configure)
def label(self) -> str:
''' Retrieve the filesystem label.'''
async def children(self) -> Mapping[str, FilesystemT]:
''' Get a dictionary of labels to filesystems that are children of this
filesystem. '''
async def snapshots(self) -> Set[SnapshotKeyT]:
''' Get a set of keys for snapshots managed by this filesystem
object. Snapshots taken on any children of the filesystem,
recursively or otherwise, are not included in the set. '''
async def take(self, tag: str, recursive: bool=False) -> SnapshotKeyT:
''' Take a snapshot on this filesystem and return the key. For recursive
snapshots, return the key of the filesystem the snapshot was
requested on. '''
async def delete(self, key: SnapshotKeyT, recursive: bool=False) -> None:
''' Delete a snapshot having a given key from this filesystem. For
recursive deletions, snapshots on children of the filesystem having
a tag and a timestamp equal to that of the parent snapshot are
deleted recursively. '''
FilesystemRegistry.register(ZFSFilesystem)