Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

CTrie

CTrie

the ctrie
NYI marking ctrie as ref see issue https://github.com/tokiwa-software/fuzion/issues/304
§add(k CTK, v CTV)
 => 
unit
:
Any 
add key value
if key is already present value is updated
try adding an element to the ctrie
may fail and result in a restart
compare and swap root of the ctrie
clean an indirection node:
compress contained container node
turns this: container_node -> Indirection_Node -> tomb_node -> singleton_node
into this: container_node -> singleton_node
compress a container node
contract a container node
takes two single nodes and returns either
Main_Node -> container_node -> singleton_nodes
or
Main_Node -> list_node -> singleton_nodes
or recurse
Main_Node -> container_node -> Indirection_Node -> dual x y
find k in linked nodes
§flagpos(hash u32, lev u32, bmp u32)
 => 
tuple u32 u32
:
Any 
returns flag and the position in the container_node for given params
convert u64 hash to u32 hash
lookup an element in this ctrie via bracket syntax

redefines:

a snapshot of the ctrie as sequence auf key-value tuples

redefines:

try lookup key in ctrie
may fail and result in a restart
lookup key k
unit type to indicate when value to lookup/remove is not found
complete the double compare and swap
of the root node
do a double compare and swap of root node
1. try compare and swap root
2. if successful complete commiting the descriptor
read root none abortably
read root
if root is currently a descriptor we are in the middle
of a double compare and swap.
Then (try) commiting the descriptor first
try remove an element from the ctrie
may fail and result in a restart
remove key from ctrie
the size of the ctrie

redefines:

take a snapshot of the ctrie
the width of the branching factor, 2^5 = 32