@Override public void load( String indexName, OBinarySerializer valueSerializer, boolean isAutomatic, OBinarySerializer keySerializer, OType[] keyTypes, boolean nullPointerSupport, int keySize, Map<String, String> engineProperties) { hashTable.load(indexName, keyTypes, nullPointerSupport); hashFunction.setValueSerializer(hashTable.getKeySerializer()); }
@Override public long size(ValuesTransformer transformer) { if (transformer == null) return hashTable.size(); else { OHashIndexBucket.Entry<Object, Object> firstEntry = hashTable.firstEntry(); if (firstEntry == null) return 0; OHashIndexBucket.Entry<Object, Object>[] entries = hashTable.ceilingEntries(firstEntry.key); long counter = 0; while (entries.length > 0) { for (OHashIndexBucket.Entry<Object, Object> entry : entries) counter += transformer.transformFromValue(entry.value).size(); entries = hashTable.higherEntries(entries[entries.length - 1].key); } return counter; } }
@Override public void create( OBinarySerializer valueSerializer, boolean isAutomatic, OType[] keyTypes, boolean nullPointerSupport, OBinarySerializer keySerializer, int keySize, Set<String> clustersToIndex, Map<String, String> engineProperties, ODocument metadata) { hashFunction.setValueSerializer(keySerializer); hashTable.create(keySerializer, valueSerializer, keyTypes, nullPointerSupport); }
@Override public boolean acquireAtomicExclusiveLock(Object key) { hashTable.acquireAtomicExclusiveLock(); return true; }
@Override public void put(Object key, Object value) { hashTable.put(key, value); }
@Override public Object get(Object key) { return hashTable.get(key); }
@Override public void close() { hashTable.close(); }
@Override public void clear() { hashTable.clear(); }
@Override public boolean remove(Object key) { return hashTable.remove(key) != null; }
@Override public boolean contains(Object key) { return hashTable.get(key) != null; }
@Override public void delete() { hashTable.delete(); }
@Override public void deleteWithoutLoad(String indexName) { hashTable.deleteWithoutLoad( indexName, (OAbstractPaginatedStorage) getDatabase().getStorage().getUnderlying()); }