storage

package
v0.0.0-...-5002849 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

View Source
const (
	SynTestsBase           = "syntest-plugins"
	AllTestRunStatus       = SynTestsBase + "/all/testRunStatus" // ui needs this
	AllPluginStatus        = SynTestsBase + "/all/pluginStatus"
	PluginLatestHealthFmt  = SynTestsBase + "/%s/latestHealth"
	PluginLastUnhealthyFmt = SynTestsBase + "/%s/lastUnhealthy"
	TestRunLatestFmt       = SynTestsBase + "/%s/latestRun"
	TestRunLastFailedFmt   = SynTestsBase + "/%s/lastFailedRun"

	ConfigBase             = "configs"
	ConfigSynTestsSummary  = ConfigBase + "/syntests/summary"
	ConfigSynTestJsonFmt   = ConfigBase + "/syntest/%s/json"
	ConfigSynTestRawFmt    = ConfigBase + "/syntest/%s/raw"
	ConfigSynTestStatusFmt = ConfigBase + "/syntest/%s/status"

	AgentsAll = "agents/all"

	SynTestChannel = "syntests"
	ConfigChannel  = "config"
	AgentChannel   = "agent"
)

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type RedisSynHeartStore

type RedisSynHeartStore struct {
	// contains filtered or unexported fields
}

func NewRedisSynHeartStore

func NewRedisSynHeartStore(config SynHeartStoreConfig, log hclog.Logger) RedisSynHeartStore

func (*RedisSynHeartStore) Close

func (r *RedisSynHeartStore) Close() error

func (*RedisSynHeartStore) DelR

func (r *RedisSynHeartStore) DelR(ctx context.Context, key string) error

Deletes key and val

func (*RedisSynHeartStore) DeleteAgentStatus

func (r *RedisSynHeartStore) DeleteAgentStatus(ctx context.Context, agentId string) error

func (*RedisSynHeartStore) DeleteAllTestRunInfo

func (r *RedisSynHeartStore) DeleteAllTestRunInfo(ctx context.Context, pluginId string) error

func (*RedisSynHeartStore) DeleteTestConfig

func (r *RedisSynHeartStore) DeleteTestConfig(ctx context.Context, configId string) error

func (*RedisSynHeartStore) FetchAllAgentStatus

func (r *RedisSynHeartStore) FetchAllAgentStatus(ctx context.Context) (map[string]common.AgentStatus, error)

func (*RedisSynHeartStore) FetchAllPluginStatus

func (r *RedisSynHeartStore) FetchAllPluginStatus(ctx context.Context) (map[string]string, error)

func (*RedisSynHeartStore) FetchAllTestConfigSummary

func (r *RedisSynHeartStore) FetchAllTestConfigSummary(ctx context.Context) (map[string]common.SyntestConfigSummary, error)

func (*RedisSynHeartStore) FetchAllTestRunStatus

func (r *RedisSynHeartStore) FetchAllTestRunStatus(ctx context.Context) (map[string]string, error)

func (*RedisSynHeartStore) FetchLastFailedTestRun

func (r *RedisSynHeartStore) FetchLastFailedTestRun(ctx context.Context, pluginId string) (proto.TestRun, error)

func (*RedisSynHeartStore) FetchLatestTestRun

func (r *RedisSynHeartStore) FetchLatestTestRun(ctx context.Context, pluginId string) (proto.TestRun, error)

func (*RedisSynHeartStore) FetchPluginHealthStatus

func (r *RedisSynHeartStore) FetchPluginHealthStatus(ctx context.Context, pluginId string) (common.PluginState, error)

func (*RedisSynHeartStore) FetchPluginLastUnhealthyStatus

func (r *RedisSynHeartStore) FetchPluginLastUnhealthyStatus(ctx context.Context, pluginId string) (common.PluginState, error)

func (*RedisSynHeartStore) FetchTestConfig

func (r *RedisSynHeartStore) FetchTestConfig(ctx context.Context, testConfigId string) (proto.SynTestConfig, error)

func (*RedisSynHeartStore) FetchTestConfigStatus

func (r *RedisSynHeartStore) FetchTestConfigStatus(ctx context.Context, configId string) (common.SyntestConfigStatus, error)

func (*RedisSynHeartStore) GetR

func (r *RedisSynHeartStore) GetR(ctx context.Context, key string) (string, error)

func (*RedisSynHeartStore) HDelR

func (r *RedisSynHeartStore) HDelR(ctx context.Context, key string, field string) error

Deletes a hashset value to a key

func (*RedisSynHeartStore) HGetAllR

func (r *RedisSynHeartStore) HGetAllR(ctx context.Context, key string) (map[string]string, error)

Fetches all fields and value from a hashset

func (*RedisSynHeartStore) HSetR

func (r *RedisSynHeartStore) HSetR(ctx context.Context, key string, field string, val string) error

Writes a hashset value to a key

func (*RedisSynHeartStore) NewAgentEvent

func (r *RedisSynHeartStore) NewAgentEvent(ctx context.Context, event string) error

func (*RedisSynHeartStore) Ping

func (r *RedisSynHeartStore) Ping(ctx context.Context) error

func (*RedisSynHeartStore) PublishR

func (r *RedisSynHeartStore) PublishR(ctx context.Context, channel string, msg string) error

Publishes value to a channel

func (*RedisSynHeartStore) SetR

func (r *RedisSynHeartStore) SetR(ctx context.Context, key string, val interface{}, expiration time.Duration) error

Writes value to a key

func (*RedisSynHeartStore) SubscribeToAgentEvents

func (r *RedisSynHeartStore) SubscribeToAgentEvents(ctx context.Context, channelSize int, agentChan chan<- string) error

func (*RedisSynHeartStore) SubscribeToConfigEvents

func (r *RedisSynHeartStore) SubscribeToConfigEvents(ctx context.Context, channelSize int, pluginName chan<- string) error

func (*RedisSynHeartStore) SubscribeToTestRunEvents

func (r *RedisSynHeartStore) SubscribeToTestRunEvents(ctx context.Context, channelSize int, testChan chan<- string) error

func (*RedisSynHeartStore) UpdatePluginStatus

func (r *RedisSynHeartStore) UpdatePluginStatus(ctx context.Context, pluginId string, status string) error

func (*RedisSynHeartStore) UpdateTestRunStatus

func (r *RedisSynHeartStore) UpdateTestRunStatus(ctx context.Context, pluginId string, passRatio float64) error

func (*RedisSynHeartStore) WriteAgentStatus

func (r *RedisSynHeartStore) WriteAgentStatus(ctx context.Context, agentId string, status common.AgentStatus) error

func (*RedisSynHeartStore) WritePluginHealthStatus

func (r *RedisSynHeartStore) WritePluginHealthStatus(ctx context.Context, pluginId string, pluginState common.PluginState) error

func (*RedisSynHeartStore) WriteTestConfig

func (r *RedisSynHeartStore) WriteTestConfig(ctx context.Context, config proto.SynTestConfig, raw string) error

func (*RedisSynHeartStore) WriteTestConfigStatus

func (r *RedisSynHeartStore) WriteTestConfigStatus(ctx context.Context, configId string, status common.SyntestConfigStatus) error

func (*RedisSynHeartStore) WriteTestRun

func (r *RedisSynHeartStore) WriteTestRun(ctx context.Context, pluginId string, testRun proto.TestRun) error

type SynHeartStore

type SynHeartStore interface {
	// TestRun functions
	SubscribeToTestRunEvents(ctx context.Context, channelSize int, pluginId chan<- string) error
	WriteTestRun(ctx context.Context, pluginId string, testRun proto.TestRun) error
	FetchLatestTestRun(ctx context.Context, pluginId string) (proto.TestRun, error)
	FetchLastFailedTestRun(ctx context.Context, pluginId string) (proto.TestRun, error)
	FetchAllTestRunStatus(ctx context.Context) (map[string]string, error)
	DeleteAllTestRunInfo(ctx context.Context, pluginId string) error

	// Plugin health status functions
	WritePluginHealthStatus(ctx context.Context, pluginId string, state common.PluginState) error
	FetchPluginHealthStatus(ctx context.Context, pluginId string) (common.PluginState, error)
	FetchPluginLastUnhealthyStatus(ctx context.Context, pluginId string) (common.PluginState, error)
	FetchAllPluginStatus(ctx context.Context) (map[string]string, error)

	// Test config functions
	SubscribeToConfigEvents(ctx context.Context, channelSize int, configChan chan<- string) error

	WriteTestConfig(ctx context.Context, config proto.SynTestConfig, raw string) error
	FetchTestConfig(ctx context.Context, configId string) (proto.SynTestConfig, error)
	DeleteTestConfig(ctx context.Context, configId string) error

	WriteTestConfigStatus(ctx context.Context, configId string, status common.SyntestConfigStatus) error
	FetchTestConfigStatus(ctx context.Context, configId string) (common.SyntestConfigStatus, error)

	FetchAllTestConfigSummary(ctx context.Context) (map[string]common.SyntestConfigSummary, error)

	// Agent functions
	FetchAllAgentStatus(ctx context.Context) (map[string]common.AgentStatus, error)
	WriteAgentStatus(ctx context.Context, agentId string, status common.AgentStatus) error
	DeleteAgentStatus(ctx context.Context, agentId string) error
	SubscribeToAgentEvents(ctx context.Context, channelSize int, configChan chan<- string) error
	NewAgentEvent(ctx context.Context, event string) error

	Close() error
	Ping(ctx context.Context) error
}

Interface that a storage for Synthetic Heart must implement

func NewSynHeartStore

func NewSynHeartStore(config SynHeartStoreConfig, log hclog.Logger) (SynHeartStore, error)

type SynHeartStoreConfig

type SynHeartStoreConfig struct {
	Type       string `yaml:"type"`
	BufferSize int    `yaml:"bufferSize"`
	Address    string `yaml:"address"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL