本文整理汇总了Golang中github.com/docker/go-plugins-helpers/volume.Response类的典型用法代码示例。如果您正苦于以下问题:Golang Response类的具体用法?Golang Response怎么用?Golang Response使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Response类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Create
func (d *shimDriver) Create(req volumeplugin.Request) volumeplugin.Response {
var res volumeplugin.Response
_, err := d.d.Create(req.Name, req.Options)
if err != nil {
res.Err = err.Error()
}
return res
}
示例2: Path
func (d *shimDriver) Path(req volumeplugin.Request) volumeplugin.Response {
var res volumeplugin.Response
v, err := d.d.Get(req.Name)
if err != nil {
res.Err = err.Error()
return res
}
res.Mountpoint = v.Path()
return res
}
示例3: Remove
func (d *shimDriver) Remove(req volumeplugin.Request) volumeplugin.Response {
var res volumeplugin.Response
v, err := d.d.Get(req.Name)
if err != nil {
res.Err = err.Error()
return res
}
if err := d.d.Remove(v); err != nil {
res.Err = err.Error()
}
return res
}
示例4: Unmount
func (d *shimDriver) Unmount(req volumeplugin.UnmountRequest) volumeplugin.Response {
var res volumeplugin.Response
v, err := d.d.Get(req.Name)
if err != nil {
res.Err = err.Error()
return res
}
if err := v.Unmount(req.ID); err != nil {
res.Err = err.Error()
}
return res
}
示例5: Get
func (d *shimDriver) Get(req volumeplugin.Request) volumeplugin.Response {
var res volumeplugin.Response
v, err := d.d.Get(req.Name)
if err != nil {
res.Err = err.Error()
return res
}
res.Volume = &volumeplugin.Volume{
Name: v.Name(),
Mountpoint: v.Path(),
}
return res
}
示例6: Mount
func (d *shimDriver) Mount(req volumeplugin.MountRequest) volumeplugin.Response {
var res volumeplugin.Response
v, err := d.d.Get(req.Name)
if err != nil {
res.Err = err.Error()
return res
}
pth, err := v.Mount(req.ID)
if err != nil {
res.Err = err.Error()
}
res.Mountpoint = pth
return res
}
示例7: Get
func (d *kvfsDriver) Get(req volume.Request) volume.Response {
var res volume.Response
d.Lock()
defer d.Unlock()
v, exists := d.volumes[req.Name]
if !exists {
return resp(fmt.Errorf("no such volume"))
}
res.Volume = &volume.Volume{
Name: v.name,
Mountpoint: v.mountPoint,
}
return res
}
示例8: Get
func (l *lvmDriver) Get(req volume.Request) volume.Response {
l.mu.RLock()
defer l.mu.RUnlock()
v, exists := l.volumes[req.Name]
if !exists {
return resp(fmt.Errorf("no such volume"))
}
var res volume.Response
res.Volume = &volume.Volume{
Name: v.Name,
Mountpoint: v.MountPoint,
}
return res
}
示例9: List
func (d *kvfsDriver) List(req volume.Request) volume.Response {
var res volume.Response
d.Lock()
defer d.Unlock()
var ls = make([]*volume.Volume, len(d.volumes))
for _, vol := range d.volumes {
v := &volume.Volume{
Name: vol.name,
Mountpoint: vol.mountPoint,
}
ls = append(ls, v)
}
res.Volumes = ls
return res
}
示例10: List
func (d *shimDriver) List(req volumeplugin.Request) volumeplugin.Response {
var res volumeplugin.Response
ls, err := d.d.List()
if err != nil {
res.Err = err.Error()
return res
}
vols := make([]*volumeplugin.Volume, len(ls))
for _, v := range ls {
vol := &volumeplugin.Volume{
Name: v.Name(),
Mountpoint: v.Path(),
}
vols = append(vols, vol)
}
res.Volumes = vols
return res
}
示例11: Capabilities
func (d *shimDriver) Capabilities(req volumeplugin.Request) volumeplugin.Response {
var res volumeplugin.Response
res.Capabilities = volumeplugin.Capability{Scope: d.d.Scope()}
return res
}