forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathannotations.go
29 lines (24 loc) · 1018 Bytes
/
annotations.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
package annotations
import (
"context"
"errors"
"github.com/grafana/grafana/pkg/apimachinery/errutil"
"github.com/grafana/grafana/pkg/setting"
)
var (
ErrTimerangeMissing = errors.New("missing timerange")
ErrBaseTagLimitExceeded = errutil.BadRequest("annotations.tag-limit-exceeded", errutil.WithPublicMessage("Tags length exceeds the maximum allowed."))
)
//go:generate mockery --name Repository --structname FakeAnnotationsRepo --inpackage --filename annotations_repository_mock.go
type Repository interface {
Save(ctx context.Context, item *Item) error
SaveMany(ctx context.Context, items []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)
}
// Cleaner is responsible for cleaning up old annotations
type Cleaner interface {
Run(ctx context.Context, cfg *setting.Cfg) (int64, int64, error)
}