當前位置: 首頁>>代碼示例>>Golang>>正文


Golang volume.Response類代碼示例

本文整理匯總了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;未經允許,請勿轉載。