33 lines
744 B
Go
33 lines
744 B
Go
package pubsub
|
|
|
|
import (
|
|
"context"
|
|
"oc-discovery/daemons/node/common"
|
|
"oc-discovery/daemons/node/stream"
|
|
"sync"
|
|
|
|
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
|
"github.com/libp2p/go-libp2p/core/host"
|
|
)
|
|
|
|
type PubSubService struct {
|
|
Node common.DiscoveryPeer
|
|
Host host.Host
|
|
PS *pubsub.PubSub
|
|
StreamService *stream.StreamService
|
|
Subscription []string
|
|
mutex sync.RWMutex
|
|
}
|
|
|
|
func InitPubSub(ctx context.Context, h host.Host, ps *pubsub.PubSub, node common.DiscoveryPeer, streamService *stream.StreamService) (*PubSubService, error) {
|
|
return &PubSubService{
|
|
Host: h,
|
|
Node: node,
|
|
StreamService: streamService,
|
|
PS: ps,
|
|
}, nil
|
|
}
|
|
|
|
func (ix *PubSubService) Close() {
|
|
}
|