当前位置: 首页>>代码示例>>Golang>>正文


Golang Volume.DriverName方法代码示例

本文整理汇总了Golang中github.com/docker/docker/volume.Volume.DriverName方法的典型用法代码示例。如果您正苦于以下问题:Golang Volume.DriverName方法的具体用法?Golang Volume.DriverName怎么用?Golang Volume.DriverName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/docker/docker/volume.Volume的用法示例。


在下文中一共展示了Volume.DriverName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: volumeExists

// volumeExists returns if the volume is still present in the driver.
// An error is returned if there was an issue communicating with the driver.
func volumeExists(v volume.Volume) (bool, error) {
	exists, err := lookupVolume(v.DriverName(), v.Name())
	if err != nil {
		return false, err
	}
	return exists != nil, nil
}
开发者ID:jfrazelle,项目名称:docker,代码行数:9,代码来源:store.go

示例2: volumeToAPIType

// volumeToAPIType converts a volume.Volume to the type used by the remote API
func volumeToAPIType(v volume.Volume) *types.Volume {
	return &types.Volume{
		Name:       v.Name(),
		Driver:     v.DriverName(),
		Mountpoint: v.Path(),
	}
}
开发者ID:m1911,项目名称:hyper,代码行数:8,代码来源:volumes.go

示例3: removeVolume

func removeVolume(v volume.Volume) error {
	vd, err := getVolumeDriver(v.DriverName())
	if err != nil {
		return nil
	}
	return vd.Remove(v)
}
开发者ID:fwalker,项目名称:dashboard,代码行数:7,代码来源:volumes.go

示例4: Remove

// Remove removes the requested volume. A volume is not removed if the usage count is > 0
func (s *VolumeStore) Remove(v volume.Volume) error {
	name := normaliseVolumeName(v.Name())
	s.locks.Lock(name)
	defer s.locks.Unlock(name)

	logrus.Debugf("Removing volume reference: driver %s, name %s", v.DriverName(), name)
	vc, exists := s.get(name)
	if !exists {
		return ErrNoSuchVolume
	}

	if vc.count > 0 {
		return ErrVolumeInUse
	}

	vd, err := volumedrivers.GetDriver(vc.DriverName())
	if err != nil {
		return err
	}
	if err := vd.Remove(vc.Volume); err != nil {
		return err
	}

	s.remove(name)
	return nil
}
开发者ID:ngorskig,项目名称:docker,代码行数:27,代码来源:store.go

示例5: AddMountPointWithVolume

// AddMountPointWithVolume adds a new mount point configured with a volume to the container.
func (container *Container) AddMountPointWithVolume(destination string, vol volume.Volume, rw bool) {
	container.MountPoints[destination] = &volume.MountPoint{
		Name:        vol.Name(),
		Driver:      vol.DriverName(),
		Destination: destination,
		RW:          rw,
		Volume:      vol,
		CopyData:    volume.DefaultCopyMode,
	}
}
开发者ID:moxiegirl,项目名称:docker,代码行数:11,代码来源:container.go

示例6: volumeToAPIType

// volumeToAPIType converts a volume.Volume to the type used by the remote API
func volumeToAPIType(v volume.Volume) *types.Volume {
	tv := &types.Volume{
		Name:   v.Name(),
		Driver: v.DriverName(),
	}
	if v, ok := v.(interface {
		Labels() map[string]string
	}); ok {
		tv.Labels = v.Labels()
	}
	return tv
}
开发者ID:RAMESHBABUK,项目名称:docker,代码行数:13,代码来源:volumes.go

示例7: Decrement

// Decrement decrements the usage count of the passed in volume by 1
func (s *volumeStore) Decrement(v volume.Volume) {
	s.mu.Lock()
	defer s.mu.Unlock()
	logrus.Debugf("Decrementing volume reference: driver %s, name %s", v.DriverName(), v.Name())

	vc, exists := s.vols[v.Name()]
	if !exists {
		return
	}
	vc.count--
	return
}
开发者ID:NunoEdgarGub1,项目名称:docker,代码行数:13,代码来源:volumes.go

示例8: Increment

// Increment increments the usage count of the passed in volume by 1
func (s *VolumeStore) Increment(v volume.Volume) {
	s.mu.Lock()
	defer s.mu.Unlock()
	logrus.Debugf("Incrementing volume reference: driver %s, name %s", v.DriverName(), v.Name())

	vc, exists := s.vols[v.Name()]
	if !exists {
		s.vols[v.Name()] = &volumeCounter{v, 1}
		return
	}
	vc.count++
}
开发者ID:previousnext,项目名称:kube-ingress,代码行数:13,代码来源:store.go

示例9: Increment

// Increment increments the usage count of the passed in volume by 1
func (s *VolumeStore) Increment(v volume.Volume) {
	name := normaliseVolumeName(v.Name())
	s.locks.Lock(name)
	defer s.locks.Unlock(name)

	logrus.Debugf("Incrementing volume reference: driver %s, name %s", v.DriverName(), v.Name())
	vc, exists := s.get(name)
	if !exists {
		s.set(name, &volumeCounter{v, 1})
		return
	}
	vc.count++
}
开发者ID:ngorskig,项目名称:docker,代码行数:14,代码来源:store.go

示例10: volumeToAPIType

// volumeToAPIType converts a volume.Volume to the type used by the remote API
func volumeToAPIType(v volume.Volume) *types.Volume {
	tv := &types.Volume{
		Name:   v.Name(),
		Driver: v.DriverName(),
	}
	if v, ok := v.(volume.DetailedVolume); ok {
		tv.Labels = v.Labels()
		tv.Options = v.Options()
		tv.Scope = v.Scope()
	}

	return tv
}
开发者ID:Mic92,项目名称:docker,代码行数:14,代码来源:volumes.go

示例11: Decrement

// Decrement decrements the usage count of the passed in volume by 1
func (s *VolumeStore) Decrement(v volume.Volume) {
	s.mu.Lock()
	defer s.mu.Unlock()
	name := normaliseVolumeName(v.Name())
	logrus.Debugf("Decrementing volume reference: driver %s, name %s", v.DriverName(), name)

	vc, exists := s.vols[name]
	if !exists {
		return
	}
	if vc.count == 0 {
		return
	}
	vc.count--
}
开发者ID:maaquib,项目名称:docker,代码行数:16,代码来源:store.go

示例12: Decrement

// Decrement decrements the usage count of the passed in volume by 1
func (s *VolumeStore) Decrement(v volume.Volume) {
	name := normaliseVolumeName(v.Name())
	s.locks.Lock(name)
	defer s.locks.Unlock(name)
	logrus.Debugf("Decrementing volume reference: driver %s, name %s", v.DriverName(), v.Name())

	vc, exists := s.get(name)
	if !exists {
		return
	}
	if vc.count == 0 {
		return
	}
	vc.count--
}
开发者ID:ngorskig,项目名称:docker,代码行数:16,代码来源:store.go

示例13: volumeToAPIType

// volumeToAPIType converts a volume.Volume to the type used by the remote API
func volumeToAPIType(v volume.Volume) *types.Volume {
	tv := &types.Volume{
		Name:     v.Name(),
		Driver:   v.DriverName(),
		Size:     -1,
		RefCount: -1,
	}
	if v, ok := v.(volume.LabeledVolume); ok {
		tv.Labels = v.Labels()
	}

	if v, ok := v.(volume.ScopedVolume); ok {
		tv.Scope = v.Scope()
	}
	return tv
}
开发者ID:SUSE,项目名称:docker.mirror,代码行数:17,代码来源:volumes.go

示例14: volumeExists

// volumeExists returns if the volume is still present in the driver.
// An error is returned if there was an issue communicating with the driver.
func volumeExists(v volume.Volume) (bool, error) {
	vd, err := volumedrivers.GetDriver(v.DriverName())
	if err != nil {
		return false, errors.Wrapf(err, "error while checking if volume %q exists in driver %q", v.Name(), v.DriverName())
	}
	exists, err := vd.Get(v.Name())
	if err != nil {
		err = errors.Cause(err)
		if _, ok := err.(net.Error); ok {
			return false, errors.Wrapf(err, "error while checking if volume %q exists in driver %q", v.Name(), v.DriverName())
		}

		// At this point, the error could be anything from the driver, such as "no such volume"
		// Let's not check an error here, and instead check if the driver returned a volume
	}
	if exists == nil {
		return false, nil
	}
	return true, nil
}
开发者ID:harche,项目名称:docker,代码行数:22,代码来源:store.go

示例15: Remove

// Remove removes the requested volume. A volume is not removed if it has any refs
func (s *VolumeStore) Remove(v volume.Volume) error {
	name := normaliseVolumeName(v.Name())
	s.locks.Lock(name)
	defer s.locks.Unlock(name)

	if refs, exists := s.refs[name]; exists && len(refs) > 0 {
		return &OpErr{Err: errVolumeInUse, Name: v.Name(), Op: "remove", Refs: refs}
	}

	vd, err := volumedrivers.GetDriver(v.DriverName())
	if err != nil {
		return &OpErr{Err: err, Name: vd.Name(), Op: "remove"}
	}

	logrus.Debugf("Removing volume reference: driver %s, name %s", v.DriverName(), name)
	if err := vd.Remove(v); err != nil {
		return &OpErr{Err: err, Name: name, Op: "remove"}
	}

	s.purge(name)
	return nil
}
开发者ID:slowreadr,项目名称:docker,代码行数:23,代码来源:store.go


注:本文中的github.com/docker/docker/volume.Volume.DriverName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。