Documentation
¶
Overview ¶
Package server is the SPECTRE server, which collects the quarantines that mirrors report. It keeps them in a storage backend, in memory or in Redis.
Index ¶
- func DirectionFromMessage(direction pb.Direction) (model.Direction, error)
- func ReasonFromMessage(message *pb.Quarantine) (model.QuarantineReason, error)
- func Serve(ctx context.Context, config ServeConfig) error
- type ClearConfig
- type Reporter
- type ReporterConfig
- type ServeConfig
- type Service
- func (s *Service) ClearDivergences(ctx context.Context, request *connect.Request[pb.ClearDivergencesRequest]) (*connect.Response[pb.ClearDivergencesResponse], error)
- func (s *Service) Handler() http.Handler
- func (s *Service) ListDivergences(ctx context.Context, request *connect.Request[pb.ListDivergencesRequest]) (*connect.Response[pb.ListDivergencesResponse], error)
- func (s *Service) Quarantine(ctx 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 ¶
func DirectionFromMessage ¶
DirectionFromMessage restores the direction a mirror reported.
func ReasonFromMessage ¶
func ReasonFromMessage(message *pb.Quarantine) (model.QuarantineReason, error)
ReasonFromMessage restores the reason a mirror reported. Protobuf getters return plain strings, so the wire format is where named types are restored.
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 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>."`
Storage storage.Config `embed:""`
}
ServeConfig configures the SPECTRE server.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service serves the SPECTRE service API.
func NewService ¶
NewService returns a SPECTRE server that keeps divergences in store.
func (*Service) ClearDivergences ¶
func (s *Service) ClearDivergences(ctx 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(ctx 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(ctx context.Context, request *connect.Request[pb.QuarantineRequest]) (*connect.Response[pb.QuarantineResponse], error)
Quarantine records that a mirror quarantined its candidate.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package client calls the SPECTRE server.
|
Package client calls the SPECTRE server. |
|
Package storage keeps the divergences that mirrors report to the SPECTRE server, either in memory or in Redis.
|
Package storage keeps the divergences that mirrors report to the SPECTRE server, either in memory or in Redis. |