lgraph_vertex_index_iterator

namespace lgraph
namespace lgraph_api
class VertexIndexIterator
#include <lgraph_vertex_index_iterator.h>

VertexIndexIterator can be used to access a set of vertices that has the same indexed value. If the index is unique (that is, each vertex has a unique index value), then each VertexIndexIterator will only have one VertexId, and will become invalid after Next() is called.

An VertexIndexIterator is valid iff it points to a valid (index_value, vid) pair, otherwise it is invalid. Calling member function on an invalid VertexIndexIterator throws an exception, except for the IsValid() function.

Public Functions

VertexIndexIterator(VertexIndexIterator &&rhs)
VertexIndexIterator &operator=(VertexIndexIterator&&)
~VertexIndexIterator()
void Close()

Closes this iterator.

bool IsValid() const

Query if this iterator is valid, i.e. the Key and Vid can be queried.

Returns

True if valid, false if not.

bool Next()

Move to the next vertex id in the list, which consists of all the valid vertex ids of the iterator and is sorted from small to large. If we hit the end of the list, iterator will become invalid and false is returned.

Returns

True if it succeeds, otherwise false.

FieldData GetIndexValue() const

Gets the current index value. The vids are sorted in (IndexValue, Vid) order. When Next() is called, the iterator moves from one vid to next, possibly moving from one IndexValue to another. This function tells the IndexValue currently pointed to.

Returns

The key.

int64_t GetVid() const

Gets the current vertex id.

Returns

The current vertex id.

Private Functions

VertexIndexIterator(lgraph::VertexIndexIterator &&it, const std::shared_ptr<lgraph::Transaction> &txn)
VertexIndexIterator(const VertexIndexIterator&) = delete
VertexIndexIterator &operator=(const VertexIndexIterator&) = delete

Private Members

std::unique_ptr<lgraph::VertexIndexIterator> it_
std::shared_ptr<lgraph::Transaction> txn_

Friends

friend class Transaction