-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
^ This is a combination of 5 commits.
^ This is the 1st commit message: refactor notifier package move services to deciated packages split configurations and implementations ^ The commit message #2 will be skipped: ^ move factory from Grafana ^ The commit message #3 will be skipped: ^ rename settings to config ^ The commit message #4 will be skipped: ^ reaname TemplateForTests to FroTests to appease linter ^ The commit message #5 will be skipped: ^ lint
- Loading branch information
1 parent
facc6b2
commit 06b42ff
Showing
88 changed files
with
2,240 additions
and
1,802 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package images | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"time" | ||
) | ||
|
||
var ( | ||
ErrImageNotFound = errors.New("image not found") | ||
|
||
// ErrImagesDone is used to stop iteration of subsequent images. It should be | ||
// returned from forEachFunc when either the intended image has been found or | ||
// the maximum number of images has been iterated. | ||
ErrImagesDone = errors.New("images done") | ||
|
||
ErrImagesUnavailable = errors.New("alert screenshots are unavailable") | ||
) | ||
|
||
type Image struct { | ||
Token string | ||
Path string | ||
URL string | ||
CreatedAt time.Time | ||
} | ||
|
||
func (i Image) HasURL() bool { | ||
return i.URL != "" | ||
} | ||
|
||
type ImageStore interface { | ||
GetImage(ctx context.Context, token string) (*Image, error) | ||
} | ||
|
||
type UnavailableImageStore struct{} | ||
|
||
// GetImage returns the image with the corresponding token, or ErrImageNotFound. | ||
func (u *UnavailableImageStore) GetImage(ctx context.Context, token string) (*Image, error) { | ||
return nil, ErrImagesUnavailable | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.