Apache GraphAr C++ Library
The C++ Library for Apache GraphAr
chunk_info_reader.cc
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #include <iostream>
21 #include <utility>
22 
23 #include "graphar/chunk_info_reader.h"
24 #include "graphar/filesystem.h"
25 #include "graphar/graph_info.h"
26 #include "graphar/reader_util.h"
27 #include "graphar/result.h"
28 #include "graphar/types.h"
29 #include "graphar/util.h"
30 
31 namespace graphar {
32 
34  const std::shared_ptr<VertexInfo>& vertex_info,
35  const std::shared_ptr<PropertyGroup>& property_group,
36  const std::string& prefix)
37  : vertex_info_(std::move(vertex_info)),
38  property_group_(std::move(property_group)),
39  prefix_(prefix),
40  chunk_index_(0) {
41  // init vertex chunk num
42  std::string base_dir;
43  GAR_ASSIGN_OR_RAISE_ERROR(auto fs,
44  FileSystemFromUriOrPath(prefix, &base_dir));
45  GAR_ASSIGN_OR_RAISE_ERROR(auto pg_path_prefix,
46  vertex_info->GetPathPrefix(property_group));
47  base_dir += pg_path_prefix;
48  GAR_ASSIGN_OR_RAISE_ERROR(chunk_num_,
49  util::GetVertexChunkNum(prefix_, vertex_info_));
50 }
51 
53  chunk_index_ = id / vertex_info_->GetChunkSize();
54  if (chunk_index_ >= chunk_num_) {
55  return Status::IndexError("Internal vertex id ", id, " is out of range [0,",
56  chunk_num_ * vertex_info_->GetChunkSize(),
57  ") of vertex ", vertex_info_->GetLabel());
58  }
59  return Status::OK();
60 }
61 
62 Result<std::string> VertexPropertyChunkInfoReader::GetChunk() const {
63  GAR_ASSIGN_OR_RAISE(auto chunk_file_path,
64  vertex_info_->GetFilePath(property_group_, chunk_index_));
65  return prefix_ + chunk_file_path;
66 }
67 
69  if (++chunk_index_ >= chunk_num_) {
70  return Status::IndexError(
71  "vertex chunk index ", chunk_index_, " is out-of-bounds for vertex ",
72  vertex_info_->GetLabel(), " chunk num ", chunk_num_);
73  }
74  return Status::OK();
75 }
76 
77 Result<std::shared_ptr<VertexPropertyChunkInfoReader>>
79  const std::shared_ptr<VertexInfo>& vertex_info,
80  const std::shared_ptr<PropertyGroup>& property_group,
81  const std::string& prefix) {
82  return std::make_shared<VertexPropertyChunkInfoReader>(
83  vertex_info, property_group, prefix);
84 }
85 
86 Result<std::shared_ptr<VertexPropertyChunkInfoReader>>
88  const std::shared_ptr<GraphInfo>& graph_info, const std::string& label,
89  const std::shared_ptr<PropertyGroup>& property_group) {
90  auto vertex_info = graph_info->GetVertexInfo(label);
91  if (!vertex_info) {
92  return Status::KeyError("The vertex ", label, " doesn't exist.");
93  }
94  return Make(vertex_info, property_group, graph_info->GetPrefix());
95 }
96 
97 Result<std::shared_ptr<VertexPropertyChunkInfoReader>>
99  const std::shared_ptr<GraphInfo>& graph_info, const std::string& label,
100  const std::string& property_name) {
101  auto vertex_info = graph_info->GetVertexInfo(label);
102  if (!vertex_info) {
103  return Status::KeyError("The vertex ", label, " doesn't exist.");
104  }
105  auto property_group = vertex_info->GetPropertyGroup(property_name);
106  if (!property_group) {
107  return Status::KeyError("The property ", property_name,
108  " doesn't exist in vertex ", label, ".");
109  }
110  return Make(vertex_info, property_group, graph_info->GetPrefix());
111 }
112 
114  const std::shared_ptr<EdgeInfo>& edge_info, AdjListType adj_list_type,
115  const std::string& prefix)
116  : edge_info_(std::move(edge_info)),
117  adj_list_type_(adj_list_type),
118  prefix_(prefix),
119  vertex_chunk_index_(0),
120  chunk_index_(0) {
121  GAR_ASSIGN_OR_RAISE_ERROR(fs_, FileSystemFromUriOrPath(prefix, &base_dir_));
122  GAR_ASSIGN_OR_RAISE_ERROR(auto adj_list_path_prefix,
123  edge_info->GetAdjListPathPrefix(adj_list_type));
124  base_dir_ = prefix_ + adj_list_path_prefix;
125  GAR_ASSIGN_OR_RAISE_ERROR(
126  vertex_chunk_num_,
127  util::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_));
128  GAR_ASSIGN_OR_RAISE_ERROR(
129  chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_,
130  vertex_chunk_index_));
131 }
132 
134  if (adj_list_type_ != AdjListType::unordered_by_source &&
135  adj_list_type_ != AdjListType::ordered_by_source) {
136  return Status::Invalid("The seek_src operation is invalid in edge ",
137  edge_info_->GetEdgeLabel(), " reader with ",
138  AdjListTypeToString(adj_list_type_), " type.");
139  }
140 
141  IdType new_vertex_chunk_index = id / edge_info_->GetSrcChunkSize();
142  if (new_vertex_chunk_index >= vertex_chunk_num_) {
143  return Status::IndexError(
144  "The source internal id ", id, " is out of range [0,",
145  edge_info_->GetSrcChunkSize() * vertex_chunk_num_, ") of edge ",
146  edge_info_->GetEdgeLabel(), " reader.");
147  }
148  if (vertex_chunk_index_ != new_vertex_chunk_index) {
149  vertex_chunk_index_ = new_vertex_chunk_index;
150  GAR_ASSIGN_OR_RAISE(
151  chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_,
152  vertex_chunk_index_));
153  }
154 
155  if (adj_list_type_ == AdjListType::unordered_by_source) {
156  return seek(0); // start from first chunk
157  } else {
158  GAR_ASSIGN_OR_RAISE(auto offset_pair,
159  util::GetAdjListOffsetOfVertex(edge_info_, prefix_,
160  adj_list_type_, id));
161  return seek(offset_pair.first);
162  }
163  return Status::OK();
164 }
165 
167  if (adj_list_type_ != AdjListType::unordered_by_dest &&
168  adj_list_type_ != AdjListType::ordered_by_dest) {
169  return Status::Invalid("The seek_dst operation is invalid in edge ",
170  edge_info_->GetEdgeLabel(), " reader with ",
171  AdjListTypeToString(adj_list_type_), " type.");
172  }
173 
174  IdType new_vertex_chunk_index = id / edge_info_->GetDstChunkSize();
175  if (new_vertex_chunk_index >= vertex_chunk_num_) {
176  return Status::IndexError(
177  "The destination internal id ", id, " is out of range [0,",
178  edge_info_->GetDstChunkSize() * vertex_chunk_num_, ") of edge ",
179  edge_info_->GetEdgeLabel(), " reader.");
180  }
181  if (vertex_chunk_index_ != new_vertex_chunk_index) {
182  vertex_chunk_index_ = new_vertex_chunk_index;
183  GAR_ASSIGN_OR_RAISE(
184  chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_,
185  vertex_chunk_index_));
186  }
187 
188  if (adj_list_type_ == AdjListType::unordered_by_dest) {
189  return seek(0); // start from the first chunk
190  } else {
191  GAR_ASSIGN_OR_RAISE(auto range,
192  util::GetAdjListOffsetOfVertex(edge_info_, prefix_,
193  adj_list_type_, id));
194  return seek(range.first);
195  }
196 }
197 
199  chunk_index_ = index / edge_info_->GetChunkSize();
200  if (chunk_index_ >= chunk_num_) {
201  return Status::IndexError("The edge offset ", index, " is out of range [0,",
202  edge_info_->GetChunkSize() * chunk_num_,
203  "), edge type: ", edge_info_->GetEdgeLabel());
204  }
205  return Status::OK();
206 }
207 
208 Result<std::string> AdjListChunkInfoReader::GetChunk() {
209  GAR_ASSIGN_OR_RAISE(auto chunk_file_path,
210  edge_info_->GetAdjListFilePath(
211  vertex_chunk_index_, chunk_index_, adj_list_type_));
212  return prefix_ + chunk_file_path;
213 }
214 
216  ++chunk_index_;
217  while (chunk_index_ >= chunk_num_) {
218  ++vertex_chunk_index_;
219  if (vertex_chunk_index_ >= vertex_chunk_num_) {
220  return Status::IndexError("vertex chunk index ", vertex_chunk_index_,
221  " is out-of-bounds for vertex chunk num ",
222  vertex_chunk_num_);
223  }
224  chunk_index_ = 0;
225  GAR_ASSIGN_OR_RAISE_ERROR(
226  chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_,
227  vertex_chunk_index_));
228  }
229  return Status::OK();
230 }
231 
232 Result<std::shared_ptr<AdjListChunkInfoReader>> AdjListChunkInfoReader::Make(
233  const std::shared_ptr<EdgeInfo>& edge_info, AdjListType adj_list_type,
234  const std::string& prefix) {
235  if (!edge_info->HasAdjacentListType(adj_list_type)) {
236  return Status::KeyError(
237  "The adjacent list type ", AdjListTypeToString(adj_list_type),
238  " doesn't exist in edge ", edge_info->GetEdgeLabel(), ".");
239  }
240  return std::make_shared<AdjListChunkInfoReader>(edge_info, adj_list_type,
241  prefix);
242 }
243 
244 Result<std::shared_ptr<AdjListChunkInfoReader>> AdjListChunkInfoReader::Make(
245  const std::shared_ptr<GraphInfo>& graph_info, const std::string& src_label,
246  const std::string& edge_label, const std::string& dst_label,
247  AdjListType adj_list_type) {
248  auto edge_info = graph_info->GetEdgeInfo(src_label, edge_label, dst_label);
249  if (!edge_info) {
250  return Status::KeyError("The edge ", src_label, " ", edge_label, " ",
251  dst_label, " doesn't exist.");
252  }
253  return Make(edge_info, adj_list_type, graph_info->GetPrefix());
254 }
255 
257  const std::shared_ptr<EdgeInfo>& edge_info, AdjListType adj_list_type,
258  const std::string& prefix)
259  : edge_info_(std::move(edge_info)),
260  adj_list_type_(adj_list_type),
261  prefix_(prefix),
262  chunk_index_(0) {
263  std::string base_dir;
264  GAR_ASSIGN_OR_RAISE_ERROR(auto fs,
265  FileSystemFromUriOrPath(prefix, &base_dir));
266  GAR_ASSIGN_OR_RAISE_ERROR(auto dir_path,
267  edge_info->GetOffsetPathPrefix(adj_list_type));
268  base_dir = prefix_ + dir_path;
269  if (adj_list_type == AdjListType::ordered_by_source ||
270  adj_list_type == AdjListType::ordered_by_dest) {
271  GAR_ASSIGN_OR_RAISE_ERROR(
272  vertex_chunk_num_,
273  util::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_));
274  vertex_chunk_size_ = adj_list_type == AdjListType::ordered_by_source
275  ? edge_info_->GetSrcChunkSize()
276  : edge_info_->GetDstChunkSize();
277  } else {
278  std::string err_msg = "Invalid adj list type " +
279  std::string(AdjListTypeToString(adj_list_type)) +
280  " to construct AdjListOffsetReader.";
281  throw std::runtime_error(err_msg);
282  }
283 }
284 
286  chunk_index_ = id / vertex_chunk_size_;
287  if (chunk_index_ >= vertex_chunk_num_) {
288  return Status::IndexError("Internal vertex id ", id, " is out of range [0,",
289  vertex_chunk_num_ * vertex_chunk_size_,
290  ") of vertex.");
291  }
292  return Status::OK();
293 }
294 
295 Result<std::string> AdjListOffsetChunkInfoReader::GetChunk() const {
296  GAR_ASSIGN_OR_RAISE(
297  auto chunk_file_path,
298  edge_info_->GetAdjListOffsetFilePath(chunk_index_, adj_list_type_));
299  return prefix_ + chunk_file_path;
300 }
301 
303  if (++chunk_index_ >= vertex_chunk_num_) {
304  return Status::IndexError("vertex chunk index ", chunk_index_,
305  " is out-of-bounds for vertex, chunk_num ",
306  vertex_chunk_num_);
307  }
308  return Status::OK();
309 }
310 
311 Result<std::shared_ptr<AdjListOffsetChunkInfoReader>>
312 AdjListOffsetChunkInfoReader::Make(const std::shared_ptr<EdgeInfo>& edge_info,
313  AdjListType adj_list_type,
314  const std::string& prefix) {
315  if (!edge_info->HasAdjacentListType(adj_list_type)) {
316  return Status::KeyError(
317  "The adjacent list type ", AdjListTypeToString(adj_list_type),
318  " doesn't exist in edge ", edge_info->GetEdgeLabel(), ".");
319  }
320  return std::make_shared<AdjListOffsetChunkInfoReader>(edge_info,
321  adj_list_type, prefix);
322 }
323 
324 Result<std::shared_ptr<AdjListOffsetChunkInfoReader>>
325 AdjListOffsetChunkInfoReader::Make(const std::shared_ptr<GraphInfo>& graph_info,
326  const std::string& src_label,
327  const std::string& edge_label,
328  const std::string& dst_label,
329  AdjListType adj_list_type) {
330  auto edge_info = graph_info->GetEdgeInfo(src_label, edge_label, dst_label);
331  if (!edge_info) {
332  return Status::KeyError("The edge ", src_label, " ", edge_label, " ",
333  dst_label, " doesn't exist.");
334  }
335  return Make(edge_info, adj_list_type, graph_info->GetPrefix());
336 }
337 
339  const std::shared_ptr<EdgeInfo>& edge_info,
340  const std::shared_ptr<PropertyGroup>& property_group,
341  AdjListType adj_list_type, const std::string prefix)
342  : edge_info_(std::move(edge_info)),
343  property_group_(std::move(property_group)),
344  adj_list_type_(adj_list_type),
345  prefix_(prefix),
346  vertex_chunk_index_(0),
347  chunk_index_(0) {
348  GAR_ASSIGN_OR_RAISE_ERROR(fs_, FileSystemFromUriOrPath(prefix, &base_dir_));
349  GAR_ASSIGN_OR_RAISE_ERROR(
350  auto pg_path_prefix,
351  edge_info->GetPropertyGroupPathPrefix(property_group, adj_list_type));
352  base_dir_ = prefix_ + pg_path_prefix;
353  GAR_ASSIGN_OR_RAISE_ERROR(
354  vertex_chunk_num_,
355  util::GetVertexChunkNum(prefix_, edge_info_, adj_list_type_));
356  GAR_ASSIGN_OR_RAISE_ERROR(
357  chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_,
358  vertex_chunk_index_));
359 }
360 
362  if (adj_list_type_ != AdjListType::unordered_by_source &&
363  adj_list_type_ != AdjListType::ordered_by_source) {
364  return Status::Invalid("The seek_src operation is invalid in edge ",
365  edge_info_->GetEdgeLabel(), " reader with ",
366  AdjListTypeToString(adj_list_type_), " type.");
367  }
368 
369  IdType new_vertex_chunk_index = id / edge_info_->GetSrcChunkSize();
370  if (new_vertex_chunk_index >= vertex_chunk_num_) {
371  return Status::IndexError(
372  "The source internal id ", id, " is out of range [0,",
373  edge_info_->GetSrcChunkSize() * vertex_chunk_num_, ") of edge ",
374  edge_info_->GetEdgeLabel(), " reader.");
375  }
376  if (vertex_chunk_index_ != new_vertex_chunk_index) {
377  vertex_chunk_index_ = new_vertex_chunk_index;
378  GAR_ASSIGN_OR_RAISE(
379  chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_,
380  vertex_chunk_index_));
381  }
382  if (adj_list_type_ == AdjListType::unordered_by_source) {
383  return seek(0); // start from first chunk
384  } else {
385  GAR_ASSIGN_OR_RAISE(auto range,
386  util::GetAdjListOffsetOfVertex(edge_info_, prefix_,
387  adj_list_type_, id));
388  return seek(range.first);
389  }
390  return Status::OK();
391 }
392 
394  if (adj_list_type_ != AdjListType::unordered_by_dest &&
395  adj_list_type_ != AdjListType::ordered_by_dest) {
396  return Status::Invalid("The seek_dst operation is invalid in edge ",
397  edge_info_->GetEdgeLabel(), " reader with ",
398  AdjListTypeToString(adj_list_type_), " type.");
399  }
400 
401  IdType new_vertex_chunk_index = id / edge_info_->GetDstChunkSize();
402  if (new_vertex_chunk_index >= vertex_chunk_num_) {
403  return Status::IndexError(
404  "The destination internal id ", id, " is out of range [0,",
405  edge_info_->GetDstChunkSize() * vertex_chunk_num_, ") of edge ",
406  edge_info_->GetEdgeLabel(), " reader.");
407  }
408  if (vertex_chunk_index_ != new_vertex_chunk_index) {
409  vertex_chunk_index_ = new_vertex_chunk_index;
410  GAR_ASSIGN_OR_RAISE(
411  chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_,
412  vertex_chunk_index_));
413  }
414 
415  if (adj_list_type_ == AdjListType::unordered_by_dest) {
416  return seek(0); // start from the first chunk
417  } else {
418  GAR_ASSIGN_OR_RAISE(auto range,
419  util::GetAdjListOffsetOfVertex(edge_info_, prefix_,
420  adj_list_type_, id));
421  return seek(range.first);
422  }
423 }
424 
426  chunk_index_ = offset / edge_info_->GetChunkSize();
427  if (chunk_index_ >= chunk_num_) {
428  return Status::IndexError("The edge offset ", offset,
429  " is out of range [0,",
430  edge_info_->GetChunkSize() * chunk_num_,
431  "), edge label: ", edge_info_->GetEdgeLabel());
432  }
433  return Status::OK();
434 }
435 
436 Result<std::string> AdjListPropertyChunkInfoReader::GetChunk() const {
437  GAR_ASSIGN_OR_RAISE(
438  auto chunk_file_path,
439  edge_info_->GetPropertyFilePath(property_group_, adj_list_type_,
440  vertex_chunk_index_, chunk_index_));
441  return prefix_ + chunk_file_path;
442 }
443 
445  ++chunk_index_;
446  while (chunk_index_ >= chunk_num_) {
447  ++vertex_chunk_index_;
448  if (vertex_chunk_index_ >= vertex_chunk_num_) {
449  return Status::IndexError(
450  "vertex chunk index ", vertex_chunk_index_,
451  " is out-of-bounds for vertex chunk num ", vertex_chunk_num_,
452  " of edge ", edge_info_->GetEdgeLabel(), " of adj list type ",
453  AdjListTypeToString(adj_list_type_), ", property group ",
454  property_group_, ".");
455  }
456  chunk_index_ = 0;
457  GAR_ASSIGN_OR_RAISE_ERROR(
458  chunk_num_, util::GetEdgeChunkNum(prefix_, edge_info_, adj_list_type_,
459  vertex_chunk_index_));
460  }
461  return Status::OK();
462 }
463 
464 Result<std::shared_ptr<AdjListPropertyChunkInfoReader>>
466  const std::shared_ptr<EdgeInfo>& edge_info,
467  const std::shared_ptr<PropertyGroup>& property_group,
468  AdjListType adj_list_type, const std::string& prefix) {
469  if (!edge_info->HasAdjacentListType(adj_list_type)) {
470  return Status::KeyError(
471  "The adjacent list type ", AdjListTypeToString(adj_list_type),
472  " doesn't exist in edge ", edge_info->GetEdgeLabel(), ".");
473  }
474  return std::make_shared<AdjListPropertyChunkInfoReader>(
475  edge_info, property_group, adj_list_type, prefix);
476 }
477 
478 Result<std::shared_ptr<AdjListPropertyChunkInfoReader>>
480  const std::shared_ptr<GraphInfo>& graph_info, const std::string& src_label,
481  const std::string& edge_label, const std::string& dst_label,
482  const std::shared_ptr<PropertyGroup>& property_group,
483  AdjListType adj_list_type) {
484  auto edge_info = graph_info->GetEdgeInfo(src_label, edge_label, dst_label);
485  if (!edge_info) {
486  return Status::KeyError("The edge ", src_label, " ", edge_label, " ",
487  dst_label, " doesn't exist.");
488  }
489  return Make(edge_info, property_group, adj_list_type,
490  graph_info->GetPrefix());
491 }
492 
493 Result<std::shared_ptr<AdjListPropertyChunkInfoReader>>
495  const std::shared_ptr<GraphInfo>& graph_info, const std::string& src_label,
496  const std::string& edge_label, const std::string& dst_label,
497  const std::string& property_name, AdjListType adj_list_type) {
498  auto edge_info = graph_info->GetEdgeInfo(src_label, edge_label, dst_label);
499  if (!edge_info) {
500  return Status::KeyError("The edge ", src_label, " ", edge_label, " ",
501  dst_label, " doesn't exist.");
502  }
503  auto property_group = edge_info->GetPropertyGroup(property_name);
504  if (!property_group) {
505  return Status::KeyError("The property ", property_name,
506  " doesn't exist in edge ", src_label, " ",
507  edge_label, " ", dst_label, ".");
508  }
509  return Make(edge_info, property_group, adj_list_type,
510  graph_info->GetPrefix());
511 }
512 
513 } // namespace graphar
Status seek_dst(IdType id)
Sets chunk position indicator for reader by destination internal vertex id.
Status seek(IdType index)
Sets chunk position indicator for reader by edge index.
Status seek_src(IdType id)
Sets chunk position indicator for reader by source internal vertex id.
Result< std::string > GetChunk()
static Result< std::shared_ptr< AdjListChunkInfoReader > > Make(const std::shared_ptr< EdgeInfo > &edge_info, AdjListType adj_list_type, const std::string &prefix)
Create an AdjListChunkInfoReader instance from edge info.
AdjListChunkInfoReader(const std::shared_ptr< EdgeInfo > &edge_info, AdjListType adj_list_type, const std::string &prefix)
Initialize the AdjListChunkInfoReader.
Status seek(IdType id)
Sets chunk position indicator for reader by source internal vertex id.
AdjListOffsetChunkInfoReader(const std::shared_ptr< EdgeInfo > &edge_info, AdjListType adj_list_type, const std::string &prefix)
Initialize the AdjListOffsetChunkInfoReader.
Result< std::string > GetChunk() const
Return the current chunk file path of chunk position indicator.
static Result< std::shared_ptr< AdjListOffsetChunkInfoReader > > Make(const std::shared_ptr< EdgeInfo > &edge_info, AdjListType adj_list_type, const std::string &prefix)
Create an AdjListOffsetChunkInfoReader instance from edge info.
Status seek(IdType offset)
Sets chunk position indicator for reader by edge index.
Status seek_src(IdType id)
Sets chunk position indicator for reader by source vertex id.
static Result< std::shared_ptr< AdjListPropertyChunkInfoReader > > Make(const std::shared_ptr< EdgeInfo > &edge_info, const std::shared_ptr< PropertyGroup > &property_group, AdjListType adj_list_type, const std::string &prefix)
Create an AdjListPropertyChunkInfoReader instance from edge info.
AdjListPropertyChunkInfoReader(const std::shared_ptr< EdgeInfo > &edge_info, const std::shared_ptr< PropertyGroup > &property_group, AdjListType adj_list_type, const std::string prefix)
Initialize the AdjListPropertyChunkInfoReader.
Result< std::string > GetChunk() const
Status seek_dst(IdType id)
Sets chunk position indicator for reader by destination vertex id.
Status outcome object (success or error)
Definition: status.h:123
static Status IndexError(Args &&... args)
Definition: status.h:197
static Status KeyError(Args &&... args)
Definition: status.h:172
static Status Invalid(Args &&... args)
Definition: status.h:188
static Status OK()
Definition: status.h:157
static Result< std::shared_ptr< VertexPropertyChunkInfoReader > > Make(const std::shared_ptr< VertexInfo > &vertex_info, const std::shared_ptr< PropertyGroup > &property_group, const std::string &prefix)
Create a VertexPropertyChunkInfoReader instance from vertex info.
Status seek(IdType id)
Sets chunk position indicator for reader by internal vertex id. If internal vertex id is not found,...
VertexPropertyChunkInfoReader(const std::shared_ptr< VertexInfo > &vertex_info, const std::shared_ptr< PropertyGroup > &property_group, const std::string &prefix)
Initialize the VertexPropertyChunkInfoReader.
Result< std::string > GetChunk() const
Return the current chunk file path of chunk position indicator.