Add primary key attribute to borg classes

This commit is contained in:
George Lacey 2021-05-04 12:04:46 +01:00
parent 57255d964c
commit b9664263d0
4 changed files with 8 additions and 4 deletions

View File

@ -2,11 +2,12 @@ from datetime import datetime
class Archive(object): class Archive(object):
def __init__(self, fingerprint: str, name: str, start: datetime, end: datetime): def __init__(self, fingerprint: str, name: str, start: datetime, end: datetime, primary_key=None):
self.fingerprint = fingerprint self.fingerprint = fingerprint
self.name = name self.name = name
self.start = start self.start = start
self.end = end self.end = end
self.primary_key = primary_key
@classmethod @classmethod
def from_json(cls, json: dict): def from_json(cls, json: dict):

View File

@ -2,9 +2,10 @@ from datetime import datetime
class Error(object): class Error(object):
def __init__(self, error: str, time: datetime): def __init__(self, error: str, time: datetime, primary_key=None):
self.error = error self.error = error
self.time = time self.time = time
self.primary_key = primary_key
@classmethod @classmethod
def from_json(cls, json: dict): def from_json(cls, json: dict):

View File

@ -3,10 +3,11 @@ from pathlib import Path
class Repo(object): class Repo(object):
def __init__(self, fingerprint: str, location: Path, last_modified: datetime): def __init__(self, fingerprint: str, location: Path, last_modified: datetime, primary_key=None):
self.fingerprint = fingerprint self.fingerprint = fingerprint
self.location = location self.location = location
self.last_modified = last_modified self.last_modified = last_modified
self.primary_key = primary_key
@classmethod @classmethod
def from_json(cls, json: dict): def from_json(cls, json: dict):

View File

@ -1,9 +1,10 @@
class Stats(object): class Stats(object):
def __init__(self, file_count: int, original_size: int, compressed_size: int, deduplicated_size: int): def __init__(self, file_count: int, original_size: int, compressed_size: int, deduplicated_size: int, primary_key=None):
self.file_count = file_count self.file_count = file_count
self.original_size = original_size self.original_size = original_size
self.compressed_size = compressed_size self.compressed_size = compressed_size
self.deduplicated_size = deduplicated_size self.deduplicated_size = deduplicated_size
self.primary_key = primary_key
@classmethod @classmethod
def from_json(cls, json: dict): def from_json(cls, json: dict):