本文整理汇总了Golang中camlistore/org/pkg/blobserver.GenerationNotSupportedError函数的典型用法代码示例。如果您正苦于以下问题:Golang GenerationNotSupportedError函数的具体用法?Golang GenerationNotSupportedError怎么用?Golang GenerationNotSupportedError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GenerationNotSupportedError函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: StorageGeneration
func (s *storage) StorageGeneration() (initTime time.Time, random string, err error) {
sgen, sok := s.small.(blobserver.Generationer)
lgen, lok := s.large.(blobserver.Generationer)
if !sok || !lok {
return time.Time{}, "", blobserver.GenerationNotSupportedError("underlying storage engines don't support Generationer")
}
st, srand, err := sgen.StorageGeneration()
if err != nil {
return
}
lt, lrand, err := lgen.StorageGeneration()
if err != nil {
return
}
hash := sha1.New()
io.WriteString(hash, srand)
io.WriteString(hash, lrand)
maxTime := func(a, b time.Time) time.Time {
if a.After(b) {
return a
}
return b
}
return maxTime(lt, st), fmt.Sprintf("%x", hash.Sum(nil)), nil
}
示例2: StorageGeneration
func (sto *condStorage) StorageGeneration() (initTime time.Time, random string, err error) {
if gener, ok := sto.read.(blobserver.Generationer); ok {
return gener.StorageGeneration()
}
err = blobserver.GenerationNotSupportedError(fmt.Sprintf("blobserver.Generationer not implemented on %T", sto.read))
return
}
示例3: ResetStorageGeneration
func (sto *condStorage) ResetStorageGeneration() error {
if gener, ok := sto.read.(blobserver.Generationer); ok {
return gener.ResetStorageGeneration()
}
return blobserver.GenerationNotSupportedError(fmt.Sprintf("blobserver.Generationer not implemented on %T", sto.read))
}