当前位置: 首页>>代码示例>>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;未经允许,请勿转载。