Documentation ¶
Index ¶
- type Cursor
- type DB
- type NewNotification
- type Notification
- type Page
- type Service
- func (service *Service) List(ctx context.Context, cursor Cursor) (_ Page, err error)
- func (service *Service) Read(ctx context.Context, notificationID uuid.UUID) (err error)
- func (service *Service) ReadAll(ctx context.Context) (err error)
- func (service *Service) Receive(ctx context.Context, newNotification NewNotification) (Notification, error)
- func (service *Service) UnreadAmount(ctx context.Context) (_ int, err error)
- type TimesNotified
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cursor ¶ added in v0.29.0
Cursor holds notification cursor entity which is used to create listed page from database.
type DB ¶
type DB interface { Insert(ctx context.Context, notification NewNotification) (Notification, error) List(ctx context.Context, cursor Cursor) (Page, error) Read(ctx context.Context, notificationID uuid.UUID) error ReadAll(ctx context.Context) error UnreadAmount(ctx context.Context) (int, error) }
DB tells how application works with notifications database.
architecture: Database
type NewNotification ¶
NewNotification holds notification entity info which is being received from satellite or local client.
type Notification ¶
type Notification struct { ID uuid.UUID `json:"id"` SenderID storj.NodeID `json:"senderId"` Type Type `json:"type"` Title string `json:"title"` Message string `json:"message"` ReadAt *time.Time `json:"readAt"` CreatedAt time.Time `json:"createdAt"` }
Notification holds notification entity info which is being retrieved from database.
type Page ¶ added in v0.29.0
type Page struct { Notifications []Notification `json:"notifications"` Offset uint64 `json:"offset"` Limit uint `json:"limit"` CurrentPage uint `json:"currentPage"` PageCount uint `json:"pageCount"` TotalCount uint64 `json:"totalCount"` }
Page holds notification page entity which is used to show listed page of notifications on UI.
type Service ¶ added in v0.29.0
type Service struct {
// contains filtered or unexported fields
}
Service is the notification service between storage nodes and satellites. architecture: Service
func NewService ¶ added in v0.29.0
NewService creates a new notification service.
func (*Service) ReadAll ¶ added in v0.29.0
ReadAll - change status of all user's notifications to Read.
func (*Service) Receive ¶ added in v0.29.0
func (service *Service) Receive(ctx context.Context, newNotification NewNotification) (Notification, error)
Receive - receives notifications from satellite and Insert them into DB.
type TimesNotified ¶ added in v1.8.1
type TimesNotified int
TimesNotified is a numeric value of amount of notifications being sent to user.
const ( // TimesNotifiedZero haven't being notified yet. TimesNotifiedZero TimesNotified = 0 // TimesNotifiedFirst sent notification one time. TimesNotifiedFirst TimesNotified = 1 // TimesNotifiedSecond sent notifications twice. TimesNotifiedSecond TimesNotified = 2 // TimesNotifiedLast three notification has been send. TimesNotifiedLast TimesNotified = 3 )
type Type ¶ added in v0.29.0
type Type int
Type is a numeric value of specific notification type.
const ( // TypeCustom is a common notification type which doesn't describe node's core functionality. // TODO: change type name when all notification types will be known. TypeCustom Type = 0 // TypeAuditCheckFailure is a notification type which describes node's audit check failure. TypeAuditCheckFailure Type = 1 // TypeDisqualification is a notification type which describes node's disqualification status. TypeDisqualification Type = 2 // TypeSuspension is a notification type which describes node's suspension status. TypeSuspension Type = 3 )