I'm developing a distributed file system with riak for a project.I want to store a tree structure in the riak database and , I want to get the node id When the path is given(A Path like /root/dev/bin)
I thought to use materialized paths to store the tree, in which a tree is stored by using the node id and the path from the root
A
/ \
B C
/ \ \
D E F
Node Id | Path
A _
B A
C A
D A,B
F A,C
So to get the id for a path, one solution is to store path as the key and node id as the value and then use riak key filters to get node id for the path, another solution is to store the path as a value and use riak search to get the node id. If i use riak search should i store the path as a json array or store it as a plain string?
Additionally i want to do operations like,
1. Get childrens of a node(all files in a directory)
2. Add new children(add files or folders)
3. Traverse the tree
So what do you think about above solutions or do you guys have any other suggestions?
Thank You