• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang sinks.Sink类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Sink类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: IsFirehoseRegistered

func (group *GroupedSinks) IsFirehoseRegistered(sink sinks.Sink) bool {
	group.RLock()
	defer group.RUnlock()
	subscriptionId := sink.AppID()
	if subscriptionId == "" {
		return false
	}

	fgroup := group.firehoses[subscriptionId]
	if fgroup == nil {
		return false
	}

	return fgroup.Exists(sink)
}
开发者ID:sunatthegilddotcom,项目名称:loggregator,代码行数:15,代码来源:grouped_sinks.go


示例3: RegisterFirehoseSink

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

	subscriptionId := sink.AppID()
	if subscriptionId == "" {
		return false
	}

	fgroup := group.firehoses[subscriptionId]
	if fgroup == nil {
		group.firehoses[subscriptionId] = firehose_group.NewFirehoseGroup()
		fgroup = group.firehoses[subscriptionId]
	}

	return fgroup.AddSink(sink, in)
}
开发者ID:sunatthegilddotcom,项目名称:loggregator,代码行数:17,代码来源:grouped_sinks.go


示例4: RegisterSink

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

	sinkManager.metrics.Inc(sink)

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

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

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


示例5: CloseAndDeleteFirehose

func (group *GroupedSinks) CloseAndDeleteFirehose(sink sinks.Sink) bool {
	group.Lock()
	defer group.Unlock()
	firehoseSubscriptionId := sink.AppID()
	fgroup, ok := group.firehoses[firehoseSubscriptionId]
	if !ok {
		return false
	}

	removed := fgroup.RemoveSink(sink)

	if removed == false {
		return false
	}

	if fgroup.IsEmpty() == true {
		delete(group.firehoses, firehoseSubscriptionId)
	}

	return true
}
开发者ID:sunatthegilddotcom,项目名称:loggregator,代码行数:21,代码来源:grouped_sinks.go


示例6: 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


示例7: 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


示例8: 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


示例9: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang syslog.SyslogSink类代码示例发布时间:2022-05-24
下一篇:
Golang config.Config类代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap