예제 #1
0
// StartMonitorFeed starts a goroutine which processes events published to the
// supplied Subscription. The goroutine will continue running until the
// Subscription's Events feed is closed.
func (nsm *NodeStatusMonitor) StartMonitorFeed(feed *util.Feed) {
	sub := feed.Subscribe()
	go func() {
		for event := range sub.Events() {
			if syncEvent, ok := event.(*TestSyncEvent); ok {
				syncEvent.consume()
			}

			ProcessNodeEvent(nsm, event)
			storage.ProcessStoreEvent(nsm, event)
		}
	}()
}
예제 #2
0
// StartMonitorFeed starts a goroutine which processes events published to the
// supplied Subscription. The goroutine will continue running until the
// Subscription's Events feed is closed.
func (nsm *NodeStatusMonitor) StartMonitorFeed(feed *util.Feed) {
	go storage.ProcessStoreEvents(nsm, feed.Subscribe())
	go ProcessNodeEvents(nsm, feed.Subscribe())
}
예제 #3
0
func (ner *nodeEventReader) readEvents(feed *util.Feed) {
	ner.perNodeFeeds = make(map[roachpb.NodeID][]string)
	feed.Subscribe(ner.recordEvent)
}
예제 #4
0
func (ser *storeEventReader) readEvents(feed *util.Feed) {
	ser.perStoreFeeds = make(map[roachpb.StoreID][]string)
	ser.perStoreUpdateCount = make(map[roachpb.StoreID]map[roachpb.Method]int)
	feed.Subscribe(ser.recordEvent)
}
예제 #5
0
// StartMonitorFeed starts a goroutine which processes events published to the
// supplied Subscription. The goroutine will continue running until the
// Subscription's Events feed is closed.
func (nsm *NodeStatusMonitor) StartMonitorFeed(feed *util.Feed) {
	feed.Subscribe(func(event interface{}) {
		ProcessNodeEvent(nsm, event)
		storage.ProcessStoreEvent(nsm, event)
	})
}
예제 #6
0
func newSimpleEventConsumer(feed *util.Feed) *simpleEventConsumer {
	return &simpleEventConsumer{
		sub: feed.Subscribe(),
	}
}
예제 #7
0
func newConsumer(feed *util.Feed) *storeEventConsumer {
	return &storeEventConsumer{
		sub: feed.Subscribe(),
	}
}