fluree / db

Fluree database library
https://fluree.github.io/db/
Other
337 stars 21 forks source link

Feature/blank node ids #732

Closed zonotope closed 7 months ago

zonotope commented 7 months ago

I woke up in a cold sweat haunted by the possibility of collisions in our blank node ids so I decided to make those far less likely.

This patch integrates nano-id to generate blank node ids instead of using rand-int like we did previously. It retains the timestamp prefix so we still won't have too much index thrashing. Using a nano-id length of 8, we'd need to generate 2 million ids in one millisecond to get a collision probability of 1%.

user> (new-blank-node-id)
"_:fdb-1708699899809-sfqiEdMv"