[feat] add basic domain & usecase
This commit is contained in:
parent
f0c4988b44
commit
9083e33675
10 changed files with 137 additions and 5 deletions
|
|
@ -16,3 +16,19 @@ class UserConflictError(UserError):
|
|||
def __init__(self, email: str) -> None:
|
||||
super().__init__('user_conflict')
|
||||
self.email = email
|
||||
|
||||
|
||||
class SandboxError(DomainError):
|
||||
pass
|
||||
|
||||
|
||||
class SandboxStartError(SandboxError):
|
||||
def __init__(self, chat_id: str) -> None:
|
||||
super().__init__('sandbox_start_failed')
|
||||
self.chat_id = chat_id
|
||||
|
||||
|
||||
class SandboxAlreadyRunningError(SandboxError):
|
||||
def __init__(self, chat_id: str) -> None:
|
||||
super().__init__('sandbox_already_running')
|
||||
self.chat_id = chat_id
|
||||
|
|
|
|||
21
domain/sandbox.py
Normal file
21
domain/sandbox.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class SandboxStatus(str, Enum):
|
||||
STARTING = 'starting'
|
||||
RUNNING = 'running'
|
||||
STOPPING = 'stopping'
|
||||
STOPPED = 'stopped'
|
||||
FAILED = 'failed'
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class SandboxSession:
|
||||
session_id: str
|
||||
chat_id: str
|
||||
container_id: str
|
||||
status: SandboxStatus
|
||||
created_at: datetime
|
||||
expires_at: datetime
|
||||
Loading…
Add table
Add a link
Reference in a new issue