本文整理汇总了Golang中github.com/janelia-flyem/dvid/dvid.Data.BackendStore方法的典型用法代码示例。如果您正苦于以下问题:Golang Data.BackendStore方法的具体用法?Golang Data.BackendStore怎么用?Golang Data.BackendStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/janelia-flyem/dvid/dvid.Data
的用法示例。
在下文中一共展示了Data.BackendStore方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: getGraphDB
func getGraphDB(d dvid.Data) (db storage.GraphDB, err error) {
store, err := d.BackendStore()
if err != nil {
return nil, err
}
if store == nil {
return nil, ErrInvalidStore
}
var ok bool
db, ok = store.(storage.GraphDB)
if !ok {
return nil, fmt.Errorf("Store assigned to data %q (%s) is not a graph db", d.DataName(), store)
}
return
}
示例2: getKeyValueBatcher
func getKeyValueBatcher(d dvid.Data) (db storage.KeyValueBatcher, err error) {
store, err := d.BackendStore()
if err != nil {
return nil, err
}
if store == nil {
return nil, ErrInvalidStore
}
var ok bool
db, ok = store.(storage.KeyValueBatcher)
if !ok {
return nil, fmt.Errorf("Store assigned to data %q (%s) is not able to batch key-value ops", d.DataName(), store)
}
return
}
示例3: DeleteDataInstance
// DeleteDataInstance removes a data instance.
func DeleteDataInstance(data dvid.Data) error {
if !manager.setup {
return fmt.Errorf("Can't delete data instance %q before storage manager is initialized", data.DataName())
}
// Get the store for the data instance.
store, err := data.BackendStore()
if err != nil {
return err
}
db, ok := store.(OrderedKeyValueDB)
if !ok {
return fmt.Errorf("store assigned to data %q is not an ordered kv db with ability to delete all", data.DataName())
}
dvid.Infof("Starting delete of instance %d: name %q, type %s\n", data.InstanceID(), data.DataName(), data.TypeName())
ctx := NewDataContext(data, 0)
if err := db.DeleteAll(ctx, true); err != nil {
return err
}
return nil
}