Moved configuration to Quadwriter and added to config file

This commit is contained in:
l.albertalli 2015-02-09 18:43:26 -08:00
parent 68cd44b986
commit 6134bc8bdd
7 changed files with 48 additions and 33 deletions

View file

@ -181,7 +181,7 @@ var (
cps = [4]quad.Direction{quad.Label, quad.Predicate, quad.Subject, quad.Object}
)
func (qs *QuadStore) ApplyDeltas(deltas []graph.Delta) error {
func (qs *QuadStore) ApplyDeltas(deltas []graph.Delta, ignoreDuplicate bool, ignoreMissing bool) error {
batch := &leveldb.Batch{}
resizeMap := make(map[string]int64)
sizeChange := int64(0)
@ -196,10 +196,10 @@ func (qs *QuadStore) ApplyDeltas(deltas []graph.Delta) error {
batch.Put(keyFor(d), bytes)
err = qs.buildQuadWrite(batch, d.Quad, d.ID.Int(), d.Action == graph.Add)
if err != nil {
if err == graph.ErrQuadExists && *graph.NoErrorDup{
if err == graph.ErrQuadExists && ignoreDuplicate{
continue
}
if err == graph.ErrQuadNotExist && *graph.NoErrorDel{
if err == graph.ErrQuadNotExist && ignoreMissing{
continue
}
return err