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


Golang Storage.Remove方法代码示例

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


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

示例1: removeAll

func removeAll(stor storage.Storage) error {
	names, err := storage.List(stor, "")
	if err != nil {
		return err
	}
	// Remove all the objects in parallel so that we incur fewer round-trips.
	// If we're in danger of having hundreds of objects,
	// we'll want to change this to limit the number
	// of concurrent operations.
	var wg sync.WaitGroup
	wg.Add(len(names))
	errc := make(chan error, len(names))
	for _, name := range names {
		name := name
		go func() {
			defer wg.Done()
			if err := stor.Remove(name); err != nil {
				errc <- err
			}
		}()
	}
	wg.Wait()
	select {
	case err := <-errc:
		return fmt.Errorf("cannot delete all provider state: %v", err)
	default:
	}
	return nil
}
开发者ID:makyo,项目名称:juju,代码行数:29,代码来源:storage.go

示例2: RemoveFakeToolsMetadata

// RemoveFakeToolsMetadata deletes the fake simplestreams tools metadata from the supplied storage.
func RemoveFakeToolsMetadata(c *gc.C, stor storage.Storage) {
	files, err := stor.List("tools/streams")
	c.Assert(err, jc.ErrorIsNil)
	for _, file := range files {
		err = stor.Remove(file)
		c.Check(err, jc.ErrorIsNil)
	}
}
开发者ID:pmatulis,项目名称:juju,代码行数:9,代码来源:tools.go

示例3: RemoveFakeToolsMetadata

// RemoveFakeToolsMetadata deletes the fake simplestreams tools metadata from the supplied storage.
func RemoveFakeToolsMetadata(c *gc.C, stor storage.Storage) {
	files := []string{simplestreams.UnsignedIndex, envtools.ProductMetadataPath}
	for _, file := range files {
		toolspath := path.Join("tools", file)
		err := stor.Remove(toolspath)
		c.Check(err, gc.IsNil)
	}
}
开发者ID:kapilt,项目名称:juju,代码行数:9,代码来源:tools.go

示例4: RemoveTools

// RemoveTools deletes all tools from the supplied storage.
func RemoveTools(c *gc.C, stor storage.Storage, toolsDir string) {
	names, err := storage.List(stor, fmt.Sprintf("tools/%s/juju-", toolsDir))
	c.Assert(err, jc.ErrorIsNil)
	c.Logf("removing files: %v", names)
	for _, name := range names {
		err = stor.Remove(name)
		c.Check(err, jc.ErrorIsNil)
	}
	RemoveFakeToolsMetadata(c, stor)
}
开发者ID:pmatulis,项目名称:juju,代码行数:11,代码来源:tools.go

示例5: RemoveTools

// RemoveTools deletes all tools from the supplied storage.
func RemoveTools(c *gc.C, stor storage.Storage) {
	names, err := storage.List(stor, "tools/releases/juju-")
	c.Assert(err, gc.IsNil)
	c.Logf("removing files: %v", names)
	for _, name := range names {
		err = stor.Remove(name)
		c.Check(err, gc.IsNil)
	}
	RemoveFakeToolsMetadata(c, stor)
}
开发者ID:kapilt,项目名称:juju,代码行数:11,代码来源:tools.go

示例6: RemoveFakeTools

// RemoveFakeTools deletes the fake tools from the supplied storage.
func RemoveFakeTools(c *gc.C, stor storage.Storage, toolsDir string) {
	c.Logf("removing fake tools")
	toolsVersion := version.Current
	name := envtools.StorageName(toolsVersion, toolsDir)
	err := stor.Remove(name)
	c.Check(err, jc.ErrorIsNil)
	defaultSeries := coretesting.FakeDefaultSeries
	if series.HostSeries() != defaultSeries {
		toolsVersion.Series = defaultSeries
		name := envtools.StorageName(toolsVersion, toolsDir)
		err := stor.Remove(name)
		c.Check(err, jc.ErrorIsNil)
	}
	RemoveFakeToolsMetadata(c, stor)
}
开发者ID:ktsakalozos,项目名称:juju,代码行数:16,代码来源:tools.go

示例7: RemoveFakeTools

// RemoveFakeTools deletes the fake tools from the supplied storage.
func RemoveFakeTools(c *gc.C, stor storage.Storage) {
	c.Logf("removing fake tools")
	toolsVersion := version.Current
	name := envtools.StorageName(toolsVersion)
	err := stor.Remove(name)
	c.Check(err, gc.IsNil)
	defaultSeries := coretesting.FakeDefaultSeries
	if version.Current.Series != defaultSeries {
		toolsVersion.Series = defaultSeries
		name := envtools.StorageName(toolsVersion)
		err := stor.Remove(name)
		c.Check(err, gc.IsNil)
	}
	RemoveFakeToolsMetadata(c, stor)
}
开发者ID:kapilt,项目名称:juju,代码行数:16,代码来源:tools.go

示例8: RemoveFakeTools

// RemoveFakeTools deletes the fake tools from the supplied storage.
func RemoveFakeTools(c *gc.C, stor storage.Storage, toolsDir string) {
	c.Logf("removing fake tools")
	toolsVersion := version.Binary{
		Number: jujuversion.Current,
		Arch:   arch.HostArch(),
		Series: series.HostSeries(),
	}
	name := envtools.StorageName(toolsVersion, toolsDir)
	err := stor.Remove(name)
	c.Check(err, jc.ErrorIsNil)
	defaultSeries := series.LatestLts()
	if series.HostSeries() != defaultSeries {
		toolsVersion.Series = defaultSeries
		name := envtools.StorageName(toolsVersion, toolsDir)
		err := stor.Remove(name)
		c.Check(err, jc.ErrorIsNil)
	}
	RemoveFakeToolsMetadata(c, stor)
}
开发者ID:bac,项目名称:juju,代码行数:20,代码来源:tools.go

示例9: RemoveTestImageData

func RemoveTestImageData(stor envstorage.Storage) {
	stor.Remove(simplestreams.UnsignedIndex("v1", 1))
	stor.Remove(productMetadatafile)
}
开发者ID:Pankov404,项目名称:juju,代码行数:4,代码来源:export_test.go

示例10: RemoveTestImageData

func RemoveTestImageData(stor storage.Storage) {
	stor.Remove(simplestreams.DefaultIndexPath + ".json")
	stor.Remove(productMetadatafile)
}
开发者ID:kapilt,项目名称:juju,代码行数:4,代码来源:export_test.go

示例11: DeleteStateFile

// DeleteStateFile deletes the state file on the given storage.
func DeleteStateFile(stor storage.Storage) error {
	return stor.Remove(StateFile)
}
开发者ID:imoapps,项目名称:juju,代码行数:4,代码来源:state.go


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