Skip to content

Commit

Permalink
refactor: remove duplicated methods from index engines APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Oct 4, 2024
1 parent 5db0d1d commit dcf54e2
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import com.orientechnologies.orient.core.config.IndexEngineData;
import com.orientechnologies.orient.core.exception.OConfigurationException;
import com.orientechnologies.orient.core.index.engine.OBaseIndexEngine;
import com.orientechnologies.orient.core.index.engine.v1.OCellBTreeIndexEngine;
import com.orientechnologies.orient.core.index.engine.v1.OCellBTreeMultiValueIndexEngine;
import com.orientechnologies.orient.core.index.engine.v1.OCellBTreeSingleValueIndexEngine;
import com.orientechnologies.orient.core.index.engine.v1.OV1IndexEngine;
import com.orientechnologies.orient.core.metadata.schema.OClass;
import com.orientechnologies.orient.core.storage.OStorage;
import com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage;
Expand Down Expand Up @@ -134,7 +134,7 @@ public int getLastVersion(final String algorithm) {
case SBTREE_ALGORITHM:
return OSBTreeIndexEngine.VERSION;
case CELL_BTREE_ALGORITHM:
return OCellBTreeIndexEngine.VERSION;
return OV1IndexEngine.VERSION;
}

throw new IllegalStateException("Invalid algorithm name " + algorithm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ default boolean hasRidBagTreesSupport() {

boolean remove(OAtomicOperation atomicOperation, Object key, ORID value);

/**
* Puts the given value under the given key into this index engine. Validates the operation using
* the provided validator.
*
* @param atomicOperation
* @param key the key to put the value under.
* @param value the value to put.
* @param validator the operation validator.
* @return {@code true} if the validator allowed the put, {@code false} otherwise.
* @see IndexEngineValidator#validate(Object, Object, Object)
*/
boolean validatedPut(
OAtomicOperation atomicOperation,
Object key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

package com.orientechnologies.orient.core.index.engine;

import com.orientechnologies.orient.core.id.ORID;
import com.orientechnologies.orient.core.index.OIndexKeyUpdater;
import com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperation;

Expand All @@ -33,31 +32,8 @@ public interface OIndexEngine extends OBaseIndexEngine {

Object get(Object key);

void put(OAtomicOperation atomicOperation, Object key, ORID value);

void update(OAtomicOperation atomicOperation, Object key, OIndexKeyUpdater<Object> updater);

boolean remove(OAtomicOperation atomicOperation, Object key);

boolean remove(OAtomicOperation atomicOperation, Object key, ORID value);

/**
* Puts the given value under the given key into this index engine. Validates the operation using
* the provided validator.
*
* @param atomicOperation
* @param key the key to put the value under.
* @param value the value to put.
* @param validator the operation validator.
* @return {@code true} if the validator allowed the put, {@code false} otherwise.
* @see IndexEngineValidator#validate(Object, Object, Object)
*/
boolean validatedPut(
OAtomicOperation atomicOperation,
Object key,
ORID value,
IndexEngineValidator<Object, ORID> validator);

@Override
default int getEngineAPIVersion() {
return VERSION;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

public final class OCellBTreeMultiValueIndexEngine implements OCellBTreeIndexEngine {
public final class OCellBTreeMultiValueIndexEngine implements OV1IndexEngine {

public static final String DATA_FILE_EXTENSION = ".cbt";
private static final String NULL_BUCKET_FILE_EXTENSION = ".nbt";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.io.IOException;
import java.util.stream.Stream;

public final class OCellBTreeSingleValueIndexEngine implements OCellBTreeIndexEngine {
public final class OCellBTreeSingleValueIndexEngine implements OV1IndexEngine {
private static final String DATA_FILE_EXTENSION = ".cbt";
private static final String NULL_BUCKET_FILE_EXTENSION = ".nbt";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.orientechnologies.orient.core.index.engine;
package com.orientechnologies.orient.core.index.engine.v1;

import com.orientechnologies.orient.core.id.ORID;
import com.orientechnologies.orient.core.index.engine.OBaseIndexEngine;
import java.util.stream.Stream;

public interface OV1IndexEngine extends OBaseIndexEngine {
int VERSION = 4;
int API_VERSION = 1;

Stream<ORID> get(Object key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@
import com.orientechnologies.orient.core.index.engine.IndexEngineValuesTransformer;
import com.orientechnologies.orient.core.index.engine.OBaseIndexEngine;
import com.orientechnologies.orient.core.index.engine.OIndexEngine;
import com.orientechnologies.orient.core.index.engine.OV1IndexEngine;
import com.orientechnologies.orient.core.index.engine.v1.OCellBTreeMultiValueIndexEngine;
import com.orientechnologies.orient.core.index.engine.v1.OCellBTreeSingleValueIndexEngine;
import com.orientechnologies.orient.core.index.engine.v1.OV1IndexEngine;
import com.orientechnologies.orient.core.metadata.OMetadataDefault;
import com.orientechnologies.orient.core.metadata.schema.OClass;
import com.orientechnologies.orient.core.metadata.schema.OImmutableClass;
Expand Down

0 comments on commit dcf54e2

Please sign in to comment.