On Thu, Jun 2, 2011 at 9:51 PM, Stack <st...@duboce.net> wrote: > On Thu, Jun 2, 2011 at 8:17 PM, Matt Corgan <mcor...@hotpads.com> wrote: > > What about turning KeyValue into an interface with only the essential > > getXX() methods? Whatever is using the KeyValue shouldn't *have* to know > > what sort of structure it's backed by, but could figure out the > > implementation in cases where it wants to optimize performance. > > A few of us have looked at doing this and baulked. Maybe if we'd had > a stiff drink first.... >
I gave it a go couple months ago on a lazy Saturday. Spent about 2 hours, came out with a huge mess and an HBase that didn't compile. Best of luck to you if you choose to fight this dragon :) We _could_ attempt to do it somewhat incrementally - eg first deprecate "getBuffer" and then slowly remove all the calls. I imagine 95% of the calls fall into the category of a) comparison or b) serialization onto wire/file. We can replace A with calls into KVComparator, and B with calls to a new "write(Column|TS|RowKey|...)" call. If we can get that down to 0, then "getBuffer" becomes private only accessible to KVComparator, and we move onto the next call that eludes interfacedom. ... > > new CssTreeBlockIndexKeyValue(CssTreeBlockIndex blockIndex, int > kvPosition) > > > > Sounds great. > > St.Ack > -- Todd Lipcon Software Engineer, Cloudera