Documentation
¶
Overview ¶
Package main/services contains the concrete services used by Itero middleware server.
Index ¶
- Constants
- func ClosePollService(evtManager events.Manager, log slog.StackedLeveled) *closePollService
- func EmailService(sender emailsender.Sender, log slog.StackedLeveled) emailService
- func NextRoundService(evtManager events.Manager, log slog.StackedLeveled) *nextRoundService
- func StartPollService(evtManager events.Manager, log slog.StackedLeveled) *startPollService
- type ClosePollEvent
- type CreatePollEvent
- type CreateUserEvent
- type DeletePollEvent
- type ForgotEvent
- type NextRoundEvent
- type PollNotifAction
- type PollNotifChannel
- type PollNotifList
- type PollNotification
- type ReverifyEvent
- type StartPollEvent
- type VoteEvent
Constants ¶
const PollNotifDelay = 20 * time.Second
PollNotifDelay is the default duration during which notifications are kept in the list. This duration must be strictly greater than the period between pulls of the frontend.
const TmplBaseDir = "email"
TmplBaseDir is the directory to find email templates into.
Variables ¶
This section is empty.
Functions ¶
func ClosePollService ¶
func ClosePollService(evtManager events.Manager, log slog.StackedLeveled) *closePollService
func EmailService ¶
func EmailService(sender emailsender.Sender, log slog.StackedLeveled) emailService
EmailService constructs the email service. This service listen to events and send emails to users.
func NextRoundService ¶
func NextRoundService(evtManager events.Manager, log slog.StackedLeveled) *nextRoundService
func StartPollService ¶
func StartPollService(evtManager events.Manager, log slog.StackedLeveled) *startPollService
Types ¶
type ClosePollEvent ¶
type ClosePollEvent struct {
Poll uint32
}
ClosePollEvent is type of events send when a poll is closed.
type CreatePollEvent ¶
type CreatePollEvent struct {
Poll uint32
}
type CreateUserEvent ¶
type CreateUserEvent struct {
User uint32
}
type DeletePollEvent ¶
type ForgotEvent ¶ added in v0.1.5
type ForgotEvent struct {
User uint32
}
ForgotEvent is sent when a user requests to change its passwd.
type NextRoundEvent ¶
NextRoundEvent is the type of events send when a new round starts.
type PollNotifAction ¶
type PollNotifAction uint8
const ( PollNotifStart PollNotifAction = iota PollNotifNext PollNotifTerm PollNotifDelete )
type PollNotifChannel ¶
type PollNotifChannel = <-chan []*PollNotification
PollNotifChannel provides lists of recent notifications.
func RunPollNotif ¶
type PollNotifList ¶
type PollNotifList struct {
// contains filtered or unexported fields
}
PollNotifList is a list of PollNotification that removes too old elements.
func NewPollNotifList ¶
func NewPollNotifList(delay time.Duration) *PollNotifList
func (*PollNotifList) Add ¶
func (self *PollNotifList) Add(notif *PollNotification)
Add adds a notification to the list. The list may be tidied.
func (*PollNotifList) Copy ¶
func (self *PollNotifList) Copy() *PollNotifList
Copy construct a copy of the current list. The original list is never tidied but the constructed one always is.
func (*PollNotifList) Slice ¶
func (self *PollNotifList) Slice() []*PollNotification
Slice return the list of notifications. The list is always tidied first.
func (*PollNotifList) Tidy ¶
func (self *PollNotifList) Tidy()
Tidy removes too old notifications from the list.
type PollNotification ¶
type PollNotification struct {
Timestamp time.Time
Id uint32
Action PollNotifAction
Round uint8
Title string
Participants map[uint32]bool
}
func NewPollNotification ¶
func NewPollNotification(evt events.Event) (ret *PollNotification)
type ReverifyEvent ¶
type ReverifyEvent struct {
User uint32
}
type StartPollEvent ¶
type StartPollEvent struct {
Poll uint32
}
StartPollEvent is send when a poll is started.