2022-09-19 15:54:37 +08:00
|
|
|
package annotationsimpl
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2023-11-15 07:11:01 +08:00
|
|
|
"github.com/grafana/grafana/pkg/services/annotations/accesscontrol"
|
|
|
|
|
2022-09-19 15:54:37 +08:00
|
|
|
"github.com/grafana/grafana/pkg/services/annotations"
|
2022-09-22 20:27:48 +08:00
|
|
|
"github.com/grafana/grafana/pkg/setting"
|
2022-09-19 15:54:37 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
type store interface {
|
2023-12-13 06:43:09 +08:00
|
|
|
readStore
|
|
|
|
writeStore
|
|
|
|
}
|
|
|
|
|
2024-02-29 02:16:37 +08:00
|
|
|
type commonStore interface {
|
|
|
|
Type() string
|
|
|
|
}
|
|
|
|
|
2023-12-13 06:43:09 +08:00
|
|
|
type readStore interface {
|
2024-02-29 02:16:37 +08:00
|
|
|
commonStore
|
2024-10-03 15:14:06 +08:00
|
|
|
Get(ctx context.Context, query annotations.ItemQuery, accessResources *accesscontrol.AccessResources) ([]*annotations.ItemDTO, error)
|
|
|
|
GetTags(ctx context.Context, query annotations.TagsQuery) (annotations.FindTagsResult, error)
|
2023-12-13 06:43:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type writeStore interface {
|
2024-02-29 02:16:37 +08:00
|
|
|
commonStore
|
2022-11-04 23:39:26 +08:00
|
|
|
Add(ctx context.Context, items *annotations.Item) error
|
|
|
|
AddMany(ctx context.Context, items []annotations.Item) error
|
2022-09-19 15:54:37 +08:00
|
|
|
Update(ctx context.Context, item *annotations.Item) error
|
|
|
|
Delete(ctx context.Context, params *annotations.DeleteParams) error
|
2022-09-22 20:27:48 +08:00
|
|
|
CleanAnnotations(ctx context.Context, cfg setting.AnnotationCleanupSettings, annotationType string) (int64, error)
|
|
|
|
CleanOrphanedAnnotationTags(ctx context.Context) (int64, error)
|
2022-09-19 15:54:37 +08:00
|
|
|
}
|