当前位置: 首页>>代码示例>>Golang>>正文


Golang Sink.Identifier方法代码示例

本文整理汇总了Golang中doppler/sinks.Sink.Identifier方法的典型用法代码示例。如果您正苦于以下问题:Golang Sink.Identifier方法的具体用法?Golang Sink.Identifier怎么用?Golang Sink.Identifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在doppler/sinks.Sink的用法示例。


在下文中一共展示了Sink.Identifier方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Exists

func (group *firehoseGroup) Exists(sink sinks.Sink) bool {
	group.Lock()
	defer group.Unlock()
	for _, sinkWrapper := range group.sinkWrappers {
		if sink.Identifier() == sinkWrapper.Sink.Identifier() {
			return true
		}
	}
	return false
}
开发者ID:lyuyun,项目名称:loggregator,代码行数:10,代码来源:firehose_group.go

示例2: CloseAndDelete

func (group *GroupedSinks) CloseAndDelete(sink sinks.Sink) bool {
	group.Lock()
	defer group.Unlock()

	appId := sink.AppID()
	wrapper, ok := group.apps[appId][sink.Identifier()]
	if ok {
		close(wrapper.InputChan)
		delete(group.apps[appId], sink.Identifier())
		return true
	}
	return false
}
开发者ID:sunatthegilddotcom,项目名称:loggregator,代码行数:13,代码来源:grouped_sinks.go

示例3: RegisterSink

func (sm *SinkManager) RegisterSink(sink sinks.Sink) bool {
	inputChan := make(chan *events.Envelope, 128)
	ok := sm.sinks.RegisterAppSink(inputChan, sink)
	if !ok {
		return false
	}

	sm.metrics.Inc(sink)

	sm.logger.Debugf("SinkManager: Sink with identifier %v requested. Opened it.", sink.Identifier())

	go func() {
		sink.Run(inputChan)
		sm.UnregisterSink(sink)
	}()

	return true
}
开发者ID:kei-yamazaki,项目名称:loggregator,代码行数:18,代码来源:sink_manager.go

示例4: RegisterAppSink

func (group *GroupedSinks) RegisterAppSink(in chan<- *events.Envelope, sink sinks.Sink) bool {
	group.Lock()
	defer group.Unlock()

	appId := sink.AppID()
	if appId == "" || sink.Identifier() == "" {
		return false
	}
	sinksForApp := group.apps[appId]
	if sinksForApp == nil {
		group.apps[appId] = make(map[string]*sink_wrapper.SinkWrapper)
		sinksForApp = group.apps[appId]
	}

	if _, ok := sinksForApp[sink.Identifier()]; ok {
		return false
	}
	sinksForApp[sink.Identifier()] = &sink_wrapper.SinkWrapper{InputChan: in, Sink: sink}
	return true
}
开发者ID:sunatthegilddotcom,项目名称:loggregator,代码行数:20,代码来源:grouped_sinks.go

示例5: UnregisterSink

func (sinkManager *SinkManager) UnregisterSink(sink sinks.Sink) {

	ok := sinkManager.sinks.CloseAndDelete(sink)
	if !ok {
		return
	}
	sinkManager.metrics.Dec(sink)

	if syslogSink, ok := sink.(*syslog.SyslogSink); ok {
		syslogSink.Disconnect()
	}

	sinkManager.logger.Debugf("SinkManager: Sink with identifier %s requested closing. Closed it.", sink.Identifier())
}
开发者ID:khj0651,项目名称:loggregator,代码行数:14,代码来源:sink_manager.go

示例6: UnregisterFirehoseSink

func (sinkManager *SinkManager) UnregisterFirehoseSink(sink sinks.Sink) {
	ok := sinkManager.sinks.CloseAndDeleteFirehose(sink)
	if !ok {
		return
	}

	sinkManager.metrics.DecFirehose()
	sinkManager.logger.Debugf("SinkManager: Firehose Sink with identifier %s requested closing. Closed it.", sink.Identifier())
}
开发者ID:khj0651,项目名称:loggregator,代码行数:9,代码来源:sink_manager.go


注:本文中的doppler/sinks.Sink.Identifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。