本文整理汇总了Golang中github.com/juju/juju/environs/storage.StorageWriter类的典型用法代码示例。如果您正苦于以下问题:Golang StorageWriter类的具体用法?Golang StorageWriter怎么用?Golang StorageWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StorageWriter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: putFile
func putFile(c *gc.C, stor storage.StorageWriter, name string, contents []byte) error {
c.Logf("check putting file %s ...", name)
reader := &readerWithClose{bytes.NewBuffer(contents), false}
err := stor.Put(name, reader, int64(len(contents)))
c.Assert(reader.closeCalled, jc.IsFalse)
return err
}
示例2: checkPutFile
func checkPutFile(c *gc.C, stor storage.StorageWriter, name string, contents []byte) {
err := stor.Put(name, bytes.NewBuffer(contents), int64(len(contents)))
c.Assert(err, gc.IsNil)
}
示例3: putState
// putState writes the given data to the state file on the given storage.
// The file's name is as defined in StateFile.
func putState(stor storage.StorageWriter, data []byte) error {
logger.Debugf("putting %q to bootstrap storage %T", StateFile, stor)
return stor.Put(StateFile, bytes.NewBuffer(data), int64(len(data)))
}