Documentation
¶
Overview ¶
Package server is the SPECTRE server, which collects the quarantines that mirrors report. It keeps them in memory, so a restart loses them.
Index ¶
- func Serve(ctx context.Context, config ServeConfig) error
- func WriteDivergences(ctx context.Context, w io.Writer, server *client.Client, ...) error
- type ClearConfig
- type DivergencesConfig
- type Reporter
- type ReporterConfig
- type ServeConfig
- type Service
- func (s *Service) ClearDivergences(_ context.Context, request *connect.Request[pb.ClearDivergencesRequest]) (*connect.Response[pb.ClearDivergencesResponse], error)
- func (s *Service) Handler() http.Handler
- func (s *Service) ListDivergences(_ context.Context, request *connect.Request[pb.ListDivergencesRequest]) (*connect.Response[pb.ListDivergencesResponse], error)
- func (s *Service) Quarantine(_ context.Context, request *connect.Request[pb.QuarantineRequest]) (*connect.Response[pb.QuarantineResponse], error)
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClearConfig ¶
type ClearConfig struct {
Client client.Config `embed:""`
Service string `required:"" help:"Service whose divergences to clear."`
Environment string `required:"" help:"Environment whose divergences to clear."`
}
ClearConfig names the service environment whose divergences to clear.
type DivergencesConfig ¶ added in v1.8.0
type DivergencesConfig struct {
Client client.Config `embed:""`
JSON bool `help:"Print JSON instead of text."`
Service string `help:"Only list divergences of this service."`
Environment string `help:"Only list divergences in this environment."`
Revision string `help:"Only list divergences of this candidate revision."`
Node string `help:"Only list divergences on routes of this migration state node."`
}
DivergencesConfig selects the divergences that the divergences command lists.
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
Reporter sends each quarantine of a mirror's sources to the SPECTRE server.
func NewReporter ¶
func NewReporter(config ReporterConfig, server *client.Client, sources ...Source) *Reporter
NewReporter reports the quarantines of a mirror's sources through server.
type ReporterConfig ¶
type ReporterConfig struct {
Client client.Config `embed:""`
Service string `required:"" help:"Service the mirror runs, reported to the SPECTRE server."`
Environment string `required:"" help:"Environment the mirror runs in, such as production-us-west-2, reported to the SPECTRE server."`
Revision string `required:"" help:"Commit of the candidate the mirror runs, reported to the SPECTRE server."`
}
ReporterConfig configures how a mirror reports quarantines to the SPECTRE server.
type ServeConfig ¶
type ServeConfig struct {
Listen string `default:"127.0.0.1:50070" help:"Address for the SPECTRE server: host:port, or unix:<path|@abstract>."`
}
ServeConfig configures the SPECTRE server.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service serves the SPECTRE service API.
func NewService ¶
func NewService() *Service
NewService returns a SPECTRE server with no divergences.
func (*Service) ClearDivergences ¶
func (s *Service) ClearDivergences(_ context.Context, request *connect.Request[pb.ClearDivergencesRequest]) (*connect.Response[pb.ClearDivergencesResponse], error)
ClearDivergences removes the divergences of one service environment.
func (*Service) ListDivergences ¶
func (s *Service) ListDivergences(_ context.Context, request *connect.Request[pb.ListDivergencesRequest]) (*connect.Response[pb.ListDivergencesResponse], error)
ListDivergences returns the latest quarantine of each mirror direction.
func (*Service) Quarantine ¶
func (s *Service) Quarantine(_ context.Context, request *connect.Request[pb.QuarantineRequest]) (*connect.Response[pb.QuarantineResponse], error)
Quarantine records that a mirror quarantined its candidate.