feat(daemon): add GET /status endpoint (bd-148)
- Add OpStatus operation and StatusResponse type to RPC protocol - Add workspacePath and dbPath fields to Server struct - Implement handleStatus() handler with daemon metadata - Track last activity time with atomic.Value - Add client.Status() method - Check for exclusive locks via ShouldSkipDatabase() - Update all test files to use new NewServer signature - Add comprehensive status endpoint test Closes bd-148
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
// Operation constants for all bd commands
|
||||
const (
|
||||
OpPing = "ping"
|
||||
OpStatus = "status"
|
||||
OpHealth = "health"
|
||||
OpMetrics = "metrics"
|
||||
OpCreate = "create"
|
||||
@@ -165,6 +166,19 @@ type PingResponse struct {
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
// StatusResponse represents the daemon status metadata
|
||||
type StatusResponse struct {
|
||||
Version string `json:"version"` // Server/daemon version
|
||||
WorkspacePath string `json:"workspace_path"` // Absolute path to workspace root
|
||||
DatabasePath string `json:"database_path"` // Absolute path to database file
|
||||
SocketPath string `json:"socket_path"` // Path to Unix socket
|
||||
PID int `json:"pid"` // Process ID
|
||||
UptimeSeconds float64 `json:"uptime_seconds"` // Time since daemon started
|
||||
LastActivityTime string `json:"last_activity_time"` // ISO 8601 timestamp of last request
|
||||
ExclusiveLockActive bool `json:"exclusive_lock_active"` // Whether an exclusive lock is held
|
||||
ExclusiveLockHolder string `json:"exclusive_lock_holder,omitempty"` // Lock holder name if active
|
||||
}
|
||||
|
||||
// HealthResponse is the response for a health check operation
|
||||
type HealthResponse struct {
|
||||
Status string `json:"status"` // "healthy", "degraded", "unhealthy"
|
||||
|
||||
Reference in New Issue
Block a user