public Long totals(final String index, final RawQuery query) { final IndexTransaction indexTx = getIndexTransaction(index); return executeRead(new TotalsCallable(query, indexTx)); }
public Backend getBackend() { Backend backend = new Backend(configuration); backend.initialize(configuration); storeFeatures = backend.getStoreFeatures(); return backend; }
public TestMockIndexProvider(Configuration config) { this.index = Backend.getImplementationClass(config, config.get(INDEX_BACKEND_PROXY), StandardIndexProvider.getAllProviderClasses()); this.failAdds = config.get(INDEX_MOCK_FAILADD); }
@Override public int compareTo(StaticBuffer other) { int otherLen = (other instanceof Entry)?((Entry) other).getValuePosition():other.length(); return compareTo(getValuePosition(),other, otherLen); }
@Override public int compareTo(StaticBuffer other) { int otherLen = (other instanceof Entry)?((Entry) other).getValuePosition():other.length(); return compareTo(getValuePosition(),other, otherLen); }
@Override public void writeByteOrder(WriteBuffer out, Integer attribute) { out.putInt(attribute - Integer.MIN_VALUE); }
public Stream<String> indexQuery(final String index, final IndexQuery query) { final IndexTransaction indexTx = getIndexTransaction(index); return executeRead(new Callable<Stream<String>>() { @Override public Stream<String> call() throws Exception { return indexTx.queryStream(query); } @Override public String toString() { return "IndexQuery"; } }); }
@Override public int getByteSize() { int size = 48; for (Entry e : this) { size += 8 + 16 + 8 + 8 + e.length(); } return size; } }
boolean isSorted() { for (int i = 1; i < size; i++) { if (!(array[i].compareTo(array[i - 1]) > 0)) return false; } return true; }
private static void writeUnsigned(WriteBuffer out, int offset, final long value) { assert offset % 7 == 0; while (offset > 0) { offset -= 7; byte b = (byte) ((value >>> offset) & BIT_MASK); if (offset == 0) { b = (byte) (b | STOP_MASK); } out.putByte(b); } }
public static void applyTTL(Collection<Entry> additions, int ttl) { for (Entry entry : additions) { assert entry instanceof MetaAnnotatable; ((MetaAnnotatable)entry).setMetaData(EntryMetaData.TTL, ttl); } }
private static KCVSConfiguration getGlobalConfiguration(final BackendOperation.TransactionalProvider txProvider, final KeyColumnValueStore store, final Configuration config) { return getConfiguration(txProvider, store, SYSTEM_CONFIGURATION_IDENTIFIER, config); }
@Override public TimestampProvider getTimestampProvider() { return handleConfig.getTimestampProvider(); } }
@Override public void rollback() throws BackendException { mutations=null; indexTx.rollback(); }
private static long readUnsigned(ScanBuffer in) { long value = 0; byte b; do { b = in.getByte(); value = value << 7 | (b & BIT_MASK); } while (b >= 0); return value; }
@Override public boolean isConsolidated() { return super.isConsolidated(ENTRY2COLUMN_FCT,ENTRY2COLUMN_FCT); }
public Stream<RawQuery.Result<String>> rawQuery(final String index, final RawQuery query) { final IndexTransaction indexTx = getIndexTransaction(index); return executeRead(new Callable<Stream<RawQuery.Result<String>>>() { @Override public Stream<RawQuery.Result<String>> call() throws Exception { return indexTx.queryStream(query); } @Override public String toString() { return "RawQuery"; } }); }
public static WriteBuffer put(WriteBuffer out, byte[] bytes) { for (byte aByte : bytes) out.putByte(aByte); return out; }
@Override public void write(WriteBuffer out, Byte object) { out.putByte((byte)(object - Byte.MIN_VALUE)); }