本文整理汇总了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
}
开发者ID:kolyshkin,项目名称:docker-volume-ploop,代码行数:8,代码来源:shim.go
示例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
}
开发者ID:kolyshkin,项目名称:docker-volume-ploop,代码行数:10,代码来源:shim.go
示例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
}
开发者ID:kolyshkin,项目名称:docker-volume-ploop,代码行数:12,代码来源:shim.go
示例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
}
开发者ID:vmware,项目名称:docker-volume-vsphere,代码行数:12,代码来源:shim.go
示例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
}
开发者ID:kolyshkin,项目名称:docker-volume-ploop,代码行数:13,代码来源:shim.go
示例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
}
开发者ID:vmware,项目名称:docker-volume-vsphere,代码行数:14,代码来源:shim.go
示例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
}
开发者ID:cpuguy83,项目名称:docker-kvfs-driver,代码行数:14,代码来源:driver.go
示例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
}
开发者ID:shishir-a412ed,项目名称:docker-lvm-plugin,代码行数:14,代码来源:driver.go
示例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
}
开发者ID:cpuguy83,项目名称:docker-kvfs-driver,代码行数:15,代码来源:driver.go
示例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
}
开发者ID:kolyshkin,项目名称:docker-volume-ploop,代码行数:19,代码来源:shim.go
示例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
}
开发者ID:vmware,项目名称:docker-volume-vsphere,代码行数:5,代码来源:shim.go
注:本文中的github.com/docker/go-plugins-helpers/volume.Response类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论