api

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2025 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTestAlreadyExists = errors.New("test already exists")
	ErrTestNotFound      = errors.New("test not found")
	ErrTestComplete      = errors.New("test is already complete")
)

Functions

This section is empty.

Types

type ErrorInfo

type ErrorInfo struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type ProgressPoint

type ProgressPoint struct {
	Timestamp time.Time                 `json:"timestamp"`
	Metrics   reporting.ProgressMetrics `json:"metrics"`
}

type Response

type Response struct {
	Data  interface{} `json:"data,omitempty"`
	Error *ErrorInfo  `json:"error,omitempty"`
}

API response types

type SSEEvent

type SSEEvent struct {
	Type      string      `json:"type"` // "test_start", "test_progress", "test_complete"
	RunID     string      `json:"run_id"`
	Timestamp time.Time   `json:"timestamp"`
	Data      interface{} `json:"data"`
}

SSE event types

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(log logrus.FieldLogger, addr string, authToken string) *Server

func (*Server) EnableMockMode

func (s *Server) EnableMockMode()

EnableMockMode enables mock mode and generates test data

func (*Server) SetCORSOrigins

func (s *Server) SetCORSOrigins(origins string)

SetCORSOrigins sets the allowed CORS origins

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(log logrus.FieldLogger) *Store

func (*Store) CleanupOrphanedTests

func (s *Store) CleanupOrphanedTests() []string

func (*Store) CompleteTest

func (s *Store) CompleteTest(runID string, req reporting.TestCompleteRequest) error

func (*Store) CreateTest

func (s *Store) CreateTest(req reporting.TestKeepaliveRequest) error

Write operations

func (*Store) GetTest

func (s *Store) GetTest(runID string) (*TestData, error)

Read operations

func (*Store) GetTestDetail

func (s *Store) GetTestDetail(runID string) (*TestDetail, error)

func (*Store) ListTests

func (s *Store) ListTests(activeOnly bool) []TestSummary

func (*Store) MarkOrphanedTests

func (s *Store) MarkOrphanedTests() []string

MarkOrphanedTests marks tests as orphaned if no keepalive for a given interval

func (*Store) Start

func (s *Store) Start()

func (*Store) Stop

func (s *Store) Stop()

func (*Store) UpdateProgress

func (s *Store) UpdateProgress(runID string, metrics reporting.ProgressMetrics) error

func (*Store) UpdateTestKeepalive

func (s *Store) UpdateTestKeepalive(req reporting.TestKeepaliveRequest) error

type TestData

type TestData struct {
	RunID      string
	Network    string
	Labels     map[string]string
	StartTime  time.Time
	LastUpdate time.Time
	EndTime    *time.Time
	IsRunning  bool
	IsComplete bool
	Error      string

	ELClient    reporting.ClientConfig
	CLClient    reporting.ClientConfig
	EnclaveName string
	SystemInfo  *sysinfo.SystemInfo
	RunTimeout  int64

	CurrentMetrics *reporting.ProgressMetrics
	History        []ProgressPoint
}

type TestDetail

type TestDetail struct {
	TestSummary
	ProgressHistory []ProgressPoint        `json:"progress_history"`
	ELClientConfig  reporting.ClientConfig `json:"el_client_config"`
	CLClientConfig  reporting.ClientConfig `json:"cl_client_config"`
	EnclaveName     string                 `json:"enclave_name"`
	EndTime         *time.Time             `json:"end_time,omitempty"`
	Error           string                 `json:"error,omitempty"`
}

type TestListResponse

type TestListResponse struct {
	Tests       []TestSummary `json:"tests"`
	TotalCount  int           `json:"total_count"`
	ActiveCount int           `json:"active_count"`
}

type TestSummary

type TestSummary struct {
	RunID          string                     `json:"run_id"`
	Network        string                     `json:"network"`
	Labels         map[string]string          `json:"labels,omitempty"`
	StartTime      time.Time                  `json:"start_time"`
	LastUpdate     time.Time                  `json:"last_update"`
	IsRunning      bool                       `json:"is_running"`
	IsComplete     bool                       `json:"is_complete"`
	ELClient       string                     `json:"el_client"`
	CLClient       string                     `json:"cl_client"`
	ELClientConfig reporting.ClientConfig     `json:"el_client_config"`
	CLClientConfig reporting.ClientConfig     `json:"cl_client_config"`
	CurrentMetrics *reporting.ProgressMetrics `json:"current_metrics,omitempty"`
	SystemInfo     *sysinfo.SystemInfo        `json:"system_info,omitempty"`
	RunTimeout     int64                      `json:"run_timeout,omitempty"`
	Error          string                     `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL