public final class EntityTable extends Object implements Closeable
[type].maxId and there is only one column "maxId" which stores the
last ID being generated. Each time when a new ID is needed for a given type, and increment and get on the
corresponding row would be called.
[type].[entityName] and have one "id" column which
stores the unique ID. The other is a reverse map from [type].id to entity name in "name" column.| Constructor and Description |
|---|
EntityTable(MetricsTable table)
Creates an EntityTable with max id = 16777215.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
long |
getId(String type,
String name)
Returns an unique id for the given name.
|
int |
getIdSize()
Returns number of bytes for ID represented by this table.
|
String |
getName(long id,
String type)
Returns the entity name for the given id and type.
|
public EntityTable(MetricsTable table)
EntityTable(MetricsTable, long).public long getId(String type, @Nullable String name)
name - The EntityName to lookup. Can be null, which is treated as a normal value.@Nullable public String getName(long id, String type)
id - The id to lookuptype - The type of the entity.null if given id is an encoded null valueIllegalArgumentException - if the given ID does not map to any name.public int getIdSize()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.