update names per discussion at google/cayley#38
This commit is contained in:
parent
d808d9347c
commit
f9c60a5f30
5 changed files with 37 additions and 30 deletions
19
db/load.go
19
db/load.go
|
|
@ -24,20 +24,19 @@ import (
|
|||
"github.com/google/cayley/nquads"
|
||||
)
|
||||
|
||||
type bulkLoadable interface {
|
||||
// BulkLoad loads Triples from a channel in bulk to the TripleStore. It
|
||||
// returns false if bulk loading is not possible (i.e. if you cannot load
|
||||
// in bulk to a non-empty database, and the current database is non-empty)
|
||||
BulkLoad(chan *graph.Triple) bool
|
||||
}
|
||||
|
||||
func Load(ts graph.TripleStore, cfg *config.Config, triplePath string) {
|
||||
tChan := make(chan *graph.Triple)
|
||||
go ReadTriplesFromFile(tChan, triplePath)
|
||||
|
||||
bulker, canBulk := ts.(bulkLoadable)
|
||||
if canBulk && bulker.BulkLoad(tChan) {
|
||||
return
|
||||
bulker, canBulk := ts.(graph.BulkLoader)
|
||||
if canBulk {
|
||||
err := bulker.BulkLoad(tChan)
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
if err != graph.ErrCannotBulkLoad {
|
||||
glog.Errorln("Error attempting to bulk load: ", err)
|
||||
}
|
||||
}
|
||||
|
||||
LoadTriplesInto(tChan, ts, cfg.LoadSize)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue