Skip to content

Latest commit

 

History

History
27 lines (14 loc) · 1.07 KB

INTERNALS.md

File metadata and controls

27 lines (14 loc) · 1.07 KB

Some implementation notes

How put() function works, all possible combinations of keys and prefixes

Nodes layout

database keys

Figures below shows only affected nodes

Initial state (we have key "PREFIX" with value "VAL")

node before update

  • Simplest case: transaction->put("PREFIX", "NEW VAL") - update existing key. If size of new value is the same, nothing changed in nodes layout. Only old value replaced by new one. If size of new value differs, new node (with new value) will be created

  • transaction->put("PRE", "VAL") - will create two nodes

node prefix -> pre + fix

  • transaction->put("PREFIXNEW", "VAL") - will create two nodes

node prefix -> prefix + prefixnew

  • transaction->put("PREPARE", "VAL") - will create three nodes

node prefix -> prefix + prepare