|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface UniqueIdInterface
Represents a table of Unique IDs, manages the lookup and creation of IDs. For efficiency, various kinds of "names" need to be mapped to small, unique IDs. For instance, we give a unique ID to each metric name, to each tag name, to each tag value.
An instance of this class handles the unique IDs for one kind of ID. For example:
UniqueId metric_names = ...; byte[] id = metric_names.get("sys.net.rx_bytes");IDs are looked up in HBase and cached forever in memory (since they're immutable). IDs are encoded on a fixed number of bytes, which is implementation dependent.
Method Summary | |
---|---|
byte[] |
getId(String name)
Finds the ID associated with a given name. |
String |
getName(byte[] id)
Finds the name associated with a given ID. |
byte[] |
getOrCreateId(String name)
Finds the ID associated with a given name or creates it. |
String |
kind()
Returns what kind of Unique ID is served by this instance. |
short |
width()
Returns the number of bytes on which each Unique ID is encoded. |
Method Detail |
---|
String kind()
short width()
String getName(byte[] id) throws NoSuchUniqueId, org.hbase.async.HBaseException
id
- The ID associated with that name.
NoSuchUniqueId
- if the given ID is not assigned.
org.hbase.async.HBaseException
- if there is a problem communicating with HBase.
IllegalArgumentException
- if the ID given in argument is encoded
on the wrong number of bytes.getId(String)
,
getOrCreateId(String)
byte[] getId(String name) throws NoSuchUniqueName, org.hbase.async.HBaseException
The length of the byte array is fixed in advance by the implementation.
name
- The name to lookup in the table.
byte[]
array.
NoSuchUniqueName
- if the name requested doesn't have an ID assigned.
org.hbase.async.HBaseException
- if there is a problem communicating with HBase.
IllegalStateException
- if the ID found in HBase is encoded on the
wrong number of bytes.getName(byte[])
byte[] getOrCreateId(String name) throws org.hbase.async.HBaseException, IllegalStateException
The length of the byte array is fixed in advance by the implementation.
name
- The name to lookup in the table or to assign an ID to.
org.hbase.async.HBaseException
- if there is a problem communicating with HBase.
IllegalStateException
- if all possible IDs are already assigned.
IllegalStateException
- if the ID found in HBase is encoded on the
wrong number of bytes.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |