Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow fetching procedures et al by id
We spend a lot of time fetching procedures and functions from a hash map. This introduces the option of getting procedures and functions by id.
- Loading branch information
1 parent
99d7610
commit f9ca9f1
Showing
18 changed files
with
332 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
community/kernel-api/src/main/java/org/neo4j/internal/kernel/api/Procedures.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (c) 2002-2018 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.internal.kernel.api; | ||
|
||
import org.neo4j.internal.kernel.api.exceptions.ProcedureException; | ||
import org.neo4j.internal.kernel.api.procs.QualifiedName; | ||
import org.neo4j.internal.kernel.api.procs.UserAggregator; | ||
import org.neo4j.internal.kernel.api.procs.UserFunctionHandle; | ||
import org.neo4j.internal.kernel.api.security.AccessMode; | ||
import org.neo4j.values.AnyValue; | ||
|
||
public interface Procedures | ||
{ | ||
UserFunctionHandle functionGet( QualifiedName name ); | ||
|
||
UserFunctionHandle aggregationFunctionGet( QualifiedName name ); | ||
|
||
/** Invoke a read-only function by name | ||
* @param id the id of the function. | ||
* @param arguments the function arguments. | ||
* @throws ProcedureException if there was an exception thrown during function execution. | ||
*/ | ||
AnyValue functionCall( int id, AnyValue[] arguments ) throws ProcedureException; | ||
|
||
/** Invoke a read-only function by name, and set the transaction's access mode to | ||
* {@link AccessMode.Static#READ READ} for the duration of the function execution. | ||
* @param id the id of the function. | ||
* @param arguments the function arguments. | ||
* @throws ProcedureException if there was an exception thrown during function execution. | ||
*/ | ||
AnyValue functionCallOverride( int id, AnyValue[] arguments ) throws ProcedureException; | ||
|
||
/** | ||
* Create a read-only aggregation function by name | ||
* @param id the id of the function | ||
* @return the aggregation function | ||
* @throws ProcedureException | ||
*/ | ||
UserAggregator aggregationFunction( int id ) throws ProcedureException; | ||
|
||
/** Invoke a read-only aggregation function by name, and set the transaction's access mode to | ||
* {@link AccessMode.Static#READ READ} for the duration of the function execution. | ||
* @param id the id of the function. | ||
* @throws ProcedureException if there was an exception thrown during function execution. | ||
*/ | ||
UserAggregator aggregationFunctionOverride( int id ) throws ProcedureException; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,4 +122,6 @@ enum Type | |
* @return The cursor factory | ||
*/ | ||
CursorFactory cursors(); | ||
|
||
Procedures procedures(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
community/kernel-api/src/main/java/org/neo4j/internal/kernel/api/procs/UserAggregator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2002-2018 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.internal.kernel.api.procs; | ||
|
||
import org.neo4j.internal.kernel.api.exceptions.ProcedureException; | ||
|
||
public interface UserAggregator | ||
{ | ||
void update( Object[] input ) throws ProcedureException; | ||
|
||
Object result() throws ProcedureException; | ||
} |
43 changes: 43 additions & 0 deletions
43
...nity/kernel-api/src/main/java/org/neo4j/internal/kernel/api/procs/UserFunctionHandle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2002-2018 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.internal.kernel.api.procs; | ||
|
||
|
||
public class UserFunctionHandle | ||
{ | ||
private final UserFunctionSignature signature; | ||
private final int id; | ||
|
||
public UserFunctionHandle( UserFunctionSignature signature, int id ) | ||
{ | ||
this.signature = signature; | ||
this.id = id; | ||
} | ||
|
||
public UserFunctionSignature signature() | ||
{ | ||
return signature; | ||
} | ||
|
||
public int id() | ||
{ | ||
return id; | ||
} | ||
} |
Oops, something went wrong.