Documentation
¶
Overview ¶
Package catalog owns the versioned, secret-free application contract for catalog administration. Adapters receive summaries and explicit commands; domain entities and their metadata never cross the application boundary.
Index ¶
- Constants
- Variables
- type CaseInput
- type ChannelModelSummary
- type ChannelSummary
- type Clock
- type Counts
- type CreateChannelCommand
- type CreateChannelModelCommand
- type CreateModelCommand
- type CreatePlanCommand
- type CreateSuiteCommand
- type CreateTestCaseCommand
- type DeleteCommand
- type Dependencies
- type MetaFactory
- type ModelSummary
- type MutationResult
- type PlanEntryInput
- type PlanEntrySummary
- type PlanSummary
- type Repository
- type RepositoryErrorSet
- type SafeDiagnosticCause
- type SaveQuickTestTargetCommand
- type SavedQuickTestTarget
- type Scope
- type Service
- func (service *Service) Counts(ctx context.Context) (Counts, error)
- func (service *Service) CreateChannel(ctx context.Context, command CreateChannelCommand) (MutationResult, error)
- func (service *Service) CreateChannelModel(ctx context.Context, command CreateChannelModelCommand) (MutationResult, error)
- func (service *Service) CreateModel(ctx context.Context, command CreateModelCommand) (MutationResult, error)
- func (service *Service) CreatePlan(ctx context.Context, command CreatePlanCommand) (MutationResult, error)
- func (service *Service) CreateSuite(ctx context.Context, command CreateSuiteCommand) (MutationResult, error)
- func (service *Service) CreateTestCase(ctx context.Context, command CreateTestCaseCommand) (MutationResult, error)
- func (service *Service) DeleteChannel(ctx context.Context, command DeleteCommand) error
- func (service *Service) DeleteChannelModel(ctx context.Context, command DeleteCommand) error
- func (service *Service) DeleteModel(ctx context.Context, command DeleteCommand) error
- func (service *Service) DeletePlan(ctx context.Context, command DeleteCommand) error
- func (service *Service) DeleteSuite(ctx context.Context, command DeleteCommand) error
- func (service *Service) DeleteTestCase(ctx context.Context, command DeleteCommand) error
- func (service *Service) ListChannelModels(ctx context.Context) ([]ChannelModelSummary, error)
- func (service *Service) ListChannels(ctx context.Context) ([]ChannelSummary, error)
- func (service *Service) ListModels(ctx context.Context) ([]ModelSummary, error)
- func (service *Service) ListPlans(ctx context.Context) ([]PlanSummary, error)
- func (service *Service) ListSuites(ctx context.Context) ([]SuiteSummary, error)
- func (service *Service) ListTestCases(ctx context.Context) ([]TestCaseSummary, error)
- func (service *Service) Snapshot(ctx context.Context, scope Scope) (Snapshot, error)
- func (service *Service) UpdateChannel(ctx context.Context, command UpdateChannelCommand) (MutationResult, error)
- func (service *Service) UpdateChannelModel(ctx context.Context, command UpdateChannelModelCommand) (MutationResult, error)
- func (service *Service) UpdateModel(ctx context.Context, command UpdateModelCommand) (MutationResult, error)
- func (service *Service) UpdatePlan(ctx context.Context, command UpdatePlanCommand) (MutationResult, error)
- func (service *Service) UpdateSuite(ctx context.Context, command UpdateSuiteCommand) (MutationResult, error)
- func (service *Service) UpdateTestCase(ctx context.Context, command UpdateTestCaseCommand) (MutationResult, error)
- type Snapshot
- type SuiteSummary
- type TestCaseSummary
- type UpdateChannelCommand
- type UpdateChannelModelCommand
- type UpdateModelCommand
- type UpdatePlanCommand
- type UpdateSuiteCommand
- type UpdateTestCaseCommand
Constants ¶
const CurrentSnapshotSchemaVersion = 1
Variables ¶
var ( ErrInvalid = errors.New("catalog: invalid input") ErrPlanProtocolMismatch = fmt.Errorf("%w: plan target protocol mismatch", ErrInvalid) ErrNotFound = errors.New("catalog: record not found") ErrConflict = errors.New("catalog: revision conflict") ErrCorrupt = errors.New("catalog: inconsistent data") )
Functions ¶
This section is empty.
Types ¶
type ChannelModelSummary ¶
type ChannelSummary ¶
type Counts ¶
type Counts struct {
Models int `json:"models"`
Channels int `json:"channels"`
EnabledChannels int `json:"enabled_channels"`
ConfiguredChannels int `json:"configured_channels"`
ChannelModels int `json:"channel_models"`
TestCases int `json:"test_cases"`
Suites int `json:"suites"`
Plans int `json:"plans"`
}
Counts omits definitions and credential references from the overview payload.
type CreateChannelCommand ¶
type CreateChannelCommand struct {
Name string `json:"name"`
BaseURL string `json:"base_url"`
APIKey string `json:"api_key"`
Enabled bool `json:"enabled"`
CredentialID string `json:"credential_id,omitempty"`
}
func (*CreateChannelCommand) UnmarshalJSON ¶
func (command *CreateChannelCommand) UnmarshalJSON(data []byte) error
type CreateModelCommand ¶
type CreatePlanCommand ¶
type CreatePlanCommand struct {
Name string `json:"name"`
Protocol domain.Protocol `json:"protocol"`
Seed uint64 `json:"seed"`
Entries []PlanEntryInput `json:"entries"`
Performance *domain.PerformancePlanProfile `json:"performance,omitempty"`
}
type CreateSuiteCommand ¶
type CreateTestCaseCommand ¶
type CreateTestCaseCommand struct {
Key string `json:"key"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Dimension string `json:"dimension"`
Enabled bool `json:"enabled"`
Default bool `json:"default"`
Severity domain.CaseSeverity `json:"severity"`
ExecutionMode domain.CaseExecutionMode `json:"execution_mode"`
Definitions domain.ProtocolDefinitions `json:"definitions"`
}
type DeleteCommand ¶
type Dependencies ¶
type Dependencies struct {
Repository Repository
Clock Clock
MetaFactory MetaFactory
RepositoryErrors RepositoryErrorSet
CaseTypes *casetypes.Registry
}
type MetaFactory ¶
type MetaFactory func(time.Time) (domain.EntityMeta, error)
type ModelSummary ¶
type MutationResult ¶
type PlanEntryInput ¶
type PlanEntryInput struct {
Name string `json:"name,omitempty"`
OnFailure string `json:"on_failure,omitempty"`
Performance *domain.PerformancePlanProfile `json:"performance,omitempty"`
WarmupCount uint32 `json:"warmup_count"`
Settings testspec.RunSettings `json:"settings"`
EntryID string `json:"entry_id,omitempty"`
TargetKind domain.PlanTargetKind `json:"target_kind"`
TargetID string `json:"target_id"`
LoadMode domain.LoadMode `json:"load_mode"`
Concurrency uint32 `json:"concurrency"`
RequestCount uint64 `json:"request_count"`
RatePerSecond float64 `json:"rate_per_second"`
DurationMS uint64 `json:"duration_ms"`
RequestTimeoutMS uint64 `json:"request_timeout_ms"`
SLAThresholds map[string]float64 `json:"sla_thresholds"`
Parameters map[string]json.RawMessage `json:"parameters"`
}
type PlanEntrySummary ¶
type PlanEntrySummary struct {
PlanEntryInput
TargetKey string `json:"target_key"`
TargetName string `json:"target_name"`
CaseCount int `json:"case_count"`
}
type PlanSummary ¶
type PlanSummary struct {
Builtin bool `json:"builtin,omitempty"`
ID string `json:"id"`
Revision uint64 `json:"revision"`
Name string `json:"name"`
Protocol domain.Protocol `json:"protocol"`
Seed uint64 `json:"seed"`
EntryCount int `json:"entry_count"`
CaseCount int `json:"case_count"`
Entries []PlanEntrySummary `json:"entries"`
Performance *domain.PerformancePlanProfile `json:"performance,omitempty"`
}
type Repository ¶
type Repository interface {
ListModels(context.Context) ([]domain.Model, error)
ListChannels(context.Context) ([]domain.Channel, error)
ListChannelModels(context.Context) ([]domain.ChannelModel, error)
ListTestCases(context.Context) ([]domain.TestCase, error)
ListSuites(context.Context) ([]domain.Suite, error)
ListPlans(context.Context) ([]domain.Plan, error)
GetModel(context.Context, string) (domain.Model, error)
GetChannel(context.Context, string) (domain.Channel, error)
GetChannelModel(context.Context, string) (domain.ChannelModel, error)
GetTestCase(context.Context, string) (domain.TestCase, error)
GetSuite(context.Context, string) (domain.Suite, error)
GetPlan(context.Context, string) (domain.Plan, error)
CreateModel(context.Context, domain.Model) error
CreateChannel(context.Context, domain.Channel) error
CreateChannelModel(context.Context, domain.ChannelModel) error
CreateTestCase(context.Context, domain.TestCase) error
CreateSuite(context.Context, domain.Suite) error
CreatePlan(context.Context, domain.Plan) error
UpdateModel(context.Context, uint64, domain.Model) error
UpdateChannel(context.Context, uint64, domain.Channel) error
UpdateChannelModel(context.Context, uint64, domain.ChannelModel) error
UpdateTestCase(context.Context, uint64, domain.TestCase) error
UpdateSuite(context.Context, uint64, domain.Suite) error
UpdatePlan(context.Context, uint64, domain.Plan) error
DeleteModel(context.Context, string, uint64) error
DeleteChannel(context.Context, string, uint64) error
DeleteChannelModel(context.Context, string, uint64) error
DeleteTestCase(context.Context, string, uint64) error
DeleteSuite(context.Context, string, uint64) error
DeletePlan(context.Context, string, uint64) error
}
Repository is implemented by the file-backed authored-catalog adapter. Its values remain inside the application layer.
type RepositoryErrorSet ¶
RepositoryErrorSet lets an adapter declare its private error sentinels without making the application layer depend on that adapter.
type SafeDiagnosticCause ¶
type SafeDiagnosticCause interface {
SafeDiagnosticCause() string
}
SafeDiagnosticCause is implemented by repository adapters only after they have removed credentials and other sensitive values from an operational error. The service may retain this text for local diagnostics while keeping its stable public error sentinel.
type SaveQuickTestTargetCommand ¶
type SaveQuickTestTargetCommand struct {
Name string `json:"name"`
BaseURL string `json:"base_url"`
APIKey string `json:"api_key"`
CredentialRunID string `json:"credential_run_id,omitempty"`
ModelName string `json:"model_name"`
Protocol domain.Protocol `json:"protocol"`
}
SaveQuickTestTargetCommand persists the connection and its model mapping.
type SavedQuickTestTarget ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New(dependencies Dependencies) (*Service, error)
func (*Service) CreateChannel ¶
func (service *Service) CreateChannel(ctx context.Context, command CreateChannelCommand) (MutationResult, error)
func (*Service) CreateChannelModel ¶
func (service *Service) CreateChannelModel(ctx context.Context, command CreateChannelModelCommand) (MutationResult, error)
func (*Service) CreateModel ¶
func (service *Service) CreateModel(ctx context.Context, command CreateModelCommand) (MutationResult, error)
func (*Service) CreatePlan ¶
func (service *Service) CreatePlan(ctx context.Context, command CreatePlanCommand) (MutationResult, error)
func (*Service) CreateSuite ¶
func (service *Service) CreateSuite(ctx context.Context, command CreateSuiteCommand) (MutationResult, error)
func (*Service) CreateTestCase ¶
func (service *Service) CreateTestCase(ctx context.Context, command CreateTestCaseCommand) (MutationResult, error)
func (*Service) DeleteChannel ¶
func (service *Service) DeleteChannel(ctx context.Context, command DeleteCommand) error
func (*Service) DeleteChannelModel ¶
func (service *Service) DeleteChannelModel(ctx context.Context, command DeleteCommand) error
func (*Service) DeleteModel ¶
func (service *Service) DeleteModel(ctx context.Context, command DeleteCommand) error
func (*Service) DeletePlan ¶
func (service *Service) DeletePlan(ctx context.Context, command DeleteCommand) error
func (*Service) DeleteSuite ¶
func (service *Service) DeleteSuite(ctx context.Context, command DeleteCommand) error
func (*Service) DeleteTestCase ¶
func (service *Service) DeleteTestCase(ctx context.Context, command DeleteCommand) error
func (*Service) ListChannelModels ¶
func (service *Service) ListChannelModels(ctx context.Context) ([]ChannelModelSummary, error)
func (*Service) ListChannels ¶
func (service *Service) ListChannels(ctx context.Context) ([]ChannelSummary, error)
func (*Service) ListModels ¶
func (service *Service) ListModels(ctx context.Context) ([]ModelSummary, error)
func (*Service) ListPlans ¶
func (service *Service) ListPlans(ctx context.Context) ([]PlanSummary, error)
func (*Service) ListSuites ¶
func (service *Service) ListSuites(ctx context.Context) ([]SuiteSummary, error)
func (*Service) ListTestCases ¶
func (service *Service) ListTestCases(ctx context.Context) ([]TestCaseSummary, error)
func (*Service) UpdateChannel ¶
func (service *Service) UpdateChannel(ctx context.Context, command UpdateChannelCommand) (MutationResult, error)
func (*Service) UpdateChannelModel ¶
func (service *Service) UpdateChannelModel(ctx context.Context, command UpdateChannelModelCommand) (MutationResult, error)
func (*Service) UpdateModel ¶
func (service *Service) UpdateModel(ctx context.Context, command UpdateModelCommand) (MutationResult, error)
func (*Service) UpdatePlan ¶
func (service *Service) UpdatePlan(ctx context.Context, command UpdatePlanCommand) (MutationResult, error)
func (*Service) UpdateSuite ¶
func (service *Service) UpdateSuite(ctx context.Context, command UpdateSuiteCommand) (MutationResult, error)
func (*Service) UpdateTestCase ¶
func (service *Service) UpdateTestCase(ctx context.Context, command UpdateTestCaseCommand) (MutationResult, error)
type Snapshot ¶
type Snapshot struct {
SchemaVersion int `json:"schema_version"`
CaseTypes []casetypes.Descriptor `json:"case_types"`
Models []ModelSummary `json:"models"`
Channels []ChannelSummary `json:"channels"`
ChannelModels []ChannelModelSummary `json:"channel_models"`
TestCases []TestCaseSummary `json:"test_cases"`
Suites []SuiteSummary `json:"suites"`
Plans []PlanSummary `json:"plans"`
}
type SuiteSummary ¶
type SuiteSummary struct {
ID string `json:"id"`
Revision uint64 `json:"revision"`
Key string `json:"key"`
Name string `json:"name"`
Protocol domain.Protocol `json:"protocol"`
Description string `json:"description"`
CaseCount int `json:"case_count"`
Cases []CaseInput `json:"cases"`
Inputs []domain.SuiteInput `json:"inputs"`
}
type TestCaseSummary ¶
type TestCaseSummary struct {
ID string `json:"id"`
Revision uint64 `json:"revision"`
Key string `json:"key"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Dimension string `json:"dimension"`
Enabled bool `json:"enabled"`
Default bool `json:"default"`
Severity domain.CaseSeverity `json:"severity"`
ExecutionMode domain.CaseExecutionMode `json:"execution_mode"`
Definitions domain.ProtocolDefinitions `json:"definitions"`
}
type UpdateChannelCommand ¶
type UpdateChannelCommand struct {
ID string `json:"id"`
ExpectedRevision uint64 `json:"expected_revision"`
Name string `json:"name"`
BaseURL string `json:"base_url"`
APIKey string `json:"api_key"` // Empty keeps the current credential.
Enabled bool `json:"enabled"`
}
func (*UpdateChannelCommand) UnmarshalJSON ¶
func (command *UpdateChannelCommand) UnmarshalJSON(data []byte) error
type UpdateChannelModelCommand ¶
type UpdateChannelModelCommand struct {
ID string `json:"id"`
ExpectedRevision uint64 `json:"expected_revision"`
UpstreamModelName string `json:"upstream_model_name"`
Protocols []domain.Protocol `json:"protocols"`
}
UpdateChannelModelCommand deliberately omits ChannelID and ModelID because a binding's two owners are immutable after creation.
type UpdateModelCommand ¶
type UpdatePlanCommand ¶
type UpdatePlanCommand struct {
ID string `json:"id"`
ExpectedRevision uint64 `json:"expected_revision"`
Name string `json:"name"`
Protocol domain.Protocol `json:"protocol"`
Seed uint64 `json:"seed"`
Entries []PlanEntryInput `json:"entries"`
Performance *domain.PerformancePlanProfile `json:"performance,omitempty"`
}
type UpdateSuiteCommand ¶
type UpdateSuiteCommand struct {
ID string `json:"id"`
ExpectedRevision uint64 `json:"expected_revision"`
Key string `json:"key"`
Name string `json:"name"`
Protocol domain.Protocol `json:"protocol"`
Description string `json:"description"`
Cases []CaseInput `json:"cases"`
Inputs []domain.SuiteInput `json:"inputs"`
}
type UpdateTestCaseCommand ¶
type UpdateTestCaseCommand struct {
ID string `json:"id"`
ExpectedRevision uint64 `json:"expected_revision"`
Key string `json:"key"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Dimension string `json:"dimension"`
Enabled bool `json:"enabled"`
Default bool `json:"default"`
Severity domain.CaseSeverity `json:"severity"`
ExecutionMode domain.CaseExecutionMode `json:"execution_mode"`
Definitions domain.ProtocolDefinitions `json:"definitions"`
}