update names per discussion at google/cayley#38

This commit is contained in:
Jeremy Jay 2014-07-18 11:07:19 -04:00
parent d808d9347c
commit f9c60a5f30
5 changed files with 37 additions and 30 deletions

View file

@ -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)