Store sessions by encodedNumber

Storing multiple sessions in a single indexeddb record is prone to
clobbering data due to races between requests to update multiple device
sessions for the same number, since you have to read the current state
of the device->session map and update it. Splitting the records up makes
it so that those updates can be made in parallel. Selecting all the
sessions for a given number can still be done efficiently thanks to
indexeddb range queries.
This commit is contained in:
lilia 2015-05-04 20:26:26 -07:00
parent 37c496f4f0
commit c26c6fc317
2 changed files with 50 additions and 44 deletions

View file

@ -34,7 +34,8 @@
conversations.createIndex("group", "members", { unique: false, multiEntry: true });
conversations.createIndex("type", "type", { unique: false });
var contacts = transaction.db.createObjectStore('contacts');
var sessions = transaction.db.createObjectStore('sessions');
var identityKeys = transaction.db.createObjectStore('identityKeys');
var preKeys = transaction.db.createObjectStore("preKeys");
var signedPreKeys = transaction.db.createObjectStore("signedPreKeys");