Documentation
¶
Index ¶
- Variables
- func ConnectStorage(ctx context.Context, storeType StoreType, bucketName string) error
- type Database
- type DbOpt
- type MockDb
- func (m *MockDb) Close(ctx context.Context) error
- func (m *MockDb) GetEnvironments(ctx context.Context) ([]summary.Environment, error)
- func (m *MockDb) GetHistory(ctx context.Context, environment ...summary.Environment) ([]*entities.PuppetHistory, error)
- func (m *MockDb) GetReport(ctx context.Context, id string) (*entities.PuppetReport, error)
- func (m *MockDb) GetReports(ctx context.Context, fqdn string) ([]*entities.PuppetReportSummary, error)
- func (m *MockDb) GetRuns(ctx context.Context) ([]*entities.PuppetRun, error)
- func (m *MockDb) GetRunsByState(ctx context.Context, states ...summary.State) ([]*entities.PuppetRun, error)
- func (m *MockDb) Ping(ctx context.Context) error
- func (m *MockDb) Purge(ctx context.Context, from time.Time) (int, error)
- func (m *MockDb) SaveRun(ctx context.Context, run *entities.PuppetReport) error
- type MockStorage
- func (m *MockStorage) DeleteFile(ctx context.Context, filePath string) error
- func (m *MockStorage) DownloadFile(ctx context.Context, filePath string) ([]byte, error)
- func (m *MockStorage) Purge(ctx context.Context, from time.Time) (int, error)
- func (m *MockStorage) SaveFile(ctx context.Context, filePath string, file []byte) error
- type StoreType
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrDuplicate is the error for a duplicate record. ErrDuplicate = errors.New("duplicate record") // ErrNotFound is the error for a record not found. ErrNotFound = errors.New("record not found") )
View Source
var DatabaseLatency = promauto.NewHistogramVec( prometheus.HistogramOpts{ Name: "database_latency", Help: "Duration of database queries", }, []string{"query"}, )
DatabaseLatency is the duration of database queries.
View Source
var Files fileHandler
View Source
var StorageLatency = promauto.NewHistogramVec( prometheus.HistogramOpts{ Name: "storage_latency", Help: "Duration of fileHandler queries", }, []string{"query"}, )
StorageLatency is the duration of Files queries.
Functions ¶
Types ¶
type Database ¶ added in v0.2.0
type Database interface { // Ping pings the database. Ping(ctx context.Context) error // Close closes the database connection. Close(ctx context.Context) error // SaveRun saves a PuppetRun to the database. SaveRun(ctx context.Context, run *entities.PuppetReport) error // GetRuns returns all PuppetRuns from the database. GetRuns(ctx context.Context) ([]*entities.PuppetRun, error) // GetRunsByState returns all PuppetRuns from the database that are in the given state. GetRunsByState(ctx context.Context, states ...summary.State) ([]*entities.PuppetRun, error) // GetReports returns all PuppetReports from the database for the given fqdn. GetReports(ctx context.Context, fqdn string) ([]*entities.PuppetReportSummary, error) // GetReport returns the PuppetReport from the database for the given id. GetReport(ctx context.Context, id string) (*entities.PuppetReport, error) // GetHistory returns the PuppetHistory from the database for the given environment. GetHistory(ctx context.Context, environment ...summary.Environment) ([]*entities.PuppetHistory, error) // GetEnvironments returns all environments from the database. GetEnvironments(ctx context.Context) ([]summary.Environment, error) // Purge purges the data from the database out of the given range. Purge(ctx context.Context, from time.Time) (int, error) }
type MockDb ¶
func (*MockDb) GetEnvironments ¶
func (*MockDb) GetHistory ¶
func (m *MockDb) GetHistory(ctx context.Context, environment ...summary.Environment) ([]*entities.PuppetHistory, error)
func (*MockDb) GetReports ¶
func (*MockDb) GetRunsByState ¶
type MockStorage ¶
func (*MockStorage) DeleteFile ¶
func (m *MockStorage) DeleteFile(ctx context.Context, filePath string) error
func (*MockStorage) DownloadFile ¶
Click to show internal directories.
Click to hide internal directories.