2016-08-01 10:07:00 +02:00
package annotations
2020-09-02 08:07:31 +02:00
import (
"context"
2021-03-29 15:47:16 +02:00
"errors"
2020-09-02 08:07:31 +02:00
"github.com/grafana/grafana/pkg/setting"
2022-09-23 13:04:41 +03:00
"github.com/grafana/grafana/pkg/util/errutil"
2020-09-02 08:07:31 +02:00
)
2016-08-01 10:07:00 +02:00
2021-03-29 15:47:16 +02:00
var (
2022-09-23 13:04:41 +03:00
ErrTimerangeMissing = errors . New ( "missing timerange" )
ErrBaseTagLimitExceeded = errutil . NewBase ( errutil . StatusBadRequest , "annotations.tag-limit-exceeded" , errutil . WithPublicMessage ( "Tags length exceeds the maximum allowed." ) )
2021-03-29 15:47:16 +02:00
)
2022-10-18 19:48:20 -06:00
//go:generate mockery --name Repository --structname FakeAnnotationsRepo --inpackage --filename annotations_repository_mock.go
2016-08-01 10:07:00 +02:00
type Repository interface {
2022-09-19 10:54:37 +03:00
Save ( ctx context . Context , item * Item ) error
2022-11-04 10:39:26 -05:00
SaveMany ( ctx context . Context , items [ ] Item ) error
2022-03-22 12:20:57 +01:00
Update ( ctx context . Context , item * Item ) error
Find ( ctx context . Context , query * ItemQuery ) ( [ ] * ItemDTO , error )
2022-03-25 13:23:09 -04:00
Delete ( ctx context . Context , params * DeleteParams ) error
FindTags ( ctx context . Context , query * TagsQuery ) ( FindTagsResult , error )
2016-08-30 09:32:56 +02:00
}
2022-09-22 15:27:48 +03:00
// Cleaner is responsible for cleaning up old annotations
type Cleaner interface {
Run ( ctx context . Context , cfg * setting . Cfg ) ( int64 , int64 , error )
2020-09-02 08:07:31 +02:00
}