Unnamed: 0
int64 0
6.7k
| func
stringlengths 12
89.6k
| target
bool 2
classes | project
stringlengths 45
151
|
|---|---|---|---|
6,200
|
public interface LegacyDatabase extends Remote
{
int stop() throws RemoteException;
String getStoreDir() throws RemoteException;
void awaitStarted( long time, TimeUnit unit ) throws RemoteException;
long createNode( String name ) throws RemoteException;
void verifyNodeExists( long id, String name ) throws RemoteException;
boolean isMaster() throws RemoteException;
}
| false
|
enterprise_ha_src_test_java_org_neo4j_ha_upgrade_LegacyDatabase.java
|
6,201
|
public interface ArrayEquality
{
boolean typeEquals( Class<?> firstType, Class<?> otherType );
boolean itemEquals( Object firstArray, Object otherArray );
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_ArrayUtil.java
|
6,202
|
public interface BiConsumer<T, U>
{
void accept( T first, U second );
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_BiConsumer.java
|
6,203
|
public interface Clock
{
Clock SYSTEM_CLOCK = new Clock()
{
@Override
public long currentTimeMillis()
{
return System.currentTimeMillis();
}
};
long currentTimeMillis();
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_Clock.java
|
6,204
|
public interface CloneableInPublic extends Cloneable
{
Object clone();
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_CloneableInPublic.java
|
6,205
|
public interface Factory<T>
{
T newInstance();
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_Factory.java
|
6,206
|
public interface Function<FROM, TO>
{
/**
* Apply a value to this function
*
* @param from the input item
* @return the mapped item
*/
TO apply( FROM from );
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_Function.java
|
6,207
|
public interface Function2<T1, T2, R>
{
/**
* Map a single item from one type to another
*
* @param from1 the first input item
* @param from2 the second input item
* @return the mapped item
*/
R apply( T1 from1, T2 from2 );
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_Function2.java
|
6,208
|
public interface FunctionFromPrimitiveInt<T>
{
T apply( int value );
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_FunctionFromPrimitiveInt.java
|
6,209
|
public interface FunctionFromPrimitiveLong<T>
{
T apply( long value );
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_FunctionFromPrimitiveLong.java
|
6,210
|
public interface FunctionToPrimitiveLong<T>
{
long apply( T value );
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_FunctionToPrimitiveLong.java
|
6,211
|
public interface Notification<T>
{
void notify(T listener);
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_Listeners.java
|
6,212
|
public interface Predicate<T>
{
/**
* @return whether or not to accept the {@code item}, where {@code true}
* means that the {@code item} is accepted and {@code false} means that
* it's not (i.e. didn't pass the filter).
*/
boolean accept( T item );
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_Predicate.java
|
6,213
|
public interface PrimitiveIntPredicate
{
boolean accept( int value );
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_PrimitiveIntPredicate.java
|
6,214
|
public interface PrimitiveLongPredicate
{
boolean accept( long value );
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_PrimitiveLongPredicate.java
|
6,215
|
public interface Provider<TYPE>
{
TYPE instance();
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_Provider.java
|
6,216
|
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface Implementation
{
/**
* The service(s) this class implements.
*
* @return the services this class implements.
*/
Class<?>[] value();
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_Service.java
|
6,217
|
private interface SettingHelper<T>
extends Setting<T>
{
String lookup( Function<String, String> settings );
String defaultLookup( Function<String, String> settings );
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_Settings.java
|
6,218
|
private static enum MyEnum
{
first,
second,
third;
}
| false
|
community_kernel_src_test_java_org_neo4j_helpers_TestArgs.java
|
6,219
|
public interface Thunk<T>
{
T evaluate();
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_Thunk.java
|
6,220
|
public interface ValueGetter<T>
{
T get();
class FromValue<T> implements ValueGetter<T>
{
private final T value;
public FromValue( T value )
{
this.value = value;
}
@Override
public T get()
{
return value;
}
}
ValueGetter<Void> NO_VALUE = new FromValue<Void>( null );
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_ValueGetter.java
|
6,221
|
public interface ClosableIterable<T> extends Iterable<T>
{
void close();
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_collection_ClosableIterable.java
|
6,222
|
public interface ClosableIterator<T> extends Iterator<T>
{
void close();
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_collection_ClosableIterator.java
|
6,223
|
public interface Visitable<T>
{
void accept(Visitor<T, RuntimeException> visitor);
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_collection_Visitable.java
|
6,224
|
public interface Visitor<E, FAILURE extends Exception>
{
/**
* Invoked for each element in a collection. Return <code>true</code> to
* terminate the iteration, <code>false</code> to continue.
*
* @param element an element from the collection.
* @return <code>true</code> to terminate the iteration, <code>false</code>
* to continue.
*/
boolean visit( E element ) throws FAILURE;
final class SafeGenerics
{
/**
* Useful for determining "is this an object that can visit the things I can provide?"
*
* Checks if the passed in object is a {@link Visitor} and if the objects it can
* {@link Visitor#visit(Object) visit} is compatible (super type of) with the provided type. Returns the
* visitor cast to compatible type parameters. If the passed in object is not an instance of {@link Visitor},
* or if it is a {@link Visitor} but one that {@link Visitor#visit(Object) visits} another type of object, this
* method returns {@code null}.
*/
@SuppressWarnings("unchecked"/*checked through reflection*/)
public static <T, F extends Exception>
Visitor<? super T, ? extends F> castOrNull( Class<T> eType, Class<F> fType, Object visitor )
{
if ( visitor instanceof Visitor<?, ?> )
{
for ( Type iface : visitor.getClass().getGenericInterfaces() )
{
if ( iface instanceof ParameterizedType )
{
ParameterizedType paramType = (ParameterizedType) iface;
if ( paramType.getRawType() == Visitor.class )
{
Type arg = paramType.getActualTypeArguments()[0];
if ( arg instanceof ParameterizedType )
{
arg = ((ParameterizedType) arg).getRawType();
}
if ( (arg instanceof Class<?>) && ((Class<?>) arg).isAssignableFrom( eType ) )
{
return (Visitor<? super T, ? extends F>) visitor;
}
}
}
}
}
return null;
}
private SafeGenerics()
{
}
}
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_collection_Visitor.java
|
6,225
|
enum State
{
INIT, LIVE
}
| false
|
community_kernel_src_main_java_org_neo4j_helpers_progress_ProgressListener.java
|
6,226
|
protected static abstract interface EntityCreator<T extends PropertyContainer>
{
T create( Object... properties );
void delete( T entity );
}
| false
|
community_lucene-index_src_test_java_org_neo4j_index_impl_lucene_AbstractLuceneIndexTest.java
|
6,227
|
protected static abstract interface EntityCreator<T extends PropertyContainer>
{
T create( Object... properties );
void delete( T entity );
}
| false
|
community_lucene-index_src_test_java_org_neo4j_index_impl_lucene_AbstractLuceneIndexTestIT.java
|
6,228
|
interface EntityType
{
Document newDocument( Object entityId );
Class<? extends PropertyContainer> getType();
}
| false
|
community_lucene-index_src_main_java_org_neo4j_index_impl_lucene_EntityType.java
|
6,229
|
private static enum LuceneFilesystemFacade
{
FS
{
@Override
Directory getDirectory( File baseStorePath, IndexIdentifier identifier ) throws IOException
{
return FSDirectory.open( getFileDirectory( baseStorePath, identifier ) );
}
@Override
void cleanWriteLocks( File dir )
{
if ( !dir.isDirectory() )
{
return;
}
for ( File file : dir.listFiles() )
{
if ( file.isDirectory() )
{
cleanWriteLocks( file );
}
else if ( file.getName().equals( "write.lock" ) )
{
boolean success = file.delete();
assert success;
}
}
}
@Override
File ensureDirectoryExists( FileSystemAbstraction fileSystem, File dir )
{
if ( !dir.exists() && !dir.mkdirs() )
{
String message = String.format( "Unable to create directory path[%s] for Neo4j store" +
".", dir.getAbsolutePath() );
throw new RuntimeException( message );
}
return dir;
}
},
MEMORY
{
@Override
Directory getDirectory( File baseStorePath, IndexIdentifier identifier )
{
return new RAMDirectory();
}
@Override
void cleanWriteLocks( File path )
{
}
@Override
File ensureDirectoryExists( FileSystemAbstraction fileSystem, File path )
{
try
{
fileSystem.mkdirs( path );
}
catch ( IOException e )
{
throw new RuntimeException( e );
}
return path;
}
};
abstract Directory getDirectory( File baseStorePath, IndexIdentifier identifier ) throws IOException;
abstract File ensureDirectoryExists( FileSystemAbstraction fileSystem, File path );
abstract void cleanWriteLocks( File path );
}
| false
|
community_lucene-index_src_main_java_org_neo4j_index_impl_lucene_LuceneDataSource.java
|
6,230
|
public interface Dependencies
{
Config getConfig();
GraphDatabaseService getDatabase();
TransactionManager getTxManager();
XaFactory getXaFactory();
FileSystemAbstraction getFileSystem();
XaDataSourceManager getXaDataSourceManager();
IndexProviders getIndexProviders();
IndexStore getIndexStore();
}
| false
|
community_lucene-index_src_main_java_org_neo4j_index_lucene_LuceneKernelExtensionFactory.java
|
6,231
|
public interface TimelineIndex<T extends PropertyContainer>
{
/**
* @return the last entity in the timeline, that is the entity with the highest
* timestamp or {@code null} if the timeline is empty.
*/
T getLast();
/**
* @return the first entity in the timeline, that is the entity with the lowest
* timestamp or {@code null} if the timeline is empty.
*/
T getFirst();
/**
* Removes an entity from the timeline. The timestamp should be the same
* as when it was added.
*
* @param entity the entity to remove from this timeline.
* @param timestamp the timestamp this entity was added with.
*/
void remove( T entity, long timestamp );
/**
* Adds an entity to this timeline with the given {@code timestamp}.
*
* @param entity the entity to add to this timeline.
* @param timestamp the timestamp to use.
*/
void add( T entity, long timestamp );
/**
* Query the timeline with optional lower/upper bounds and get back
* entities within that range, ordered by date. If {@code reversed} is
* {@code true} the order of the result is reversed.
*
* @param startTimestampOrNull the start timestamp, entities with greater
* timestamp value will be returned (exclusive). Will be ignored if {@code null}.
* @param endTimestampOrNull the end timestamp, entities with lesser timestamp
* @param reversed reverses the result order if {@code true}.
* value will be returned (exclude). Will be ignored if {@code null}.
* @return all entities within the given boundaries in this timeline, ordered
* by timestamp.
*/
IndexHits<T> getBetween( Long startTimestampOrNull, Long endTimestampOrNull, boolean reversed );
/**
* Query the timeline with optional lower/upper bounds and get back
* entities within that range, ordered by date with lowest first.
*
* @param startTimestampOrNull the start timestamp, entities with greater
* timestamp value will be returned (exclusive). Will be ignored if {@code null}.
* @param endTimestampOrNull the end timestamp, entities with lesser timestamp
* value will be returned (exclude). Will be ignored if {@code null}.
* @return all entities within the given boundaries in this timeline, ordered
* by timestamp.
*/
IndexHits<T> getBetween( Long startTimestampOrNull, Long endTimestampOrNull );
}
| false
|
community_lucene-index_src_main_java_org_neo4j_index_lucene_TimelineIndex.java
|
6,232
|
private interface EntityCreator<T extends PropertyContainer>
{
T create();
}
| false
|
community_lucene-index_src_test_java_org_neo4j_index_timeline_TestTimeline.java
|
6,233
|
@Target( { ElementType.METHOD, ElementType.TYPE, ElementType.FIELD } )
@Retention( RetentionPolicy.RUNTIME )
public @interface Description
{
// TODO: refactor for localization
String value();
int impact() default MBeanOperationInfo.UNKNOWN;
}
| false
|
community_jmx_src_main_java_org_neo4j_jmx_Description.java
|
6,234
|
@ManagementInterface( name = Kernel.NAME )
@Description( "Information about the Neo4j kernel" )
public interface Kernel
{
final String NAME = "Kernel";
@Description( "An ObjectName that can be used as a query for getting all management "
+ "beans for this Neo4j instance." )
ObjectName getMBeanQuery();
@Description( "The location where the Neo4j store is located" )
String getStoreDirectory();
@Description( "The version of Neo4j" )
String getKernelVersion();
@Description( "The time from which this Neo4j instance was in operational mode." )
Date getKernelStartTime();
@Description( "The time when this Neo4j graph store was created." )
Date getStoreCreationDate();
@Description( "An identifier that, together with store creation time, uniquely identifies this Neo4j graph store." )
String getStoreId();
@Description( "The current version of the Neo4j store logical log." )
long getStoreLogVersion();
@Description( "Whether this is a read only instance" )
boolean isReadOnly();
}
| false
|
community_jmx_src_main_java_org_neo4j_jmx_Kernel.java
|
6,235
|
@Target( ElementType.TYPE )
@Retention( RetentionPolicy.RUNTIME )
public @interface ManagementInterface
{
String name();
}
| false
|
community_jmx_src_main_java_org_neo4j_jmx_ManagementInterface.java
|
6,236
|
@ManagementInterface( name = Primitives.NAME )
@Description( "Estimates of the numbers of different kinds of Neo4j primitives" )
public interface Primitives
{
final String NAME = "Primitive count";
@Description( "An estimation of the number of nodes used in this Neo4j instance" )
long getNumberOfNodeIdsInUse();
@Description( "An estimation of the number of relationships used in this Neo4j instance" )
long getNumberOfRelationshipIdsInUse();
@Description( "The number of relationship types used in this Neo4j instance" )
long getNumberOfRelationshipTypeIdsInUse();
@Description( "An estimation of the number of properties used in this Neo4j instance" )
long getNumberOfPropertyIdsInUse();
}
| false
|
community_jmx_src_main_java_org_neo4j_jmx_Primitives.java
|
6,237
|
@ManagementInterface( name = StoreFile.NAME )
@Description( "Information about the sizes of the different parts of the Neo4j graph store" )
public interface StoreFile
{
final String NAME = "Store file sizes";
@Description( "The amount of disk space used by the current Neo4j logical log, in bytes." )
long getLogicalLogSize();
@Description( "The total disk space used by this Neo4j instance, in bytes." )
long getTotalStoreSize();
@Description( "The amount of disk space used to store nodes, in bytes." )
long getNodeStoreSize();
@Description( "The amount of disk space used to store relationships, in bytes." )
long getRelationshipStoreSize();
@Description( "The amount of disk space used to store properties "
+ "(excluding string values and array values), in bytes." )
long getPropertyStoreSize();
@Description( "The amount of disk space used to store string properties, in bytes." )
long getStringStoreSize();
@Description( "The amount of disk space used to store array properties, in bytes." )
long getArrayStoreSize();
}
| false
|
community_jmx_src_main_java_org_neo4j_jmx_StoreFile.java
|
6,238
|
public interface Dependencies
{
KernelData getKernelData();
Logging getLogging();
}
| false
|
community_jmx_src_main_java_org_neo4j_jmx_impl_JmxExtensionFactory.java
|
6,239
|
public interface AvailabilityListener
{
void available();
void unavailable();
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_AvailabilityGuard.java
|
6,240
|
public interface AvailabilityRequirement
{
String description();
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_AvailabilityGuard.java
|
6,241
|
public enum CommonBranchOrdering implements BranchOrderingPolicy
{
/**
* @deprecated See {@link BranchOrderingPolicies}
*/
PREORDER_DEPTH_FIRST
{
public BranchSelector create( TraversalBranch startSource, PathExpander expander )
{
return BranchOrderingPolicies.PREORDER_DEPTH_FIRST.create( startSource, expander );
}
},
/**
* @deprecated See {@link BranchOrderingPolicies}
*/
POSTORDER_DEPTH_FIRST
{
public BranchSelector create( TraversalBranch startSource, PathExpander expander )
{
return BranchOrderingPolicies.POSTORDER_DEPTH_FIRST.create( startSource, expander );
}
},
/**
* @deprecated See {@link BranchOrderingPolicies}
*/
PREORDER_BREADTH_FIRST
{
public BranchSelector create( TraversalBranch startSource, PathExpander expander )
{
return BranchOrderingPolicies.PREORDER_BREADTH_FIRST.create( startSource, expander );
}
},
/**
* @deprecated See {@link BranchOrderingPolicies}
*/
POSTORDER_BREADTH_FIRST
{
public BranchSelector create( TraversalBranch startSource, PathExpander expander )
{
return BranchOrderingPolicies.POSTORDER_BREADTH_FIRST.create( startSource, expander );
}
};
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_CommonBranchOrdering.java
|
6,242
|
public interface Dependencies
{
Config getConfig();
KernelData getKernel();
}
| false
|
community_kernel_src_test_java_org_neo4j_kernel_DummyExtensionFactory.java
|
6,243
|
interface Expansion<T> extends Iterable<T>
{
Expander expander();
Expansion<Node> nodes();
Expansion<Relationship> relationships();
Expansion<Pair<Relationship, Node>> pairs();
Expansion<T> including( RelationshipType type );
Expansion<T> including( RelationshipType type, Direction direction );
Expansion<T> excluding( RelationshipType type );
Expansion<T> filterNodes( Predicate<? super Node> filter );
Expansion<T> filterRelationships( Predicate<? super Relationship> filter );
boolean isEmpty();
T getSingle();
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_Expansion.java
|
6,244
|
@Deprecated
public interface GraphDatabaseAPI extends GraphDatabaseService
{
/**
* Look up database components for direct access.
* Usage of this method is generally an indication of architectural error.
*/
DependencyResolver getDependencyResolver();
/** Provides the unique id assigned to this database. */
StoreId storeId();
/** A more fine-grained mechanism for creating transactions, allows modifying transaction-global behavior. */
TransactionBuilder tx();
@Deprecated
String getStoreDir();
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_GraphDatabaseAPI.java
|
6,245
|
private enum Type
{
without, enabled, activeTimeout, activeOpscount
}
| false
|
community_kernel_src_test_java_org_neo4j_kernel_GuardPerformanceImpact.java
|
6,246
|
@Deprecated
public interface IdGeneratorFactory
{
IdGenerator open( FileSystemAbstraction fs, File fileName, int grabSize, IdType idType, long highId );
void create( FileSystemAbstraction fs, File fileName, long highId );
IdGenerator get( IdType idType );
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_IdGeneratorFactory.java
|
6,247
|
@Deprecated
public enum IdType
{
NODE( 35, false ),
RELATIONSHIP( 35, false ),
PROPERTY( 36, true ),
STRING_BLOCK( 36, true ),
ARRAY_BLOCK( 36, true ),
PROPERTY_KEY_TOKEN( false ),
PROPERTY_KEY_TOKEN_NAME( false ),
RELATIONSHIP_TYPE_TOKEN( 16, false ),
RELATIONSHIP_TYPE_TOKEN_NAME( false ),
LABEL_TOKEN( false ),
LABEL_TOKEN_NAME( false ),
NEOSTORE_BLOCK( false ),
SCHEMA( 35, false ),
NODE_LABELS( 35, true );
private final long max;
private final boolean allowAggressiveReuse;
private IdType( boolean allowAggressiveReuse )
{
this( 32, allowAggressiveReuse );
}
private IdType( int bits, boolean allowAggressiveReuse )
{
this.allowAggressiveReuse = allowAggressiveReuse;
this.max = (long)Math.pow( 2, bits )-1;
}
public long getMaxValue()
{
return this.max;
}
public boolean allowAggressiveReuse()
{
return allowAggressiveReuse;
}
public int getGrabSize()
{
return allowAggressiveReuse ? 50000 : 1024;
}
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_IdType.java
|
6,248
|
public interface Dependencies
{
/**
* Allowed to be null. Null means that no external {@link Logging} was created, let the
* database create its own logging.
* @return
*/
Logging logging();
Iterable<Class<?>> settingsClasses();
Iterable<KernelExtensionFactory<?>> kernelExtensions();
Iterable<CacheProvider> cacheProviders();
Iterable<TransactionInterceptorProvider> transactionInterceptorProviders();
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_InternalAbstractGraphDatabase.java
|
6,249
|
@Deprecated
public interface PropertyTracker<T extends PropertyContainer>
{
void propertyAdded( T primitive, String propertyName, Object propertyValue );
void propertyRemoved( T primitive, String propertyName, Object propertyValue );
void propertyChanged( T primitive, String propertyName, Object oldValue, Object newValue );
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_PropertyTracker.java
|
6,250
|
public enum SideSelectorPolicies implements SideSelectorPolicy
{
/**
* @deprecated See {@link org.neo4j.graphdb.traversal.SideSelectorPolicies}
*/
LEVEL
{
@Override
public SideSelector create( BranchSelector start, BranchSelector end, int maxDepth )
{
return org.neo4j.graphdb.traversal.SideSelectorPolicies.LEVEL.create( start, end, maxDepth );
}
},
/**
* @deprecated See {@link org.neo4j.graphdb.traversal.SideSelectorPolicies}
*/
LEVEL_STOP_DESCENT_ON_RESULT
{
@Override
public SideSelector create( BranchSelector start, BranchSelector end, int maxDepth )
{
return org.neo4j.graphdb.traversal.SideSelectorPolicies.LEVEL_STOP_DESCENT_ON_RESULT
.create( start, end, maxDepth );
}
},
/**
* @deprecated See {@link org.neo4j.graphdb.traversal.SideSelectorPolicies}
*/
ALTERNATING
{
@Override
public SideSelector create( BranchSelector start, BranchSelector end, int maxDepth )
{
return org.neo4j.graphdb.traversal.SideSelectorPolicies.ALTERNATING.create( start, end, maxDepth );
}
};
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_SideSelectorPolicies.java
|
6,251
|
private enum Exclusion
{
ALL( null, "!" )
{
@Override
public boolean accept( Node start, Relationship rel )
{
return false;
}
},
INCOMING( Direction.OUTGOING )
{
@Override
Exclusion reversed()
{
return OUTGOING;
}
},
OUTGOING( Direction.INCOMING )
{
@Override
Exclusion reversed()
{
return INCOMING;
}
},
NONE( Direction.BOTH, "" )
{
@Override
boolean includes( Direction direction )
{
return true;
}
};
private final String string;
private final Direction direction;
private Exclusion( Direction direction, String string )
{
this.direction = direction;
this.string = string;
}
private Exclusion( Direction direction )
{
this.direction = direction;
this.string = "!" + name() + ":";
}
@Override
public final String toString()
{
return string;
}
boolean accept( Node start, Relationship rel )
{
return matchDirection( direction, start, rel );
}
Exclusion reversed()
{
return this;
}
boolean includes( Direction dir )
{
return this.direction == dir;
}
static Exclusion include( Direction direction )
{
switch ( direction )
{
case INCOMING:
return OUTGOING;
case OUTGOING:
return INCOMING;
default:
return NONE;
}
}
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_StandardExpander.java
|
6,252
|
@Deprecated
public interface TransactionBuilder
{
/**
* Starts a new transaction and associates it with the current thread.
*
* @return a new transaction instance
*/
Transaction begin();
/**
* Relaxes the forcing constraint of the logical logs for this transaction
* so that the data is written out, but not forced to disk.
*
* Pros
* <ul>
* <li>The overhead of committing a transaction is lowered due to the removal
* of the force, i.e. I/O waiting for the disk to actually write the bytes down.
* The smaller the transaction the bigger percentage of it is spent forcing
* the logical logs to disk, so small transactions get most benefit from
* being unforced.</li>
* </ul>
*
* Cons
* <ul>
* <li>Since there's no guarantee that the data is actually written down to disk
* the data provided in this transaction could be lost in the event of power failure
* or similar. It is however guaranteed that the data that has been written to disk
* is consistent so the worst case scenario for unforced transactions is that a couple
* of seconds (depending on write load) worth of data might be lost in an event of
* power failure, but the database will still get back to a consistent state after
* a recovery.</li>
* </ul>
*
* @return a {@link TransactionBuilder} instance with relaxed force set.
*/
TransactionBuilder unforced();
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_TransactionBuilder.java
|
6,253
|
public interface PathDescriptor<T extends Path>
{
/**
* Returns a string representation of a {@link Node}.
* @param path the {@link Path} we're building a string representation
* from.
* @param node the {@link Node} to return a string representation of.
* @return a string representation of a {@link Node}.
*/
String nodeRepresentation( T path, Node node );
/**
* Returns a string representation of a {@link Relationship}.
* @param path the {@link Path} we're building a string representation
* from.
* @param from the previous {@link Node} in the path.
* @param relationship the {@link Relationship} to return a string
* representation of.
* @return a string representation of a {@link Relationship}.
*/
String relationshipRepresentation( T path, Node from,
Relationship relationship );
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_Traversal.java
|
6,254
|
public enum Uniqueness implements UniquenessFactory
{
/**
* @deprecated See {@link org.neo4j.graphdb.traversal.Uniqueness}
*/
NODE_GLOBAL
{
public UniquenessFilter create( Object optionalParameter )
{
return org.neo4j.graphdb.traversal.Uniqueness.NODE_GLOBAL.create(optionalParameter);
}
},
/**
* @deprecated See {@link org.neo4j.graphdb.traversal.Uniqueness}
*/
NODE_PATH
{
public UniquenessFilter create( Object optionalParameter )
{
return org.neo4j.graphdb.traversal.Uniqueness.NODE_PATH.create(optionalParameter);
}
},
/**
*@deprecated See {@link org.neo4j.graphdb.traversal.Uniqueness}
*/
NODE_RECENT
{
public UniquenessFilter create( Object optionalParameter )
{
return org.neo4j.graphdb.traversal.Uniqueness.NODE_RECENT.create(optionalParameter);
}
},
/**
* @deprecated See {@link org.neo4j.graphdb.traversal.Uniqueness}
*/
NODE_LEVEL
{
@Override
public UniquenessFilter create( Object optionalParameter )
{
return org.neo4j.graphdb.traversal.Uniqueness.NODE_LEVEL.create(optionalParameter);
}
},
/**
* @deprecated See {@link org.neo4j.graphdb.traversal.Uniqueness}
*/
RELATIONSHIP_GLOBAL
{
public UniquenessFilter create( Object optionalParameter )
{
return org.neo4j.graphdb.traversal.Uniqueness.RELATIONSHIP_GLOBAL.create(optionalParameter);
}
},
/**
* @deprecated See {@link org.neo4j.graphdb.traversal.Uniqueness}
*/
RELATIONSHIP_PATH
{
public UniquenessFilter create( Object optionalParameter )
{
return org.neo4j.graphdb.traversal.Uniqueness.RELATIONSHIP_PATH.create(optionalParameter);
}
},
/**
* @deprecated See {@link org.neo4j.graphdb.traversal.Uniqueness}
*/
RELATIONSHIP_RECENT
{
public UniquenessFilter create( Object optionalParameter )
{
return org.neo4j.graphdb.traversal.Uniqueness.RELATIONSHIP_RECENT.create(optionalParameter);
}
},
/**
* @deprecated See {@link org.neo4j.graphdb.traversal.Uniqueness}
*/
RELATIONSHIP_LEVEL
{
@Override
public UniquenessFilter create( Object optionalParameter )
{
return org.neo4j.graphdb.traversal.Uniqueness.RELATIONSHIP_LEVEL.create(optionalParameter);
}
},
/**
* @deprecated See {@link org.neo4j.graphdb.traversal.Uniqueness}
*/
NONE
{
public UniquenessFilter create( Object optionalParameter )
{
return org.neo4j.graphdb.traversal.Uniqueness.NONE.create(optionalParameter);
}
};
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_Uniqueness.java
|
6,255
|
interface DataRead
{
/**
* @param labelId the label id of the label that returned nodes are guaranteed to have
* @return ids of all nodes that have the given label
*/
PrimitiveLongIterator nodesGetForLabel( int labelId );
/**
* Returns an iterable with the matched nodes.
*
* @throws org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException
* if no such index found.
*/
PrimitiveLongIterator nodesGetFromIndexLookup( IndexDescriptor index, Object value )
throws IndexNotFoundKernelException;
/**
* Returns node id of unique node found in the given unique index for value or
* {@link StatementConstants#NO_SUCH_NODE} if the index does not contain a
* matching node.
*
* If a node is found, a READ lock for the index entry will be held. If no node
* is found (if {@link StatementConstants#NO_SUCH_NODE} was returned), a WRITE
* lock for the index entry will be held. This is to facilitate unique creation
* of nodes, to build get-or-create semantics on top of this method.
*
* @throws org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException if no such index found.
*/
long nodeGetUniqueFromIndexLookup( IndexDescriptor index, Object value ) throws IndexNotFoundKernelException,
IndexBrokenKernelException;
/**
* Checks if a node is labeled with a certain label or not. Returns
* {@code true} if the node is labeled with the label, otherwise {@code false.}
*/
boolean nodeHasLabel( long nodeId, int labelId ) throws EntityNotFoundException;
/**
* Returns all labels set on node with id {@code nodeId}.
* If the node has no labels an empty {@link Iterable} will be returned.
*/
PrimitiveIntIterator nodeGetLabels( long nodeId ) throws EntityNotFoundException;
Property nodeGetProperty( long nodeId, int propertyKeyId ) throws EntityNotFoundException;
Property relationshipGetProperty( long relationshipId, int propertyKeyId ) throws EntityNotFoundException;
Property graphGetProperty( int propertyKeyId );
Iterator<DefinedProperty> nodeGetAllProperties( long nodeId ) throws EntityNotFoundException;
Iterator<DefinedProperty> relationshipGetAllProperties( long relationshipId )
throws EntityNotFoundException;
Iterator<DefinedProperty> graphGetAllProperties();
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_DataRead.java
|
6,256
|
interface DataWrite
{
long nodeCreate();
void nodeDelete( long nodeId );
long relationshipCreate( long relationshipTypeId, long startNodeId, long endNodeId )
throws RelationshipTypeIdNotFoundKernelException, EntityNotFoundException;
void relationshipDelete( long relationshipId );
/**
* Labels a node with the label corresponding to the given label id.
* If the node already had that label nothing will happen. Label ids
* are retrieved from {@link org.neo4j.kernel.impl.api.operations.KeyWriteOperations#labelGetOrCreateForName(org.neo4j.kernel.api.Statement,
* String)} or {@link
* org.neo4j.kernel.impl.api.operations.KeyReadOperations#labelGetForName(org.neo4j.kernel.api.Statement, String)}.
*/
boolean nodeAddLabel( long nodeId, int labelId )
throws EntityNotFoundException, ConstraintValidationKernelException;
/**
* Removes a label with the corresponding id from a node.
* If the node doesn't have that label nothing will happen. Label ids
* are retrieved from {@link org.neo4j.kernel.impl.api.operations.KeyWriteOperations#labelGetOrCreateForName(org.neo4j.kernel.api.Statement,
* String)} or {@link
* org.neo4j.kernel.impl.api.operations.KeyReadOperations#labelGetForName(org.neo4j.kernel.api.Statement, String)}.
*/
boolean nodeRemoveLabel( long nodeId, int labelId ) throws EntityNotFoundException;
Property nodeSetProperty( long nodeId, DefinedProperty property )
throws EntityNotFoundException, ConstraintValidationKernelException;
Property relationshipSetProperty( long relationshipId, DefinedProperty property ) throws EntityNotFoundException;
Property graphSetProperty( DefinedProperty property );
/**
* Remove a node's property given the node's id and the property key id and return the value to which
* it was set or null if it was not set on the node
*/
Property nodeRemoveProperty( long nodeId, int propertyKeyId ) throws EntityNotFoundException;
Property relationshipRemoveProperty( long relationshipId, int propertyKeyId ) throws EntityNotFoundException;
Property graphRemoveProperty( int propertyKeyId );
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_DataWrite.java
|
6,257
|
public interface DataWriteOperations extends TokenWriteOperations, DataWrite
{
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_DataWriteOperations.java
|
6,258
|
public enum EntityType
{
NODE, RELATIONSHIP, GRAPH
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_EntityType.java
|
6,259
|
public interface KernelAPI
{
/**
* Creates and returns a new {@link KernelTransaction} capable of modifying the
* underlying graph.
*/
KernelTransaction newTransaction();
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_KernelAPI.java
|
6,260
|
public interface KernelTransaction
{
Statement acquireStatement();
// Made unavailable for now, should be re-instated once the WriteTransaction/KernelTransaction structure is
// sorted out.
// void prepare();
//
// /**
// * Commit this transaction, this will make the changes in this context visible to other
// * transactions.
// */
// void commit() throws TransactionFailureException;
//
// /** Roll back this transaction, undoing any changes that have been made. */
// void rollback() throws TransactionFailureException;
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_KernelTransaction.java
|
6,261
|
public interface ReadOperations extends TokenRead, DataRead, SchemaRead, SchemaState
{
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_ReadOperations.java
|
6,262
|
interface IndexProviderDependencies
{
GraphDatabaseService db();
Config config();
}
| false
|
enterprise_ha_src_test_java_org_neo4j_kernel_api_SchemaIndexHaIT.java
|
6,263
|
interface SchemaRead
{
/** Returns the index rule for the given labelId and propertyKey. */
IndexDescriptor indexesGetForLabelAndPropertyKey( int labelId, int propertyKey )
throws SchemaRuleNotFoundException;
/** Get all indexes for a label. */
Iterator<IndexDescriptor> indexesGetForLabel( int labelId );
/** Returns all indexes. */
Iterator<IndexDescriptor> indexesGetAll();
/** Returns the constraint index for the given labelId and propertyKey. */
IndexDescriptor uniqueIndexGetForLabelAndPropertyKey( int labelId, int propertyKeyId )
throws SchemaRuleNotFoundException;
/** Get all constraint indexes for a label. */
Iterator<IndexDescriptor> uniqueIndexesGetForLabel( int labelId );
/** Returns all constraint indexes. */
Iterator<IndexDescriptor> uniqueIndexesGetAll();
/** Retrieve the state of an index. */
InternalIndexState indexGetState( IndexDescriptor descriptor ) throws IndexNotFoundKernelException;
/** Returns the failure description of a failed index. */
String indexGetFailure( IndexDescriptor descriptor ) throws IndexNotFoundKernelException;
/**
* Get all constraints applicable to label and propertyKey. There are only {@link
* org.neo4j.kernel.api.constraints.UniquenessConstraint}
* for the time being.
*/
Iterator<UniquenessConstraint> constraintsGetForLabelAndPropertyKey( int labelId, int propertyKeyId );
/**
* Get all constraints applicable to label. There are only {@link UniquenessConstraint}
* for the time being.
*/
Iterator<UniquenessConstraint> constraintsGetForLabel( int labelId );
/**
* Get all constraints. There are only {@link UniquenessConstraint}
* for the time being.
*/
Iterator<UniquenessConstraint> constraintsGetAll();
/**
* Get the owning constraint for a constraint index. Returns null if the index does not have an owning constraint.
*/
Long indexGetOwningUniquenessConstraintId( IndexDescriptor index ) throws SchemaRuleNotFoundException;
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_SchemaRead.java
|
6,264
|
interface SchemaState
{
<K, V> V schemaStateGetOrCreate( K key, Function<K, V> creator );
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_SchemaState.java
|
6,265
|
interface SchemaWrite
{
/**
* Creates an index, indexing properties with the given {@code propertyKeyId} for nodes with the given
* {@code labelId}.
*/
IndexDescriptor indexCreate( int labelId, int propertyKeyId )
throws AddIndexFailureException, AlreadyIndexedException, AlreadyConstrainedException;
/** Drops a {@link IndexDescriptor} from the database */
void indexDrop( IndexDescriptor descriptor ) throws DropIndexFailureException;
UniquenessConstraint uniquenessConstraintCreate( int labelId, int propertyKeyId )
throws CreateConstraintFailureException, AlreadyConstrainedException, AlreadyIndexedException;
void constraintDrop( UniquenessConstraint constraint ) throws DropConstraintFailureException;
/**
* This should not be used, it is exposed to allow an external job to clean up constraint indexes.
* That external job should become an internal job, at which point this operation should go away.
*/
void uniqueIndexDrop( IndexDescriptor descriptor ) throws DropIndexFailureException;
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_SchemaWrite.java
|
6,266
|
public interface SchemaWriteOperations extends TokenWriteOperations, SchemaWrite
{
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_SchemaWriteOperations.java
|
6,267
|
public interface Statement extends Resource
{
ReadOperations readOperations();
/**
* We create tokens as part of both schema write transactions and data write transactions.
* Creating tokens is always allowed, except on read-only databases.
* Generally we know from context which of these transaction types we are trying to execute, but in Cypher it
* is harder to distinguish the cases. Therefore this operation set is called out separately.
*/
TokenWriteOperations tokenWriteOperations() throws ReadOnlyDatabaseKernelException;
DataWriteOperations dataWriteOperations() throws InvalidTransactionTypeKernelException, ReadOnlyDatabaseKernelException;
SchemaWriteOperations schemaWriteOperations() throws InvalidTransactionTypeKernelException,
ReadOnlyDatabaseKernelException;
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_Statement.java
|
6,268
|
public interface TokenNameLookup
{
String labelGetName( int labelId );
String propertyKeyGetName( int propertyKeyId );
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_TokenNameLookup.java
|
6,269
|
interface TokenRead
{
int NO_SUCH_LABEL = -1;
int NO_SUCH_PROPERTY_KEY = -1;
/** Returns a label id for a label name. If the label doesn't exist, {@link #NO_SUCH_LABEL} will be returned. */
int labelGetForName( String labelName );
/** Returns the label name for the given label id. */
String labelGetName( int labelId ) throws LabelNotFoundKernelException;
/**
* Returns a property key id for the given property key. If the property key doesn't exist,
* {@link StatementConstants#NO_SUCH_PROPERTY_KEY} will be returned.
*/
int propertyKeyGetForName( String propertyKeyName );
/** Returns the name of a property given its property key id */
String propertyKeyGetName( int propertyKeyId ) throws PropertyKeyIdNotFoundKernelException;
/** Returns the property keys currently stored in the database */
Iterator<Token> propertyKeyGetAllTokens();
/** Returns the labels currently stored in the database * */
Iterator<Token> labelsGetAllTokens(); // TODO: Token is a store level concern, should not make it this far up the stack
int relationshipTypeGetForName( String relationshipTypeName );
String relationshipTypeGetName( int relationshipTypeId ) throws RelationshipTypeIdNotFoundKernelException;
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_TokenRead.java
|
6,270
|
public interface TokenWrite
{
/**
* Returns a label id for a label name. If the label doesn't exist prior to
* this call it gets created.
*/
int labelGetOrCreateForName( String labelName ) throws IllegalTokenNameException, TooManyLabelsException;
/**
* Returns a property key id for a property key. If the key doesn't exist prior to
* this call it gets created.
*/
int propertyKeyGetOrCreateForName( String propertyKeyName ) throws IllegalTokenNameException;
int relationshipTypeGetOrCreateForName( String relationshipTypeName ) throws IllegalTokenNameException;
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_TokenWrite.java
|
6,271
|
public interface TokenWriteOperations extends ReadOperations, TokenWrite
{
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_TokenWriteOperations.java
|
6,272
|
public interface AllEntriesLabelScanReader extends BoundedIterable<NodeLabelRange>
{
AllEntriesLabelScanReader EMPTY = new AllEntriesLabelScanReader()
{
@Override
public long maxCount()
{
return 0;
}
@Override
public void close() throws IOException
{
}
@Override
public Iterator<NodeLabelRange> iterator()
{
return emptyIterator();
}
};
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_direct_AllEntriesLabelScanReader.java
|
6,273
|
public interface BoundedIterable<RECORD> extends Iterable<RECORD>, Closeable
{
long maxCount();
BoundedIterable EMPTY = new BoundedIterable()
{
@Override
public long maxCount()
{
return 0;
}
@Override public void close() throws IOException
{
}
@Override public Iterator<Long> iterator()
{
return emptyIterator();
}
};
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_direct_BoundedIterable.java
|
6,274
|
public interface NodeLabelRange
{
int id();
long[] nodes();
long[] labels( long nodeId );
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_direct_NodeLabelRange.java
|
6,275
|
public interface Status
{
/*
* A note on naming: Since these are public status codes and users will base error handling on them, please take
* care to place them in correct categories and assign them correct classifications. Also make sure you are not
* introducing duplicates.
*
* If you are unsure, contact Jake or Tobias before making modifications.
*/
enum Network implements Status
{
// transient
UnknownFailure( TransientError, "An unknown network failure occurred, a retry may resolve the issue." );
private final Code code;
@Override
public Code code()
{
return code;
}
private Network( Classification classification, String description )
{
this.code = new Code( classification, this, description );
}
}
enum Request implements Status
{
// client
Invalid( ClientError, "The client provided an invalid request." ),
InvalidFormat( ClientError, "The client provided a request that was missing required fields, or had values " +
"that are not allowed." );
private final Code code;
@Override
public Code code()
{
return code;
}
private Request( Classification classification, String description )
{
this.code = new Code( classification, this, description );
}
}
enum Transaction implements Status
{
UnknownId( ClientError, "The request referred to a transaction that does not exist."),
ConcurrentRequest( ClientError, "There were concurrent requests accessing the same transaction, which is not " +
"allowed." ),
CouldNotBegin( DatabaseError, "The database was unable to start the transaction." ),
CouldNotRollback( DatabaseError, "The database was unable to roll back the transaction." ),
CouldNotCommit( DatabaseError, "The database was unable to commit the transaction." ),
InvalidType( ClientError, "The transaction is of the wrong type to service the request. For instance, a " +
"transaction that has had schema modifications performed in it cannot be used to subsequently " +
"perform data operations, and vice versa." ),
ReleaseLocksFailed( DatabaseError, "The transaction was unable to release one or more of its locks." ),
;
private final Code code;
@Override
public Code code()
{
return code;
}
private Transaction( Classification classification, String description )
{
this.code = new Code( classification, this, description );
}
}
enum Statement implements Status
{
// client
InvalidSyntax( ClientError, "The statement contains invalid or unsupported syntax." ),
InvalidSemantics( ClientError, "The statement is syntactically valid, but expresses something that the " +
"database cannot do." ),
ParameterMissing( ClientError, "The statement is referring to a parameter that was not provided in the " +
"request." ),
ConstraintViolation( ClientError, "A constraint imposed by the statement is violated by the data in the " +
"database." ),
EntityNotFound( ClientError, "The statement is directly referring to an entity that does not exist." ),
NoSuchProperty( ClientError, "The statement is referring to a property that does not exist." ),
NoSuchLabel( ClientError, "The statement is referring to a label that does not exist."),
InvalidType( ClientError, "The statement is attempting to perform operations on values with types that " +
"are not supported by the operation." ),
InvalidArguments( ClientError, "The statement is attempting to perform operations using invalid arguments"),
ArithmeticError( ClientError, "Invalid use of arithmetic, such as dividing by zero." ),
// database
ExecutionFailure( DatabaseError, "The database was unable to execute the statement." ),
;
private final Code code;
@Override
public Code code()
{
return code;
}
private Statement( Classification classification, String description )
{
this.code = new Code( classification, this, description );
}
}
enum Schema implements Status
{
/** A constraint in the database was violated by the query. */
ConstraintViolation( ClientError, "A constraint imposed by the database was violated." ),
NoSuchIndex( ClientError, "The request (directly or indirectly) referred to an index that does not exist." ),
NoSuchConstraint( ClientError, "The request (directly or indirectly) referred to a constraint that does " +
"not exist." ),
IndexCreationFailure( DatabaseError, "Failed to create an index."),
ConstraintAlreadyExists( ClientError, "Unable to perform operation because it would clash with a pre-existing" +
" constraint." ),
IndexAlreadyExists( ClientError, "Unable to perform operation because it would clash with a pre-existing " +
"index." ),
IndexDropFailure( DatabaseError, "The database failed to drop a requested index." ),
ConstraintVerificationFailure( ClientError, "Unable to create constraint because data that exists in the " +
"database violates it." ),
ConstraintCreationFailure( DatabaseError, "Creating a requested constraint failed." ),
ConstraintDropFailure( DatabaseError, "The database failed to drop a requested constraint." ),
IllegalTokenName( ClientError, "A token name, such as a label, relationship type or property key, used is " +
"not valid. Tokens cannot be empty strings and cannot be null." ),
IndexBelongsToConstraint(
ClientError, "A requested operation can not be performed on the specified index because the index is " +
"part of a constraint. If you want to drop the index, for instance, you must drop the constraint." ),
NoSuchLabel( DatabaseError, "The request accessed a label that did not exist." ),
NoSuchPropertyKey( DatabaseError, "The request accessed a property that does not exist." ),
NoSuchRelationshipType( DatabaseError, "The request accessed a relationship type that does not exist." ),
NoSuchSchemaRule( DatabaseError, "The request referred to a schema rule that does not exist." ),
LabelLimitReached( ClientError, "The maximum number of labels supported has been reached, no more labels can be created." ),
;
private final Code code;
@Override
public Code code()
{
return code;
}
private Schema( Classification classification, String description )
{
this.code = new Code( classification, this, description );
}
}
enum General implements Status
{
ReadOnly( ClientError, "This is a read only database, writing or modifying the database is not allowed." ),
// database
FailedIndex( DatabaseError, "The request (directly or indirectly) referred to an index that is in a failed " +
"state. The index needs to be dropped and recreated manually." ),
UnknownFailure( DatabaseError, "An unknown failure occurred." ),
CorruptSchemaRule( DatabaseError, "A malformed schema rule was encountered. Please contact your support representative." ),
;
private final Code code;
@Override
public Code code()
{
return code;
}
private General( Classification classification, String description )
{
this.code = new Code( classification, this, description );
}
}
Code code();
class Code
{
public static Collection<Status> all()
{
Collection<Status> result = new ArrayList<>();
for ( Class<?> child : Status.class.getDeclaredClasses() )
{
if ( child.isEnum() && Status.class.isAssignableFrom( child ) )
{
@SuppressWarnings("unchecked")
Class<? extends Status> statusType = (Class<? extends Status>) child;
Collections.addAll( result, statusType.getEnumConstants() );
}
}
return result;
}
private final Classification classification;
private final String description;
private final String category;
private final String title;
<C extends Enum<C> & Status> Code( Classification classification, C categoryAndTitle, String description )
{
this.classification = classification;
this.category = categoryAndTitle.getDeclaringClass().getSimpleName();
this.title = categoryAndTitle.name();
this.description = description;
}
/**
* The portable, serialized status code. This will always be in the format:
*
* <pre>
* Neo.[Classification].[Category].[Title]
* </pre>
* @return
*/
public final String serialize()
{
return format( "Neo.%s.%s.%s", classification, category, title );
}
public final String description()
{
return description;
}
public Classification classification()
{
return classification;
}
@Override
public boolean equals( Object o )
{
if ( this == o )
{
return true;
}
if ( o == null || getClass() != o.getClass() )
{
return false;
}
Code code = (Code) o;
if ( !category.equals( code.category ) )
{
return false;
}
if ( classification != code.classification )
{
return false;
}
if ( !title.equals( code.title ) )
{
return false;
}
return true;
}
@Override
public int hashCode()
{
int result = classification.hashCode();
result = 31 * result + category.hashCode();
result = 31 * result + title.hashCode();
return result;
}
}
public enum Classification
{
/** The Client sent a bad request - changing the request might yield a successful outcome. */
ClientError( TransactionEffect.NONE,
"The Client sent a bad request - changing the request might yield a successful outcome." ),
/** The database failed to service the request. */
DatabaseError( TransactionEffect.ROLLBACK,
"The database failed to service the request. " ),
/** The database cannot service the request right now, retrying later might yield a successful outcome. */
TransientError( TransactionEffect.NONE,
"The database cannot service the request right now, retrying later might yield a successful outcome. "),
;
private enum TransactionEffect
{
ROLLBACK, NONE,
}
final boolean rollbackTransaction;
private final String description;
private Classification( TransactionEffect transactionEffect, String description )
{
this.description = description;
this.rollbackTransaction = transactionEffect == TransactionEffect.ROLLBACK;
}
public String description()
{
return description;
}
public boolean rollbackTransaction()
{
return rollbackTransaction;
}
}
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_exceptions_Status.java
|
6,276
|
public enum Classification
{
/** The Client sent a bad request - changing the request might yield a successful outcome. */
ClientError( TransactionEffect.NONE,
"The Client sent a bad request - changing the request might yield a successful outcome." ),
/** The database failed to service the request. */
DatabaseError( TransactionEffect.ROLLBACK,
"The database failed to service the request. " ),
/** The database cannot service the request right now, retrying later might yield a successful outcome. */
TransientError( TransactionEffect.NONE,
"The database cannot service the request right now, retrying later might yield a successful outcome. "),
;
private enum TransactionEffect
{
ROLLBACK, NONE,
}
final boolean rollbackTransaction;
private final String description;
private Classification( TransactionEffect transactionEffect, String description )
{
this.description = description;
this.rollbackTransaction = transactionEffect == TransactionEffect.ROLLBACK;
}
public String description()
{
return description;
}
public boolean rollbackTransaction()
{
return rollbackTransaction;
}
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_exceptions_Status.java
|
6,277
|
private enum TransactionEffect
{
ROLLBACK, NONE,
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_exceptions_Status.java
|
6,278
|
enum General implements Status
{
ReadOnly( ClientError, "This is a read only database, writing or modifying the database is not allowed." ),
// database
FailedIndex( DatabaseError, "The request (directly or indirectly) referred to an index that is in a failed " +
"state. The index needs to be dropped and recreated manually." ),
UnknownFailure( DatabaseError, "An unknown failure occurred." ),
CorruptSchemaRule( DatabaseError, "A malformed schema rule was encountered. Please contact your support representative." ),
;
private final Code code;
@Override
public Code code()
{
return code;
}
private General( Classification classification, String description )
{
this.code = new Code( classification, this, description );
}
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_exceptions_Status.java
|
6,279
|
enum Network implements Status
{
// transient
UnknownFailure( TransientError, "An unknown network failure occurred, a retry may resolve the issue." );
private final Code code;
@Override
public Code code()
{
return code;
}
private Network( Classification classification, String description )
{
this.code = new Code( classification, this, description );
}
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_exceptions_Status.java
|
6,280
|
enum Request implements Status
{
// client
Invalid( ClientError, "The client provided an invalid request." ),
InvalidFormat( ClientError, "The client provided a request that was missing required fields, or had values " +
"that are not allowed." );
private final Code code;
@Override
public Code code()
{
return code;
}
private Request( Classification classification, String description )
{
this.code = new Code( classification, this, description );
}
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_exceptions_Status.java
|
6,281
|
enum Schema implements Status
{
/** A constraint in the database was violated by the query. */
ConstraintViolation( ClientError, "A constraint imposed by the database was violated." ),
NoSuchIndex( ClientError, "The request (directly or indirectly) referred to an index that does not exist." ),
NoSuchConstraint( ClientError, "The request (directly or indirectly) referred to a constraint that does " +
"not exist." ),
IndexCreationFailure( DatabaseError, "Failed to create an index."),
ConstraintAlreadyExists( ClientError, "Unable to perform operation because it would clash with a pre-existing" +
" constraint." ),
IndexAlreadyExists( ClientError, "Unable to perform operation because it would clash with a pre-existing " +
"index." ),
IndexDropFailure( DatabaseError, "The database failed to drop a requested index." ),
ConstraintVerificationFailure( ClientError, "Unable to create constraint because data that exists in the " +
"database violates it." ),
ConstraintCreationFailure( DatabaseError, "Creating a requested constraint failed." ),
ConstraintDropFailure( DatabaseError, "The database failed to drop a requested constraint." ),
IllegalTokenName( ClientError, "A token name, such as a label, relationship type or property key, used is " +
"not valid. Tokens cannot be empty strings and cannot be null." ),
IndexBelongsToConstraint(
ClientError, "A requested operation can not be performed on the specified index because the index is " +
"part of a constraint. If you want to drop the index, for instance, you must drop the constraint." ),
NoSuchLabel( DatabaseError, "The request accessed a label that did not exist." ),
NoSuchPropertyKey( DatabaseError, "The request accessed a property that does not exist." ),
NoSuchRelationshipType( DatabaseError, "The request accessed a relationship type that does not exist." ),
NoSuchSchemaRule( DatabaseError, "The request referred to a schema rule that does not exist." ),
LabelLimitReached( ClientError, "The maximum number of labels supported has been reached, no more labels can be created." ),
;
private final Code code;
@Override
public Code code()
{
return code;
}
private Schema( Classification classification, String description )
{
this.code = new Code( classification, this, description );
}
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_exceptions_Status.java
|
6,282
|
enum Statement implements Status
{
// client
InvalidSyntax( ClientError, "The statement contains invalid or unsupported syntax." ),
InvalidSemantics( ClientError, "The statement is syntactically valid, but expresses something that the " +
"database cannot do." ),
ParameterMissing( ClientError, "The statement is referring to a parameter that was not provided in the " +
"request." ),
ConstraintViolation( ClientError, "A constraint imposed by the statement is violated by the data in the " +
"database." ),
EntityNotFound( ClientError, "The statement is directly referring to an entity that does not exist." ),
NoSuchProperty( ClientError, "The statement is referring to a property that does not exist." ),
NoSuchLabel( ClientError, "The statement is referring to a label that does not exist."),
InvalidType( ClientError, "The statement is attempting to perform operations on values with types that " +
"are not supported by the operation." ),
InvalidArguments( ClientError, "The statement is attempting to perform operations using invalid arguments"),
ArithmeticError( ClientError, "Invalid use of arithmetic, such as dividing by zero." ),
// database
ExecutionFailure( DatabaseError, "The database was unable to execute the statement." ),
;
private final Code code;
@Override
public Code code()
{
return code;
}
private Statement( Classification classification, String description )
{
this.code = new Code( classification, this, description );
}
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_exceptions_Status.java
|
6,283
|
enum Transaction implements Status
{
UnknownId( ClientError, "The request referred to a transaction that does not exist."),
ConcurrentRequest( ClientError, "There were concurrent requests accessing the same transaction, which is not " +
"allowed." ),
CouldNotBegin( DatabaseError, "The database was unable to start the transaction." ),
CouldNotRollback( DatabaseError, "The database was unable to roll back the transaction." ),
CouldNotCommit( DatabaseError, "The database was unable to commit the transaction." ),
InvalidType( ClientError, "The transaction is of the wrong type to service the request. For instance, a " +
"transaction that has had schema modifications performed in it cannot be used to subsequently " +
"perform data operations, and vice versa." ),
ReleaseLocksFailed( DatabaseError, "The transaction was unable to release one or more of its locks." ),
;
private final Code code;
@Override
public Code code()
{
return code;
}
private Transaction( Classification classification, String description )
{
this.code = new Code( classification, this, description );
}
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_exceptions_Status.java
|
6,284
|
public enum BitmapDocumentFormat
{
_32( BitmapFormat._32 )
{
@Override
protected NumericField setFieldValue( NumericField field, long bitmap )
{
assert (bitmap & 0xFFFFFFFF00000000L) == 0 :
"Tried to store a bitmap as int, but which had values outside int limits";
return field.setIntValue( (int) bitmap );
}
},
_64( BitmapFormat._64 )
{
@Override
protected NumericField setFieldValue( NumericField field, long bitmap )
{
return field.setLongValue( bitmap );
}
};
public static final String RANGE = "range", LABEL = "label";
private final BitmapFormat format;
private BitmapDocumentFormat( BitmapFormat format )
{
this.format = format;
}
@Override
public String toString()
{
return format( "%s{%s bit}", getClass().getSimpleName(), format );
}
public BitmapFormat bitmapFormat()
{
return format;
}
public long rangeOf( Document doc )
{
return Long.parseLong( doc.get( RANGE ) );
}
public long rangeOf( Fieldable field )
{
return Long.parseLong( field.stringValue() );
}
public long mapOf( Document doc, long labelId )
{
return bitmap( doc.getFieldable( label( labelId ) ) );
}
public Query labelQuery( long labelId )
{
return new TermQuery( new Term( LABEL, Long.toString( labelId ) ) );
}
public Query rangeQuery( long range )
{
return new TermQuery( new Term( RANGE, Long.toString( range) ) );
}
public Fieldable rangeField( long range )
{
// TODO: figure out what flags to set on the field
Field field = new Field( RANGE, Long.toString( range ), Field.Store.YES, Field.Index.NOT_ANALYZED );
field.setOmitNorms( true );
field.setIndexOptions( FieldInfo.IndexOptions.DOCS_ONLY );
return field;
}
public Fieldable labelField( long key, long bitmap )
{
// Label Fields are DOCUMENT ONLY (not indexed)
// TODO: figure out what flags to set on the field
NumericField field = new NumericField( label( key ), Field.Store.YES, false );
field = setFieldValue( field, bitmap );
field.setOmitNorms( true );
field.setIndexOptions( FieldInfo.IndexOptions.DOCS_ONLY );
return field;
}
protected abstract NumericField setFieldValue( NumericField field, long bitmap );
public void addLabelField( Document document, long label, Bitmap bitmap )
{
document.add( labelField( label, bitmap ) );
document.add( labelSearchField( label ) );
}
public Fieldable labelSearchField( long label )
{
// Label Search Fields are INDEX ONLY (not stored in the document)
Field field = new Field( LABEL, Long.toString( label ), Field.Store.NO, Field.Index.NOT_ANALYZED );
field.setOmitNorms( true );
field.setIndexOptions( FieldInfo.IndexOptions.DOCS_ONLY );
return field;
}
public Fieldable labelField( long key, Bitmap value )
{
return labelField( key, value.bitmap() );
}
String label( long key )
{
return Long.toString( key );
}
public long labelId( Fieldable field )
{
return Long.parseLong( field.name() );
}
public Term rangeTerm( long range )
{
return new Term( RANGE, Long.toString( range ) );
}
public Term rangeTerm( Document document )
{
return new Term( RANGE, document.get( RANGE ) );
}
public boolean isRangeField( Fieldable field )
{
String fieldName = field.name();
return RANGE.equals( fieldName ) || LABEL.equals( fieldName );
}
public Bitmap readBitmap( Fieldable field )
{
return new Bitmap( bitmap( field ) );
}
private long bitmap( Fieldable field )
{
if ( field == null )
{
return 0;
}
if ( field instanceof NumericField )
{
return ((NumericField) field).getNumericValue().longValue();
}
throw new IllegalArgumentException( field + " is not a numeric field" );
}
}
| false
|
community_lucene-index_src_main_java_org_neo4j_kernel_api_impl_index_BitmapDocumentFormat.java
|
6,285
|
public interface DirectoryFactory extends FileSystemAbstraction.ThirdPartyFileSystem
{
Directory open( File dir ) throws IOException;
/**
* Called when the directory factory is disposed of, really only here to allow
* the ram directory thing to close open directories.
*/
void close();
final DirectoryFactory PERSISTENT = new DirectoryFactory()
{
@SuppressWarnings("ResultOfMethodCallIgnored")
@Override
public Directory open( File dir ) throws IOException
{
dir.mkdirs();
return FSDirectory.open( dir );
}
@Override
public void close()
{
// No resources to release. This method only exists as a hook for test implementations.
}
@Override
public void dumpToZip( ZipOutputStream zip, byte[] scratchPad )
{
// do nothing
}
};
final class InMemoryDirectoryFactory implements DirectoryFactory
{
private final Map<File, RAMDirectory> directories = new HashMap<File, RAMDirectory>( );
@Override
public synchronized Directory open( File dir ) throws IOException
{
if(!directories.containsKey( dir ))
{
directories.put( dir, new RAMDirectory() );
}
return new UncloseableDirectory(directories.get(dir));
}
@Override
public synchronized void close()
{
for ( RAMDirectory ramDirectory : directories.values() )
{
ramDirectory.close();
}
directories.clear();
}
@Override
public void dumpToZip( ZipOutputStream zip, byte[] scratchPad ) throws IOException
{
for ( Map.Entry<File, RAMDirectory> entry : directories.entrySet() )
{
RAMDirectory ramDir = entry.getValue();
for ( String fileName : ramDir.listAll() )
{
zip.putNextEntry( new ZipEntry( new File( entry.getKey(), fileName ).getAbsolutePath() ) );
copy( ramDir.openInput( fileName ), zip, scratchPad );
zip.closeEntry();
}
}
}
private static void copy( IndexInput source, OutputStream target, byte[] buffer ) throws IOException
{
for ( long remaining = source.length(),read; remaining > 0;remaining -= read)
{
read = min( remaining, buffer.length );
source.readBytes( buffer, 0, (int) read );
target.write( buffer, 0, (int) read );
}
}
}
final class Single implements DirectoryFactory
{
private final Directory directory;
public Single( Directory directory )
{
this.directory = directory;
}
@Override
public Directory open( File dir ) throws IOException
{
return directory;
}
@Override
public void close()
{
}
@Override
public void dumpToZip( ZipOutputStream zip, byte[] scratchPad )
{
throw new UnsupportedOperationException();
}
}
final class UncloseableDirectory extends Directory
{
private final Directory delegate;
public UncloseableDirectory(Directory delegate)
{
this.delegate = delegate;
}
@Override
public void close() throws IOException
{
// No-op
}
@Override
public String[] listAll() throws IOException
{
return delegate.listAll();
}
@Override
public boolean fileExists( String s ) throws IOException
{
return delegate.fileExists( s );
}
@Deprecated
@Override
public long fileModified( String s ) throws IOException
{
return delegate.fileModified( s );
}
@Override
@Deprecated
public void touchFile( String s ) throws IOException
{
delegate.touchFile( s );
}
@Override
public void deleteFile( String s ) throws IOException
{
delegate.deleteFile( s );
}
@Override
public long fileLength( String s ) throws IOException
{
return delegate.fileLength( s );
}
@Override
public IndexOutput createOutput( String s ) throws IOException
{
return delegate.createOutput( s );
}
@Override
@Deprecated
public void sync( String name ) throws IOException
{
delegate.sync( name );
}
@Override
public void sync( Collection<String> names ) throws IOException
{
delegate.sync( names );
}
@Override
public IndexInput openInput( String s ) throws IOException
{
return delegate.openInput( s );
}
@Override
public IndexInput openInput( String name, int bufferSize ) throws IOException
{
return delegate.openInput( name, bufferSize );
}
@Override
public Lock makeLock( final String name )
{
return delegate.makeLock( name );
}
@Override
public void clearLock( String name ) throws IOException
{
delegate.clearLock( name );
}
@Override
public void setLockFactory( LockFactory lockFactory ) throws IOException
{
delegate.setLockFactory( lockFactory );
}
@Override
public LockFactory getLockFactory()
{
return delegate.getLockFactory();
}
@Override
public String getLockID()
{
return delegate.getLockID();
}
@Override
public String toString()
{
return delegate.toString();
}
@Override
public void copy( Directory to, String src, String dest ) throws IOException
{
delegate.copy( to, src, dest );
}
@Deprecated
public static void copy( Directory src, Directory dest, boolean closeDirSrc ) throws IOException
{
Directory.copy( src, dest, closeDirSrc );
}
}
}
| false
|
community_lucene-index_src_main_java_org_neo4j_kernel_api_impl_index_DirectoryFactory.java
|
6,286
|
public interface LabelScanStorageStrategy
{
PrimitiveLongIterator nodesWithLabel( IndexSearcher searcher, int labelId );
AllEntriesLabelScanReader newNodeLabelReader( SearcherManager searcher );
Iterator<Long> labelsForNode( IndexSearcher searcher, long nodeId );
LabelScanWriter acquireWriter( StorageService storage );
interface StorageService
{
void updateDocument( Term documentTerm, Document document ) throws IOException;
void deleteDocuments( Term documentTerm ) throws IOException;
IndexSearcher acquireSearcher();
void releaseSearcher( IndexSearcher searcher ) throws IOException;
void refreshSearcher() throws IOException;
}
}
| false
|
community_lucene-index_src_main_java_org_neo4j_kernel_api_impl_index_LabelScanStorageStrategy.java
|
6,287
|
interface StorageService
{
void updateDocument( Term documentTerm, Document document ) throws IOException;
void deleteDocuments( Term documentTerm ) throws IOException;
IndexSearcher acquireSearcher();
void releaseSearcher( IndexSearcher searcher ) throws IOException;
void refreshSearcher() throws IOException;
}
| false
|
community_lucene-index_src_main_java_org_neo4j_kernel_api_impl_index_LabelScanStorageStrategy.java
|
6,288
|
private static enum Labels implements Label
{
First,
Second;
}
| false
|
enterprise_ha_src_test_java_org_neo4j_kernel_api_impl_index_LabelScanStoreHaIT.java
|
6,289
|
enum ValueEncoding
{
Number
{
@Override
String key()
{
return "number";
}
@Override
boolean canEncode( Object value )
{
return value instanceof Number;
}
@Override
Fieldable encodeField( Object value )
{
String encodedString = NumericUtils.doubleToPrefixCoded( ((Number)value).doubleValue() );
return field( key(), encodedString );
}
@Override
Query encodeQuery( Object value )
{
String encodedString = NumericUtils.doubleToPrefixCoded( ((Number)value).doubleValue() );
return new TermQuery( new Term( key(), encodedString ) );
}
},
Array
{
@Override
String key()
{
return "array";
}
@Override
boolean canEncode( Object value )
{
return value.getClass().isArray();
}
@Override
Fieldable encodeField( Object value )
{
return field( key(), ArrayEncoder.encode( value ) );
}
@Override
Query encodeQuery( Object value )
{
return new TermQuery( new Term( key(), ArrayEncoder.encode( value ) ) );
}
},
Bool
{
@Override
String key()
{
return "bool";
}
@Override
boolean canEncode( Object value )
{
return value instanceof Boolean;
}
@Override
Fieldable encodeField( Object value )
{
return field( key(), value.toString() );
}
@Override
Query encodeQuery( Object value )
{
return new TermQuery( new Term( key(), value.toString() ) );
}
},
String
{
@Override
String key()
{
return "string";
}
@Override
boolean canEncode( Object value )
{
// Any other type can be safely serialised as a string
return true;
}
@Override
Fieldable encodeField( Object value )
{
return field( key(), value.toString() );
}
@Override
Query encodeQuery( Object value )
{
return new TermQuery( new Term( key(), value.toString() ) );
}
};
abstract String key();
abstract boolean canEncode( Object value );
abstract Fieldable encodeField( Object value );
abstract Query encodeQuery( Object value );
}
| false
|
community_lucene-index_src_main_java_org_neo4j_kernel_api_impl_index_LuceneDocumentStructure.java
|
6,290
|
public interface LuceneIndexWriterFactory
{
IndexWriter create( Directory directory ) throws IOException;
}
| false
|
community_lucene-index_src_main_java_org_neo4j_kernel_api_impl_index_LuceneIndexWriterFactory.java
|
6,291
|
public interface Monitor
{
void init();
void noIndex();
void lockedIndex( LockObtainFailedException e );
void corruptIndex( IOException e );
void rebuilding();
void rebuilt( long roughNodeCount );
}
| false
|
community_lucene-index_src_main_java_org_neo4j_kernel_api_impl_index_LuceneLabelScanStore.java
|
6,292
|
public interface Dependencies
{
Config getConfig();
FileSystemAbstraction getFileSystem();
NeoStoreProvider getNeoStoreProvider();
Logging getLogging();
}
| false
|
community_lucene-index_src_main_java_org_neo4j_kernel_api_impl_index_LuceneLabelScanStoreExtension.java
|
6,293
|
public interface Dependencies
{
Config getConfig();
FileSystemAbstraction getFileSystem();
}
| false
|
community_lucene-index_src_main_java_org_neo4j_kernel_api_impl_index_LuceneSchemaIndexProviderFactory.java
|
6,294
|
public enum BitmapFormat
{
_32( 5, 0xFFFF_FFFFL ),
_64( 6, -1 );
public final int shift;
private final long mask;
private BitmapFormat( int shift, long mask )
{
this.shift = shift;
this.mask = mask;
}
public int rangeSize() {
return 1 << shift;
}
public long rangeOf( long id )
{
return id >> shift;
}
public long[] convertRangeAndBitmapToArray( long range, long bitmap )
{
bitmap &= mask;
int bitCount = Long.bitCount( bitmap );
if ( bitCount == 0 )
{
return null;
}
long[] result = new long[bitCount];
for ( int i = 0, offset = -1; i < result.length; i++ )
{
//noinspection StatementWithEmptyBody
while ( (bitmap & (1L << ++offset)) == 0 )
{
;
}
result[i] = (range << shift) | offset;
}
return result;
}
// Returns true if the label exists on the given node for the given bitmap
public boolean hasLabel( long bitmap, long nodeId )
{
long normalizedNodeId = nodeId % (1L << shift);
long bitRepresentingNodeIdInBitmap = 1L << normalizedNodeId;
return ((bitmap & bitRepresentingNodeIdInBitmap) != 0);
}
public void set( Bitmap bitmap, long id, boolean set )
{
if ( bitmap == null )
{
return;
}
long low = (1L << shift) - 1;
if ( set )
{
bitmap.bitmap |= 1L << (id & low);
}
else
{
bitmap.bitmap &= mask ^ (1L << (id & low));
}
}
}
| false
|
community_lucene-index_src_main_java_org_neo4j_kernel_api_impl_index_bitmaps_BitmapFormat.java
|
6,295
|
public interface IndexAccessor extends Closeable
{
/**
* Deletes this index as well as closes all used external resources.
* There will not be any interactions after this call.
*
* @throws IOException if unable to drop index.
*/
void drop() throws IOException;
/**
* Return an updater for applying a set of changes to this index.
* Updates must be visible in {@link #newReader() readers} created after this update.
*
* This is called with IndexUpdateMode.RECOVERY when starting up after
* a crash or similar. Updates given then may have already been applied to this index, so
* additional checks must be in place so that data doesn't get duplicated, but is idempotent.
*/
IndexUpdater newUpdater( IndexUpdateMode mode );
/**
* Forces this index to disk. Called at certain points from within Neo4j for example when
* rotating the logical log. After completion of this call there cannot be any essential state that
* hasn't been forced to disk.
*
* @throws IOException if there was a problem forcing the state to persistent storage.
*/
void force() throws IOException;
/**
* Closes this index accessor. There will not be any interactions after this call.
* After completion of this call there cannot be any essential state that hasn't been forced to disk.
*
* @throws IOException if unable to close index.
*/
void close() throws IOException;
/**
* @return a new {@link IndexReader} responsible for looking up results in the index. The returned
* reader must honor repeatable reads.
*/
IndexReader newReader();
BoundedIterable<Long> newAllEntriesReader();
/**
* Should return a full listing of all files needed by this index accessor to work with the index. The files
* need to remain available until the resource iterator returned here is closed. This is used to duplicate created
* indexes across clusters, among other things.
*/
ResourceIterator<File> snapshotFiles() throws IOException;
class Adapter implements IndexAccessor
{
@Override
public void drop()
{
}
@Override
public IndexUpdater newUpdater( IndexUpdateMode mode )
{
return SwallowingIndexUpdater.INSTANCE;
}
@Override
public void force()
{
}
@Override
public void close()
{
}
@Override
public IndexReader newReader()
{
return IndexReader.EMPTY;
}
@Override
public BoundedIterable<Long> newAllEntriesReader()
{
return new BoundedIterable<Long>()
{
@Override
public long maxCount()
{
return 0;
}
@Override public void close() throws IOException
{
}
@Override public Iterator<Long> iterator()
{
return emptyIterator();
}
};
}
@Override
public ResourceIterator<File> snapshotFiles()
{
return emptyIterator();
}
}
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_index_IndexAccessor.java
|
6,296
|
public interface IndexPopulator
{
/**
* Remove all data in the index and paves the way for populating an index.
*/
void create() throws IOException;
/**
* Closes and deletes this index.
*/
void drop() throws IOException;
/**
* Called when initially populating an index over existing data. Guaranteed to be
* called by the same thread every time. All data coming in here is guaranteed to not
* have been added to this index previously, so no checks needs to be performed before applying it.
* Implementations may verify constraints at this time, or defer them until the first verification
* of {@link #verifyDeferredConstraints(PropertyAccessor)}.
*
* @param nodeId node id to index.
* @param propertyValue property value for the entry to index.
*/
void add( long nodeId, Object propertyValue ) throws IndexEntryConflictException, IOException;
/**
* Verify constraints for all entries added so far.
*/
@Deprecated // TODO we want to remove this in 2.1, and properly prevent value collisions.
void verifyDeferredConstraints( PropertyAccessor accessor ) throws Exception;
/**
* Return an updater for applying a set of changes to this index, generally this will be a set of changes from a
* transaction.
*
* Index population goes through the existing data in the graph and feeds relevant data to this populator.
* Simultaneously as population progresses there might be incoming updates
* from committing transactions, which needs to be applied as well. This populator will only receive updates
* for nodes that it already has seen. Updates coming in here must be applied idempotently as the same data
* may have been {@link #add(long, Object) added previously}.
* Updates can come in two different {@link NodePropertyUpdate#getUpdateMode() modes}.
* <ol>
* <li>{@link UpdateMode#ADDED} means that there's an added property to a node already seen by this
* populator and so needs to be added. Note that this addition needs to be applied idempotently.
* <li>{@link UpdateMode#CHANGED} means that there's a change to a property for a node already seen by
* this populator and that this new change needs to be applied. Note that this change needs to be
* applied idempotently.</li>
* <li>{@link UpdateMode#REMOVED} means that a property already seen by this populator or even the node itself
* has been removed and need to be removed from this index as well. Note that this removal needs to be
* applied idempotently.</li>
* </ol>
*/
IndexUpdater newPopulatingUpdater( PropertyAccessor accessor ) throws IOException;
// void update( Iterable<NodePropertyUpdate> updates ) throws IndexEntryConflictException, IOException;
// TODO instead of this flag, we should store if population fails and mark indexes as failed internally
// Rationale: Users should be required to explicitly drop failed indexes
/**
* Close this populator and releases any resources related to it.
* If {@code populationCompletedSuccessfully} is {@code true} then it must mark this index
* as {@link InternalIndexState#ONLINE} so that future invocations of its parent
* {@link SchemaIndexProvider#getInitialState(long)} also returns {@link InternalIndexState#ONLINE}.
*/
void close( boolean populationCompletedSuccessfully ) throws IOException;
/**
* Called then a population failed. The failure string should be stored for future retrieval by
* {@link SchemaIndexProvider#getPopulationFailure(long)}. Called before {@link #close(boolean)}
* if there was a failure during population.
*
* @param failure the description of the failure.
* @throws IOException if marking failed.
*/
void markAsFailed( String failure ) throws IOException;
class Adapter implements IndexPopulator
{
@Override
public void create() throws IOException
{
}
@Override
public void drop() throws IOException
{
}
@Override
public void add( long nodeId, Object propertyValue ) throws IndexEntryConflictException, IOException
{
}
@Override
public void verifyDeferredConstraints( PropertyAccessor accessor ) throws IndexEntryConflictException, IOException
{
}
@Override
public IndexUpdater newPopulatingUpdater( PropertyAccessor accessor )
{
return SwallowingIndexUpdater.INSTANCE;
}
@Override
public void close( boolean populationCompletedSuccessfully ) throws IOException
{
}
@Override
public void markAsFailed( String failure )
{
}
}
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_index_IndexPopulator.java
|
6,297
|
public interface IndexReader extends Resource
{
PrimitiveLongIterator lookup( Object value );
IndexReader EMPTY = new IndexReader()
{
@Override
public PrimitiveLongIterator lookup( Object value )
{
return emptyPrimitiveLongIterator();
}
@Override
public void close()
{
}
};
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_index_IndexReader.java
|
6,298
|
public interface IndexUpdater extends AutoCloseable
{
void process( NodePropertyUpdate update ) throws IOException, IndexEntryConflictException;
@Override
void close() throws IOException, IndexEntryConflictException;
void remove( Iterable<Long> nodeIds ) throws IOException;
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_index_IndexUpdater.java
|
6,299
|
public enum InternalIndexState
{
/**
* Denotes that an index is in the process of being created.
*/
POPULATING,
/**
* Given after the database has populated the index, and notified the index provider that the index is in
* fact populated.
*/
ONLINE,
/**
* Denotes that the index, for one reason or another, is broken. Information about the
* failure is expected to have been logged.
*
* Dropping a failed index should be possible, as long as the failure is not caused by eg. out of memory.
*/
FAILED;
}
| false
|
community_kernel_src_main_java_org_neo4j_kernel_api_index_InternalIndexState.java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.