Skip to content

depreciate default string constructor for Id#8

Open
davidtyee wants to merge 2 commits into
jivesoftware:masterfrom
davidtyee:master
Open

depreciate default string constructor for Id#8
davidtyee wants to merge 2 commits into
jivesoftware:masterfrom
davidtyee:master

Conversation

@davidtyee
Copy link
Copy Markdown

This change is about moving away from the string constructor for Id, and moving back to using the constructor that takes a long. This should be adequate for current id space concerns.

Here's what this addresses:
1) Deprecate the String constructor
2) Change the implementation of this constructor so that it it now converts the string to a bit packed long, basically by doing this:

   ByteBuffer buffer = ByteBuffer.wrap(coder.decode(oldStringFormOfId));
    Id id = new Id(buffer.getLong());

This will essentially switches us to long representation everywhere, without the massive code change fanout. We can slowly, convert the depreciated constructor calls at our leisure.

  1. Change the implementation of idFromJsonObject, so that it is backwards compatible, i.e. if the passed in json string is a bit packed long, we return a new Id constructed with a long. If it's not a bit packed long, we know this is legacy (i.e. existing json on the hdfs WAL) and we make sure we're backwards compatible.

I think this is a reasonable first step, it has a lot of goodness:

  • Deprecates the existing constructor
  • Seamless converts all users of the string constructor, to long representation
  • Maintains backwards compatibility with existing json, created and serialized with the older string constructor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant