Add UniqueId.getTSUIDFromKey() to parse TSUIDs from an HBase row key

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add "tsd.core.meta.enable_tracking" config option, defaults to false

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add TSMeta.metaExistsInStorage() to determine if a meta object exists
Add TSMeta.incrementAndGetCounter() to use atomic counters for tracking
timeseries as per Tsuna
Add TSMeta constructor that stores a given created timestamp
Add TSMeta.storeNew() that stores a new timeseris meta object without syncs
Fix possible issues to avoid corrupted storage data for TSMeta objects
Add total_dps field and getter to TSMeta
Change TSMeta.QUALIFIER to META_QUALIFER and add COUNTER_QUALIFIER to
differentiate between the columns
Fix TSMeta to throw an exception if a user tries to modify an entry that does
not exist instead of creating one
Modify TSMeta.getFromStorage() to load the last_received and total datapoints
from storage
Replace TSMeta.copyToStorageObject() with getStorageJSON() to serialize only
the fields we want to the data store

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add UIDMeta.storeNew() to create a new object
Add UIDmeta.setCreated() as we may need to override when syncing past timeseries
Add logging ignores to TestUIDMeta

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add TSDB reference to UniqueId for the UIDMeta creation calls with a setter so
we don't have to modify the constructor
Add UniqueIdType field to UniqueId
Modify UniqueId to create the UIDMeta when assigning a UID if enabled by the
user

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Replace NoSuchUniqueName catches with NoSuchUniqueId in UniqueIdRpc UID calls, was a bug
Refactor TestUniqueIdRpc tests so setups are only called where necessary

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add call to TSMeta.incrementAndGetCounter() in TSDB if meta tracking is enabled
Add call to UniqueId.setTSDB() if meta tracking is enabled

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add TSMeta.counterExistsInStorage() to determine if the counter exists

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add uid metasync CLI command to generate meta data from existing data for use
in upgrading to 2.0. The command also updates the "created" timestamp and
attempts to fix corrupted meta data

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Fix bug in UniqueId when assigning new UIDs if the tsdb has not been set

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add support for TSUID queries to Query and TsdbQuery. It is fully backwards
compatible. If a list of tsuids is provided, the metric/tags are ignored.
Otherwise the query behaves as usual. A row key regex is built to return only
the rows matching the TSUID. All TSUIDs in the list must share the same metric
and their data will be aggregated together.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Modify TSSubQuery to use a generic List for TSUIDs
Modify TSQuery to supply the list of TSUIDs to a TsdbQuery if given

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Update QueryRpc to accept TSUID queries

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Modify UniqueId to fetch names and suggestions asynchronously.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add MockBase.java, a mock implementation of HBase used for unit testing.
It uses nested hash tables to store keys as hex encoding strings with
byte arrays as the value. It does not currently support timestamps or
multiple versions. The asyncbase client is mocked with the following:
GetRequest
DeleteRequest
PutRequest
CompareAndSet
Scanner (limited to row regex and always returns the entire result in
  the first call)
AtomicIncrementRequest

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Modify all storage calls in TSMeta and UIDMeta to be asynchronous along with
all unit tests and callers
Update TSDB.getUidName() to use the asynchronous name call
Modify UniqueIdRpc to access TSMeta and UIDMeta asynchronously, though the RPCs
could still be asynced when responding to the client.

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add tree building classes including:
Branch - A list of leaves and child branches in a tree
Leaf - Represents a single timeseries in the tree
Tree - Container with meta data for trees
TreeBuilder - Logic for compiling a tree from TSMeta objects
TreeRule - A single rule in the tree definition, determines how timeseries
are organized in the tree
Add TreeRuleTypeDeserializer JSON helper class for deserializing rule type
strings

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add tsd.core.tree.enable_processing configuration option

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Add TSDB.processTSMetaThroughTrees() for processing new TSMeta as they come in,
if configured

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>
Modify TSMeta.incrementAndGetCounter() to pass new TSMetas through tree builders

Signed-off-by: Chris Larsen <clarsen@euphoriaaudio.com>