Documentation
¶
Index ¶
- Variables
- type AlertAlreadyRegisteredError
- type AlertNotRegisteredError
- type BaseRepo
- type CheckArtifact
- type ChecksRepo
- func (s *ChecksRepo) GetArtifact(ctx context.Context, network, client, checkID, artifactType string) (*CheckArtifact, error)
- func (s *ChecksRepo) GetBucket() string
- func (s *ChecksRepo) GetPrefix() string
- func (s *ChecksRepo) GetStore() *s3.Client
- func (s *ChecksRepo) Key(artifact *CheckArtifact) string
- func (s *ChecksRepo) List(ctx context.Context) ([]*CheckArtifact, error)
- func (s *ChecksRepo) Persist(ctx context.Context, artifact *CheckArtifact) error
- func (s *ChecksRepo) Purge(ctx context.Context, identifiers ...string) error
- type ClientMention
- type MentionsRepo
- func (s *MentionsRepo) Get(ctx context.Context, network, client string) (*ClientMention, error)
- func (s *MentionsRepo) Key(mention *ClientMention) string
- func (s *MentionsRepo) List(ctx context.Context) ([]*ClientMention, error)
- func (s *MentionsRepo) Persist(ctx context.Context, mention *ClientMention) error
- func (s *MentionsRepo) Purge(ctx context.Context, identifiers ...string) error
- type Metrics
- type MonitorAlert
- type MonitorRepo
- type Repository
- type S3Config
Constants ¶
This section is empty.
Variables ¶
var ( DefaultRegion = "us-east-1" DefaultBucketPrefix = "ethrand" )
Functions ¶
This section is empty.
Types ¶
type AlertAlreadyRegisteredError ¶
AlertAlreadyRegisteredError represents an error when trying to register an alert that already exists.
func (*AlertAlreadyRegisteredError) Error ¶
func (e *AlertAlreadyRegisteredError) Error() string
Error implements error.
type AlertNotRegisteredError ¶
AlertNotRegisteredError represents an error when trying to deregister an alert that doesn't exist.
func (*AlertNotRegisteredError) Error ¶
func (e *AlertNotRegisteredError) Error() string
Error implements error.
type BaseRepo ¶
type BaseRepo struct {
// contains filtered or unexported fields
}
BaseRepo contains common S3 functionality for all repositories.
func NewBaseRepo ¶
func NewBaseRepo(ctx context.Context, log *logrus.Logger, cfg *S3Config, metrics *Metrics) (BaseRepo, error)
NewBaseRepo creates a new base repository with common S3 functionality.
func (*BaseRepo) GetS3Client ¶
GetS3Client returns the underlying S3 client.
type CheckArtifact ¶
type CheckArtifact struct {
Network string `json:"network"`
Client string `json:"client"`
CheckID string `json:"checkId"`
Type string `json:"type"` // log, png, etc
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Content []byte `json:"content"`
}
CheckArtifact represents a single artifact from a check run.
type ChecksRepo ¶
type ChecksRepo struct {
BaseRepo
}
ChecksRepo implements Repository for check artifacts.
func NewChecksRepo ¶
func NewChecksRepo(ctx context.Context, log *logrus.Logger, cfg *S3Config, metrics *Metrics) (*ChecksRepo, error)
NewChecksRepo creates a new ChecksRepo.
func (*ChecksRepo) GetArtifact ¶
func (s *ChecksRepo) GetArtifact(ctx context.Context, network, client, checkID, artifactType string) (*CheckArtifact, error)
GetArtifact retrieves an artifact from S3.
func (*ChecksRepo) GetBucket ¶
func (s *ChecksRepo) GetBucket() string
GetBucket returns the S3 bucket name.
func (*ChecksRepo) GetPrefix ¶
func (s *ChecksRepo) GetPrefix() string
GetPrefix returns the S3 prefix.
func (*ChecksRepo) GetStore ¶
func (s *ChecksRepo) GetStore() *s3.Client
GetStore returns the S3 client.
func (*ChecksRepo) Key ¶
func (s *ChecksRepo) Key(artifact *CheckArtifact) string
Key implements Repository[*CheckArtifact].
func (*ChecksRepo) List ¶
func (s *ChecksRepo) List(ctx context.Context) ([]*CheckArtifact, error)
List implements Repository[*CheckArtifact].
func (*ChecksRepo) Persist ¶
func (s *ChecksRepo) Persist(ctx context.Context, artifact *CheckArtifact) error
Persist implements Repository[*CheckArtifact].
type ClientMention ¶
type ClientMention struct {
Network string `json:"network"`
Client string `json:"client"`
Mentions []string `json:"mentions"` // List of role/user IDs to mention
Enabled bool `json:"enabled"` // Whether mentions are enabled
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
ClientMention represents a set of mentions for a client on a network.
type MentionsRepo ¶
type MentionsRepo struct {
BaseRepo
}
MentionsRepo implements Repository[*ClientMention].
func NewMentionsRepo ¶
func NewMentionsRepo(ctx context.Context, log *logrus.Logger, cfg *S3Config, metrics *Metrics) (*MentionsRepo, error)
NewMentionsRepo creates a new MentionsRepo.
func (*MentionsRepo) Get ¶
func (s *MentionsRepo) Get(ctx context.Context, network, client string) (*ClientMention, error)
Get retrieves a specific mention by network and client.
func (*MentionsRepo) Key ¶
func (s *MentionsRepo) Key(mention *ClientMention) string
Key implements Repository[*ClientMention].
func (*MentionsRepo) List ¶
func (s *MentionsRepo) List(ctx context.Context) ([]*ClientMention, error)
List implements Repository[*ClientMention].
func (*MentionsRepo) Persist ¶
func (s *MentionsRepo) Persist(ctx context.Context, mention *ClientMention) error
Persist implements Repository[*ClientMention].
type MonitorAlert ¶
type MonitorAlert struct {
Network string `json:"network"`
Client string `json:"client"`
CheckID string `json:"checkId"`
Enabled bool `json:"enabled"`
DiscordChannel string `json:"discordChannel"`
Interval time.Duration `json:"interval"`
ClientType clients.ClientType `json:"clientType"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
MonitorAlert represents a monitor alert.
type MonitorRepo ¶
type MonitorRepo struct {
BaseRepo
}
MonitorRepo implements Repository[*MonitorAlert].
func NewMonitorRepo ¶
func NewMonitorRepo(ctx context.Context, log *logrus.Logger, cfg *S3Config, metrics *Metrics) (*MonitorRepo, error)
NewMonitorRepo creates a new MonitorRepo.
func (*MonitorRepo) Key ¶
func (s *MonitorRepo) Key(alert *MonitorAlert) string
Key implements Repository[*MonitorAlert].
func (*MonitorRepo) List ¶
func (s *MonitorRepo) List(ctx context.Context) ([]*MonitorAlert, error)
List implements Repository[*MonitorAlert].
func (*MonitorRepo) Persist ¶
func (s *MonitorRepo) Persist(ctx context.Context, alert *MonitorAlert) error
Persist implements Repository[*MonitorAlert].
type Repository ¶
type Repository[T any] interface { // List returns all items of type T. List(ctx context.Context) ([]T, error) // Persist stores an item of type T. Persist(ctx context.Context, item T) error // Purge removes an item based on its identifiers. Purge(ctx context.Context, identifiers ...string) error // Key returns the key for an item based on its identifiers. Key(item T) string }
Repository defines a generic interface for S3-backed storage.