Closed itsjohncs closed 10 years ago
The tricky part of serializing the NodeID is that I need there to be only one valid serialized string for each NodeID (so JSON and XML and related formats are out). This is my current idea:
The ID is made out of two parts, local and machine. The local part will be a simple integer allocated with the help of a Redis counter. The machine will be set by the System Administrator and should support UTF-8.
We can serialize it very simply with machine:local
(so just smooshing them together with a colon, the local part being a base 10, textually encoded number). To parse it, we read backwards to grab everything after the last colon, then the remaining is the machine part. This allows any character to beused in the machine part including colons.
It's been a little bit tricky creating the Redis Lua scripts without having an excellent idea of what the NodeID class will serialize to, therefore I want to complete the NodeID class as thoroughly as possible right now and settle on the interface of it so I don't break things later.