|
9 | 9 | NativeTransportBackend, |
10 | 10 | native_extension_available, |
11 | 11 | ) |
| 12 | +from ix_operator.diagnostics import ApplicationSnapshot |
12 | 13 | from ix_operator.identity import NodeIdentity, NodeIdentityStore, default_identity_store |
13 | 14 | from ix_operator.node import OperatorNode |
14 | 15 | from ix_operator.runtime import RuntimeContext |
@@ -47,6 +48,25 @@ def context(self) -> RuntimeContext: |
47 | 48 | def identity_store(self) -> NodeIdentityStore: |
48 | 49 | return self._identity_store |
49 | 50 |
|
| 51 | + def status_snapshot(self) -> ApplicationSnapshot: |
| 52 | + identity = self._identity_store.load() |
| 53 | + |
| 54 | + snapshot = ApplicationSnapshot( |
| 55 | + product_name="IX-Operator", |
| 56 | + version="0.1.0", |
| 57 | + mode=self._config.mode.value, |
| 58 | + transport=self._config.transport_backend.value, |
| 59 | + boot_id=self._context.boot_id, |
| 60 | + runtime_root=str(self._config.runtime_paths.root), |
| 61 | + audit_log_path=str(self._context.audit.path), |
| 62 | + identity_path=str(self._identity_store.path), |
| 63 | + identity_exists=self._identity_store.exists(), |
| 64 | + native_extension_available=native_extension_available(), |
| 65 | + local_peer_id=identity.peer_id if identity is not None else None, |
| 66 | + ) |
| 67 | + snapshot.validate() |
| 68 | + return snapshot |
| 69 | + |
50 | 70 | def initialize_identity( |
51 | 71 | self, |
52 | 72 | *, |
|
0 commit comments