API Reference#
Graph Info#
-
class PropertyGroup#
PropertyGroup is a class to store the property group information.
Public Functions
-
PropertyGroup() = default#
Default constructor.
-
inline ~PropertyGroup()#
-
inline explicit PropertyGroup(std::vector<Property> properties, FileType file_type, const std::string &prefix = "")#
Initialize the PropertyGroup
- Parameters
properties – Property list of group
file_type – File type of property group chunk file
prefix – prefix of property group chunk file [Option]. the default prefix is the concatenation of property names with ‘_’ as separator
-
PropertyGroup(const PropertyGroup &other) = default#
Copy constructor.
-
PropertyGroup(PropertyGroup &&other) = default#
Move constructor.
-
inline PropertyGroup &operator=(const PropertyGroup &other) = default#
Copy assignment operator.
-
inline PropertyGroup &operator=(PropertyGroup &&other) = default#
Move assignment operator.
-
inline const std::string &GetPrefix() const#
Get the prefix of property group chunk file.
-
PropertyGroup() = default#
-
class VertexInfo#
VertexInfo is a class to store the vertex meta information.
Public Functions
-
VertexInfo() = default#
Default constructor.
-
inline ~VertexInfo()#
-
inline explicit VertexInfo(const std::string &label, IdType chunk_size, const std::string &prefix = "")#
Initialize the vertex info.
- Parameters
label – The label of the vertex.
chunk_size – number of vertex in each vertex chunk.
prefix – prefix of the vertex info.
-
VertexInfo(const VertexInfo &vertex_info) = default#
Copy constructor.
-
explicit VertexInfo(VertexInfo &&vertex_info) = default#
Move constructor.
-
inline VertexInfo &operator=(const VertexInfo &other) = default#
Copy assignment operator.
-
inline VertexInfo &operator=(VertexInfo &&other) = default#
Move assignment operator.
-
inline Status AddPropertyGroup(const PropertyGroup &property_group)#
Add a property group to vertex info.
-
inline std::string GetLabel() const#
Get the label of the vertex.
-
inline std::string GetPrefix() const#
Get the path prefix of the vertex.
-
inline const std::vector<PropertyGroup> &GetPropertyGroups() const#
Get the property groups of the vertex.
-
inline Result<const PropertyGroup&> GetPropertyGroup(const std::string &property_name) const noexcept#
Get the property group that contains property.
-
inline Result<DataType::type> GetPropertyType(const std::string &property_name) const noexcept#
Get the data type of property.
-
inline bool ContainProperty(const std::string &property_name) const#
Check if the vertex info contains certain property.
-
inline Result<bool> IsPrimaryKey(const std::string &property_name) const noexcept#
Check if the property is primary key or not.
-
inline bool ContainPropertyGroup(const PropertyGroup &property_group) const#
Check if the vertex info contains the property group.
-
inline const Result<VertexInfo> Extend(const PropertyGroup &property_group) const noexcept#
Extending the property groups of vertex and return a new vertex info.
-
inline Result<std::string> GetFilePath(const PropertyGroup &property_group, IdType chunk_index) const noexcept#
Get the chunk file path of property group of vertex chunk.
-
inline Result<std::string> GetDirPath(const PropertyGroup &property_group) const noexcept#
Get the chunk files directory path of property group.
-
inline Result<std::string> GetVerticesNumFilePath() const noexcept#
Get the chunk file path of the number of vertices.
-
inline bool IsValidated() const noexcept#
Check if the vertex info is validated.
Public Static Functions
Load the input yaml as a VertexInfo instance.
-
VertexInfo() = default#
-
class EdgeInfo#
Edge info is a class to store the edge meta information.
Public Functions
-
EdgeInfo() = default#
Default constructor.
-
inline ~EdgeInfo()#
-
inline explicit EdgeInfo(const std::string &src_label, const std::string &edge_label, const std::string &dst_label, IdType chunk_size, IdType src_chunk_size, IdType dst_chunk_size, bool directed, const std::string &prefix = "")#
Initialize the EdgeInfo.
- Parameters
src_label – source vertex label
edge_label – edge label
dst_label – destination vertex label
chunk_size – number of edges in each edge chunk
src_chunk_size – number of source vertices in each vertex chunk
dst_chunk_size – number of destination vertices in each vertex chunk
directed – whether the edge is directed
prefix – prefix of the edge info
-
inline Status AddAdjList(const AdjListType &adj_list_type, FileType file_type, const std::string &prefix = "")#
Add adj list information to edge info The adj list information is used to store the edge list by CSR, CSC or COO format.
- Parameters
adj_list_type – adj list type to add
file_type – the file type of adj list topology and offset chunk file
prefix – prefix of adj list topology chunk, optional, default is empty
- Returns
InvalidOperation if the adj list type is already added
-
inline Status AddPropertyGroup(const PropertyGroup &property_group, AdjListType adj_list_type) noexcept#
Add a property group to edge info Each adj list type has its own property groups.
- Parameters
property_group – property group to add
adj_list_type – adj list type to add property group to
- Returns
InvalidOperation if adj_list_type not support or the property group is already added to the adj list type
-
inline std::string GetSrcLabel() const#
Get source vertex label of edge.
-
inline std::string GetEdgeLabel() const#
Get edge label of edge.
-
inline std::string GetDstLabel() const#
Get destination vertex label of edge.
-
inline std::string GetPrefix() const#
Get path prefix of edge.
-
inline bool IsDirected() const noexcept#
Check if edge is directed.
-
inline Result<std::string> GetAdjListPrefix(AdjListType adj_list_type) const#
Get path prefix of adj list type.
-
inline bool ContainAdjList(AdjListType adj_list_type) const noexcept#
Check if the edge info contains the adj list type.
-
inline bool ContainPropertyGroup(const PropertyGroup &property_group, AdjListType adj_list_type) const#
Check if the edge info contains the property group if adj_list_type is not supported by edge info, return false.
- Parameters
property_group – property group to check
adj_list_type – the adj list type property group belongs to
-
inline bool ContainProperty(const std::string &property) const#
Check if the edge info contains the property.
-
inline Result<FileType> GetAdjListFileType(AdjListType adj_list_type) const noexcept#
Get the adj list topology chunk file type of adj list type.
-
inline Result<const std::vector<PropertyGroup>&> GetPropertyGroups(AdjListType adj_list_type) const noexcept#
Get the property groups of adj list type if adj_list_type is not supported by edge info, return error.
-
inline Result<const PropertyGroup&> GetPropertyGroup(const std::string &property, AdjListType adj_list_type) const noexcept#
Return property group that contains certain property and with adj list type.
- Parameters
property – property name
adj_list_type – adj list type of the property group
-
inline Result<std::string> GetAdjListFilePath(IdType vertex_chunk_index, IdType edge_chunk_index, AdjListType adj_list_type) const noexcept#
Get the file path of adj list topology chunk.
- Parameters
vertex_chunk_index – the vertex chunk index
edge_chunk_index – index of edge adj list chunk of the vertex chunk
-
inline Result<std::string> GetAdjListDirPath(AdjListType adj_list_type) const noexcept#
Get the adj list topology chunk file directory path of adj list type.
-
inline Result<std::string> GetAdjListOffsetFilePath(IdType vertex_chunk_index, AdjListType adj_list_type) const noexcept#
Get the adj list offset chunk file path of vertex chunk the offset chunks is aligned with the vertex chunks.
- Parameters
vertex_chunk_index – index of vertex chunk
-
inline Result<std::string> GetAdjListOffsetDirPath(AdjListType adj_list_type) const noexcept#
Get the adj list offset chunk file directory path of adj list type.
-
inline Result<std::string> GetPropertyFilePath(const PropertyGroup &property_group, AdjListType adj_list_type, IdType vertex_chunk_index, IdType edge_chunk_index) const#
Get the chunk file path of adj list property group the property group chunks is aligned with the adj list topology chunks.
- Parameters
property_group – property group
adj_list_type – adj list type that the property group belongs to
vertex_chunk_index – the vertex chunk index
edge_chunk_index – index of edge property group chunk of the vertex chunk
-
inline Result<std::string> GetPropertyDirPath(const PropertyGroup &property_group, AdjListType adj_list_type) const noexcept#
Get the property group chunk file directory path of adj list type.
-
inline Result<DataType::type> GetPropertyType(const std::string &property) const noexcept#
Get the data type of property.
-
inline Result<bool> IsPrimaryKey(const std::string &property) const noexcept#
Check if the property is primary key.
-
inline const Result<EdgeInfo> ExtendAdjList(AdjListType adj_list_type, FileType file_type, const std::string &prefix = "") const noexcept#
Extend the adj list type of edge info and return a new edge info return error if the adj list type is already contained.
- Parameters
adj_list_type – adj list type to extend
prefix – path prefix of adj list type
file_type – file type of adj list topology and offset chunks
- Returns
new edge info
-
inline const Result<EdgeInfo> ExtendPropertyGroup(const PropertyGroup &property_group, AdjListType adj_list_type) const noexcept#
Extend the property groups of adj list type and return a new edge info return error if the property group is already contained or the adj list type is not contained.
- Parameters
property_group – property group to extend.
adj_list_type – the adj list type of property group
- Returns
new edge info
-
inline bool IsValidated() const noexcept#
Check if the edge info is validated.
Public Static Functions
Loads the yaml as a EdgeInfo instance.
-
EdgeInfo() = default#
-
class GraphInfo#
GraphInfo is is a class to store the graph meta information.
Public Functions
-
inline explicit GraphInfo(const std::string &graph_name, const std::string &prefix = "./")#
Initialize the GraphInfo. the prefix of graph would be ./ by default.
- Parameters
graph_name – [in] name of graph
prefix – [in] absolute path prefix to store chunk files of graph.
-
inline Status AddVertex(const VertexInfo &vertex_info) noexcept#
Add a vertex info to graph info.
-
inline void AddVertexInfoPath(const std::string &path) noexcept#
Add a vertex info path to graph info.
- Parameters
path – vertex info path to add
-
inline void AddEdgeInfoPath(const std::string &path) noexcept#
Add a edge info path to graph info.
- Parameters
path – edge info path to add
-
inline std::string GetName() const noexcept#
Get the name of graph.
-
inline std::string GetPrefix() const noexcept#
Get the absolute path prefix of chunk files.
-
inline Result<const VertexInfo&> GetVertexInfo(const std::string &label) const noexcept#
Get the vertex info by vertex label.
-
inline Result<const EdgeInfo&> GetEdgeInfo(const std::string &src_label, const std::string &edge_label, const std::string &dst_label) const noexcept#
Get the edge info by src label, edge label and dst label.
- Parameters
src_label – source vertex label
edge_label – edge label
dst_label – destination vertex label
-
inline Result<const PropertyGroup&> GetVertexPropertyGroup(const std::string &label, const std::string &property) const noexcept#
Get the property group of vertex by label and property.
- Parameters
label – vertex label
property – vertex property that belongs to the group
-
inline Result<const PropertyGroup&> GetEdgePropertyGroup(const std::string &src_label, const std::string &edge_label, const std::string &dst_label, const std::string &property, AdjListType adj_list_type) const noexcept#
Get the property group of edge by label, property and adj list type.
- Parameters
src_label – source vertex label
edge_label – edge label
dst_label – destination vertex label
property – edge property that belongs to the group
adj_list_type – adj list type of edge
-
inline const std::map<std::string, VertexInfo> &GetAllVertexInfo() const noexcept#
Get all vertex info of graph.
-
inline const std::map<std::string, EdgeInfo> &GetAllEdgeInfo() const noexcept#
Get all edge info of graph.
-
inline bool IsValidated() const noexcept#
Check if the graph info is validated.
-
inline explicit GraphInfo(const std::string &graph_name, const std::string &prefix = "./")#
Readers#
Chunk Info Reader#
-
class VertexPropertyChunkInfoReader#
The chunk info reader for vertex property group.
Public Functions
-
inline ~VertexPropertyChunkInfoReader()#
-
inline explicit VertexPropertyChunkInfoReader(const VertexInfo &vertex_info, const PropertyGroup &property_group, const std::string &prefix)#
Initialize the VertexPropertyChunkInfoReader.
- Parameters
vertex_info – The vertex info that describes the vertex type.
property_group – The property group that describes the property group.
prefix – The absolute prefix of the graph.
-
inline Status seek(IdType id) noexcept#
Sets chunk position indicator for reader by vertex id. If vertex id is not found, will return Status::KeyError error. After seeking to an invalid vertex id, the next call to GetChunk function may undefined, e.g. return an non exist path.
- Parameters
id – the vertex id.
-
inline Result<std::string> GetChunk() noexcept#
Return the current chunk file path of chunk position indicator.
-
inline Status next_chunk() noexcept#
Sets chunk position indicator to next chunk. if current chunk is the last chunk, will return Status::OutOfRange error.
-
inline ~VertexPropertyChunkInfoReader()#
-
class AdjListChunkInfoReader#
The chunk info reader for adj list topology chunk.
Public Functions
-
inline ~AdjListChunkInfoReader()#
-
inline explicit AdjListChunkInfoReader(const EdgeInfo &edge_info, AdjListType adj_list_type, const std::string &prefix)#
Initialize the AdjListChunkInfoReader.
- Parameters
edge_info – The edge info that describes the edge type.
adj_list_type – The adj list type for the edges.
prefix – The absolute prefix of the graph.
-
Status seek_src(IdType id) noexcept#
Sets chunk position indicator for reader by source vertex id.
- Parameters
id – the source vertex id.
-
Status seek_dst(IdType id) noexcept#
Sets chunk position indicator for reader by destination vertex id.
- Parameters
id – the destination vertex id.
-
inline Status seek(IdType index) noexcept#
Sets chunk position indicator for reader by edge index.
- Parameters
offset – edge index of the vertex chunk. Note: the offset is the edge index of the vertex chunk, not the edge index of the whole graph.
-
inline Result<std::string> GetChunk() noexcept#
Return the current chunk file path of chunk position indicator.
-
inline Status next_chunk()#
Sets chunk position indicator to next chunk. if current chunk is the last chunk, will return Status::OutOfRange error.
-
inline ~AdjListChunkInfoReader()#
-
class AdjListPropertyChunkInfoReader#
The chunk info reader for edge property group chunk.
Public Functions
-
inline explicit AdjListPropertyChunkInfoReader(const EdgeInfo &edge_info, const PropertyGroup &property_group, AdjListType adj_list_type, const std::string prefix)#
Initialize the AdjListPropertyChunkInfoReader.
- Parameters
edge_info – The edge info that describes the edge type.
property_group – The property group of the edge property.
adj_list_type – The adj list type for the edges.
prefix – The absolute prefix of the graph.
-
Status seek_src(IdType id) noexcept#
Sets chunk position indicator for reader by source vertex id.
- Parameters
id – the source vertex id.
-
Status seek_dst(IdType id) noexcept#
Sets chunk position indicator for reader by destination vertex id.
- Parameters
id – the destination vertex id.
-
inline Status seek(IdType offset) noexcept#
Sets chunk position indicator for reader by edge index.
- Parameters
offset – edge index of the vertex chunk. Note: the offset is the edge index of the vertex chunk, not the edge index of the whole graph.
-
inline Result<std::string> GetChunk() noexcept#
Return the current chunk file path of chunk position indicator.
-
inline Status next_chunk()#
Sets chunk position indicator to next chunk. if current chunk is the last chunk, will return Status::OutOfRange error.
-
inline explicit AdjListPropertyChunkInfoReader(const EdgeInfo &edge_info, const PropertyGroup &property_group, AdjListType adj_list_type, const std::string prefix)#
-
static inline Result<VertexPropertyChunkInfoReader> GraphArchive::ConstructVertexPropertyChunkInfoReader(const GraphInfo &graph_info, const std::string &label, const PropertyGroup &property_group) noexcept#
Helper function to Construct VertexPropertyChunkInfoReader.
- Parameters
graph_info – The graph info to describe the graph.
label – label name of the vertex.
property_group – The property group of the vertex.
-
static inline Result<AdjListChunkInfoReader> GraphArchive::ConstructAdjListChunkInfoReader(const GraphInfo &graph_info, const std::string &src_label, const std::string &edge_label, const std::string &dst_label, AdjListType adj_list_type) noexcept#
Helper function to Construct AdjListChunkInfoReader.
- Parameters
graph_info – The graph info to describe the graph.
src_label – label of source vertex.
edge_label – label of edge.
dst_label – label of destination vertex.
adj_list_type – The adj list type for the edges.
-
static inline Result<AdjListPropertyChunkInfoReader> GraphArchive::ConstructAdjListPropertyChunkInfoReader(const GraphInfo &graph_info, const std::string &src_label, const std::string &edge_label, const std::string &dst_label, const PropertyGroup &property_group, AdjListType adj_list_type) noexcept#
Helper function to Construct AdjListPropertyChunkInfoReader.
- Parameters
graph_info – The graph info to describe the graph.
src_label – label of source vertex.
edge_label – label of edge.
dst_label – label of destination vertex.
property_group – The property group of the edge.
adj_list_type – The adj list type for the edges.
Arrow Chunk Reader#
-
class VertexPropertyArrowChunkReader#
The arrow chunk reader for vertex property group.
Public Functions
-
inline VertexPropertyArrowChunkReader(const VertexInfo &vertex_info, const PropertyGroup &property_group, const std::string &prefix, IdType chunk_index = 0)#
Initialize the VertexPropertyArrowChunkReader.
- Parameters
vertex_info – The vertex info that describes the vertex type.
property_group – The property group that describes the property group.
prefix – The absolute prefix.
-
inline Status seek(IdType id) noexcept#
Sets chunk position indicator for reader by vertex id. If vertex id is not found, will return Status::KeyError error. After seeking to an invalid vertex id, the next call to GetChunk function may undefined, e.g. return an non exist path.
- Parameters
id – the vertex id.
-
Result<std::shared_ptr<arrow::Table>> GetChunk() noexcept#
Return the current arrow chunk table of chunk position indicator.
-
Result<std::pair<IdType, IdType>> GetRange() noexcept#
Get the vertex id range of current chunk.
- Returns
Result: std::pair<begin_id, end_id> or error.
-
inline Status next_chunk() noexcept#
Sets chunk position indicator to next chunk.
if current chunk is the last chunk, will return Status::OutOfRange error.
-
inline VertexPropertyArrowChunkReader(const VertexInfo &vertex_info, const PropertyGroup &property_group, const std::string &prefix, IdType chunk_index = 0)#
-
class AdjListArrowChunkReader#
The arrow chunk reader for adj list topology chunk.
Public Functions
-
inline AdjListArrowChunkReader(const EdgeInfo &edge_info, AdjListType adj_list_type, const std::string &prefix, IdType vertex_chunk_index = 0)#
Initialize the AdjListArrowChunkReader.
- Parameters
edge_info – The edge info that describes the edge type.
adj_list_type – The adj list type for the edges.
prefix – The absolute prefix.
vertex_chunk_index – The vertex chunk index, default is 0.
-
inline AdjListArrowChunkReader(const AdjListArrowChunkReader &other)#
Copy constructor.
-
Status seek_src(IdType id) noexcept#
Sets chunk position indicator for reader by source vertex id.
- Parameters
id – the source vertex id.
-
Status seek_dst(IdType offset) noexcept#
Sets chunk position indicator for reader by destination vertex id.
- Parameters
id – the destination vertex id.
-
inline Status seek(IdType offset) noexcept#
Sets chunk position indicator for reader by edge index.
- Parameters
offset – edge index of the vertex chunk. Note: the offset is the edge index of the vertex chunk, not the edge index of the whole graph.
-
Result<std::shared_ptr<arrow::Table>> GetChunk() noexcept#
Return the current chunk of chunk position indicator as arrow::Table.
-
inline AdjListArrowChunkReader(const EdgeInfo &edge_info, AdjListType adj_list_type, const std::string &prefix, IdType vertex_chunk_index = 0)#
-
class AdjListOffsetArrowChunkReader#
The arrow chunk reader for edge offset.
Public Functions
-
inline AdjListOffsetArrowChunkReader(const EdgeInfo &edge_info, AdjListType adj_list_type, const std::string &prefix)#
Initialize the AdjListOffsetArrowChunkReader.
- Parameters
edge_info – The edge info that describes the edge type.
adj_list_type – The adj list type for the edges. Note that the adj list type must be AdjListType::ordered_by_source or AdjListType::ordered_by_dest.
prefix – The absolute prefix.
-
inline Status seek(IdType id) noexcept#
Sets chunk position indicator to next chunk. if current chunk is the last chunk, will return Status::OutOfRange error.
-
Result<std::shared_ptr<arrow::Array>> GetChunk() noexcept#
Get the current offset chunk as arrow::Array.
-
inline Status next_chunk()#
Sets chunk position indicator to next chunk. if current chunk is the last chunk, will return Status::OutOfRange error.
-
inline AdjListOffsetArrowChunkReader(const EdgeInfo &edge_info, AdjListType adj_list_type, const std::string &prefix)#
-
static inline Result<VertexPropertyArrowChunkReader> GraphArchive::ConstructVertexPropertyArrowChunkReader(const GraphInfo &graph_info, const std::string &label, const PropertyGroup &property_group) noexcept#
Helper function to Construct VertexPropertyArrowChunkReader.
- Parameters
graph_info – The graph info to describe the graph.
label – label of the vertex.
property_group – The property group of the vertex.
-
static inline Result<AdjListArrowChunkReader> GraphArchive::ConstructAdjListArrowChunkReader(const GraphInfo &graph_info, const std::string &src_label, const std::string &edge_label, const std::string &dst_label, AdjListType adj_list_type) noexcept#
Helper function to Construct AdjListArrowChunkReader.
- Parameters
graph_info – The graph info to describe the graph.
src_label – label of source vertex.
edge_label – label of edge.
dst_label – label of destination vertex.
adj_list_type – The adj list type for the edges.
-
static inline Result<AdjListOffsetArrowChunkReader> GraphArchive::ConstructAdjListOffsetArrowChunkReader(const GraphInfo &graph_info, const std::string &src_label, const std::string &edge_label, const std::string &dst_label, AdjListType adj_list_type) noexcept#
Helper function to Construct AdjListOffsetArrowChunkReader.
- Parameters
graph_info – The graph info to describe the graph.
src_label – label of source vertex.
edge_label – label of edge.
dst_label – label of destination vertex.
adj_list_type – The adj list type for the edges.
Vertices Collection#
-
class Vertex#
Vertex contains information of certain vertex.
Public Functions
-
explicit Vertex(IdType id, std::vector<VertexPropertyArrowChunkReader> &readers)#
Initialize the Vertex.
- Parameters
id – The vertex id.
readers – A set of readers for reading the vertex properties.
-
explicit Vertex(IdType id, std::vector<VertexPropertyArrowChunkReader> &readers)#
-
class VerticesCollection#
VerticesCollection is designed for reading a collection of vertices.
Public Functions
-
inline explicit VerticesCollection(const VertexInfo &vertex_info, const std::string &prefix)#
Initialize the VerticesCollection.
- Parameters
vertex_info – The vertex info that describes the vertex type.
prefix – The absolute prefix.
-
inline size_t size() const noexcept#
Get the number of vertices in the collection.
-
class iterator#
The iterator for traversing a type of vertices.
Public Functions
-
inline explicit iterator(const VertexInfo &vertex_info, const std::string &prefix, IdType offset) noexcept#
Initialize the iterator.
- Parameters
vertex_info – The vertex info that describes the vertex type.
prefix – The absolute prefix.
offset – The current offset of the readers.
-
inline explicit iterator(const VertexInfo &vertex_info, const std::string &prefix, IdType offset) noexcept#
-
inline explicit VerticesCollection(const VertexInfo &vertex_info, const std::string &prefix)#
-
static inline Result<VerticesCollection> GraphArchive::ConstructVerticesCollection(const GraphInfo &graph_info, const std::string &label) noexcept#
Construct the collection for vertices with specific label.
- Parameters
graph_info – The GraphInfo for the graph.
label – The vertex label.
- Returns
The constructed collection or error.
Edges Collection#
-
class Edge#
Edge contains information of certain edge.
Public Functions
-
explicit Edge(AdjListArrowChunkReader &adj_list_reader, std::vector<AdjListPropertyArrowChunkReader> &property_readers)#
Initialize the Edge.
- Parameters
adj_list_reader – The reader for reading the adjList.
property_readers – A set of readers for reading the edge properties.
-
inline IdType source() const noexcept#
Get source id of the edge.
- Returns
The id of the source vertex.
-
explicit Edge(AdjListArrowChunkReader &adj_list_reader, std::vector<AdjListPropertyArrowChunkReader> &property_readers)#
-
template<AdjListType adj_list_type>
class EdgesCollection# EdgesCollection is designed for reading a collection of edges.
-
class EdgeIter#
The iterator for traversing a type of edges.
Public Functions
Initialize the iterator.
- Parameters
edge_info – The edge info that describes the edge type.
prefix – The absolute prefix.
adj_list_type – The type of adjList.
global_chunk_index – The global index of the current edge chunk.
offset – The current offset in the current edge chunk.
chunk_begin – The index of the first chunk.
chunk_end – The index of the last chunk.
offset_of_chunk_begin – The begin offset of the first chunk.
offset_of_chunk_end – The end offset of the last chunk.
index_converter – The converter for transforming the edge chunk indices.
-
template<typename T>
inline Result<T> property(const std::string &property) noexcept# Get the value of a property for the current edge.
-
inline bool first_src(const EdgeIter &from, IdType id)#
Let the input iterator to point to the first out-going edge of the vertex with specific id after the current position of the iterator.
- Parameters
from – The input iterator.
id – The vertex id.
- Returns
If such edge is found or not.
-
inline bool first_dst(const EdgeIter &from, IdType id)#
Let the input iterator to point to the first incoming edge of the vertex with specific id after the current position of the iterator.
- Parameters
from – The input iterator.
id – The vertex id.
- Returns
If such edge is found or not.
-
inline void to_begin()#
Let the iterator to point to the begin.
-
inline bool is_end() const#
Check if the current position is the end.
-
inline bool next_src()#
Point to the next edge with the same source, return false if not found.
-
inline bool next_dst()#
Point to the next edge with the same destination, return false if not found.
Friends
- friend class EdgesCollection< AdjListType::ordered_by_source >
- friend class EdgesCollection< AdjListType::ordered_by_dest >
- friend class EdgesCollection< AdjListType::unordered_by_source >
- friend class EdgesCollection< AdjListType::unordered_by_dest >
-
template<>
class EdgesCollection<AdjListType::ordered_by_source># The implementation of EdgesCollection when the type of adjList is AdjListType::ordered_by_source.
Public Functions
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix)#
Initialize the EdgesCollection.
- Parameters
edge_info – The edge info that describes the edge type.
prefix – The absolute prefix.
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix, IdType chunk_begin, IdType chunk_end)#
Initialize the EdgesCollection with a range of chunks.
- Parameters
edge_info – The edge info that describes the edge type.
prefix – The absolute prefix.
chunk_begin – The global index of the begin chunk.
chunk_end – The global index of the end chunk.
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix, IdType vertex_chunk_index)#
Initialize the EdgesCollection for a vertex chunk.
- Parameters
edge_info – The edge info that describes the edge type.
prefix – The absolute prefix.
vertex_chunk_index – The index of the vertex chunk.
Public Static Attributes
-
static const AdjListType adj_list_type_ = AdjListType::ordered_by_source#
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix)#
-
template<>
class EdgesCollection<AdjListType::ordered_by_dest># The implementation of EdgesCollection when the type of adjList is AdjListType::ordered_by_dest.
Public Functions
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix)#
Initialize the EdgesCollection.
- Parameters
edge_info – The edge info that describes the edge type.
prefix – The absolute prefix.
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix, IdType chunk_begin, IdType chunk_end)#
Initialize the EdgesCollection with a range of chunks.
- Parameters
edge_info – The edge info that describes the edge type.
prefix – The absolute prefix.
chunk_begin – The global index of the begin chunk.
chunk_end – The global index of the end chunk.
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix, IdType vertex_chunk_index)#
Initialize the EdgesCollection for a vertex chunk.
- Parameters
edge_info – The edge info that describes the edge type.
prefix – The absolute prefix.
vertex_chunk_index – The index of the vertex chunk.
Public Static Attributes
-
static const AdjListType adj_list_type_ = AdjListType::ordered_by_dest#
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix)#
-
template<>
class EdgesCollection<AdjListType::unordered_by_source># The implementation of EdgesCollection when the type of adjList is AdjListType::unordered_by_source.
Public Functions
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix)#
Initialize the EdgesCollection.
- Parameters
edge_info – The edge info that describes the edge type.
prefix – The absolute prefix.
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix, IdType chunk_begin, IdType chunk_end)#
Initialize the EdgesCollection with a range of chunks.
- Parameters
edge_info – The edge info that describes the edge type.
prefix – The absolute prefix.
chunk_begin – The global index of the begin chunk.
chunk_end – The global index of the end chunk.
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix, IdType vertex_chunk_index)#
Initialize the EdgesCollection for a vertex chunk.
- Parameters
edge_info – The edge info that describes the edge type.
prefix – The absolute prefix.
vertex_chunk_index – The index of the vertex chunk.
Public Static Attributes
-
static const AdjListType adj_list_type_ = AdjListType::unordered_by_source#
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix)#
-
template<>
class EdgesCollection<AdjListType::unordered_by_dest># The implementation of EdgesCollection when the type of adjList is AdjListType::unordered_by_dest.
Public Functions
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix)#
Initialize the EdgesCollection.
- Parameters
edge_info – The edge info that describes the edge type.
prefix – The absolute prefix.
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix, IdType chunk_begin, IdType chunk_end)#
Initialize the EdgesCollection with a range of chunks.
- Parameters
edge_info – The edge info that describes the edge type.
prefix – The absolute prefix.
chunk_begin – The global index of the begin chunk.
chunk_end – The global index of the end chunk.
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix, IdType vertex_chunk_index)#
Initialize the EdgesCollection for a vertex chunk.
- Parameters
edge_info – The edge info that describes the edge type.
prefix – The absolute prefix.
vertex_chunk_index – The index of the vertex chunk.
Public Static Attributes
-
static const AdjListType adj_list_type_ = AdjListType::unordered_by_dest#
-
inline EdgesCollection(const EdgeInfo &edge_info, const std::string &prefix)#
-
static inline Result<Edges> GraphArchive::ConstructEdgesCollection(const GraphInfo &graph_info, const std::string &src_label, const std::string &edge_label, const std::string &dst_label, AdjListType adj_list_type) noexcept#
Construct the collection for a type of edges.
- Parameters
graph_info – The GraphInfo for the graph.
src_label – The source vertex label.
edge_label – The edge label.
dst_label – The destination vertex label.
adj_list_type – The adjList type.
- Returns
The constructed collection or error.
-
static inline Result<Edges> GraphArchive::ConstructEdgesCollection(const GraphInfo &graph_info, const std::string &src_label, const std::string &edge_label, const std::string &dst_label, AdjListType adj_list_type, const IdType chunk_begin, const IdType chunk_end) noexcept#
Construct the collection for a range of edges.
- Parameters
graph_info – The GraphInfo for the graph.
src_label – The source vertex label.
edge_label – The edge label.
dst_label – The destination vertex label.
adj_list_type – The adjList type.
chunk_begin – The global index of the begin chunk.
chunk_end – The global index of the end chunk.
- Returns
The constructed collection or error.
-
static inline Result<Edges> GraphArchive::ConstructEdgesCollection(const GraphInfo &graph_info, const std::string &src_label, const std::string &edge_label, const std::string &dst_label, AdjListType adj_list_type, IdType vertex_chunk_index) noexcept#
Construct the collection for edges of a vertex chunk.
- Parameters
graph_info – The GraphInfo for this graph.
src_label – The source vertex label.
edge_label – The edge label.
dst_label – The destination vertex label.
adj_list_type – The adjList type.
vertex_chunk_index – The index of the vertex chunk.
- Returns
The constructed collection or error.
Writer and Builder#
Chunk Writer#
-
class VertexPropertyWriter#
The writer for vertex property group chunks.
Public Functions
-
inline VertexPropertyWriter(const VertexInfo &vertex_info, const std::string &prefix, const ValidateLevel &validate_level = ValidateLevel::no_validate)#
Initialize the VertexPropertyWriter.
- Parameters
vertex_info – The vertex info that describes the vertex type.
prefix – The absolute prefix.
validate_level – The validate level, with no validate by default.
-
inline void SetValidateLevel(const ValidateLevel &validate_level)#
Set the validate level.
- Parameters
validate_level – The validate level to set.
-
inline ValidateLevel GetValidateLevel() const#
Get the validate level.
- Returns
The validate level of this writer.
Check if the write opeartion is allowed.
- Parameters
input_table – The input table containing data.
property_group – The property group to write.
chunk_index – The index of the vertex chunk.
validate_level – The validate level for this operation, which is the writer’s validate level by default.
- Returns
Status: ok or error.
-
Status WriteVerticesNum(const IdType &count) const noexcept#
Write the number of vertices into the file.
- Parameters
count – The number of vertices.
- Returns
Status: ok or error.
-
Status WriteChunk(const std::string &file_name, const PropertyGroup &property_group, IdType chunk_index) const noexcept#
Copy a file as a vertex property group chunk.
- Parameters
file_name – The file to copy.
property_group – The property group.
chunk_index – The index of the vertex chunk.
- Returns
Status: ok or error.
Validate and write a single property group for a single vertex chunk.
- Parameters
input_table – The table containing data.
property_group – The property group.
chunk_index – The index of the vertex chunk.
- Returns
Status: ok or error.
Write all property groups of a single vertex chunk to corresponding files.
- Parameters
input_table – The table containing data.
chunk_index – The index of the vertex chunk.
- Returns
Status: ok or error.
Write a single property group for multiple vertex chunks to corresponding files.
- Parameters
input_table – The table containing data.
property_group – The property group.
start_chunk_index – The start index of the vertex chunks.
- Returns
Status: ok or error.
Write all property groups for multiple vertex chunks to corresponding files.
- Parameters
input_table – The table containing data.
start_chunk_index – The start index of the vertex chunks.
- Returns
Status: ok or error.
-
inline VertexPropertyWriter(const VertexInfo &vertex_info, const std::string &prefix, const ValidateLevel &validate_level = ValidateLevel::no_validate)#
-
class EdgeChunkWriter#
The writer for edge (adj list, offset and property group) chunks.
Public Functions
-
inline EdgeChunkWriter(const EdgeInfo &edge_info, const std::string &prefix, const AdjListType adj_list_type = AdjListType::unordered_by_source, const ValidateLevel &validate_level = ValidateLevel::no_validate)#
Initialize the EdgeChunkWriter.
- Parameters
edge_info – The edge info that describes the edge type.
prefix – The absolute prefix.
adj_list_type – The adj list type for the edges.
validate_level – The validate level, with no validate by default.
-
inline void SetValidateLevel(const ValidateLevel &validate_level)#
Set the validate level.
- Parameters
validate_level – The validate level to set.
Check if the writer operation (for adj list or offset) is allowed.
- Parameters
input_table – The input table containing data.
vertex_chunk_index – The index of the vertex chunk.
validate_level – The validate level for this operation, which is the writer’s validate level by default.
- Returns
Status: ok or error.
Check if the writer operation (for property group) is allowed.
- Parameters
input_table – The input table containing data.
property_group – The property group to write.
vertex_chunk_index – The index of the vertex chunk.
validate_level – The validate level for this operation, which is the writer’s validate level by default.
- Returns
Status: ok or error.
-
Status WriteOffsetChunk(const std::string &file_name, IdType vertex_chunk_index) const noexcept#
Copy a file as a offset chunk.
- Parameters
file_name – The file to copy.
vertex_chunk_index – The index of the vertex chunk.
- Returns
Status: ok or error.
-
Status WriteAdjListChunk(const std::string &file_name, IdType vertex_chunk_index, IdType chunk_index) const noexcept#
Copy a file as an adj list chunk.
- Parameters
file_name – The file to copy.
vertex_chunk_index – The index of the vertex chunk.
chunk_index – The index of the edge chunk inside the vertex chunk.
- Returns
Status: ok or error.
-
Status WritePropertyChunk(const std::string &file_name, const PropertyGroup &property_group, IdType vertex_chunk_index, IdType chunk_index) const noexcept#
Copy a file as an edge property group chunk.
- Parameters
file_name – The file to copy.
property_group – The property group to write.
vertex_chunk_index – The index of the vertex chunk.
chunk_index – The index of the edge chunk inside the vertex chunk.
- Returns
Status: ok or error.
Validate and write the offset chunk for a vertex chunk.
- Parameters
input_table – The table containing data.
vertex_chunk_index – The index of the vertex chunk.
- Returns
Status: ok or error.
Validate and write the adj list chunk for an edge chunk.
- Parameters
input_table – The table containing data.
vertex_chunk_index – The index of the vertex chunk.
chunk_index – The index of the edge chunk inside the vertex chunk.
- Returns
Status: ok or error.
Validate and write a single edge property group for an edge chunk.
- Parameters
input_table – The table containing data.
property_group – The property group to write.
vertex_chunk_index – The index of the vertex chunk.
chunk_index – The index of the edge chunk inside the vertex chunk.
- Returns
Status: ok or error.
Write all edge property groups for an edge chunk.
- Parameters
input_table – The table containing data.
vertex_chunk_index – The index of the vertex chunk.
chunk_index – The index of the edge chunk inside the vertex chunk.
- Returns
Status: ok or error.
Write the adj list and all property groups for an edge chunk.
- Parameters
input_table – The table containing data.
vertex_chunk_index – The index of the vertex chunk.
chunk_index – The index of the edge chunk inside the vertex chunk.
- Returns
Status: ok or error.
Write the adj list chunks for the edges of a vertex chunk.
- Parameters
input_table – The table containing data.
vertex_chunk_index – The index of the vertex chunk.
start_chunk_index – The start index of the edge chunks inside the vertex chunk.
- Returns
Status: ok or error.
Write chunks of a single property group for the edges of a vertex chunk.
- Parameters
input_table – The table containing data.
property_group – The property group to write.
vertex_chunk_index – The index of the vertex chunk.
start_chunk_index – The start index of the edge chunks inside the vertex chunk.
- Returns
Status: ok or error.
Write chunks of all property groups for the edges of a vertex chunk.
- Parameters
input_table – The table containing data.
vertex_chunk_index – The index of the vertex chunk.
start_chunk_index – The start index of the edge chunks inside the vertex chunk.
- Returns
Status: ok or error.
Write chunks of the adj list and all property groups for the edges of a vertex chunk.
- Parameters
input_table – The table containing data.
vertex_chunk_index – The index of the vertex chunk.
start_chunk_index – The start index of the edge chunks inside the vertex chunk.
- Returns
Status: ok or error.
Sort the edges, and write the adj list chunks for the edges of a vertex chunk.
- Parameters
input_table – The table containing data.
vertex_chunk_index – The index of the vertex chunk.
start_chunk_index – The start index of the edge chunks inside the vertex chunk.
- Returns
Status: ok or error.
Sort the edges, and write chunks of a single property group for the edges of a vertex chunk.
- Parameters
input_table – The table containing data.
property_group – The property group to write.
vertex_chunk_index – The index of the vertex chunk.
start_chunk_index – The start index of the edge chunks inside the vertex chunk.
- Returns
Status: ok or error.
Sort the edges, and write chunks of all property groups for the edges of a vertex chunk.
- Parameters
input_table – The table containing data.
vertex_chunk_index – The index of the vertex chunk.
start_chunk_index – The start index of the edge chunks inside the vertex chunk.
- Returns
Status: ok or error.
Sort the edges, and write chunks of the adj list and all property groups for the edges of a vertex chunk.
- Parameters
input_table – The table containing data.
vertex_chunk_index – The index of the vertex chunk.
start_chunk_index – The start index of the edge chunks inside the vertex chunk.
- Returns
Status: ok or error.
-
inline EdgeChunkWriter(const EdgeInfo &edge_info, const std::string &prefix, const AdjListType adj_list_type = AdjListType::unordered_by_source, const ValidateLevel &validate_level = ValidateLevel::no_validate)#
Builder#
-
class Vertex#
Vertex is designed for constucting vertices builder.
Public Functions
-
inline Vertex()#
-
inline explicit Vertex(IdType id)#
Initialize the vertex with a given id.
- Parameters
id – The id of the vertex.
-
inline bool Empty() const noexcept#
Check if the vertex is empty.
- Returns
true/false.
-
inline void AddProperty(const std::string &name, const std::any &val)#
Add a property to the vertex.
- Parameters
name – The name of the property.
val – The value of the property.
-
inline const std::any &GetProperty(const std::string &property) const#
Get a property of the vertex.
- Parameters
property – The name of the property.
- Returns
The value of the property.
-
inline const std::unordered_map<std::string, std::any> &GetProperties() const#
Get all properties of the vertex.
- Returns
The map containing all properties of the vertex.
-
inline bool ContainProperty(const std::string &property)#
Check if the vertex contains a property.
- Parameters
property – The name of the property.
- Returns
true/false.
-
inline Vertex()#
-
class Edge#
Edge is designed for constructing edges builder.
Public Functions
-
inline explicit Edge(IdType src_id, IdType dst_id)#
Initialize the edge with its source and destination.
- Parameters
src_id – The id of the source vertex.
dst_id – The id of the destination vertex.
-
inline bool Empty() const noexcept#
Check if the edge is empty.
- Returns
true/false.
-
inline IdType GetSource() const noexcept#
Get source id of the edge.
- Returns
The id of the source vertex.
-
inline IdType GetDestination() const noexcept#
Get destination id of the edge.
- Returns
The id of the destination vertex.
-
inline void AddProperty(const std::string &name, const std::any &val)#
Add a property to the edge.
- Parameters
name – The name of the property.
val – The value of the property.
-
inline const std::any &GetProperty(const std::string &property) const#
Get a property of the edge.
- Parameters
property – The name of the property.
- Returns
The value of the property.
-
inline const std::unordered_map<std::string, std::any> &GetProperties() const#
Get all properties of the edge.
- Returns
The map containing all properties of the edge.
-
inline bool ContainProperty(const std::string &property) const#
Check if the edge contains a property.
- Parameters
property – The name of the property.
- Returns
true/false.
-
inline explicit Edge(IdType src_id, IdType dst_id)#
-
class VerticesBuilder#
VertexBuilder is designed for building and writing a collection of vertices.
Public Functions
-
inline explicit VerticesBuilder(const VertexInfo &vertex_info, const std::string &prefix, IdType start_vertex_index = 0)#
Initialize the VerciesBuilder.
- Parameters
vertex_info – The vertex info that describes the vertex type.
prefix – The absolute prefix.
start_vertex_index – The start index of the vertices collection.
-
inline Status Validate(const Vertex &v, IdType index = -1) const#
Check if adding a vertex with the given index is allowed.
- Parameters
v – The vertex to add.
index – The given index, -1 means the next unused index.
- Returns
Status: ok or Status::InvalidOperation error.
-
inline Status AddVertex(Vertex &v, IdType index = -1)#
Add a vertex with the given index.
- Parameters
v – The vertex to add.
index – The given index, -1 means the next unused index.
- Returns
Status: ok or Status::InvalidOperation error.
-
inline explicit VerticesBuilder(const VertexInfo &vertex_info, const std::string &prefix, IdType start_vertex_index = 0)#
-
class EdgesBuilder#
EdgeBuilder is designed for building and writing a collection of edges.
Public Functions
-
inline explicit EdgesBuilder(const EdgeInfo edge_info, const std::string &prefix, AdjListType adj_list_type = AdjListType::unordered_by_source, IdType num_vertices = -1)#
Initialize the EdgesBuilder.
- Parameters
edge_info – The edge info that describes the vertex type.
prefix – The absolute prefix.
adj_list_type – The adj list type of the edges.
num_vertices – The total number of vertices for source or destination.
-
inline Status Validate(const Edge &e)#
Check if adding an edge is allowed.
- Parameters
e – The edge to add.
- Returns
Status: ok or status::InvalidOperation error.
-
inline IdType getVertexChunkIndex(const Edge &e)#
Get the vertex chunk index of a given edge.
- Parameters
e – The edge to add.
- Returns
The vertex chunk index of the edge.
-
inline Status AddEdge(const Edge &e)#
Add an edge to the collection.
- Parameters
e – The edge to add.
- Returns
Status: ok or Status::InvalidOperation error.
-
inline explicit EdgesBuilder(const EdgeInfo edge_info, const std::string &prefix, AdjListType adj_list_type = AdjListType::unordered_by_source, IdType num_vertices = -1)#
Types#
Data Type#
-
struct DataType#
The DataType struct to provide enum type for data type and functions to parse data type.
Public Types
-
enum type#
Main data type enumeration.
Values:
-
enumerator BOOL#
Boolean as 1 bit, LSB bit-packed ordering.
-
enumerator INT32#
Signed 32-bit little-endian integer.
-
enumerator INT64#
Signed 64-bit little-endian integer.
-
enumerator FLOAT#
4-byte floating point value
-
enumerator DOUBLE#
8-byte floating point value
-
enumerator STRING#
UTF8 variable-length string as List<Char>
-
enumerator MAX_ID#
-
enumerator BOOL#
-
enum type#
File Type#
Adj List Type#
-
enum class GraphArchive::AdjListType : std::uint8_t#
Adj list type enumeration for adjacency list of graph.
Values:
-
enumerator unordered_by_source#
collection of edges by source, but unordered, can represent COO format
-
enumerator unordered_by_dest#
collection of edges by destination, but unordered, can represent COO format
-
enumerator ordered_by_source#
collection of edges by source, ordered by source, can represent CSR format
-
enumerator ordered_by_dest#
collection of edges by destination, ordered by destination, can represent CSC format
-
enumerator unordered_by_source#
Utilities#
Result and Status#
-
template<typename T>
using GraphArchive::Result = cpp::result<T, Status># A class for representing either a usable value, or an error.
A Result object either contains a value of type
Tor a Status object explaining why such a value is not present. The typeTmust be copy-constructible and/or move-constructible.The state of a Result object may be determined by calling has_error() or status(). The has_error() method returns false if the object contains a valid value. The status() method returns the internal Status object. A Result object that contains a valid value will return an OK Status for a call to status().
A value of type
Tmay be extracted from a Result object through a call to value(). This function should only be called if a call to has_error() returns false. Sample usage:gar::Result<Foo> result = CalculateFoo(); if (!result.has_error()) { Foo foo = result.value(); foo.DoSomethingCool(); } else { std::err << result.status(); }
-
class Status#
Status outcome object (success or error)
The Status object is an object holding the outcome of an operation. The outcome is represented as a StatusCode, either success (StatusCode::OK) or an error (any other of the StatusCode enumeration values).
Additionally, if an error occurred, a specific error message is generally attached.
Public Functions
-
inline Status() noexcept#
-
inline ~Status() noexcept#
-
inline Status(StatusCode code, const std::string &msg)#
Create a status with the specified error code and message.
-
inline bool ok() const#
Return true iff the status indicates success.
-
inline bool IsKeyError() const#
Return true iff the status indicates a key lookup error.
-
inline bool IsTypeError() const#
Return true iff the status indicates a type match error.
-
inline bool IsInvalid() const#
Return true iff the status indicates invalid data.
-
inline bool IsInvalidValue() const#
-
inline bool IsInvalidArgument() const#
-
inline bool IsInvalidOperation() const#
-
inline bool IsOutOfRange() const#
-
inline bool IsEndOfChunk() const#
-
inline bool IsYamlError() const#
Return true iff the status indicates an yaml-cpp related failure.
-
inline bool IsArrowError() const#
Return true iff the status indicates an arrow-related failure.
-
inline StatusCode code() const#
Return the StatusCode value attached to this status.
-
inline std::string message() const#
Return the specific error message attached to this status.
Public Static Functions
-
static inline Status IOError(const std::string &msg = "")#
Return an error status when some IO-related operation failed.
-
static inline Status KeyError(const std::string &msg = "")#
Return an error status for failed key lookups.
-
static inline Status TypeError(const std::string &msg = "")#
Return an error status for failed type matches.
-
static inline Status Invalid(const std::string &msg = "")#
Return an error status for invalid data (for example a string that fails parsing)
-
static inline Status OutOfRange(const std::string &msg = "")#
Return an error status for value is out of range (for example next_chunk is out of range)
-
static inline Status YamlError(const std::string &msg = "")#
Return an error status when some yaml-cpp related operation failed.
-
inline Status() noexcept#
FileSystem#
-
class FileSystem#
A wrapper of arrow::FileSystem to provide read/write arrow::Table from/to file and other necessary file operations.
Public Functions
Create a FileSystem instance.
-
~FileSystem() = default#
-
Result<std::shared_ptr<arrow::Table>> ReadFileToTable(const std::string &path, FileType file_type) const noexcept#
Read a file as an arrow::Table.
-
template<typename T>
Result<T> ReadFileToValue(const std::string &path) const noexcept# Read a file to value if the file bytes can not be converted to value, return Status::ArrowError
-
template<typename T>
Status WriteValueToFile(const T &value, const std::string &path) const noexcept# Write a value to a file.
Write a table to a file with a specific type.
- Parameters
input_table – The table to write.
file_type – The type of the output file.
path – The path of the output file.
-
Status CopyFile(const std::string &src_path, const std::string &dst_path) const noexcept#
Copy a file.
If the destination exists and is a directory, an Status::ArrowError is returned. Otherwise, it is replaced.
-
Result<std::shared_ptr<FileSystem>> GraphArchive::FileSystemFromUriOrPath(const std::string &uri, std::string *out_path = nullptr)#
Create a new FileSystem by URI.
wrapper of arrow::fs::FileSystemFromUri
Recognized schemes are “file”, “mock”, “hdfs”, “viewfs”, “s3”, “gs” and “gcs”.
in addition also recognize non-URIs, and treat them as local filesystem paths. Only absolute local filesystem paths are allowed.
Yaml Parser#
-
class Yaml#
A wrapper of YAML::Node to provide functions to parse yaml.
Public Static Functions
-
static Result<std::shared_ptr<Yaml>> Load(const std::string &input)#
Loads the input string as Yaml instance.
Return Status::YamlError if input string can not be loaded(malformed).
-
static Result<std::shared_ptr<Yaml>> Load(const char *input)#
Loads the input string as Yaml instance.
Return Status::YamlError if input string can not be loaded(malformed).
-
static Result<std::shared_ptr<Yaml>> Load(const std::string &input)#