use of com.baidu.hugegraph.structure.graph.Edges in project incubator-hugegraph-toolchain by apache.
the class CommonTraverserApiTest method testScanEdgeInPaging.
@Test
public void testScanEdgeInPaging() {
List<Shard> shards = edgesAPI.shards(1 * 1024 * 1024);
List<Edge> edges = new LinkedList<>();
for (Shard shard : shards) {
String page = "";
while (page != null) {
Edges results = edgesAPI.scan(shard, page, DEFAULT_PAGE_LIMIT);
edges.addAll(ImmutableList.copyOf(results.results()));
page = results.page();
}
}
Assert.assertEquals(6, edges.size());
}
use of com.baidu.hugegraph.structure.graph.Edges in project incubator-hugegraph-toolchain by apache.
the class CommonTraverserApiTest method testScanEdge.
@Test
public void testScanEdge() {
List<Shard> shards = edgesAPI.shards(1 * 1024 * 1024);
List<Edge> edges = new LinkedList<>();
for (Shard shard : shards) {
Edges results = edgesAPI.scan(shard, null, 0L);
Assert.assertNull(results.page());
edges.addAll(ImmutableList.copyOf(results.results()));
}
Assert.assertEquals(6, edges.size());
}
use of com.baidu.hugegraph.structure.graph.Edges in project incubator-hugegraph-toolchain by apache.
the class BackupManager method backupEdgeShard.
private void backupEdgeShard(Shard shard) {
String desc = String.format("backing up edges[shard %s]", shard);
Edges edges = null;
String page = this.initPage();
TraverserManager g = client.traverser();
do {
try {
String p = page;
if (page == null) {
edges = retry(() -> g.edges(shard), desc);
} else {
edges = retry(() -> g.edges(shard, p), desc);
}
} catch (ToolsException e) {
this.exceptionHandler(e, HugeType.EDGE, shard);
}
if (edges == null) {
return;
}
List<Edge> edgeList = edges.results();
if (edgeList == null || edgeList.isEmpty()) {
return;
}
long count = this.backup(HugeType.EDGE, suffix.get(), edgeList);
this.edgeCounter.getAndAdd(count);
Printer.printInBackward(this.edgeCounter.get());
} while ((page = edges.page()) != null);
}
use of com.baidu.hugegraph.structure.graph.Edges in project incubator-hugegraph-toolchain by apache.
the class TraverserManager method edges.
public Edges edges(Shard shard, String page, long pageLimit) {
E.checkArgument(page == null || pageLimit >= 0, "Page limit must be >= 0 when page is not null");
Edges edges = this.edgesAPI.scan(shard, page, pageLimit);
for (Edge edge : edges.results()) {
edge.attachManager(this.graphManager);
}
return edges;
}
use of com.baidu.hugegraph.structure.graph.Edges in project incubator-hugegraph-toolchain by apache.
the class TraverserManager method edges.
public Edges edges(Shard shard) {
Edges edges = this.edges(shard, null, 0L);
E.checkState(edges.page() == null, "Can't contains page when not in paging");
return edges;
}
Aggregations