Skip to content

Instantly share code, notes, and snippets.

@joestump
Created October 8, 2009 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joestump/205537 to your computer and use it in GitHub Desktop.
Save joestump/205537 to your computer and use it in GitHub Desktop.
I started working on an EmailAddressPartitioner that sorts user@example.com as com.example@user,
but I'm confused what the role of Token objects is supposed to be. The Token classes have
essentially no javadoc and classes that use them seem to assume you know exactly how Tokens fit
into everything. Should the token be (essentially) the decorated key? What's the meaning of the
default token? Existing implementations use a random value if the config file doesn't specify
anything, so I assume the default token doesn't have to correspond to an actual key.
It looks like the midpoint method does the important work, but it's not clear exactly what semantics
are desired. If I'm partitioning keys that map to Strings, is there a reason to not use the
OrderPreservingPartitioner's implementation? That is, is there any semantic meaning to the result
of midpoint(), or is it data agnostic?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment