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