本文整理汇总了Golang中github.com/contiv/volplugin/db.Entity.Prefix方法的典型用法代码示例。如果您正苦于以下问题:Golang Entity.Prefix方法的具体用法?Golang Entity.Prefix怎么用?Golang Entity.Prefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/contiv/volplugin/db.Entity
的用法示例。
在下文中一共展示了Entity.Prefix方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ListPrefix
// ListPrefix is used to list a subtree of an entity, such as listing volume by policy.
func (c *Client) ListPrefix(prefix string, obj db.Entity) ([]db.Entity, error) {
resp, err := c.client.Get(context.Background(), c.qualified(path.Join(obj.Prefix(), prefix)), &client.GetOptions{Recursive: true})
if err != nil {
return nil, err
}
return c.traverse(resp.Node, obj), nil
}
示例2: WatchPrefixStop
// WatchPrefixStop stops a watch.
func (c *Client) WatchPrefixStop(obj db.Entity) error {
return helpers.WatchStop(c, obj.Prefix(), c.watchers, &c.watcherMutex)
}
示例3: WatchPrefix
// WatchPrefix watches a directory prefix for changes.
func (c *Client) WatchPrefix(obj db.Entity) (chan db.Entity, chan error) {
// these paths are qualified in watchInternal
return helpers.WrapWatch(c, obj, obj.Prefix(), true, c.watchers, &c.watcherMutex, c.watchInternal)
}
示例4: WatchPrefixStop
// WatchPrefixStop stops
func (c *Client) WatchPrefixStop(obj db.Entity) error {
return c.watchStopPath(obj.Prefix())
}
示例5: WatchPrefix
// WatchPrefix watches all items under the given entity's prefix
func (c *Client) WatchPrefix(obj db.Entity) (chan db.Entity, chan error) {
return c.watchPath(obj, obj.Prefix(), true)
}