init
This commit is contained in:
67
core/objects/backup_object.py
Normal file
67
core/objects/backup_object.py
Normal file
@@ -0,0 +1,67 @@
|
||||
"""
|
||||
********************************************
|
||||
* @Date: 2024 09 27
|
||||
* @Description: BackupObject备份对象
|
||||
********************************************
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import List, Union
|
||||
from .tree_object import TreeObject
|
||||
from .blob_object import BlobObject
|
||||
|
||||
|
||||
class BackupObject(ObjectBase):
|
||||
"""
|
||||
备份对象,负责管理存储对象(tree、blob)对象、备份信息、恢复等操作
|
||||
"""
|
||||
|
||||
backup_name: str
|
||||
backup_time_lately: str
|
||||
backup_time_create: str
|
||||
backup_size: int
|
||||
backup_version_number: int
|
||||
backup_tree: List[Union[TreeObject, BlobObject]]
|
||||
new_backup_flag: bool
|
||||
|
||||
def __init__(self, backup_name: str, backup_base_path: str):
|
||||
self.backup_name = backup_name
|
||||
|
||||
backup_path = os.path.join(backup_base_path, backup_name)
|
||||
if not os.path.exists(backup_path):
|
||||
self.new_backup_flag = True
|
||||
else:
|
||||
self.new_backup_flag = False
|
||||
pass #TODO 读取备份信息
|
||||
|
||||
|
||||
def createNewBackup(self, backup_dirs: List[str]):
|
||||
"""
|
||||
创建新的备份
|
||||
|
||||
:return
|
||||
"""
|
||||
for backup_dir in backup_dirs:
|
||||
if os.path.isdir(backup_dir):
|
||||
self.backup_tree.append(TreeObject(backup_dir))
|
||||
else:
|
||||
self.backup_tree.append(BlobObject(backup_dir))
|
||||
|
||||
def backup(self):
|
||||
pass
|
||||
|
||||
def recover(self, recover_path: str):
|
||||
"""
|
||||
恢复到指定备份
|
||||
|
||||
:return
|
||||
"""
|
||||
pass
|
||||
|
||||
def getBackupTree(self):
|
||||
"""
|
||||
获取备份树
|
||||
|
||||
:return
|
||||
"""
|
||||
pass
|
||||
Reference in New Issue
Block a user