2016-08-01 03:07:00 -05:00
package annotations
2020-09-02 01:07:31 -05:00
import (
"context"
2021-03-29 08:47:16 -05:00
"errors"
2020-09-02 01:07:31 -05:00
"github.com/grafana/grafana/pkg/setting"
2022-09-23 05:04:41 -05:00
"github.com/grafana/grafana/pkg/util/errutil"
2020-09-02 01:07:31 -05:00
)
2016-08-01 03:07:00 -05:00
2021-03-29 08:47:16 -05:00
var (
2022-09-23 05:04:41 -05: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 08:47:16 -05:00
)
2022-10-18 20:48:20 -05:00
//go:generate mockery --name Repository --structname FakeAnnotationsRepo --inpackage --filename annotations_repository_mock.go
2016-08-01 03:07:00 -05:00
type Repository interface {
2022-09-19 02:54:37 -05: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 06:20:57 -05:00
Update ( ctx context . Context , item * Item ) error
Find ( ctx context . Context , query * ItemQuery ) ( [ ] * ItemDTO , error )
2022-03-25 12:23:09 -05:00
Delete ( ctx context . Context , params * DeleteParams ) error
FindTags ( ctx context . Context , query * TagsQuery ) ( FindTagsResult , error )
2016-08-30 02:32:56 -05:00
}
2022-09-22 07:27:48 -05: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 01:07:31 -05:00
}