Documentation
¶
Index ¶
- type DashboardService
- func (s *DashboardService) GetMetricsTimeSeries(ctx context.Context, appName string, period Period) (ports.MetricsTimeSeries, error)
- func (s *DashboardService) GetStats(ctx context.Context) (ports.DashboardStats, error)
- func (s *DashboardService) ListInstances(ctx context.Context, limit int) ([]ports.InstanceSummary, error)
- type InstanceService
- func (s *InstanceService) Activate(ctx context.Context, instanceID string) error
- func (s *InstanceService) GetPublicKey(ctx context.Context, instanceID string) (string, error)
- func (s *InstanceService) Register(ctx context.Context, input RegisterInstanceInput) error
- func (s *InstanceService) Revoke(ctx context.Context, instanceID string) error
- type Period
- type RegisterInstanceInput
- type SaveSnapshotInput
- type SnapshotService
- func (s *SnapshotService) GetHistory(ctx context.Context, instanceID string, limit int) ([]*domain.Snapshot, error)
- func (s *SnapshotService) GetLatest(ctx context.Context, instanceID string) (*domain.Snapshot, error)
- func (s *SnapshotService) Save(ctx context.Context, input SaveSnapshotInput) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DashboardService ¶
type DashboardService struct {
// contains filtered or unexported fields
}
DashboardService handles dashboard-related use cases. This is a read-only service (CQRS-lite pattern).
func NewDashboardService ¶
func NewDashboardService(reader ports.DashboardReader) *DashboardService
NewDashboardService creates a new DashboardService.
func (*DashboardService) GetMetricsTimeSeries ¶
func (s *DashboardService) GetMetricsTimeSeries(ctx context.Context, appName string, period Period) (ports.MetricsTimeSeries, error)
GetMetricsTimeSeries returns time-series metrics for an app.
func (*DashboardService) GetStats ¶
func (s *DashboardService) GetStats(ctx context.Context) (ports.DashboardStats, error)
GetStats returns aggregated dashboard statistics.
func (*DashboardService) ListInstances ¶
func (s *DashboardService) ListInstances(ctx context.Context, limit int) ([]ports.InstanceSummary, error)
ListInstances returns instances with their latest metrics.
type InstanceService ¶
type InstanceService struct {
// contains filtered or unexported fields
}
InstanceService handles instance-related use cases.
func NewInstanceService ¶
func NewInstanceService(repo ports.InstanceRepository) *InstanceService
NewInstanceService creates a new InstanceService.
func (*InstanceService) Activate ¶
func (s *InstanceService) Activate(ctx context.Context, instanceID string) error
Activate transitions an instance from pending to active status. This requires a valid signature (verified by middleware before calling this).
func (*InstanceService) GetPublicKey ¶
GetPublicKey retrieves the public key for signature verification. Returns an error if the instance is not found or is revoked.
func (*InstanceService) Register ¶
func (s *InstanceService) Register(ctx context.Context, input RegisterInstanceInput) error
Register registers a new instance or updates an existing one. This is an unauthenticated endpoint - instances self-register with their public key.
type RegisterInstanceInput ¶
type RegisterInstanceInput struct {
InstanceID string
PublicKey string
AppName string
AppVersion string
DeploymentMode string
Environment string
OSArch string
}
RegisterInstanceInput holds the data needed to register an instance.
type SaveSnapshotInput ¶
type SaveSnapshotInput struct {
InstanceID string
Timestamp time.Time
Metrics json.RawMessage
}
SaveSnapshotInput holds the data needed to save a snapshot.
type SnapshotService ¶
type SnapshotService struct {
// contains filtered or unexported fields
}
SnapshotService handles snapshot-related use cases.
func NewSnapshotService ¶
func NewSnapshotService(snapshotRepo ports.SnapshotRepository, instanceRepo ports.InstanceRepository) *SnapshotService
NewSnapshotService creates a new SnapshotService.
func (*SnapshotService) GetHistory ¶
func (s *SnapshotService) GetHistory(ctx context.Context, instanceID string, limit int) ([]*domain.Snapshot, error)
GetHistory retrieves recent snapshots for an instance.
func (*SnapshotService) GetLatest ¶
func (s *SnapshotService) GetLatest(ctx context.Context, instanceID string) (*domain.Snapshot, error)
GetLatest retrieves the most recent snapshot for an instance.
func (*SnapshotService) Save ¶
func (s *SnapshotService) Save(ctx context.Context, input SaveSnapshotInput) error
Save validates and persists a snapshot from an instance. The instance must exist and not be revoked (verified by signature middleware).