Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Error is the standard error class for node events. Error = errs.Class("node events") )
Functions ¶
This section is empty.
Types ¶
type Chore ¶ added in v1.68.1
Chore is a chore that reads events from node events and sends emails.
func (*Chore) SetNotifier ¶ added in v1.68.1
SetNotifier sets the notifier on chore for testing.
type Config ¶ added in v1.68.1
type Config struct { Interval time.Duration `help:"how long to wait before checking the node events DB again if there is nothing to work on" default:"5m"` SelectionWaitPeriod time.Duration `` /* 130-byte string literal not displayed */ Notifier string `help:"which notification provider to use" default:""` Customerio CustomerioConfig }
Config contains configurable values for node events chore.
type CustomerioBatch ¶ added in v1.69.1
type CustomerioBatch struct { Name string `json:"name"` Data CustomerioData `json:"data"` }
CustomerioBatch contains info regarding a batch of node events for a particular node operator email address.
type CustomerioConfig ¶ added in v1.69.1
type CustomerioConfig struct { URL string `help:"the url for the customer.io endpoint to send node event data to" default:"https://track.customer.io/api/v1"` SiteID string `help:"the account id for the customer.io api" default:""` APIKey string `help:"api key for the customer.io api" default:""` RequestTimeout time.Duration `help:"timeout for the http request to customer.io endpoint" default:"30s"` }
CustomerioConfig handles customer.io credentials info.
type CustomerioData ¶ added in v1.69.1
CustomerioData contains the satellite name and the node IDs that had an occurrence of the event.
type CustomerioNotifier ¶ added in v1.69.1
type CustomerioNotifier struct {
// contains filtered or unexported fields
}
CustomerioNotifier notifies customer.io about node events.
func NewCustomerioNotifier ¶ added in v1.69.1
func NewCustomerioNotifier(log *zap.Logger, config CustomerioConfig) *CustomerioNotifier
NewCustomerioNotifier is a constructor for CustomerioNotifier.
type DB ¶
type DB interface { // Insert a node event into the node events table. Insert(ctx context.Context, email string, nodeID storj.NodeID, event Type) (nodeEvent NodeEvent, err error) // GetLatestByEmailAndEvent gets latest node event by email and event type. GetLatestByEmailAndEvent(ctx context.Context, email string, event Type) (nodeEvent NodeEvent, err error) // GetNextBatch gets the next batch of events to combine into an email. GetNextBatch(ctx context.Context, firstSeenBefore time.Time) (events []NodeEvent, err error) // GetByID get a node event by id. GetByID(ctx context.Context, id uuid.UUID) (nodeEvent NodeEvent, err error) // UpdateEmailSent updates email_sent for a group of rows. UpdateEmailSent(ctx context.Context, ids []uuid.UUID, timestamp time.Time) (err error) // UpdateLastAttempted updates last_attempted for a group of rows. UpdateLastAttempted(ctx context.Context, ids []uuid.UUID, timestamp time.Time) (err error) }
DB implements the database for node events.
architecture: Database
type MockNotifier ¶ added in v1.68.1
type MockNotifier struct {
// contains filtered or unexported fields
}
MockNotifier implements the Notifier interface.
func NewMockNotifier ¶ added in v1.68.1
func NewMockNotifier(log *zap.Logger) *MockNotifier
NewMockNotifier is a constructor for MockNotifier.
type NodeEvent ¶
type NodeEvent struct { ID uuid.UUID Email string NodeID storj.NodeID Event Type CreatedAt time.Time LastAttempted *time.Time EmailSent *time.Time }
NodeEvent contains information needed to notify a node operator about something that happened to a node.
type Notifier ¶ added in v1.68.1
type Notifier interface { // Notify notifies a node operator about an event that occurred on some of their nodes. Notify(ctx context.Context, satellite string, events []NodeEvent) (err error) }
Notifier notifies node operators about node events.
type Type ¶
type Type int
Type is a type of node event.
const ( // Online indicates that the node has come back online. Online Type = iota // Offline indicates that the node is offline. Offline // Disqualified indicates that the node is disqualified. Disqualified // UnknownAuditSuspended indicates that the node is suspended for unknown audit errors. UnknownAuditSuspended // UnknownAuditUnsuspended indicates that the node is no longer suspended for unknown audit errors. UnknownAuditUnsuspended // OfflineSuspended indicates that the node is suspended for being offline. OfflineSuspended // OfflineUnsuspended indicates that the node is no longer suspended for being offline. OfflineUnsuspended // BelowMinVersion indicates that the node's software is below the minimum version. BelowMinVersion )