Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPayload ¶
func NewPayload(payloadType peer_proto.PayloadType) *peer_proto.Payload
Types ¶
type PayloadHandler ¶
type PayloadHandler func(p *Peer, payload *peer_proto.Payload)
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
func (*Peer) Connected ¶
func (p *Peer) Connected(connection *peer_transport.Connection)
func (*Peer) GetConnection ¶
func (p *Peer) GetConnection() *peer_transport.Connection
type PeerDocument ¶
type PeerDocument struct { Id primitive.ObjectID `bson:"_id,omitempty"` PeerId string `bson:"peerId"` HeartbeatAt time.Time `bson:"heartbeatAt"` Address string `bson:"fullAddress"` Port int `bson:"port"` }
func (*PeerDocument) GetId ¶
func (d *PeerDocument) GetId() string
func (*PeerDocument) ToFilter ¶
func (d *PeerDocument) ToFilter() bson.M
type PeerService ¶
type PeerService interface { Start(appCtx context.Context, listenAddress string, peerNotifyAddress string, mongoDatabase *mongo.Database) error Stop() RegisterPayloadHandler(payloadType peer_proto.PayloadType, handler PayloadHandler) GetPeerId() string GetPeers() []*Peer NotifyTopic(peerId string, tenantId string, topicName string, data []byte) error }
func New ¶
func New() (PeerService, error)
Click to show internal directories.
Click to hide internal directories.