Documentation
¶
Index ¶
- Variables
- func NewStore(db *bbolt.DB) (*pollStore, error)
- type MessageReceiver
- type MessageSender
- type Messenger
- type PeerGetter
- type Policy
- type PollInfo
- type PollMessage
- type PollNotFoundErr
- type RequestPollMessage
- type Service
- func (s *Service) GetCompatiblePolls() (map[string]PollInfo, error)
- func (s *Service) GetPollFrom(peerId string) (*PollInfo, error)
- func (s *Service) GetPolls() (map[string]PollInfo, error)
- func (s *Service) MessageHandler(peerId string, msgType string, payload []byte) error
- func (s *Service) Poll(peer string)
- func (s *Service) PollAllPeers()
- func (s *Service) RequestAllPeerPolls()
- func (s *Service) RequestPoll(peer string)
- func (s *Service) Start()
- func (s *Service) Stop()
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var POLL_BUCKET = []byte("poll-list")
Functions ¶
Types ¶
type MessageReceiver ¶
type MessageSender ¶
type Messenger ¶
type Messenger interface { MessageSender MessageReceiver }
type PeerGetter ¶
type PeerGetter interface {
GetPeers() []string
}
type PollMessage ¶
type PollMessage struct { Version uint64 `json:"version"` Assets []string `json:"assets"` PeerAllowed bool `json:"peer_allowed"` }
func (PollMessage) MessageType ¶
func (PollMessage) MessageType() messages.MessageType
type PollNotFoundErr ¶
type PollNotFoundErr string
func (PollNotFoundErr) Error ¶
func (p PollNotFoundErr) Error() string
type RequestPollMessage ¶
type RequestPollMessage struct { Version uint64 `json:"version"` Assets []string `json:"assets"` PeerAllowed bool `json:"peer_allowed"` }
func (RequestPollMessage) MessageType ¶
func (RequestPollMessage) MessageType() messages.MessageType
type Service ¶
func NewService ¶
func (*Service) GetCompatiblePolls ¶
GetCompatiblePolls returns all polls from peers that are running the same protocol version.
func (*Service) GetPollFrom ¶
GetPollFrom returns the PollInfo for a single peer with peerId. Returns a PollNotFoundErr if no PollInfo for the peer is present.
func (*Service) MessageHandler ¶
MessageHandler checks for the incomming messages type and takes the incomming payload to update the store.
func (*Service) PollAllPeers ¶
func (s *Service) PollAllPeers()
func (*Service) RequestAllPeerPolls ¶
func (s *Service) RequestAllPeerPolls()
RequestAllPeerPolls requests the poll message from every peer.
func (*Service) RequestPoll ¶
RequestPoll sends the REUQEST_POLL message to a single peer.
Click to show internal directories.
Click to hide internal directories.