當前位置: 首頁>>代碼示例>>Golang>>正文


Golang util.Subscription類代碼示例

本文整理匯總了Golang中github.com/cockroachdb/cockroach/util.Subscription的典型用法代碼示例。如果您正苦於以下問題:Golang Subscription類的具體用法?Golang Subscription怎麽用?Golang Subscription使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Subscription類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: readEvents

func (ser *storeEventReader) readEvents(sub *util.Subscription) {
	ser.perStoreFeeds = make(map[proto.StoreID][]string)
	ser.perStoreUpdateCount = make(map[proto.StoreID]map[proto.Method]int)
	for e := range sub.Events() {
		ser.recordEvent(e)
	}
}
開發者ID:routhcr,項目名稱:cockroach,代碼行數:7,代碼來源:client_event_test.go

示例2: ProcessStoreEvents

// ProcessStoreEvents reads store events from the supplied channel and passes
// them to the correct methods of the supplied StoreEventListener. This method
// will run until the Subscription's events channel is closed.
func ProcessStoreEvents(l StoreEventListener, sub *util.Subscription) {
	for event := range sub.Events() {
		// TODO(tamird): https://github.com/barakmich/go-nyet/issues/7
		switch specificEvent := event.(type) {
		case *StartStoreEvent:
			l.OnStartStore(specificEvent)
		case *RegisterRangeEvent:
			l.OnRegisterRange(specificEvent)
		case *UpdateRangeEvent:
			l.OnUpdateRange(specificEvent)
		case *RemoveRangeEvent:
			l.OnRemoveRange(specificEvent)
		case *SplitRangeEvent:
			l.OnSplitRange(specificEvent)
		case *MergeRangeEvent:
			l.OnMergeRange(specificEvent)
		case *BeginScanRangesEvent:
			l.OnBeginScanRanges(specificEvent)
		case *EndScanRangesEvent:
			l.OnEndScanRanges(specificEvent)
		case *StoreStatusEvent:
			l.OnStoreStatus(specificEvent)
		case *ReplicationStatusEvent:
			l.OnReplicationStatus(specificEvent)
		}
	}
}
開發者ID:mingpengxiao,項目名稱:cockroach,代碼行數:30,代碼來源:feed.go

示例3: ProcessNodeEvents

// ProcessNodeEvents reads node events from the supplied channel and passes them
// to the correct methods of the supplied NodeEventListener. This method will
// run until the Subscription's events channel is closed.
func ProcessNodeEvents(l NodeEventListener, sub *util.Subscription) {
	for event := range sub.Events() {
		// TODO(tamird): https://github.com/barakmich/go-nyet/issues/7
		switch specificEvent := event.(type) {
		case *CallSuccessEvent:
			l.OnCallSuccess(specificEvent)
		case *CallErrorEvent:
			l.OnCallError(specificEvent)
		}
	}
}
開發者ID:Hellblazer,項目名稱:cockroach,代碼行數:14,代碼來源:feed.go

示例4: readEvents

func (ner *nodeEventReader) readEvents(sub *util.Subscription) {
	ner.perNodeFeeds = make(map[proto.NodeID][]string)
	for e := range sub.Events() {
		ner.recordEvent(e)
	}
}
開發者ID:Hellblazer,項目名稱:cockroach,代碼行數:6,代碼來源:feed_test.go


注:本文中的github.com/cockroachdb/cockroach/util.Subscription類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。