mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 06:42:13 +08:00
37 lines
891 B
Go
37 lines
891 B
Go
package annotations
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
)
|
|
|
|
var (
|
|
ErrTimerangeMissing = errors.New("missing timerange")
|
|
)
|
|
|
|
type Repository interface {
|
|
Save(ctx context.Context, item *Item) error
|
|
Update(ctx context.Context, item *Item) error
|
|
Find(ctx context.Context, query *ItemQuery) ([]*ItemDTO, error)
|
|
Delete(ctx context.Context, params *DeleteParams) error
|
|
FindTags(ctx context.Context, query *TagsQuery) (FindTagsResult, error)
|
|
}
|
|
|
|
// AnnotationCleaner is responsible for cleaning up old annotations
|
|
type AnnotationCleaner interface {
|
|
CleanAnnotations(ctx context.Context, cfg *setting.Cfg) (int64, int64, error)
|
|
}
|
|
|
|
// var repositoryInstance Repository
|
|
var cleanerInstance AnnotationCleaner
|
|
|
|
func GetAnnotationCleaner() AnnotationCleaner {
|
|
return cleanerInstance
|
|
}
|
|
|
|
func SetAnnotationCleaner(rep AnnotationCleaner) {
|
|
cleanerInstance = rep
|
|
}
|