-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nikita Unisikhin
committed
Nov 3, 2024
1 parent
e93101e
commit f38f085
Showing
2 changed files
with
29 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
ch_tools/chadmin/internal/object_storage/orphaned_objects_state.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from dataclasses import asdict, dataclass | ||
import json | ||
|
||
|
||
@dataclass | ||
class OrphanedObjectsState: | ||
orphaned_objects_size: int | ||
error_msg: str | ||
|
||
@classmethod | ||
def from_json(cls, json_str: str) -> "OrphanedObjectsState": | ||
data = json.load(json_str) | ||
return cls( | ||
orphaned_objects_size=data['orphaned_objects_size'], | ||
error_msg=data['error_msg'] | ||
) | ||
|
||
def to_json(self) -> str: | ||
return json.dumps(asdict(self), indent=4) |