示例#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(),
	}
}