feat: add begin repair workflow
This commit is contained in:
1 parent
d738b8e27e
commit
f6a2512e23
21 files changed
+3108
-5
No files matched your search
@@ -0,0 +1,58 @@
|
||||
"""Domain exceptions for repair workflows."""
|
||||
|
||||
|
||||
class RepairError(Exception):
|
||||
"""Base exception for repair operations."""
|
||||
|
||||
|
||||
class RepairMinerNotFound(RepairError):
|
||||
"""Raised when the requested miner does not exist."""
|
||||
|
||||
def __init__(self, miner_id: object):
|
||||
self.miner_id = miner_id
|
||||
super().__init__(f"Miner not found: {miner_id}")
|
||||
|
||||
|
||||
class RepairConflict(RepairError):
|
||||
"""Base exception for a conflicting repair state."""
|
||||
|
||||
|
||||
class ActiveRepairConflict(RepairConflict):
|
||||
"""Raised when a miner already has an active repair."""
|
||||
|
||||
def __init__(self, miner_id: object):
|
||||
self.miner_id = miner_id
|
||||
super().__init__(f"Miner already has an active repair: {miner_id}")
|
||||
|
||||
|
||||
class IncompatibleMinerLifecycle(RepairConflict):
|
||||
"""Raised when the miner lifecycle cannot enter repair."""
|
||||
|
||||
def __init__(self, miner_id: object, lifecycle_status: object):
|
||||
self.miner_id = miner_id
|
||||
self.lifecycle_status = lifecycle_status
|
||||
super().__init__(
|
||||
"Miner lifecycle is incompatible with beginning repair: "
|
||||
f"{lifecycle_status}"
|
||||
)
|
||||
|
||||
|
||||
class InconsistentRepairState(RepairConflict):
|
||||
"""Raised when lifecycle state and repair records disagree."""
|
||||
|
||||
def __init__(self, miner_id: object):
|
||||
self.miner_id = miner_id
|
||||
super().__init__(
|
||||
"Miner is marked in repair but has no active repair record"
|
||||
)
|
||||
|
||||
|
||||
class RepairActorRequired(RepairError):
|
||||
"""Raised when an operational workflow lacks an authenticated actor."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("An authenticated actor is required to begin repair")
|
||||
|
||||
|
||||
class RepairPersistenceError(RepairError):
|
||||
"""Raised when a required repair persistence operation fails."""
|
||||
Reference in new issue
Block a user