Skip to content

Commit

Permalink
misc java-docs and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd committed Nov 9, 2017
1 parent b93c790 commit df4c2b8
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 32 deletions.
Expand Up @@ -20,11 +20,17 @@
package org.neo4j.internal.kernel.api; package org.neo4j.internal.kernel.api;


/** /**
* A cursor for accessing data in an explicit index. * A result from a search in an explicit index.
*/ */
interface ExplicitIndexCursor interface ExplicitIndexSearchResult
{ {
int totalExpectedCursorSize(); /**
* @return The expected total number of results
*/
int expectedTotalNumberOfResults();


/**
* @return The score of this search result.
*/
float score(); float score();
} }
Expand Up @@ -22,6 +22,6 @@
/** /**
* Cursor for accessing manual index nodes. * Cursor for accessing manual index nodes.
*/ */
public interface NodeExplicitIndexCursor extends NodeIndexCursor, ExplicitIndexCursor public interface NodeExplicitIndexCursor extends NodeIndexCursor, ExplicitIndexSearchResult
{ {
} }
Expand Up @@ -22,6 +22,6 @@
/** /**
* Cursor for accessing manual index relationships. * Cursor for accessing manual index relationships.
*/ */
public interface RelationshipExplicitIndexCursor extends RelationshipIndexCursor, ExplicitIndexCursor public interface RelationshipExplicitIndexCursor extends RelationshipIndexCursor, ExplicitIndexSearchResult
{ {
} }
Expand Up @@ -36,5 +36,5 @@ public interface RelationshipIndexCursor extends Cursor


long targetNodeReference(); long targetNodeReference();


long relationshipReference(); // will relationships have independent references? exposing it is leakage! long relationshipReference();
} }
Expand Up @@ -19,36 +19,59 @@
*/ */
package org.neo4j.internal.kernel.api; package org.neo4j.internal.kernel.api;


import org.neo4j.internal.kernel.api.exceptions.KernelException;

/** /**
* Token creation and lookup. * Token creation and lookup.
*/ */
public interface Token public interface Token
{ {
class SomeException extends Exception /**
{ * Value indicating the a token does not exist in the graph.
} */
int NO_TOKEN = -1;


/** /**
* Returns a label id for a label name. If the label doesn't exist prior to * Returns a label id for a label name. If the label doesn't exist prior to
* this call it gets created. * this call it gets created.
*/ */
int labelGetOrCreateForName( String labelName ) throws SomeException; int labelGetOrCreateForName( String labelName ) throws KernelException;


/** /**
* Returns a property key id for a property key. If the key doesn't exist prior to * Returns a property key id for a property key. If the key doesn't exist prior to
* this call it gets created. * this call it gets created.
*/ */
int propertyKeyGetOrCreateForName( String propertyKeyName ) throws SomeException; int propertyKeyGetOrCreateForName( String propertyKeyName ) throws KernelException;


int relationshipTypeGetOrCreateForName( String relationshipTypeName ) throws SomeException; int relationshipTypeGetOrCreateForName( String relationshipTypeName ) throws KernelException;


void labelCreateForName( String labelName, int id ) throws SomeException; void labelCreateForName( String labelName, int id ) throws KernelException;


void propertyKeyCreateForName( String propertyKeyName, int id ) throws SomeException; void propertyKeyCreateForName( String propertyKeyName, int id ) throws KernelException;


void relationshipTypeCreateForName( String relationshipTypeName, int id ) throws SomeException; void relationshipTypeCreateForName( String relationshipTypeName, int id ) throws KernelException;


/**
* Return the id of the provided label, or NO_TOKEN if the label isn't known to the graph.
*
* @param name The label name.
* @return the label id, or NO_TOKEN
*/
int nodeLabel( String name ); int nodeLabel( String name );


/**
* Return the id of the provided relationship type, or NO_TOKEN if the type isn't known to the graph.
*
* @param name The relationship type name.
* @return the relationship type id, or NO_TOKEN
*/
int relationshipType( String name );

/**
* Return the id of the provided property key, or NO_TOKEN if the property isn't known to the graph.
*
* @param name The property key name.
* @return the property key id, or NO_TOKEN
*/
int propertyKey( String name ); int propertyKey( String name );
} }
Expand Up @@ -26,6 +26,7 @@
import org.neo4j.function.Suppliers; import org.neo4j.function.Suppliers;
import org.neo4j.function.Suppliers.Lazy; import org.neo4j.function.Suppliers.Lazy;
import org.neo4j.internal.kernel.api.Token; import org.neo4j.internal.kernel.api.Token;
import org.neo4j.internal.kernel.api.exceptions.KernelException;
import org.neo4j.io.pagecache.PageCursor; import org.neo4j.io.pagecache.PageCursor;
import org.neo4j.kernel.api.ExplicitIndex; import org.neo4j.kernel.api.ExplicitIndex;
import org.neo4j.kernel.api.exceptions.explicitindex.ExplicitIndexNotFoundKernelException; import org.neo4j.kernel.api.exceptions.explicitindex.ExplicitIndexNotFoundKernelException;
Expand Down Expand Up @@ -144,37 +145,37 @@ public IndexDescriptor index( int label, int... properties )
} }


@Override @Override
public int labelGetOrCreateForName( String labelName ) throws SomeException public int labelGetOrCreateForName( String labelName ) throws KernelException
{ {
throw new UnsupportedOperationException( "not implemented" ); throw new UnsupportedOperationException( "not implemented" );
} }


@Override @Override
public int propertyKeyGetOrCreateForName( String propertyKeyName ) throws SomeException public int propertyKeyGetOrCreateForName( String propertyKeyName ) throws KernelException
{ {
throw new UnsupportedOperationException( "not implemented" ); throw new UnsupportedOperationException( "not implemented" );
} }


@Override @Override
public int relationshipTypeGetOrCreateForName( String relationshipTypeName ) throws SomeException public int relationshipTypeGetOrCreateForName( String relationshipTypeName ) throws KernelException
{ {
throw new UnsupportedOperationException( "not implemented" ); throw new UnsupportedOperationException( "not implemented" );
} }


@Override @Override
public void labelCreateForName( String labelName, int id ) throws SomeException public void labelCreateForName( String labelName, int id ) throws KernelException
{ {
throw new UnsupportedOperationException( "not implemented" ); throw new UnsupportedOperationException( "not implemented" );
} }


@Override @Override
public void propertyKeyCreateForName( String propertyKeyName, int id ) throws SomeException public void propertyKeyCreateForName( String propertyKeyName, int id ) throws KernelException
{ {
throw new UnsupportedOperationException( "not implemented" ); throw new UnsupportedOperationException( "not implemented" );
} }


@Override @Override
public void relationshipTypeCreateForName( String relationshipTypeName, int id ) throws SomeException public void relationshipTypeCreateForName( String relationshipTypeName, int id ) throws KernelException
{ {
throw new UnsupportedOperationException( "not implemented" ); throw new UnsupportedOperationException( "not implemented" );
} }
Expand All @@ -185,6 +186,12 @@ public int nodeLabel( String name )
return read.labelGetForName( name ); return read.labelGetForName( name );
} }


@Override
public int relationshipType( String name )
{
return read.relationshipTypeGetForName( name );
}

@Override @Override
public int propertyKey( String name ) public int propertyKey( String name )
{ {
Expand All @@ -194,37 +201,37 @@ public int propertyKey( String name )
@Override @Override
PageCursor nodePage( long reference ) PageCursor nodePage( long reference )
{ {
return nodeStore.openPageCursor( reference ); return nodeStore.openPageCursorForReading( reference );
} }


@Override @Override
PageCursor relationshipPage( long reference ) PageCursor relationshipPage( long reference )
{ {
return relationshipStore.openPageCursor( reference ); return relationshipStore.openPageCursorForReading( reference );
} }


@Override @Override
PageCursor groupPage( long reference ) PageCursor groupPage( long reference )
{ {
return groupStore.openPageCursor( reference ); return groupStore.openPageCursorForReading( reference );
} }


@Override @Override
PageCursor propertyPage( long reference ) PageCursor propertyPage( long reference )
{ {
return propertyStore.openPageCursor( reference ); return propertyStore.openPageCursorForReading( reference );
} }


@Override @Override
PageCursor stringPage( long reference ) PageCursor stringPage( long reference )
{ {
return propertyStore.getStringStore().openPageCursor( reference ); return propertyStore.getStringStore().openPageCursorForReading( reference );
} }


@Override @Override
PageCursor arrayPage( long reference ) PageCursor arrayPage( long reference )
{ {
return propertyStore.getArrayStore().openPageCursor( reference ); return propertyStore.getArrayStore().openPageCursorForReading( reference );
} }


@Override @Override
Expand Down
Expand Up @@ -54,7 +54,7 @@ public boolean acceptEntity( long reference, float score )
} }


@Override @Override
public int totalExpectedCursorSize() public int expectedTotalNumberOfResults()
{ {
return expectedSize; return expectedSize;
} }
Expand Down
Expand Up @@ -418,8 +418,7 @@ public final void futureRelationshipPropertyReferenceRead( long reference )
* <p> * <p>
* This function is its own inverse function. * This function is its own inverse function.
* *
* @param reference * @param reference the reference to invert.
* the reference to invert.
* @return the inverted reference. * @return the inverted reference.
*/ */
static long invertReference( long reference ) static long invertReference( long reference )
Expand Down
Expand Up @@ -55,7 +55,7 @@ public boolean acceptEntity( long reference, float score )
} }


@Override @Override
public int totalExpectedCursorSize() public int expectedTotalNumberOfResults()
{ {
return expectedSize; return expectedSize;
} }
Expand Down
Expand Up @@ -409,7 +409,7 @@ public boolean isInUse( long id )
/** /**
* DANGER: make sure to always close this cursor. * DANGER: make sure to always close this cursor.
*/ */
public PageCursor openPageCursor( long id ) public PageCursor openPageCursorForReading( long id )
{ {
try try
{ {
Expand Down

0 comments on commit df4c2b8

Please sign in to comment.