RowKey is a representation of an identifier for a specific data row that
may be retrieved from a
TableDataProvider . Specialized
implementations might also provide extra capabilities for navigation
between rows, or other value added services.
A RowKey (and rowId) is expected to remain valid for as long as possible -
meaning when a RowKey is fetched from a TableDataProvider, it is considered
an address of a particular row in that TableDataProvider. If rows have been
added or removed from the TableDataProvider, a previously fetched RowKey
should still represent the row it did when it was first retrieved. A common
strategy for TableDataProvider implementations is to store intrinsicly
"primary key-like" data from the underlying data source inside of a
specialized RowKey implementation. Another strategy is to store a random
hash index in the RowKeys, and maintain a map inside the TableDataProvider
implementation to resolve the RowKeys back to the underlying data rows. This
insolates consumers of the TableDataProvider implementation from row index
changes (due to inserts, deletes, etc) in the underlying data source.
At any point a user might call
TableDataProvider.getRowKey(String) in order to fetch a valid RowKey for a particular rowId, so the
TableDataProvider must be capable of resolving a rowId back to a unique
RowKey.
RowKey implements Comparable so that batched deletes and inserts can be
done in reverse order to help ensure consistency of row order. This is only
for blind operations implemented where there is no knowledge of a specific
RowKey or TableDataProvider implementations. A RowKey implementation might
not support intrinsic ordering of any type.
author: Joe Nuxoll |