Documentation ¶
Index ¶
- type Config
- type Storage
- func (s *Storage) LoadEvents(id string) (evts []app.Event, loaded bool)
- func (s *Storage) SearchTest(f func(k, v string) bool) (id string, canary string)
- func (s *Storage) SetTest(secret []byte) (id string, canary string, err error)
- func (s *Storage) StartExpire(ret chan error)
- func (s *Storage) StoreEvent(evt app.Event) error
- func (s *Storage) TotalEvents() int
- func (s *Storage) TotalTests() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { TTL time.Duration CheckInterval time.Duration MaxRestarts int MaxEvents int MaxEventsByTest int MaxDumpSize int HMACKey []byte }
Config represents the storage's configurable options.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage represents the storage itself, holding its configurations and state.
func New ¶
New contains the logic to construct and return a new *Storage according to the passed *Config object. In case of error, it returns the error to the caller.
func (*Storage) LoadEvents ¶
LoadEvents returns the copy of an test's events slice if the test exists.
func (*Storage) SearchTest ¶
SearchTest receives a function to be run against each tests' id and canary, and returns the id and canary of the first test for which the passed function returns true. If the function never returns true empty strings are returned to the caller.
func (*Storage) SetTest ¶
SetTest creates a new test or fetches an existing one to return a newly generated or already existing test id. In case of error, it returns the error to the caller.
func (*Storage) StartExpire ¶
StartExpire is used by the caller to start expiring events and, in case of a panic from expire function, try to restart the expiration process the configured number of times.
Panics should not and are not expected to happen as a normal occurrence, so this may be useless and soon to be dropped.
func (*Storage) StoreEvent ¶
StoreEvent appends an event to an existing test if it exists, otherwise it will return an error to the caller.
func (*Storage) TotalEvents ¶
TotalEvents returns the number of total events recorded in the storage at the moment.
func (*Storage) TotalTests ¶
TotalTests returns the number of total tests recorded in the storage at the moment.