proj_name
stringclasses
131 values
relative_path
stringlengths
30
228
class_name
stringlengths
1
68
func_name
stringlengths
1
48
masked_class
stringlengths
78
9.82k
func_body
stringlengths
46
9.61k
len_input
int64
29
2.01k
len_output
int64
14
1.94k
total
int64
55
2.05k
relevant_context
stringlengths
0
38.4k
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/AdamicAdarAPI.java
AdamicAdarAPI
get
class AdamicAdarAPI extends API { @GET @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) public String get(@Context GraphManager manager, @PathParam("graph") String graph, @QueryParam("vertex") String current, @QueryParam("other") String o...
LOG.debug("Graph [{}] get adamic adar between '{}' and '{}' with " + "direction {}, edge label {}, max degree '{}' and limit '{}'", graph, current, other, direction, edgeLabel, maxDegree, limit); Id sourceId = VertexAPI.checkAndParseVertexId(curren...
174
253
427
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CountAPI.java
CountAPI
post
class CountAPI extends API { private static final Logger LOG = Log.logger(CountAPI.class); @POST @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) public String post(@Context GraphManager manager, @PathParam("graph") String graph, CountRequest request) {...
LOG.debug("Graph [{}] get count from '{}' with request {}", graph, request); E.checkArgumentNotNull(request.source, "The source of request can't be null"); Id sourceId = HugeVertex.getIdValue(request.source); E.checkArgumentNotNull(reque...
652
280
932
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CrosspointsAPI.java
CrosspointsAPI
get
class CrosspointsAPI extends API { private static final Logger LOG = Log.logger(CrosspointsAPI.class); @GET @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) public String get(@Context GraphManager manager, @PathParam("graph") String graph, @QueryParam("so...
LOG.debug("Graph [{}] get crosspoints with paths from '{}', to '{}' " + "with direction '{}', edge label '{}', max depth '{}', " + "max degree '{}', capacity '{}' and limit '{}'", graph, source, target, direction, edgeLabel, depth, maxDegr...
234
314
548
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CustomizedCrosspointsAPI.java
CustomizedCrosspointsAPI
pathPatterns
class CustomizedCrosspointsAPI extends API { private static final Logger LOG = Log.logger(CustomizedCrosspointsAPI.class); private static List<CustomizedCrosspointsTraverser.PathPattern> pathPatterns( HugeGraph graph, CrosspointsRequest request) {<FILL_FUNCTION_BODY>} @POST @Timed @Co...
int stepSize = request.pathPatterns.size(); List<CustomizedCrosspointsTraverser.PathPattern> pathPatterns = new ArrayList<>(stepSize); for (PathPattern pattern : request.pathPatterns) { CustomizedCrosspointsTraverser.PathPattern pathPattern = new CustomizedCrossp...
1,524
147
1,671
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/CustomizedPathsAPI.java
CustomizedPathsAPI
post
class CustomizedPathsAPI extends API { private static final Logger LOG = Log.logger(CustomizedPathsAPI.class); private static List<WeightedEdgeStep> step(HugeGraph graph, PathRequest request) { int stepSize = request.steps.size(); List<WeightedEdg...
E.checkArgumentNotNull(request, "The path request body can't be null"); E.checkArgumentNotNull(request.sources, "The sources of path request can't be null"); E.checkArgument(request.steps != null && !request.steps.isEmpty(), "The steps of p...
903
699
1,602
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java
EdgeExistenceAPI
get
class EdgeExistenceAPI extends TraverserAPI { private static final Logger LOG = Log.logger(EdgeExistenceAPI.class); private static final String DEFAULT_EMPTY = ""; @GET @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) @Operation(summary = "get edges from 'source' to 'target' vertex") public...
LOG.debug("Graph [{}] get edgeExistence with " + "source '{}', target '{}', edgeLabel '{}', sortValue '{}', limit '{}'", graph, source, target, edgeLabel, sortValues, limit); E.checkArgumentNotNull(source, "The source can't be null"); E.checkArgumentNotNull(...
212
233
445
<methods>public non-sealed void <init>() <variables>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgesAPI.java
EdgesAPI
shards
class EdgesAPI extends API { private static final Logger LOG = Log.logger(EdgesAPI.class); @GET @Timed @Compress @Produces(APPLICATION_JSON_WITH_CHARSET) public String list(@Context GraphManager manager, @PathParam("graph") String graph, @QueryPara...
LOG.debug("Graph [{}] get vertex shards with split size '{}'", graph, splitSize); HugeGraph g = graph(manager, graph); List<Shard> shards = g.metadata(HugeType.EDGE_OUT, "splits", splitSize); return manager.serializer(g).writeList("shards", shards);
644
94
738
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/FusiformSimilarityAPI.java
FusiformSimilarityAPI
post
class FusiformSimilarityAPI extends API { private static final Logger LOG = Log.logger(FusiformSimilarityAPI.class); @POST @Timed @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON_WITH_CHARSET) public String post(@Context GraphManager manager, @PathParam("graph") St...
E.checkArgumentNotNull(request, "The fusiform similarity " + "request body can't be null"); E.checkArgumentNotNull(request.sources, "The sources of fusiform similarity " + "request can't be null"); ...
639
822
1,461
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/JaccardSimilarityAPI.java
JaccardSimilarityAPI
post
class JaccardSimilarityAPI extends TraverserAPI { private static final Logger LOG = Log.logger(JaccardSimilarityAPI.class); @GET @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) public String get(@Context GraphManager manager, @PathParam("graph") String graph, ...
E.checkArgumentNotNull(request, "The request body can't be null"); E.checkArgumentNotNull(request.vertex, "The source vertex of request can't be null"); E.checkArgument(request.step != null, "The steps of request can't be null"); E....
693
376
1,069
<methods>public non-sealed void <init>() <variables>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/KneighborAPI.java
KneighborAPI
post
class KneighborAPI extends TraverserAPI { private static final Logger LOG = Log.logger(KneighborAPI.class); @GET @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) public String get(@Context GraphManager manager, @PathParam("graph") String graph, @QueryPara...
E.checkArgumentNotNull(request, "The request body can't be null"); E.checkArgumentNotNull(request.source, "The source of request can't be null"); E.checkArgument(request.steps != null, "The steps of request can't be null"); if (requ...
900
867
1,767
<methods>public non-sealed void <init>() <variables>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/NeighborRankAPI.java
NeighborRankAPI
neighborRank
class NeighborRankAPI extends API { private static final Logger LOG = Log.logger(NeighborRankAPI.class); @POST @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) public String neighborRank(@Context GraphManager manager, @PathParam("graph") String graph, ...
E.checkArgumentNotNull(request, "The rank request body can't be null"); E.checkArgumentNotNull(request.source, "The source of rank request can't be null"); E.checkArgument(request.steps != null && !request.steps.isEmpty(), "The steps of ran...
682
389
1,071
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PathsAPI.java
PathsAPI
post
class PathsAPI extends TraverserAPI { private static final Logger LOG = Log.logger(PathsAPI.class); @GET @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) public String get(@Context GraphManager manager, @PathParam("graph") String graph, @QueryParam("sourc...
E.checkArgumentNotNull(request, "The request body can't be null"); E.checkArgumentNotNull(request.sources, "The sources of request can't be null"); E.checkArgumentNotNull(request.targets, "The targets of request can't be null"); ...
924
729
1,653
<methods>public non-sealed void <init>() <variables>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/PersonalRankAPI.java
PersonalRankAPI
personalRank
class PersonalRankAPI extends API { private static final Logger LOG = Log.logger(PersonalRankAPI.class); private static final double DEFAULT_DIFF = 0.0001; private static final double DEFAULT_ALPHA = 0.85; private static final int DEFAULT_DEPTH = 5; @POST @Timed @Produces(APPLICATION_JSON...
E.checkArgumentNotNull(request, "The rank request body can't be null"); E.checkArgument(request.source != null, "The source vertex id of rank request can't be null"); E.checkArgument(request.label != null, "The edge label of rank request can't be ...
522
634
1,156
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/RaysAPI.java
RaysAPI
get
class RaysAPI extends API { private static final Logger LOG = Log.logger(RaysAPI.class); @GET @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) public String get(@Context GraphManager manager, @PathParam("graph") String graph, @QueryParam("source") String ...
LOG.debug("Graph [{}] get rays paths from '{}' with " + "direction '{}', edge label '{}', max depth '{}', " + "max degree '{}', capacity '{}' and limit '{}'", graph, sourceV, direction, edgeLabel, depth, maxDegree, capacity, limit); ...
262
484
746
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/ResourceAllocationAPI.java
ResourceAllocationAPI
create
class ResourceAllocationAPI extends API { @GET @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) public String create(@Context GraphManager manager, @PathParam("graph") String graph, @QueryParam("vertex") String current, @QueryPar...
LOG.debug("Graph [{}] get resource allocation between '{}' and '{}' " + "with direction {}, edge label {}, max degree '{}' and " + "limit '{}'", graph, current, other, direction, edgeLabel, maxDegree, limit); Id sourceId = VertexAPI.checkAndParseVe...
173
256
429
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/RingsAPI.java
RingsAPI
get
class RingsAPI extends API { private static final Logger LOG = Log.logger(RingsAPI.class); @GET @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) public String get(@Context GraphManager manager, @PathParam("graph") String graph, @QueryParam("source") Strin...
LOG.debug("Graph [{}] get rings paths reachable from '{}' with " + "direction '{}', edge label '{}', max depth '{}', " + "source in ring '{}', max degree '{}', capacity '{}', " + "limit '{}', with_vertex '{}' and with_edge '{}'", graph, so...
288
528
816
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/SameNeighborsAPI.java
SameNeighborsAPI
sameNeighbors
class SameNeighborsAPI extends API { private static final Logger LOG = Log.logger(SameNeighborsAPI.class); @GET @Timed @Produces(APPLICATION_JSON_WITH_CHARSET) public String get(@Context GraphManager manager, @PathParam("graph") String graph, @QueryParam...
LOG.debug("Graph [{}] get same neighbors among batch, '{}'", graph, request.toString()); ApiMeasurer measure = new ApiMeasurer(); Directions dir = Directions.convert(EdgeAPI.parseDirection(request.direction)); HugeGraph g = graph(manager, graph); SameNeighborTraverser traverse...
783
402
1,185
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/TemplatePathsAPI.java
TemplatePathsAPI
post
class TemplatePathsAPI extends TraverserAPI { private static final Logger LOG = Log.logger(TemplatePathsAPI.class); private static List<RepeatEdgeStep> steps(HugeGraph g, List<TemplatePathStep> steps) { List<RepeatEdgeStep> edgeSteps = new ArrayList<>(step...
E.checkArgumentNotNull(request, "The request body can't be null"); E.checkArgumentNotNull(request.sources, "The sources of request can't be null"); E.checkArgumentNotNull(request.targets, "The targets of request can't be null"); ...
730
663
1,393
<methods>public non-sealed void <init>() <variables>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/TraverserAPI.java
TraverserAPI
steps
class TraverserAPI extends API { protected static EdgeStep step(HugeGraph graph, Step step) { return new EdgeStep(graph, step.direction, step.labels, step.properties, step.maxDegree, step.skipDegree); } protected static Steps steps(HugeGraph graph, VESteps steps) {<FILL...
Map<String, Map<String, Object>> vSteps = new HashMap<>(); if (steps.vSteps != null) { for (VEStepEntity vStep : steps.vSteps) { vSteps.put(vStep.label, vStep.properties); } } Map<String, Map<String, Object>> eSteps = new HashMap<>(); if ...
662
198
860
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/Vertices.java
Vertices
vertices
class Vertices { @JsonProperty("ids") public Set<Object> ids; @JsonProperty("label") public String label; @JsonProperty("properties") public Map<String, Object> properties; public Iterator<Vertex> vertices(HugeGraph g) {<FILL_FUNCTION_BODY>} @Override public String toString() { ...
Map<String, Object> props = this.properties; E.checkArgument(!((this.ids == null || this.ids.isEmpty()) && (props == null || props.isEmpty()) && this.label == null), "No source vertices provided"); Iterator<Vertex> iterator; if (this.i...
145
451
596
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/VerticesAPI.java
VerticesAPI
list
class VerticesAPI extends API { private static final Logger LOG = Log.logger(VerticesAPI.class); @GET @Timed @Compress @Produces(APPLICATION_JSON_WITH_CHARSET) public String list(@Context GraphManager manager, @PathParam("graph") String graph, @Que...
LOG.debug("Graph [{}] get vertices by ids: {}", graph, stringIds); E.checkArgument(stringIds != null && !stringIds.isEmpty(), "The ids parameter can't be null or empty"); Object[] ids = new Id[stringIds.size()]; for (int i = 0; i < ids.length; i++) { ...
562
176
738
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
VariablesAPI
get
class VariablesAPI extends API { private static final Logger LOG = Log.logger(VariablesAPI.class); @PUT @Timed @Path("{key}") @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON_WITH_CHARSET) public Map<String, Object> update(@Context GraphManager manager, ...
LOG.debug("Graph [{}] get variable by key '{}'", graph, key); HugeGraph g = graph(manager, graph); Optional<?> object = g.variables().get(key); if (!object.isPresent()) { throw new NotFoundException(String.format( "Variable '%s' does not exist", key)); ...
597
109
706
<methods>public non-sealed void <init>() ,public static boolean checkAndParseAction(java.lang.String) ,public static R commit(org.apache.hugegraph.HugeGraph, Callable<R>) ,public static void commit(org.apache.hugegraph.HugeGraph, java.lang.Runnable) ,public static org.apache.hugegraph.HugeGraph graph(org.apache.hugegra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java
ConfigAuthenticator
authenticate
class ConfigAuthenticator implements HugeAuthenticator { public static final String KEY_USERNAME = CredentialGraphTokens.PROPERTY_USERNAME; public static final String KEY_PASSWORD = CredentialGraphTokens.PROPERTY_PASSWORD; private final Map<String, String> tokens; public ConfigAuthenticator() { ...
E.checkArgumentNotNull(username, "The username parameter can't be null"); E.checkArgumentNotNull(password, "The password parameter can't be null"); E.checkArgument(token == null, "The token must be null"); RolePermission rol...
533
187
720
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ContextGremlinServer.java
ContextGremlinServer
listenChanges
class ContextGremlinServer extends GremlinServer { private static final Logger LOG = Log.logger(ContextGremlinServer.class); private static final String G_PREFIX = "__g_"; private final EventHub eventHub; static { HugeGraphAuthProxy.setContext(Context.admin()); } public ContextGreml...
this.eventHub.listen(Events.GRAPH_CREATE, event -> { LOG.debug("GremlinServer accepts event '{}'", event.name()); event.checkArgs(HugeGraph.class); HugeGraph graph = (HugeGraph) event.args()[0]; this.injectGraph(graph); return null; }); ...
1,040
189
1,229
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/StandardAuthenticator.java
TokenSaslAuthenticator
decode
class TokenSaslAuthenticator implements SaslNegotiator { private static final byte NUL = 0; private String username; private String password; private String token; @Override public byte[] evaluateResponse(final byte[] clientResponse) throws AuthenticationException { ...
this.username = null; this.password = null; int end = bytes.length; for (int i = bytes.length - 1; i >= 0; i--) { if (bytes[i] != NUL) { continue; } if (this.password == null) { pas...
378
267
645
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/WsAndHttpBasicAuthHandler.java
HttpBasicAuthHandler
channelRead
class HttpBasicAuthHandler extends AbstractAuthenticationHandler { private final Base64.Decoder decoder = Base64.getUrlDecoder(); public HttpBasicAuthHandler(Authenticator authenticator) { super(authenticator); } @Override public void channelRead(Channe...
if (msg instanceof FullHttpMessage) { final FullHttpMessage request = (FullHttpMessage) msg; if (!request.headers().contains("Authorization")) { sendError(ctx, msg); return; } // strip off "Basic " from...
186
472
658
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsModule.java
TimerSerializer
serialize
class TimerSerializer extends StdSerializer<Timer> { private static final long serialVersionUID = 6283520188524929099L; private final String rateUnit; private final double rateFactor; private final String durationUnit; private final double durationFactor; private final ...
json.writeStartObject(); final Snapshot snapshot = timer.getSnapshot(); json.writeNumberField("count", timer.getCount()); json.writeNumberField("min", snapshot.getMin() * this.durationFactor); json.writeNumberField("me...
260
586
846
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/ServerReporter.java
ServerReporter
report
class ServerReporter extends ScheduledReporter { private static volatile ServerReporter instance = null; private SortedMap<String, Gauge<?>> gauges; private SortedMap<String, Counter> counters; private SortedMap<String, Histogram> histograms; private SortedMap<String, Meter> meters; private So...
this.gauges = (SortedMap) gauges; this.counters = counters; this.histograms = histograms; this.meters = meters; this.timers = timers;
681
61
742
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SlowQueryLog.java
SlowQueryLog
toString
class SlowQueryLog { public String rawQuery; public String method; public String path; public long executeTime; public long startTime; public long thresholdTime; public SlowQueryLog(String rawQuery, String method, String path, long executeTime, long startTime, ...
return "SlowQueryLog{executeTime=" + executeTime + ", startTime=" + startTime + ", rawQuery='" + rawQuery + '\'' + ", method='" + method + '\'' + ", threshold=" + thresholdTime + ", path='" + path + '\'' + '}';
174
84
258
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/metrics/SystemMetrics.java
SystemMetrics
getBasicMetrics
class SystemMetrics { private static final long MB = Bytes.MB; public Map<String, Map<String, Object>> metrics() { Map<String, Map<String, Object>> metrics = new LinkedHashMap<>(); metrics.put("basic", this.getBasicMetrics()); metrics.put("heap", this.getHeapMetrics()); metrics...
Map<String, Object> metrics = new LinkedHashMap<>(); Runtime runtime = Runtime.getRuntime(); // Heap allocated memory (measured in bytes) long total = runtime.totalMemory(); // Heap free memory long free = runtime.freeMemory(); long used = total - free; ...
1,011
231
1,242
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherPlugin.java
CypherPlugin
getDeclaredPublicMethods
class CypherPlugin implements GremlinPlugin { private static final ImportCustomizer IMPORTS = DefaultImportCustomizer.build() .addClassImports(CustomPredicate.class) .addMethodImports( getDe...
Method[] declaredMethods = klass.getDeclaredMethods(); return Stream.of(declaredMethods) .filter(method -> Modifier.isPublic(method.getModifiers())) .collect(Collectors.toList());
263
60
323
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/rpc/RpcClientProviderWithAuth.java
RpcClientProviderWithAuth
authManager
class RpcClientProviderWithAuth extends RpcClientProvider { private final RpcConsumerConfig authConsumerConfig; public RpcClientProviderWithAuth(HugeConfig config) { super(config); String authUrl = config.get(ServerOptions.AUTH_REMOTE_URL); this.authConsumerConfig = StringUtils.isNotB...
E.checkArgument(this.authConsumerConfig != null, "RpcClient is not enabled, please config option '%s'", ServerOptions.AUTH_REMOTE_URL.name()); return this.authConsumerConfig.serviceProxy(AuthManager.class);
137
70
207
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/ApplicationConfig.java
GraphManagerFactory
provide
class GraphManagerFactory extends AbstractBinder implements Factory<GraphManager> { private GraphManager manager = null; public GraphManagerFactory(HugeConfig conf, EventHub hub) { register(new ApplicationEventListener() { private final ApplicationEvent.Type eventInited = ...
if (this.manager == null) { String message = "Please wait for the server to initialize"; throw new MultiException(new HugeException(message), false); } return this.manager;
385
54
439
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/server/RestServer.java
RestServer
calcMaxWriteThreads
class RestServer { private static final Logger LOG = Log.logger(RestServer.class); private final HugeConfig conf; private final EventHub eventHub; private HttpServer httpServer = null; public RestServer(HugeConfig conf, EventHub hub) { this.conf = conf; this.eventHub = hub; } ...
int maxWriteThreads = this.conf.get(ServerOptions.MAX_WRITE_THREADS); if (maxWriteThreads > 0) { // Use the value of MAX_WRITE_THREADS option if it's not 0 return; } assert maxWriteThreads == 0; int maxWriteRatio = this.conf.get(ServerOptions.MAX_WRITE_...
1,448
431
1,879
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-cassandra/src/main/java/com/datastax/driver/core/querybuilder/Clauses.java
BinClause
appendTo
class BinClause extends Clause { private final Clause left; private final String op; private final Clause right; public BinClause(Clause left, String op, Clause right) { this.left = left; this.op = op; this.right = right; } @Override...
// NOTE: '(? AND ?)' is not supported by Cassandra: // SyntaxError: line xx missing ')' at 'AND' // sb.append("("); this.left.appendTo(sb, variables, codecRegistry); sb.append(" "); sb.append(this.op); sb.append(" "); this....
209
113
322
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraEntryIterator.java
CassandraEntryIterator
fetch
class CassandraEntryIterator extends BackendEntryIterator { private final ResultSet results; private final Iterator<Row> rows; private final BiFunction<BackendEntry, Row, BackendEntry> merger; private int fetchedPageSize; private long expected; private BackendEntry next; public CassandraE...
assert this.current == null; if (this.next != null) { this.current = this.next; this.next = null; } while (this.expected > 0L && this.rows.hasNext()) { // Limit expected count, due to rows.hasNext() will fetch next page this.expected--; ...
1,253
311
1,564
<methods>public void <init>(org.apache.hugegraph.backend.query.Query) ,public static final void checkInterrupted() ,public boolean hasNext() ,public transient java.lang.Object metadata(java.lang.String, java.lang.Object[]) ,public org.apache.hugegraph.backend.store.BackendEntry next() <variables>public static final lon...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraFeatures.java
CassandraFeatures
supportsTransaction
class CassandraFeatures implements BackendFeatures { @Override public boolean supportsScanToken() { return true; } @Override public boolean supportsScanKeyPrefix() { return false; } @Override public boolean supportsScanKeyRange() { return false; } @Ove...
// Cassandra support tx(atomicity level) with batch API // https://docs.datastax.com/en/cassandra/2.1/cassandra/dml/dml_atomicity_c.html return true;
519
60
579
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraOptions.java
CassandraOptions
instance
class CassandraOptions extends OptionHolder { private CassandraOptions() { super(); } private static volatile CassandraOptions instance; public static synchronized CassandraOptions instance() {<FILL_FUNCTION_BODY>} public static final ConfigOption<String> CASSANDRA_HOST = new...
if (instance == null) { instance = new CassandraOptions(); instance.registerOptions(); } return instance;
880
36
916
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSerializer.java
CassandraSerializer
readUserdata
class CassandraSerializer extends TableSerializer { public CassandraSerializer(HugeConfig config) { super(config); } @Override public CassandraBackendEntry newBackendEntry(HugeType type, Id id) { return new CassandraBackendEntry(type, id); } @Override protected TableBacken...
assert entry instanceof CassandraBackendEntry; // Parse all user data of a schema element Map<String, String> userdata = entry.column(HugeKeys.USER_DATA); for (Map.Entry<String, String> e : userdata.entrySet()) { String key = e.getKey(); Object value = JsonUtil.f...
1,495
113
1,608
<methods>public void <init>(HugeConfig) ,public org.apache.hugegraph.backend.serializer.TableBackendEntry newBackendEntry(org.apache.hugegraph.type.HugeType, org.apache.hugegraph.backend.id.Id) ,public org.apache.hugegraph.structure.HugeEdge readEdge(org.apache.hugegraph.HugeGraph, org.apache.hugegraph.backend.store.Ba...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraSessionPool.java
CassandraSessionPool
open
class CassandraSessionPool extends BackendSessionPool { private static final int SECOND = 1000; private Cluster cluster; private final String keyspace; public CassandraSessionPool(HugeConfig config, String keyspace, String store) { super(config, keyspace + "/" ...
if (this.opened()) { throw new BackendException("Please close the old SessionPool " + "before opening a new one"); } HugeConfig config = this.config(); // Contact options String hosts = config.get(CassandraOptions.CASSANDRA_HOS...
1,348
483
1,831
<methods>public void <init>(HugeConfig, java.lang.String) ,public boolean close() ,public boolean closed() ,public HugeConfig config() ,public void forceResetSessions() ,public final org.apache.hugegraph.backend.store.BackendSession getOrNewSession() ,public abstract void open() throws java.lang.Exception,public abstra...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraShard.java
SplitCallable
call
class SplitCallable implements Callable<List<Shard>> { private final TokenRange tokenRange; private final long splitPartitions; private final long splitSize; public SplitCallable(TokenRange tokenRange, long splitPartitions, long splitSize) { if ...
ArrayList<Shard> splits = new ArrayList<>(); Map<TokenRange, Long> subSplits = getSubSplits( this.tokenRange, this.splitPartitions, this.splitSize); for (Map.Entry<TokenRange, Long> entry : subSplits.entrySet()) { ...
273
229
502
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraStoreProvider.java
CassandraStoreProvider
driverVersion
class CassandraStoreProvider extends AbstractBackendStoreProvider { protected String keyspace() { return this.graph().toLowerCase(); } @Override protected BackendStore newSchemaStore(HugeConfig config, String store) { return new CassandraSchemaStore(this, this.keyspace(), store); }...
/* * Versions history: * [1.0] HugeGraph-1328: supports backend table version checking * [1.1] HugeGraph-1322: add support for full-text search * [1.2] #296: support range sortKey feature * [1.3] #455: fix scylladb backend doesn't support label query in page ...
220
328
548
<methods>public non-sealed void <init>() ,public void clear() throws org.apache.hugegraph.backend.BackendException,public void close() throws org.apache.hugegraph.backend.BackendException,public void createSnapshot() ,public java.lang.String graph() ,public void init() ,public boolean initialized() ,public void listen(...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-cassandra/src/main/java/org/apache/hugegraph/backend/store/cassandra/CassandraTables.java
VertexLabel
init
class VertexLabel extends CassandraTable { public static final String TABLE = HugeType.VERTEX_LABEL.string(); public VertexLabel() { super(TABLE); } @Override public void init(CassandraSessionPool.Session session) {<FILL_FUNCTION_BODY>} }
ImmutableMap<HugeKeys, DataType> pkeys = ImmutableMap.of( HugeKeys.ID, TYPE_SL ); ImmutableMap<HugeKeys, DataType> ckeys = ImmutableMap.of(); ImmutableMap<HugeKeys, DataType> columns = ImmutableMap .<HugeKeys, DataType>builder() ...
87
361
448
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeException.java
HugeException
rootCause
class HugeException extends RuntimeException { private static final long serialVersionUID = -8711375282196157058L; public HugeException(String message) { super(message); } public HugeException(String message, Throwable cause) { super(message, cause); } public HugeException(St...
Throwable cause = e; while (cause.getCause() != null) { cause = cause.getCause(); } return cause;
286
45
331
<methods>public void <init>() ,public void <init>(java.lang.String) ,public void <init>(java.lang.Throwable) ,public void <init>(java.lang.String, java.lang.Throwable) <variables>static final long serialVersionUID
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java
HugeFactory
open
class HugeFactory { private static final Logger LOG = Log.logger(HugeFactory.class); private static final Thread SHUT_DOWN_HOOK = new Thread(() -> { LOG.info("HugeGraph is shutting down"); HugeFactory.shutdown(30L, true); }, "hugegraph-shutdown"); static { SerialEnum.registerI...
SecurityManager sm = System.getSecurityManager(); if (sm != null) { // Not allowed to read file via Gremlin when SecurityManager enabled String configFileName; File configFile = config.file(); if (configFile == null) { configFileName = con...
1,015
278
1,293
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnalyzerFactory.java
AnalyzerFactory
analyzer
class AnalyzerFactory { private static final Map<String, Class<? extends Analyzer>> ANALYZERS; static { ANALYZERS = new ConcurrentHashMap<>(); } public static Analyzer analyzer(String name, String mode) {<FILL_FUNCTION_BODY>} private static Analyzer customizedAnalyzer(String name, String...
name = name.toLowerCase(); switch (name) { case "ansj": return new AnsjAnalyzer(mode); case "hanlp": return new HanLPAnalyzer(mode); case "smartcn": return new SmartCNAnalyzer(mode); case "jieba": ...
500
175
675
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/AnsjAnalyzer.java
AnsjAnalyzer
segment
class AnsjAnalyzer implements Analyzer { public static final List<String> SUPPORT_MODES = ImmutableList.of( "BaseAnalysis", "IndexAnalysis", "ToAnalysis", "NlpAnalysis" ); private final String analysis; public AnsjAnalyzer(String mode) { if (!SU...
Result terms; switch (this.analysis) { case "BaseAnalysis": terms = BaseAnalysis.parse(text); break; case "ToAnalysis": terms = ToAnalysis.parse(text); break; case "NlpAnalysis": terms = ...
191
195
386
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/HanLPAnalyzer.java
HanLPAnalyzer
segment
class HanLPAnalyzer implements Analyzer { public static final List<String> SUPPORT_MODES = ImmutableList.<String>builder() .add("standard") .add("nlp") .add("index") .add("nShort") ...
List<Term> terms; switch (this.tokenizer) { case "standard": terms = StandardTokenizer.segment(text); break; case "nlp": terms = NLPTokenizer.segment(text); break; case "index": terms = I...
324
260
584
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/IKAnalyzer.java
IKAnalyzer
segment
class IKAnalyzer implements Analyzer { public static final List<String> SUPPORT_MODES = ImmutableList.of( "smart", "max_word" ); private final boolean smartSegMode; public IKAnalyzer(String mode) { if (!SUPPORT_MODES.contains(mode)) { throw new ConfigExcept...
Set<String> result = InsertionOrderUtil.newSet(); IKSegmenter ik = new IKSegmenter(new StringReader(text), this.smartSegMode); try { Lexeme word; while ((word = ik.next()) != null) { result.add(word.getLexemeText()...
192
134
326
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JcsegAnalyzer.java
JcsegAnalyzer
segment
class JcsegAnalyzer implements Analyzer { public static final List<String> SUPPORT_MODES = ImmutableList.of( "Simple", "Complex" ); private static final SegmenterConfig CONFIG = new SegmenterConfig(); private static final ADictionary DIC = DictionaryFactory.createDefaultDiction...
Set<String> result = InsertionOrderUtil.newSet(); try { ISegment segmentor = this.type.factory.create(CONFIG, DIC); segmentor.reset(new StringReader(text)); IWord word; while ((word = segmentor.next()) != null) { result.add(word.getValue(...
259
133
392
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/JiebaAnalyzer.java
JiebaAnalyzer
segment
class JiebaAnalyzer implements Analyzer { public static final List<String> SUPPORT_MODES = ImmutableList.of( "SEARCH", "INDEX" ); private static final JiebaSegmenter JIEBA_SEGMENTER = new JiebaSegmenter(); private final JiebaSegmenter.SegMode segMode; public JiebaAnalyzer...
Set<String> result = InsertionOrderUtil.newSet(); for (SegToken token : JIEBA_SEGMENTER.process(text, this.segMode)) { result.add(token.word); } return result;
225
65
290
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/MMSeg4JAnalyzer.java
MMSeg4JAnalyzer
segment
class MMSeg4JAnalyzer implements Analyzer { public static final List<String> SUPPORT_MODES = ImmutableList.of( "Simple", "Complex", "MaxWord" ); private static final Dictionary DIC = Dictionary.getInstance(); private final Seg seg; public MMSeg4JAnalyzer(Strin...
Set<String> result = InsertionOrderUtil.newSet(); MMSeg mmSeg = new MMSeg(new StringReader(text), this.seg); try { Word word; while ((word = mmSeg.next()) != null) { result.add(word.getString()); } } catch (Exception e) { t...
320
124
444
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/analyzer/SmartCNAnalyzer.java
SmartCNAnalyzer
segment
class SmartCNAnalyzer implements Analyzer { private static final SmartChineseAnalyzer ANALYZER = new SmartChineseAnalyzer(); public SmartCNAnalyzer(String mode) { // pass } @Override public Set<String> segment(String text) {<FILL_FUNCTION_BODY>} }
Set<String> result = InsertionOrderUtil.newSet(); Reader reader = new StringReader(text); try (TokenStream tokenStream = ANALYZER.tokenStream("text", reader)) { tokenStream.reset(); CharTermAttribute term; while (tokenStream.incrementToken()) { ...
88
150
238
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/EntityManager.java
EntityManager
delete
class EntityManager<T extends Entity> { private final HugeGraphParams graph; private final String label; private final Function<Vertex, T> deser; private final ThreadLocal<Boolean> autoCommit = new ThreadLocal<>(); private static final long NO_LIMIT = -1L; public EntityManager(HugeGraphParams...
T entity = null; Iterator<Vertex> vertices = this.tx().queryVertices(id); if (vertices.hasNext()) { HugeVertex vertex = (HugeVertex) vertices.next(); entity = this.deser.apply(vertex); this.tx().removeVertex(vertex); this.commitOrRollback(); ...
1,325
108
1,433
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeAccess.java
HugeAccess
property
class HugeAccess extends Relationship { private static final long serialVersionUID = -7644007602408729385L; private final Id group; private final Id target; private HugePermission permission; private String description; public HugeAccess(Id group, Id target) { this(group, target, null...
if (super.property(key, value)) { return true; } switch (key) { case P.PERMISSION: this.permission = HugePermission.fromCode((Byte) value); break; case P.DESCRIPTION: this.description = (String) value; ...
1,350
113
1,463
<methods>public non-sealed void <init>() ,public static T fromEdge(Edge, T) ,public java.lang.String idString() ,public abstract org.apache.hugegraph.backend.id.Id source() ,public abstract java.lang.String sourceLabel() ,public abstract org.apache.hugegraph.backend.id.Id target() ,public abstract java.lang.String targ...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeBelong.java
HugeBelong
property
class HugeBelong extends Relationship { private static final long serialVersionUID = -7242751631755533423L; private final Id user; private final Id group; private String description; public HugeBelong(Id user, Id group) { this.user = user; this.group = group; this.descript...
if (super.property(key, value)) { return true; } if (key.equals(P.DESCRIPTION)) { this.description = (String) value; } else { throw new AssertionError("Unsupported key: " + key); } return true;
1,110
79
1,189
<methods>public non-sealed void <init>() ,public static T fromEdge(Edge, T) ,public java.lang.String idString() ,public abstract org.apache.hugegraph.backend.id.Id source() ,public abstract java.lang.String sourceLabel() ,public abstract org.apache.hugegraph.backend.id.Id target() ,public abstract java.lang.String targ...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeGroup.java
HugeGroup
fromVertex
class HugeGroup extends Entity { private static final long serialVersionUID = 2330399818352242686L; private String name; private String description; public HugeGroup(String name) { this(null, name); } public HugeGroup(Id id) { this(id, null); } public HugeGroup(Id id...
HugeGroup group = new HugeGroup((Id) vertex.id()); return fromVertex(vertex, group);
1,167
31
1,198
<methods>public non-sealed void <init>() ,public static T fromVertex(Vertex, T) ,public java.lang.String idString() <variables>private static final long serialVersionUID
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeTarget.java
HugeTarget
asArray
class HugeTarget extends Entity { private static final long serialVersionUID = -3361487778656878418L; private String name; private String graph; private String url; private List<HugeResource> resources; private static final List<HugeResource> EMPTY = ImmutableList.of(); public HugeTarget...
E.checkState(this.name != null, "Target name can't be null"); E.checkState(this.url != null, "Target url can't be null"); List<Object> list = new ArrayList<>(16); list.add(T.label); list.add(P.TARGET); list.add(P.NAME); list.add(this.name); list.add(P...
1,570
215
1,785
<methods>public non-sealed void <init>() ,public static T fromVertex(Vertex, T) ,public java.lang.String idString() <variables>private static final long serialVersionUID
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/HugeUser.java
HugeUser
property
class HugeUser extends Entity { private static final long serialVersionUID = -8951193710873772717L; private String name; private String password; private String phone; private String email; private String avatar; private String description; // This field is just for cache private R...
if (super.property(key, value)) { return true; } switch (key) { case P.NAME: this.name = (String) value; break; case P.PASSWORD: this.password = (String) value; break; case P.PHONE: ...
1,697
176
1,873
<methods>public non-sealed void <init>() ,public static T fromVertex(Vertex, T) ,public java.lang.String idString() <variables>private static final long serialVersionUID
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RelationshipManager.java
RelationshipManager
commitOrRollback
class RelationshipManager<T extends Relationship> { private final HugeGraphParams graph; private final String label; private final Function<Edge, T> deser; private final ThreadLocal<Boolean> autoCommit = new ThreadLocal<>(); private static final long NO_LIMIT = -1L; public RelationshipManager...
Boolean autoCommit = this.autoCommit.get(); if (autoCommit != null && !autoCommit) { return; } this.tx().commitOrRollback();
1,773
54
1,827
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/ResourceObject.java
ResourceObject
of
class ResourceObject<V> { private final String graph; private final ResourceType type; private final V operated; public ResourceObject(String graph, ResourceType type, V operated) { E.checkNotNull(graph, "graph"); E.checkNotNull(type, "type"); E.checkNotNull(operated, "operated...
ResourceType resType = ResourceType.from(elem.type()); return new ResourceObject<>(graph, resType, elem);
536
34
570
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/RolePermission.java
RolePermission
contains
class RolePermission { public static final RolePermission NONE = RolePermission.role( "none", HugePermission.NONE); public static final RolePermission ADMIN = RolePermission.role( "admin", HugePermission.ANY); static { SimpleModule module = new SimpleModule(); modu...
for (Map.Entry<String, Map<HugePermission, List<HugeResource>>> e1 : other.roles.entrySet()) { String g = e1.getKey(); Map<HugePermission, List<HugeResource>> perms = this.roles.get(g); if (perms == null) { return false; } ...
1,347
256
1,603
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/SchemaDefine.java
AuthElement
asMap
class AuthElement implements Serializable { private static final long serialVersionUID = 8746691160192814973L; protected static final String CREATE = "create"; protected static final String UPDATE = "update"; protected static final String CREATOR = "creator"; protected Id id; ...
E.checkState(this.create != null, "Property %s time can't be null", CREATE); E.checkState(this.update != null, "Property %s time can't be null", UPDATE); E.checkState(this.creator != null, "Property %s can't ...
781
208
989
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/TokenGenerator.java
TokenGenerator
verify
class TokenGenerator { private final SecretKey key; public TokenGenerator(HugeConfig config) { String secretKey = config.get(AuthOptions.AUTH_TOKEN_SECRET); this.key = Keys.hmacShaKeyFor(secretKey.getBytes(StandardCharsets.UTF_8)); } public String create(Map<String, ?> payload, long e...
try { Jws<Claims> claimsJws = Jwts.parserBuilder() .setSigningKey(key) .build() .parseClaimsJws(token); return claimsJws.getBody(); } catch (ExpiredJwtExceptio...
200
120
320
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/LocalCounter.java
LocalCounter
nextId
class LocalCounter { private final Map<HugeType, AtomicLong> counters; public LocalCounter() { this.counters = new ConcurrentHashMap<>(); } public synchronized Id nextId(HugeType type) {<FILL_FUNCTION_BODY>} public long getCounter(HugeType type) { AtomicLong counter = this.counte...
AtomicLong counter = this.counters.get(type); if (counter == null) { counter = new AtomicLong(0); AtomicLong previous = this.counters.putIfAbsent(type, counter); if (previous != null) { counter = previous; } } return IdGene...
344
97
441
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/AbstractCache.java
AbstractCache
tick
class AbstractCache<K, V> implements Cache<K, V> { public static final int MB = 1024 * 1024; public static final int DEFAULT_SIZE = 1 * MB; public static final int MAX_INIT_CAP = 100 * MB; protected static final Logger LOG = Log.logger(AbstractCache.class); // The unit of expired time is ms p...
long expireTime = this.expire; if (expireTime <= 0) { return 0L; } int expireItems = 0; long current = now(); for (Iterator<CacheNode<K, V>> it = this.nodes(); it.hasNext(); ) { CacheNode<K, V> node = it.next(); if (current - node.tim...
1,771
213
1,984
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CacheManager.java
CacheManager
cache
class CacheManager { private static final Logger LOG = Log.logger(CacheManager.class); private static final CacheManager INSTANCE = new CacheManager(); // Check the cache expiration every 30s by default private static final long TIMER_TICK_PERIOD = 30; // Log if tick cost time > 1000ms privat...
if (!this.caches.containsKey(name)) { this.caches.putIfAbsent(name, new RamCache(capacity)); LOG.info("Init RamCache for '{}' with capacity {}", name, capacity); } @SuppressWarnings("unchecked") Cache<Id, V> cache = (Cache<Id, V>) this.caches...
1,210
136
1,346
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedBackendStore.java
CachedBackendStore
query
class CachedBackendStore implements BackendStore { private BackendStore store = null; private Cache<Id, Object> cache = null; public CachedBackendStore(BackendStore store) { this.store = store; this.cache = CacheManager.instance().cache("store-" + store()); // Set expire 30s ...
if (query.empty()) { return this.store.query(query); } QueryId id = new QueryId(query); Object result = this.cache.get(id); if (result != null) { return (Iterator<BackendEntry>) result; } else { Iterator<BackendEntry> rs = this.store....
1,200
135
1,335
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedSchemaTransaction.java
SchemaCaches
set
class SchemaCaches<V extends SchemaElement> { private final int size; private final IntObjectMap<V> pks; private final IntObjectMap<V> vls; private final IntObjectMap<V> els; private final IntObjectMap<V> ils; private final CachedTypes cachedTypes; public Sche...
assert id.number(); long longId = id.asLong(); if (longId <= 0L) { assert false : id; return; } int key = (int) longId; if (key >= this.size) { return; } this.setValue(type, ...
842
89
931
<methods>public void <init>(org.apache.hugegraph.HugeGraphParams, org.apache.hugegraph.backend.store.BackendStore) ,public void addEdgeLabel(org.apache.hugegraph.schema.EdgeLabel) ,public void addIndexLabel(org.apache.hugegraph.schema.SchemaLabel, org.apache.hugegraph.schema.IndexLabel) ,public org.apache.hugegraph.bac...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/LevelCache.java
LevelCache
access
class LevelCache extends AbstractCache<Id, Object> { // For multi-layer caches private final AbstractCache<Id, Object>[] caches; @SuppressWarnings("unchecked") public LevelCache(AbstractCache<Id, Object> lavel1, AbstractCache<Id, Object> lavel2) { super(lavel2.capacity())...
for (AbstractCache<Id, Object> cache : this.caches) { // Priority access to the previous level Object value = cache.access(id); if (value != null) { return value; } } return null;
674
69
743
<methods>public void <init>() ,public void <init>(long) ,public T attachment(T) ,public T attachment() ,public final long capacity() ,public boolean enableMetrics(boolean) ,public void expire(long) ,public final long expire() ,public java.lang.Object get(org.apache.hugegraph.backend.id.Id) ,public java.lang.Object getO...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdGenerator.java
UuidId
fromBytes
class UuidId implements Id { private final UUID uuid; public UuidId(String string) { this(StringEncoding.uuid(string)); } public UuidId(byte[] bytes) { this(fromBytes(bytes)); } public UuidId(UUID uuid) { E.checkArgument(uuid != nul...
E.checkArgument(bytes != null, "The UUID can't be null"); BytesBuffer buffer = BytesBuffer.wrap(bytes); long high = buffer.readLong(); long low = buffer.readLong(); return new UUID(high, low);
533
69
602
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdUtil.java
IdUtil
unescape
class IdUtil { public static String writeStoredString(Id id) { String idString; switch (id.type()) { case LONG: case STRING: case UUID: idString = IdGenerator.asStoredString(id); break; case EDGE: idStri...
/* * Note that the `splitter`/`escape` maybe special characters in regular * expressions, but this is a frequently called method, for faster * execution, we forbid the use of special characters as delimiter * or escape sign. * * The `limit` param -1 in spli...
898
176
1,074
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SnowflakeIdGenerator.java
SnowflakeIdGenerator
instance
class SnowflakeIdGenerator extends IdGenerator { private static final Logger LOG = Log.logger(SnowflakeIdGenerator.class); private static final Map<String, SnowflakeIdGenerator> INSTANCES = new ConcurrentHashMap<>(); private final boolean forceString; private final IdWorker idWorker; ...
String graphName = graph.name(); SnowflakeIdGenerator generator = INSTANCES.get(graphName); E.checkState(generator != null, "SnowflakeIdGenerator of graph '%s' is not initialized", graphName); return generator;
1,316
73
1,389
<methods>public non-sealed void <init>() ,public static java.lang.String asStoredString(org.apache.hugegraph.backend.id.Id) ,public abstract org.apache.hugegraph.backend.id.Id generate(org.apache.hugegraph.structure.HugeVertex) ,public static org.apache.hugegraph.backend.id.Id.IdType idType(org.apache.hugegraph.backend...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/SplicingIdGenerator.java
SplicingIdGenerator
instance
class SplicingIdGenerator extends IdGenerator { private static volatile SplicingIdGenerator instance; public static SplicingIdGenerator instance() {<FILL_FUNCTION_BODY>} /* * The following defines can't be java regex special characters: * "\^$.|?*+()[{" * See: http://www.regular-expression...
if (instance == null) { synchronized (SplicingIdGenerator.class) { if (instance == null) { instance = new SplicingIdGenerator(); } } } return instance;
1,055
60
1,115
<methods>public non-sealed void <init>() ,public static java.lang.String asStoredString(org.apache.hugegraph.backend.id.Id) ,public abstract org.apache.hugegraph.backend.id.Id generate(org.apache.hugegraph.structure.HugeVertex) ,public static org.apache.hugegraph.backend.id.Id.IdType idType(org.apache.hugegraph.backend...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/IdHolder.java
BatchIdHolder
fetchNext
class BatchIdHolder extends IdHolder implements CIter<IdHolder> { private final Iterator<BackendEntry> entries; private final Function<Long, Set<Id>> fetcher; private long count; private PageIds currentBatch; public BatchIdHolder(ConditionQuery query, ...
E.checkArgument(page == null, "Not support page parameter by BatchIdHolder"); E.checkArgument(batchSize >= 0L, "Invalid batch size value: %s", batchSize); if (this.currentBatch != null) { return this.getFromCur...
773
266
1,039
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/IdHolderList.java
IdHolderList
empty
class IdHolderList extends ArrayList<IdHolder> { private static final IdHolderList EMPTY_P = new IdHolderList(true); private static final IdHolderList EMPTY_NP = new IdHolderList(false); private static final long serialVersionUID = -738694176552424990L; private final boolean paging; public stati...
IdHolderList empty = paging ? EMPTY_P : EMPTY_NP; empty.clear(); return empty;
298
36
334
<methods>public void <init>() ,public void <init>(int) ,public void <init>(Collection<? extends org.apache.hugegraph.backend.page.IdHolder>) ,public boolean add(org.apache.hugegraph.backend.page.IdHolder) ,public void add(int, org.apache.hugegraph.backend.page.IdHolder) ,public boolean addAll(Collection<? extends org.a...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageEntryIterator.java
PageEntryIterator
parsePageInfo
class PageEntryIterator<R> implements CIter<R> { private final QueryList<R> queries; private final long pageSize; private final PageInfo pageInfo; private final QueryResults<R> queryResults; // for upper layer private QueryList.PageResults<R> pageResults; private long remaining; public Pa...
String page = this.queries.parent().pageWithoutCheck(); PageInfo pageInfo = PageInfo.fromString(page); E.checkState(pageInfo.offset() < this.queries.total(), "Invalid page '%s' with an offset '%s' exceeds " + "the size of IdHolderList", page, pageInfo.o...
779
94
873
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageIds.java
PageIds
page
class PageIds { public static final PageIds EMPTY = new PageIds(ImmutableSet.of(), PageState.EMPTY); private final Set<Id> ids; private final PageState pageState; public PageIds(Set<Id> ids, PageState pageState) { this.ids = ids; thi...
if (this.pageState == null) { return null; } return this.pageState.toString();
185
33
218
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageInfo.java
PageInfo
fromBytes
class PageInfo { public static final String PAGE = "page"; public static final String PAGE_NONE = ""; private int offset; private String page; public PageInfo(int offset, String page) { E.checkArgument(offset >= 0, "The offset must be >= 0"); E.checkNotNull(page, "page"); ...
if (bytes.length == 0) { // The first page return new PageInfo(0, PAGE_NONE); } try { BytesBuffer buffer = BytesBuffer.wrap(bytes); int offset = buffer.readInt(); byte[] pageState = buffer.readBytes(); String page = PageSta...
617
146
763
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/PageState.java
PageState
fromString
class PageState { public static final byte[] EMPTY_BYTES = new byte[0]; public static final PageState EMPTY = new PageState(EMPTY_BYTES, 0, 0); public static final char SPACE = ' '; public static final char PLUS = '+'; private final byte[] position; private final int offset; private final ...
E.checkNotNull(page, "page"); /* * URLDecoder will auto decode '+' to space in url due to the request * of HTML4, so we choose to replace the space to '+' after getting it * More details refer to #1437 */ page = page.replace(SPACE, PLUS); return fromB...
628
100
728
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/QueryList.java
IndexQuery
updateOffsetIfNeeded
class IndexQuery implements FlattenQuery<R> { // One IdHolder each sub-query private final IdHolderList holders; // Fetching ids size each time, default 100 private final long batchSize; public IndexQuery(IdHolderList holders, long batchSize) { this.holders = holder...
Query parent = parent(); assert parent instanceof ConditionQuery; OptimizedType optimized = ((ConditionQuery) parent).optimized(); if (optimized == OptimizedType.INDEX_FILTER) { return; } // Others sub-query may update parent offse...
1,041
85
1,126
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/page/SortByCountIdHolderList.java
SortByCountIdHolderList
add
class SortByCountIdHolderList extends IdHolderList { private static final long serialVersionUID = -7779357582250824558L; private final List<IdHolder> mergedHolders; public SortByCountIdHolderList(boolean paging) { super(paging); this.mergedHolders = new ArrayList<>(); } @Override...
if (this.paging()) { return super.add(holder); } this.mergedHolders.add(holder); if (super.isEmpty()) { Query parent = holder.query().originQuery(); super.add(new SortByCountIdHolder(parent)); } SortByCountIdHolder sortHolder = (SortB...
469
116
585
<methods>public void <init>(boolean) ,public boolean add(org.apache.hugegraph.backend.page.IdHolder) ,public boolean addAll(Collection<? extends org.apache.hugegraph.backend.page.IdHolder>) ,public static org.apache.hugegraph.backend.page.IdHolderList empty(boolean) ,public boolean paging() <variables>private static fi...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Aggregate.java
Aggregate
reduce
class Aggregate { private final AggregateFunc func; private final String column; public Aggregate(AggregateFunc func, String column) { this.func = func; this.column = column; } public AggregateFunc func() { return this.func; } public String column() { retu...
Number number; long count = 0L; if (results.hasNext()) { number = results.next(); count++; } else { return this.defaultValue; } while (results.hasNext()) { number = this.merger.apply(...
486
121
607
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/BatchConditionQuery.java
BatchConditionQuery
mergeToIN
class BatchConditionQuery extends ConditionQuery { private Condition.Relation in; private final int batchSize; public BatchConditionQuery(HugeType resultType, int batchSize) { super(resultType); this.in = null; this.batchSize = batchSize; } public void mergeToIN(ConditionQ...
Object value = query.condition(key); if (this.in == null) { assert !this.containsRelation(RelationType.IN); this.resetConditions(InsertionOrderUtil.newList( (List<Condition>) query.conditions())); this.unsetCondition(key); List<Object...
254
254
508
<methods>public void <init>(org.apache.hugegraph.type.HugeType) ,public void <init>(org.apache.hugegraph.type.HugeType, org.apache.hugegraph.backend.query.Query) ,public boolean allRelation() ,public boolean allSysprop() ,public void checkFlattened() ,public static java.lang.String concatValues(List<?>) ,public static ...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java
BinCondition
toString
class BinCondition extends Condition { private Condition left; private Condition right; public BinCondition(Condition left, Condition right) { E.checkNotNull(left, "left condition"); E.checkNotNull(right, "right condition"); this.left = left; thi...
StringBuilder sb = new StringBuilder(64); sb.append(this.left).append(' '); sb.append(this.type().name()).append(' '); sb.append(this.right); return sb.toString();
440
63
503
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/EdgesQueryIterator.java
EdgesQueryIterator
next
class EdgesQueryIterator implements Iterator<Query> { private final List<Id> labels; private final Directions directions; private final long limit; private final Iterator<Id> sources; public EdgesQueryIterator(Iterator<Id> sources, Directions directions, ...
Id sourceId = this.sources.next(); ConditionQuery query = GraphTransaction.constructEdgesQuery(sourceId, this.directions, this.labels); if (this.limit != Query...
204
114
318
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdPrefixQuery.java
IdPrefixQuery
toString
class IdPrefixQuery extends Query { private final Id start; private final boolean inclusiveStart; private final Id prefix; public IdPrefixQuery(HugeType resultType, Id prefix) { this(resultType, null, prefix, true, prefix); } public IdPrefixQuery(Query originQuery, Id prefix) { ...
StringBuilder sb = new StringBuilder(super.toString()); assert sb.length() > 0; sb.deleteCharAt(sb.length() - 1); // Remove the last "`" sb.append(" id prefix with ").append(this.prefix); if (this.start != this.prefix) { sb.append(" and start with ").append(this.star...
543
150
693
<methods>public void <init>(org.apache.hugegraph.type.HugeType) ,public void <init>(org.apache.hugegraph.type.HugeType, org.apache.hugegraph.backend.query.Query) ,public long actualOffset() ,public org.apache.hugegraph.backend.query.Aggregate aggregate() ,public void aggregate(org.apache.hugegraph.backend.query.Aggrega...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdQuery.java
OneIdQuery
query
class OneIdQuery extends IdQuery { private Id id; public OneIdQuery(HugeType resultType, Id id) { super(resultType); super.mustSortByInput = false; this.id = id; } public OneIdQuery(Query originQuery, Id id) { super(originQuery.resultTyp...
E.checkArgumentNotNull(id, "Query id can't be null"); this.id = id; return this;
391
35
426
<methods>public void <init>(org.apache.hugegraph.type.HugeType) ,public void <init>(org.apache.hugegraph.type.HugeType, org.apache.hugegraph.backend.query.Query) ,public long actualOffset() ,public org.apache.hugegraph.backend.query.Aggregate aggregate() ,public void aggregate(org.apache.hugegraph.backend.query.Aggrega...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/IdRangeQuery.java
IdRangeQuery
toString
class IdRangeQuery extends Query { private final Id start; private final Id end; private final boolean inclusiveStart; private final boolean inclusiveEnd; public IdRangeQuery(HugeType resultType, Id start, Id end) { this(resultType, null, start, end); } public IdRangeQuery(HugeTyp...
StringBuilder builder = new StringBuilder(super.toString()); assert builder.length() > 0; builder.deleteCharAt(builder.length() - 1); // Remove the last "`" builder.append(" id in range ") .append(this.inclusiveStart ? "[" : "(") .append(this.start) ...
585
132
717
<methods>public void <init>(org.apache.hugegraph.type.HugeType) ,public void <init>(org.apache.hugegraph.type.HugeType, org.apache.hugegraph.backend.query.Query) ,public long actualOffset() ,public org.apache.hugegraph.backend.query.Aggregate aggregate() ,public void aggregate(org.apache.hugegraph.backend.query.Aggrega...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/AbstractSerializer.java
AbstractSerializer
writeQuery
class AbstractSerializer implements GraphSerializer, SchemaSerializer { protected HugeConfig config; public AbstractSerializer() { // TODO: default constructor } public AbstractSerializer(HugeConfig config) { this.config = config; } protected BackendEntry convertEntry...
HugeType type = query.resultType(); // Serialize edge condition query (TODO: add VEQ(for EOUT/EIN)) if (type.isEdge() && query.conditionsSize() > 0) { if (query.idsSize() > 0) { throw new BackendException("Not supported query edge by id " + ...
185
350
535
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryBackendEntry.java
BinaryId
asBytes
class BinaryId implements Id { private final byte[] bytes; private final Id id; public BinaryId(byte[] bytes, Id id) { this.bytes = bytes; this.id = id; } public Id origin() { return this.id; } @Override public IdTyp...
E.checkArgument(offset < this.bytes.length, "Invalid offset %s, must be < length %s", offset, this.bytes.length); return Arrays.copyOfRange(this.bytes, offset, this.bytes.length);
418
65
483
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryEntryIterator.java
BinaryEntryIterator
fetch
class BinaryEntryIterator<Elem> extends BackendEntryIterator { protected final BackendIterator<Elem> results; protected final BiFunction<BackendEntry, Elem, BackendEntry> merger; protected BackendEntry next; public BinaryEntryIterator(BackendIterator<Elem> results, Query query, ...
assert this.current == null; if (this.next != null) { this.current = this.next; this.next = null; } while (this.results.hasNext()) { Elem elem = this.results.next(); BackendEntry merged = this.merger.apply(this.current, elem); ...
652
318
970
<methods>public void <init>(org.apache.hugegraph.backend.query.Query) ,public static final void checkInterrupted() ,public boolean hasNext() ,public transient java.lang.Object metadata(java.lang.String, java.lang.Object[]) ,public org.apache.hugegraph.backend.store.BackendEntry next() <variables>public static final lon...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinaryScatterSerializer.java
BinaryScatterSerializer
readVertex
class BinaryScatterSerializer extends BinarySerializer { public BinaryScatterSerializer(HugeConfig config) { super(true, true, false); } @Override public BackendEntry writeVertex(HugeVertex vertex) { BinaryBackendEntry entry = newBackendEntry(vertex); if (vertex.removed()) { ...
if (bytesEntry == null) { return null; } BinaryBackendEntry entry = this.convertEntry(bytesEntry); // Parse label final byte[] VL = this.formatSyspropName(entry.id(), HugeKeys.LABEL); BackendColumn vl = entry.column(VL); VertexLabel vertexLabel = Ver...
290
237
527
<methods>public void <init>() ,public void <init>(HugeConfig) ,public void <init>(boolean, boolean, boolean) ,public static void increaseOne(byte[]) ,public org.apache.hugegraph.backend.store.BackendEntry parse(org.apache.hugegraph.backend.store.BackendEntry) ,public org.apache.hugegraph.structure.HugeEdge readEdge(org...
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/MergeIterator.java
MergeIterator
fetch
class MergeIterator<T, R> extends WrappedIterator<T> { private final Iterator<T> originIterator; private final BiFunction<T, R, Boolean> merger; private final List<Iterator<R>> iterators = new ArrayList<>(); private final List<R> headElements; public MergeIterator(Iterator<T> originIterator, ...
if (!this.originIterator.hasNext()) { return false; } T next = this.originIterator.next(); for (int i = 0; i < this.iterators.size(); i++) { R element = this.headElements.get(i); if (element == none()) { continue; } ...
428
206
634
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/SerializerFactory.java
SerializerFactory
serializer
class SerializerFactory { private static final Map<String, Class<? extends AbstractSerializer>> serializers; static { serializers = new ConcurrentHashMap<>(); } public static AbstractSerializer serializer(HugeConfig config, String name) {<FILL_FUNCTION_BODY>} @SuppressWarnings({"rawtypes...
name = name.toLowerCase(); switch (name) { case "binary": return new BinarySerializer(config); case "binaryscatter": return new BinaryScatterSerializer(config); case "text": return new TextSerializer(config); ...
328
194
522
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/TableBackendEntry.java
Row
mergeable
class Row { private HugeType type; private Id id; private Id subId; private final Map<HugeKeys, Object> columns; private long ttl; public Row(HugeType type) { this(type, null); } public Row(HugeType type, Id id) { this.type = typ...
if (!(other instanceof TableBackendEntry)) { return false; } TableBackendEntry tableEntry = (TableBackendEntry) other; Object selfId = this.column(HugeKeys.ID); Object otherId = tableEntry.column(HugeKeys.ID); if (!selfId.equals(otherId)) { return...
1,744
156
1,900
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStore.java
AbstractBackendStore
metadata
class AbstractBackendStore<Session extends BackendSession> implements BackendStore { // TODO: move SystemSchemaStore into backend like MetaStore private final SystemSchemaStore systemSchemaStore; private final MetaDispatcher<Session> dispatcher; public AbstractBackendStore() { this.sys...
Session session = this.session(type); MetaDispatcher<Session> dispatcher; if (type == null) { dispatcher = this.metaDispatcher(); } else { BackendTable<Session, ?> table = this.table(type); dispatcher = table.metaDispatcher(); } return...
425
99
524
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/AbstractBackendStoreProvider.java
AbstractBackendStoreProvider
initialized
class AbstractBackendStoreProvider implements BackendStoreProvider { private static final Logger LOG = Log.logger(AbstractBackendStoreProvider.class); private String graph = null; private final EventHub storeEventHub = new EventHub("store"); protected Map<String, BackendStore> stores = null;...
this.checkOpened(); for (BackendStore store : this.stores.values()) { if (!store.initialized()) { return false; } } return true;
1,678
54
1,732
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendEntryIterator.java
BackendEntryIterator
reachLimit
class BackendEntryIterator implements CIter<BackendEntry> { private static final Logger LOG = Log.logger(BackendEntryIterator.class); public static final long INLINE_BATCH_SIZE = Query.COMMIT_BATCH; protected final Query query; protected BackendEntry current; private long count; public Backe...
try { checkInterrupted(); } catch (Throwable e) { try { this.close(); } catch (Throwable ex) { LOG.warn("Failed to close backend entry iterator for interrupted query", ex); } throw e; } return th...
1,263
85
1,348
<no_super_class>
apache_incubator-hugegraph
incubator-hugegraph/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/BackendProviderFactory.java
BackendProviderFactory
open
class BackendProviderFactory { private static final Logger LOG = Log.logger(BackendProviderFactory.class); private static Map<String, Class<? extends BackendStoreProvider>> providers; static { providers = new ConcurrentHashMap<>(); } public static BackendStoreProvider open(HugeGraphParam...
HugeConfig config = params.configuration(); String backend = config.get(CoreOptions.BACKEND).toLowerCase(); String graph = config.get(CoreOptions.STORE); boolean raftMode = config.get(CoreOptions.RAFT_MODE); BackendStoreProvider provider = newProvider(config); if (raftM...
603
151
754
<no_super_class>