pub trait PositionMap {
    // Required methods
    fn len(&self) -> u64;
    fn write(&mut self, key: &u64, new_val: &u64) -> u64;
}
Expand description

PositionMap trait conceptually is an array of TreeIndex. Each value in the map corresponds to a leaf in the complete binary tree, at some common height.

PositionMap trait must be object-safe so that dyn PositionMap works. It also only needs to work with integer types, and padding up to u64 is fine. Therefore we make a new trait which is reduced and only exposes the things that PathORAM needs from the position map.

TODO: API for resizing it? Changing height?

Required Methods§

source

fn len(&self) -> u64

The number of keys in the map. The valid keys are in the range 0..len.

source

fn write(&mut self, key: &u64, new_val: &u64) -> u64

Write a new value to a particular key. The new value should be a random nonce from a CSPRNG. Returns the old value. It is illegal to write to a key that is out of bounds.

Implementors§