Go to the documentation of this file.
16 #ifndef GRAPHSCOPE_DATABASE_READ_TRANSACTION_H_
17 #define GRAPHSCOPE_DATABASE_READ_TRANSACTION_H_
28 class MutablePropertyFragment;
31 template <
typename EDATA_T>
92 template <
typename EDATA_T>
105 template <
typename FUNC_T>
107 const FUNC_T& func)
const {
108 const auto& edges =
csr_.get_edges(v);
109 auto ptr = edges.end() - 1;
110 auto end = edges.begin() - 1;
119 if (!(ptr->data < min_value) && (ptr->data < max_value)) {
120 func(*ptr, min_value, max_value);
127 ptr = std::upper_bound(end + 1, ptr + 1, max_value,
133 if (ptr->data < min_value) {
136 func(*ptr, min_value, max_value);
142 template <
typename FUNC_T>
144 const auto& edges =
csr_.get_edges(v);
145 auto ptr = edges.end() - 1;
146 auto end = edges.begin() - 1;
155 if (min_value < ptr->data) {
156 func(*ptr, min_value);
161 if (!(min_value < ptr->data)) {
164 func(*ptr, min_value);
170 template <
typename FUNC_T>
172 const auto& edges =
csr_.get_edges(v);
173 auto ptr = edges.end() - 1;
174 auto end = edges.begin() - 1;
183 if (!(ptr->data < min_value)) {
184 func(*ptr, min_value);
189 if (ptr->data < min_value) {
192 func(*ptr, min_value);
203 template <
typename EDATA_T>
214 return csr_.get_edge(v);
234 return csr_.get_edge(v);
242 template <
typename EDATA_T>
249 return (
csr_.get_edge(v).neighbor != std::numeric_limits<vid_t>::max());
253 return csr_.get_edge(v);
267 return (
csr_.get_edge(v).neighbor != std::numeric_limits<vid_t>::max());
271 return csr_.get_edge(v);
298 uint8_t label,
const std::string& col_name)
const {
309 template <
typename T>
311 uint8_t label,
const std::string& col_name)
const {
313 CHECK(pk.size() == 1) <<
"Only support single primary key";
314 if (col_name == std::get<1>(pk[0])) {
315 return std::dynamic_pointer_cast<TypedRefColumn<T>>(
320 return std::dynamic_pointer_cast<TypedRefColumn<T>>(
354 std::shared_ptr<CsrConstEdgeIterBase> iter);
373 std::shared_ptr<CsrConstEdgeIterBase>
iter_;
394 template <
typename EDATA_T>
403 template <
typename EDATA_T>
414 template <
typename EDATA_T>
423 template <
typename EDATA_T>
432 template <
typename EDATA_T>
440 template <
typename EDATA_T>
448 template <
typename EDATA_T>
456 template <
typename EDATA_T>
477 #endif // GRAPHSCOPE_DATABASE_READ_TRANSACTION_H_
vertex_iterator FindVertex(label_t label, const Any &id) const
Definition: read_transaction.cc:95
Definition: read_transaction.h:328
SingleGraphView(const SingleMutableCsr< std::string_view > &csr, timestamp_t timestamp)
Definition: read_transaction.h:225
slice_t edges_
Definition: read_transaction.h:88
bool GetVertexIndex(label_t label, const Any &id, vid_t &index) const
Definition: read_transaction.cc:105
vid_t GetNeighbor() const
Definition: read_transaction.cc:78
const_nbr_ptr_t ptr_
Definition: read_transaction.h:67
nbr_iterator end() const
Definition: read_transaction.h:81
bool exist(vid_t v) const
Definition: read_transaction.h:209
VersionManager & vm_
Definition: read_transaction.h:471
Any GetVertexId(label_t label, vid_t index) const
Definition: read_transaction.cc:114
int FieldNum() const
Definition: read_transaction.cc:56
uint32_t timestamp_t
Definition: types.h:30
SingleImmutableGraphView(const SingleImmutableCsr< EDATA_T > &csr)
Definition: read_transaction.h:245
const Schema & schema() const
Definition: mutable_property_fragment.cc:388
const GraphDBSession & GetSession() const
Definition: read_transaction.cc:139
Any GetId() const
Definition: read_transaction.cc:47
Definition: read_transaction.h:204
vid_t GetIndex() const
Definition: read_transaction.cc:50
AdjListView< EDATA_T > GetIncomingEdges(label_t v_label, vid_t v, label_t neighbor_label, label_t edge_label) const
Definition: read_transaction.h:404
uint32_t vid_t
Definition: types.h:31
const SingleImmutableCsr< std::string_view > & csr_
Definition: read_transaction.h:275
ImmutableNbr< std::string_view > get_edge(vid_t v) const
Definition: read_transaction.h:270
timestamp_t timestamp() const
Definition: read_transaction.cc:28
const MutableNbr< EDATA_T > & get_edge(vid_t v) const
Definition: read_transaction.h:213
const ImmutableNbr< EDATA_T > & get_edge(vid_t v) const
Definition: read_transaction.h:252
void foreach_edges_gt(vid_t v, EDATA_T &min_value, const FUNC_T &func) const
Definition: read_transaction.h:143
void release()
Definition: read_transaction.cc:132
Definition: read_transaction.h:351
Definition: adj_list.h:23
const std::shared_ptr< TypedRefColumn< T > > get_vertex_ref_property_column(uint8_t label, const std::string &col_name) const
Get the handle of the vertex property column, including the primary key.
Definition: read_transaction.h:310
label_t label_
Definition: read_transaction.h:345
const_nbr_ptr_t operator->() const
Definition: read_transaction.h:48
std::shared_ptr< CsrConstEdgeIterBase > iter_
Definition: read_transaction.h:373
const_nbr_ptr_t begin() const
Definition: nbr.h:267
void foreach_edges_between(vid_t v, EDATA_T &min_value, EDATA_T &max_value, const FUNC_T &func) const
Definition: read_transaction.h:106
bool operator==(const nbr_iterator &rhs) const
Definition: read_transaction.h:58
timestamp_t unsorted_since_
Definition: read_transaction.h:200
edge_iterator GetInEdgeIterator(label_t label, vid_t u, label_t neighbor_label, label_t edge_label) const
Definition: read_transaction.cc:124
std::shared_ptr< RefColumnBase > CreateRefColumn(std::shared_ptr< ColumnBase > column)
Definition: column.cc:187
Any GetField(int col_id) const
Definition: read_transaction.cc:52
bool exist(vid_t v) const
Definition: read_transaction.h:266
const GraphDBSession & session_
Definition: read_transaction.h:469
Definition: read_transaction.h:33
std::shared_ptr< RefColumnBase > get_vertex_id_column(uint8_t label) const
Definition: mutable_property_fragment.cc:504
nbr_iterator begin() const
Definition: read_transaction.h:78
Definition: mutable_property_fragment.h:37
timestamp_t timestamp_
Definition: read_transaction.h:472
void Goto(vid_t target)
Definition: read_transaction.cc:43
const MutableCsr< EDATA_T > & csr_
Definition: read_transaction.h:198
Definition: read_transaction.h:32
timestamp_t timestamp_
Definition: read_transaction.h:69
CsrBase * get_ie_csr(label_t label, label_t neighbor_label, label_t edge_label)
Definition: mutable_property_fragment.cc:483
const_nbr_ptr_t end_
Definition: read_transaction.h:68
const_nbr_ptr_t end() const
Definition: nbr.h:268
EDATA_T data
Definition: nbr.h:221
vertex_iterator(label_t label, vid_t cur, vid_t num, const MutablePropertyFragment &graph)
Definition: read_transaction.cc:36
const SingleMutableCsr< EDATA_T > & csr_
Definition: read_transaction.h:218
AdjListView< EDATA_T > get_edges(vid_t v) const
Definition: read_transaction.h:100
const_nbr_t & operator*() const
Definition: read_transaction.h:46
void foreach_edges_ge(vid_t v, EDATA_T &min_value, const FUNC_T &func) const
Definition: read_transaction.h:171
GraphView(const MutableCsr< EDATA_T > &csr, timestamp_t timestamp)
Definition: read_transaction.h:95
Definition: graph_db_session.h:36
void Next()
Definition: read_transaction.cc:76
bool exist(vid_t v) const
Definition: read_transaction.h:248
vertex_iterator GetVertexIterator(label_t label) const
Definition: read_transaction.cc:90
bool IsValid() const
Definition: read_transaction.cc:41
Definition: immutable_csr.h:326
GraphView< EDATA_T > GetIncomingGraphView(label_t v_label, label_t neighbor_label, label_t edge_label) const
Definition: read_transaction.h:424
Definition: version_manager.h:34
Definition: mutable_csr.h:183
typename MutableNbrSlice< EDATA_T >::const_nbr_ptr_t const_nbr_ptr_t
Definition: read_transaction.h:35
Definition: read_transaction.h:243
const Schema & schema() const
Definition: read_transaction.cc:130
AdjListView< EDATA_T > GetOutgoingEdges(label_t v_label, vid_t v, label_t neighbor_label, label_t edge_label) const
Definition: read_transaction.h:395
label_t edge_label_
Definition: read_transaction.h:371
Definition: read_transaction.h:278
Definition: immutable_csr.h:512
Definition: csr_base.h:135
vid_t GetVertexNum(label_t label) const
Definition: read_transaction.cc:110
SingleGraphView< EDATA_T > GetIncomingSingleGraphView(label_t v_label, label_t neighbor_label, label_t edge_label) const
Definition: read_transaction.h:441
AdjListView(const slice_t &slice, timestamp_t timestamp)
Definition: read_transaction.h:75
void Next()
Definition: read_transaction.cc:42
const MutablePropertyFragment & graph_
Definition: read_transaction.h:348
typename MutableNbrSlice< EDATA_T >::const_nbr_t const_nbr_t
Definition: read_transaction.h:34
CsrBase * get_oe_csr(label_t label, label_t neighbor_label, label_t edge_label)
Definition: mutable_property_fragment.cc:467
SingleGraphView(const SingleMutableCsr< EDATA_T > &csr, timestamp_t timestamp)
Definition: read_transaction.h:206
label_t GetEdgeLabel() const
Definition: read_transaction.cc:86
SingleImmutableGraphView< EDATA_T > GetIncomingSingleImmutableGraphView(label_t v_label, label_t neighbor_label, label_t edge_label) const
Definition: read_transaction.h:457
label_t neighbor_label_
Definition: read_transaction.h:370
Definition: loading_config.h:232
Definition: mutable_csr.h:745
edge_iterator(label_t neighbor_label, label_t edge_label, std::shared_ptr< CsrConstEdgeIterBase > iter)
Definition: read_transaction.cc:60
SingleImmutableGraphView(const SingleImmutableCsr< std::string_view > &csr)
Definition: read_transaction.h:263
GraphView< EDATA_T > GetOutgoingGraphView(label_t v_label, label_t neighbor_label, label_t edge_label) const
Definition: read_transaction.h:415
const SingleMutableCsr< std::string_view > & csr_
Definition: read_transaction.h:238
bool IsValid() const
Definition: read_transaction.cc:72
nbr_iterator(const_nbr_ptr_t ptr, const_nbr_ptr_t end, timestamp_t timestamp)
Definition: read_transaction.h:38
Definition: read_transaction.h:93
edge_iterator GetOutEdgeIterator(label_t label, vid_t u, label_t neighbor_label, label_t edge_label) const
Definition: read_transaction.cc:118
ReadTransaction(const GraphDBSession &session, const MutablePropertyFragment &graph, VersionManager &vm, timestamp_t timestamp)
Definition: read_transaction.cc:22
timestamp_t timestamp_
Definition: read_transaction.h:199
timestamp_t timestamp_
Definition: read_transaction.h:239
~ReadTransaction()
Definition: read_transaction.cc:26
Any GetData() const
Definition: read_transaction.cc:68
label_t GetNeighborLabel() const
Definition: read_transaction.cc:82
const MutablePropertyFragment & graph() const
Definition: read_transaction.cc:34
const std::shared_ptr< ColumnBase > get_vertex_property_column(uint8_t label, const std::string &col_name) const
Definition: read_transaction.h:297
nbr_iterator & operator++()
Definition: read_transaction.h:50
vid_t num_
Definition: read_transaction.h:347
bool operator!=(const nbr_iterator &rhs) const
Definition: read_transaction.h:62
MutableNbr< std::string_view > get_edge(vid_t v) const
Definition: read_transaction.h:233
vid_t cur_
Definition: read_transaction.h:346
void Abort()
Definition: read_transaction.cc:32
Definition: mutable_csr.h:954
int size() const
Definition: nbr.h:263
const SingleImmutableCsr< EDATA_T > & csr_
Definition: read_transaction.h:257
int estimated_degree() const
Definition: read_transaction.h:85
timestamp_t timestamp_
Definition: read_transaction.h:89
bool exist(vid_t v) const
Definition: read_transaction.h:229
timestamp_t timestamp_
Definition: read_transaction.h:219
Table & get_vertex_table(label_t vertex_label)
Definition: mutable_property_fragment.cc:392
SingleGraphView< EDATA_T > GetOutgoingSingleGraphView(label_t v_label, label_t neighbor_label, label_t edge_label) const
Definition: read_transaction.h:433
uint8_t label_t
Definition: types.h:32
std::shared_ptr< ColumnBase > get_column(const std::string &name)
Definition: table.cc:171
const std::vector< std::tuple< PropertyType, std::string, size_t > > & get_vertex_primary_key(label_t index) const
Definition: schema.cc:376
void Commit()
Definition: read_transaction.cc:30
const MutablePropertyFragment & graph_
Definition: read_transaction.h:470
SingleImmutableGraphView< EDATA_T > GetOutgoingSingleImmutableGraphView(label_t v_label, label_t neighbor_label, label_t edge_label) const
Definition: read_transaction.h:449