public IndexDefinition(EntityDefinition entityDef, Index index) { this.entityDef = entityDef; this.index = index; this.indexPrefix = entityDef.getPrefix() + "_" + index.name(); final String[] indexColumns = index.columns(); this.columns = new IndexColumn[indexColumns.length]; for (int i = 0; i < indexColumns.length; ++i) { final String name = indexColumns[i]; final boolean isTag = entityDef.isTag(name); final Qualifier qualifier = isTag ? null : entityDef.getDisplayNameMap().get(name); columns[i] = new IndexColumn(name, isTag, qualifier); } LOG.info("Created index " + index.name() + " for " + entityDef.getEntityClass().getSimpleName()); }
public boolean isUnique() { return index.unique(); }
@TimeSeries(false) @Indexes({ @Index(name = "Index_1_name", columns = { "name" }, unique = true)
public String getIndexName() { return index.name(); }
@TimeSeries(false) @Indexes({ @Index(name="Index_1_name", columns = { "name" }, unique = true) }) public class MetricMetadataEntity extends TaggedLogAPIEntity {
public String getIndexName() { return index.name(); }
public IndexDefinition(EntityDefinition entityDef, Index index) { this.entityDef = entityDef; this.index = index; this.indexPrefix = entityDef.getPrefix() + "_" + index.name(); final String[] indexColumns = index.columns(); this.columns = new IndexColumn[indexColumns.length]; for (int i = 0; i < indexColumns.length; ++i) { final String name = indexColumns[i]; final boolean isTag = entityDef.isTag(name); final Qualifier qualifier = isTag ? null : entityDef.getDisplayNameMap().get(name); columns[i] = new IndexColumn(name, isTag, qualifier); } LOG.info("Created index " + index.name() + " for " + entityDef.getEntityClass().getSimpleName()); }
@Tags({"site", "application", "alertExecutorId", "policyId", "policyType"}) @Indexes({ @Index(name="Index_1_alertExecutorId", columns = { "alertExecutorID" }, unique = true), }) public class AlertDefinitionAPIEntity extends AbstractPolicyDefinitionEntity {
public boolean isUnique() { return index.unique(); }
public byte[] generateIndexRowkey(TaggedLogAPIEntity entity) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { if (entity.getClass() != entityDef.getEntityClass()) { throw new IllegalArgumentException("Expected entity class: " + entityDef.getEntityClass().getName() + ", but got class " + entity.getClass().getName()); } final byte[][] indexValues = generateIndexValues(entity); final int[] partitionHashCodes = generatePartitionHashCodes(entity); SortedMap<Integer, Integer> tagMap = null; if (!index.unique()) { // non cluster index tagMap = RowkeyBuilder.generateSortedTagMap(entityDef.getPartitions(), entity.getTags()); } return generateUniqueIndexRowkey(indexValues, partitionHashCodes, tagMap); }
public byte[] generateIndexRowkey(TaggedLogAPIEntity entity) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { if (entity.getClass() != entityDef.getEntityClass()) { throw new IllegalArgumentException("Expected entity class: " + entityDef.getEntityClass().getName() + ", but got class " + entity.getClass().getName()); } final byte[][] indexValues = generateIndexValues(entity); final int[] partitionHashCodes = generatePartitionHashCodes(entity); SortedMap<Integer, Integer> tagMap = null; if (!index.unique()) { // non cluster index tagMap = RowkeyBuilder.generateSortedTagMap(entityDef.getPartitions(), entity.getTags()); } return generateUniqueIndexRowkey(indexValues, partitionHashCodes, tagMap); }
if (index.unique()) { return IndexType.UNIQUE_INDEX;
if (index.unique()) { return IndexType.UNIQUE_INDEX;