本文整理汇总了Golang中doppler/sinks.Sink.StreamId方法的典型用法代码示例。如果您正苦于以下问题:Golang Sink.StreamId方法的具体用法?Golang Sink.StreamId怎么用?Golang Sink.StreamId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类doppler/sinks.Sink
的用法示例。
在下文中一共展示了Sink.StreamId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: CloseAndDelete
func (group *GroupedSinks) CloseAndDelete(sink sinks.Sink) bool {
group.Lock()
defer group.Unlock()
appId := sink.StreamId()
wrapper, ok := group.apps[appId][sink.Identifier()]
if ok {
close(wrapper.InputChan)
delete(group.apps[appId], sink.Identifier())
return true
}
return false
}
示例2: IsFirehoseRegistered
func (group *GroupedSinks) IsFirehoseRegistered(sink sinks.Sink) bool {
group.RLock()
defer group.RUnlock()
subscriptionId := sink.StreamId()
if subscriptionId == "" {
return false
}
fgroup := group.firehoses[subscriptionId]
if fgroup == nil {
return false
}
return fgroup.Exists(sink)
}
示例3: RegisterFirehoseSink
func (group *GroupedSinks) RegisterFirehoseSink(in chan<- *events.Envelope, sink sinks.Sink) bool {
group.Lock()
defer group.Unlock()
subscriptionId := sink.StreamId()
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)
}
示例4: RegisterAppSink
func (group *GroupedSinks) RegisterAppSink(in chan<- *events.Envelope, sink sinks.Sink) bool {
group.Lock()
defer group.Unlock()
appId := sink.StreamId()
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
}
示例5: CloseAndDeleteFirehose
func (group *GroupedSinks) CloseAndDeleteFirehose(sink sinks.Sink) bool {
group.Lock()
defer group.Unlock()
firehoseSubscriptionId := sink.StreamId()
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
}