@Override public StatisticsId[] getSupportedStatistics() { return new StatisticsId[] { new StatisticsId(new BaseStatisticsType<>(statType), fieldName)}; } };
protected ByteBuffer binaryBuffer(final byte[] bytes) { final ByteBuffer buffer = ByteBuffer.wrap(bytes); adapterId = VarintUtils.readUnsignedShort(buffer); final int typeLength = VarintUtils.readUnsignedInt(buffer); final int extenedIdLength = VarintUtils.readUnsignedInt(buffer); final byte typeBytes[] = new byte[typeLength]; buffer.get(typeBytes); statisticsType = new BaseStatisticsType(); statisticsType.fromBinary(typeBytes); final byte[] extendedIdBytes = new byte[extenedIdLength]; buffer.get(extendedIdBytes); extendedId = StringUtils.stringFromBinary(extendedIdBytes); return buffer; }
@Override protected boolean performStatsCommand( final DataStorePluginOptions storeOptions, final InternalDataAdapter<?> adapter, final StatsCommandLineOptions statsOptions) throws IOException { // Remove the stat final DataStatisticsStore statStore = storeOptions.createDataStatisticsStore(); final String[] authorizations = getAuthorizations(statsOptions.getAuthorizations()); if (!statStore.removeStatistics( adapter.getAdapterId(), fieldName, new BaseStatisticsType<>(statType), authorizations)) { throw new RuntimeException("Unable to remove statistic: " + statType); } return true; }
public static InternalDataStatistics<?, ?, ?> setFields( final GeoWaveMetadata entry, final InternalDataStatistics<?, ?, ?> basicStats, final short adapterId) { if (basicStats != null) { basicStats.setAdapterId(adapterId); final int index = Bytes.indexOf(entry.getPrimaryId(), (byte) 0); if ((index > 0) && (index < (entry.getPrimaryId().length - 1))) { basicStats.setType( new BaseStatisticsType(Arrays.copyOfRange(entry.getPrimaryId(), 0, index))); basicStats.setExtendedId( StringUtils.stringFromBinary( Arrays.copyOfRange(entry.getPrimaryId(), index + 1, entry.getPrimaryId().length))); } else { basicStats.setType(new BaseStatisticsType(entry.getPrimaryId())); } final byte[] visibility = entry.getVisibility(); if (visibility != null) { basicStats.setVisibility(visibility); } } return basicStats; }