ramirez7 / uuid-divide

Mutually-exclusive, collectively-exhaustive sets of UUID ranges
BSD 3-Clause "New" or "Revised" License
0 stars 3 forks source link

Division into sets of glob patterns instead of ranges #1

Open ramirez7 opened 6 years ago

ramirez7 commented 6 years ago

Right now, uuid-divide returns ranges of explicit UUIDs. This works well with Postgres or other RDBMSes where we can use btree indexes to efficiently perform these queries.

These ranges are not useful for querying Redis keys. Redis keys can only be batch-filtered with glob patterns (docs here). It should be possible to return glob patterns that form mutually exclusive ranges.

Each "range" would be instead a set of globs for that range. Examples:

uuidDivideGlob 0 = [[*]]
uuidDivideGlob 2 =
 [ [0*, 1*, 2*, 3*]
 , [4*, 5*, 6*, 7*]
 , [8*, 9*, a*, b*]
 , [c*, d*, e*, f*]
 ]
ramirez7 commented 6 years ago

I think it would be best to create a more fundamental type that can be transformed into either UUIDRange or globs. Then all derived functions (such as https://github.com/ramirez7/uuid-divide/issues/2) would give the user their pick of glob or range (or any other derived thing)