Make graph.Delta zero state invalid for use
Previously, an incorrectly initialised Delta (omission of Action) would result in an Add operation. Make that detectable and return an error.
This commit is contained in:
parent
9088fe376b
commit
46f987ca51
5 changed files with 20 additions and 5 deletions
|
|
@ -185,6 +185,9 @@ func (qs *QuadStore) ApplyDeltas(deltas []graph.Delta) error {
|
|||
resizeMap := make(map[string]int64)
|
||||
sizeChange := int64(0)
|
||||
for _, d := range deltas {
|
||||
if d.Action != graph.Add && d.Action != graph.Delete {
|
||||
return errors.New("leveldb: invalid action")
|
||||
}
|
||||
bytes, err := json.Marshal(d)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue