本文整理汇总了Golang中launchpad/net/juju-core/environs.Environ.Storage方法的典型用法代码示例。如果您正苦于以下问题:Golang Environ.Storage方法的具体用法?Golang Environ.Storage怎么用?Golang Environ.Storage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类launchpad/net/juju-core/environs.Environ
的用法示例。
在下文中一共展示了Environ.Storage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: putNames
// putNames puts a set of names into the environ's private
// and public storage. The data in the private storage is
// the name itself; in the public storage the name is preceded with "public-".
func putNames(c *C, env environs.Environ, private, public []string) {
for _, name := range private {
err := env.Storage().Put(name, strings.NewReader(name), int64(len(name)))
c.Assert(err, IsNil)
}
// The contents of all files in the public storage is prefixed with "public-" so
// that we can easily tell if we've got the right thing.
for _, name := range public {
data := "public-" + name
err := env.PublicStorage().(environs.Storage).Put(name, strings.NewReader(data), int64(len(data)))
c.Assert(err, IsNil)
}
}
示例2: RemoveAllTools
// RemoveAllTools deletes all tools from the supplied environment.
func RemoveAllTools(c *C, env environs.Environ) {
c.Logf("clearing private storage")
RemoveTools(c, env.Storage())
c.Logf("clearing public storage")
RemoveTools(c, env.PublicStorage().(environs.Storage))
}