本文整理汇总了Golang中github.com/pdf/golifx/common.Subscription类的典型用法代码示例。如果您正苦于以下问题:Golang Subscription类的具体用法?Golang Subscription怎么用?Golang Subscription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Subscription类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: CloseSubscription
// CloseSubscription is a callback for handling the closing of subscriptions.
func (p *V2) CloseSubscription(sub *common.Subscription) error {
p.RLock()
_, ok := p.subscriptions[sub.ID()]
p.RUnlock()
if !ok {
return common.ErrNotFound
}
p.Lock()
delete(p.subscriptions, sub.ID())
p.Unlock()
return nil
}
开发者ID:chendo,项目名称:golifx,代码行数:14,代码来源:v2.go
示例2: CloseSubscription
// CloseSubscription is a callback for handling the closing of subscriptions.
func (c *Client) CloseSubscription(sub *common.Subscription) error {
c.RLock()
_, ok := c.subscriptions[sub.ID()]
c.RUnlock()
if !ok {
return common.ErrNotFound
}
c.Lock()
delete(c.subscriptions, sub.ID())
c.Unlock()
return nil
}
开发者ID:pdf,项目名称:golifx,代码行数:14,代码来源:client.go
示例3: CloseSubscription
// CloseSubscription is a callback for handling the closing of subscriptions.
func (d *Device) CloseSubscription(sub *common.Subscription) error {
d.RLock()
_, ok := d.subscriptions[sub.ID()]
d.RUnlock()
if !ok {
return common.ErrNotFound
}
d.Lock()
delete(d.subscriptions, sub.ID())
d.Unlock()
return nil
}
开发者ID:pdf,项目名称:golifx,代码行数:14,代码来源:device.go
示例4: CloseSubscription
// CloseSubscription is a callback for handling the closing of subscriptions.
func (g *Group) CloseSubscription(sub *common.Subscription) error {
g.RLock()
_, ok := g.subscriptions[sub.ID()]
g.RUnlock()
if !ok {
return common.ErrNotFound
}
g.Lock()
delete(g.subscriptions, sub.ID())
g.Unlock()
return nil
}
开发者ID:chendo,项目名称:golifx,代码行数:14,代码来源:group.go
示例5:
var _ = Describe("Golifx", func() {
var (
client *Client
protocolSubscription *common.Subscription
clientSubscription *common.Subscription
timeout = 200 * time.Millisecond
mockProtocol *mocks.Protocol
mockDevice *mocks.Device
mockLight *mocks.Light
mockLocation *mocks.Location
mockGroup *mocks.Group
deviceID = uint64(1234)
deviceUnknownID = uint64(4321)
deviceLabel = `mockDevice`
deviceUnknownLabel = `unknownDevice`
lightID = uint64(5678)
lightLabel = `mockLight`
locationID = `mockLocationID`
locationUnknownID = `unknownLocationID`
locationLabel = `mockLocation`
locationUnknownLabel = `unknownLocation`
groupID = `mockGroupID`
groupUnknownID = `unknownGroupID`
groupLabel = `mockGroup`
groupUnknownLabel = `unknownGroup`
)
It("should send discovery to the protocol on NewClient", func() {
开发者ID:chendo,项目名称:golifx,代码行数:31,代码来源:client_test.go
注:本文中的github.com/pdf/golifx/common.Subscription类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论