Documentation
¶
Overview ¶
Package storage keeps the divergences that mirrors report to the SPECTRE server, either in memory or in Redis.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Storage Backend `default:"memory" enum:"memory,redis" help:"Where to keep divergences: memory, which a restart loses, or redis."`
RedisURL string `` /* 145-byte string literal not displayed */
}
Config selects where the SPECTRE server keeps divergences.
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
Memory keeps divergences in memory, so a restart loses them. Stored divergences share their slices with callers, who never mutate them.
func (*Memory) Clear ¶
Clear removes the divergences of both directions of a service environment's mirror.
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
Redis keeps divergences in a Redis hash, so they outlive the SPECTRE server and are shared by every server using the same Redis database.
func (*Redis) Clear ¶
Clear removes the divergences of both directions of a service environment's mirror.
type Store ¶
type Store interface {
// Record keeps a divergence unless its source has already reported a later quarantine.
Record(ctx context.Context, divergence model.Divergence) error
// Clear removes the divergences of both directions of a service environment's mirror.
Clear(ctx context.Context, service, environment string) error
// List returns every stored divergence, in no particular order.
List(ctx context.Context) ([]model.Divergence, error)
Close() error
}
Store keeps the latest divergence of each mirror direction. Callers validate divergences before recording them and never mutate stored or listed ones.