42 static std::unique_ptr<Index>
Create(
43 std::shared_ptr<const IndexDesc> idxdesc);
150 bool upper_isstrict) = 0;
153 Index(std::shared_ptr<const IndexDesc> idxdesc);
202 constexpr
const Index*
BulkLoadIterator is an interface for providing (key, RecordId) pairs for index bulk loading.
Definition: BulkLoadIterator.h:17
Definition: IndexDesc.h:11
A forward-iterator for the items in the index.
Definition: Index.h:181
virtual bool Next()=0
Moves the iterator to the next indexed item if any.
Iterator & operator=(Iterator &&it)=default
Default move assignment.
virtual const Record & GetCurrentItem()=0
Returns the current indexed item the iterator is currently at, where the GetData() and GetLength() pa...
constexpr T * GetIndexAs() const
Static casts the m_index pointer to T* type.
Definition: Index.h:248
virtual bool IsAtValidItem()=0
Returns whether the iterator is currently at a valid indexed item.
virtual ~Iterator()=default
Index * m_index
Definition: Index.h:253
Iterator(const Iterator &)=delete
Iterator(Iterator &&it)=default
Default move constructor.
virtual void EndScan()=0
Ends the index scan.
Iterator & operator=(const Iterator &)=delete
constexpr const Index * GetIndex() const
Returns the underlying index.
Definition: Index.h:203
Iterator(Index *index)
Definition: Index.h:238
virtual RecordId GetCurrentRecordId()=0
Returns the record id of the indexed item the iterator is currently at.
An interface class for index implementations.
Definition: Index.h:19
virtual std::unique_ptr< Iterator > StartScan(const IndexKey *lower, bool lower_isstrict, const IndexKey *upper, bool upper_isstrict)=0
Returns a forward-iterator for all the indexed items in the specified range defined by the arguments.
unique_malloced_ptr m_key
A buffer enough for holding an Indexkey for the number of fields in the key schema.
Definition: Index.h:174
virtual void BulkLoad(BulkLoadIterator &iter)
Loads all the (key, record id) pairs provided by the iterator iter into an empty index.
Definition: Index.cpp:17
void PrepareKey(std::vector< Datum > &data, const char *recbuf, const Schema *tabschema)
Extract the keys from recbuf into m_key.
Definition: Index.cpp:68
static std::unique_ptr< Index > Create(std::shared_ptr< const IndexDesc > idxdesc)
Creates an index object over an index file described by the index descriptor, which has already been ...
Definition: Index.cpp:40
virtual bool InsertKey(const IndexKey *key, RecordId rid)=0
Inserts the (key, rid) pair into the index.
bool InsertRecord(const Record &rec, const Schema *tabschema=nullptr)
Inserts the (key, rid) extracted from the table record into the index.
Definition: Index.cpp:54
virtual bool DeleteKey(const IndexKey *key, RecordId &rid)=0
Deletes an arbitrary data entry with matching key if rid is invalid.
static void Initialize(const IndexDesc *idxdesc)
Initializes an index described by an index descriptor.
Definition: Index.cpp:25
const Schema * GetKeySchema() const
Returns the key schema of this index.
Definition: Index.h:62
const IndexDesc * GetIndexDesc() const
Returns the index descriptor of this index.
Definition: Index.h:54
bool DeleteRecord(Record &rec, const Schema *tabschema=nullptr)
Deletes the (key, rid) extracted from the table record from the index.
Definition: Index.cpp:61
std::shared_ptr< const IndexDesc > m_idxdesc
Definition: Index.h:167
Index(std::shared_ptr< const IndexDesc > idxdesc)
Definition: Index.cpp:10
virtual ~Index()
Index object destructor.
Definition: Index.cpp:14
A Schema object stores the information for accessing an ordered set of typed fields either from a dis...
Definition: Schema.h:39
An IndexKey stores references to a few data (Datum objects) that comprise a key tuple to in an index.
Definition: IndexKey.h:35
The record ID of a record on a page is a pair of ‘(PageNumber, SlotId)’.
Definition: Record.h:17
std::unique_ptr< void, AlignedAllocImpl::FreeMem > unique_malloced_ptr
Definition: tdb_base.h:94