You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
760 B
29 lines
760 B
4 years ago
|
package streammanager
|
||
|
|
||
|
import (
|
||
|
"github.com/ethereum/go-ethereum/event"
|
||
|
sttypes "github.com/harmony-one/harmony/p2p/stream/types"
|
||
|
)
|
||
|
|
||
|
// EvtStreamAdded is the event of adding a new stream
|
||
|
type (
|
||
|
EvtStreamAdded struct {
|
||
|
Stream sttypes.Stream
|
||
|
}
|
||
|
|
||
|
// EvtStreamRemoved is an event of stream removed
|
||
|
EvtStreamRemoved struct {
|
||
|
ID sttypes.StreamID
|
||
|
}
|
||
|
)
|
||
|
|
||
|
// SubscribeAddStreamEvent subscribe the add stream event
|
||
|
func (sm *streamManager) SubscribeAddStreamEvent(ch chan<- EvtStreamAdded) event.Subscription {
|
||
|
return sm.addStreamFeed.Subscribe(ch)
|
||
|
}
|
||
|
|
||
|
// SubscribeRemoveStreamEvent subscribe the remove stream event
|
||
|
func (sm *streamManager) SubscribeRemoveStreamEvent(ch chan<- EvtStreamRemoved) event.Subscription {
|
||
|
return sm.removeStreamFeed.Subscribe(ch)
|
||
|
}
|