forked from pallavidn/monitoring
-
Notifications
You must be signed in to change notification settings - Fork 0
/
repository.go
30 lines (24 loc) · 1.16 KB
/
repository.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// The repository package contains definitions about metric repository.
// A metric repository is composed of a list of repository entities, each of which contains metrics related to the entity.
package repository
import (
"github.com/turbonomic/turbo-go-monitoring/pkg/model"
)
// A Repository defines a set of interfaces to access its entities and their metrics
type Repository interface {
// GetEntity() returns the RepositoryEntity associated with the given entity type and id
GetEntity(entityType model.EntityType, entityId model.EntityId) (RepositoryEntity, error)
// GetAllEntities() returns the list of all RepositoryEntity's in the repository
GetAllEntities() []RepositoryEntity
// GetEntitiesByType() returns the list of RepositoryEntity's matching the given entity type
GetEntitiesByType(entityType model.EntityType) []RepositoryEntity
// SetEntities() updates the repository with the given set of RepositoryEntity's
SetEntities([]RepositoryEntity)
// SetMetricValue() sets the value of the given metric in the repository
SetMetricValue(
entityType model.EntityType,
entityId model.EntityId,
metricKey EntityMetricKey,
value model.MetricValue,
) error
}