本文整理匯總了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)
}