diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2012-04-05 17:17:38 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-04-05 17:17:38 +0100 |
commit | 20cc571cbc15e555420362086315f0035c8efe7b (patch) | |
tree | 6bc6fcb57ee4359569eecf84ac3b7209b46c654e | |
parent | 88cd0c8f6beb378d7b564ee0c2a1eaf325ae56dd (diff) | |
download | rabbitmq-server-20cc571cbc15e555420362086315f0035c8efe7b.tar.gz |
dtree API cleanup: handle 'insert' w empty secondary key list correctly
-rw-r--r-- | src/dtree.erl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dtree.erl b/src/dtree.erl index 473b4283..e88ad963 100644 --- a/src/dtree.erl +++ b/src/dtree.erl @@ -65,7 +65,11 @@ empty() -> {gb_trees:empty(), gb_trees:empty()}. %% Insert an entry. Fails if there already is an entry with the given -%% primary key. The list of secondary keys should be non-empty. +%% primary key. +insert(PK, [], V, {P, S}) -> + %% dummy insert to force error if PK exists + gb_trees:insert(PK, {gb_sets:empty(), V}, P), + {P, S}; insert(PK, SKs, V, {P, S}) -> {gb_trees:insert(PK, {gb_sets:from_list(SKs), V}, P), lists:foldl(fun (SK, S0) -> |