-
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.
Added error handle to orphaned objects monitoring (#247)
* Added ORPHANED_OBJECTS_ERROR_MSG_FIELD * Update old tests * Refactoring * Add OrphanedObjectsState --------- Co-authored-by: Nikita Unisikhin <nik.unisikhin.04@gmail.com>
- Loading branch information
1 parent
d7ca9d3
commit d49b7c9
Showing
6 changed files
with
118 additions
and
57 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 @@ | ||
import json | ||
from dataclasses import asdict, dataclass | ||
|
||
|
||
@dataclass | ||
class OrphanedObjectsState: | ||
orphaned_objects_size: int | ||
error_msg: str | ||
|
||
@classmethod | ||
def from_json(cls, json_str: str) -> "OrphanedObjectsState": | ||
data = json.loads(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) |
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
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
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
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