taco-db  0.1.0
BulkLoadIterator.h
Go to the documentation of this file.
1 #ifndef INDEX_BULKLOADITERATOR_H
2 #define INDEX_BULKLOADITERATOR_H
3 
4 #include "tdb.h"
5 
6 #include "catalog/Schema.h"
7 #include "index/IndexKey.h"
8 #include "storage/Record.h"
9 
10 namespace taco {
11 
18 public:
24  BulkLoadIterator(const Schema *key_schema):
25  m_key_schema(key_schema),
27  IndexKey::ComputeStructSize(m_key_schema->GetNumFields()))),
28  m_recid() {}
29 
33  virtual ~BulkLoadIterator() {}
34 
42  virtual bool Next() = 0;
43 
49  return reinterpret_cast<IndexKey*>(m_key.get());
50  }
51 
57  return m_recid;
58  }
59 
65  virtual void EndScan() = 0;
66 
67 protected:
71 };
72 
73 } // namespace taco
74 
75 #endif // INDEX_BULKLOADITERATOR_H
BulkLoadIterator is an interface for providing (key, RecordId) pairs for index bulk loading.
Definition: BulkLoadIterator.h:17
virtual bool Next()=0
Subclass should override the Next() function for moving to the next (key, record id) pair.
const RecordId & GetCurrentRecordId()
Returns the current record id.
Definition: BulkLoadIterator.h:56
const IndexKey * GetCurrentKey()
Returns the current key.
Definition: BulkLoadIterator.h:48
virtual void EndScan()=0
Ends the scan.
RecordId m_recid
Definition: BulkLoadIterator.h:70
BulkLoadIterator(const Schema *key_schema)
Constructs a bulk load iterator with the key_schema.
Definition: BulkLoadIterator.h:24
virtual ~BulkLoadIterator()
Destructor.
Definition: BulkLoadIterator.h:33
unique_malloced_ptr m_key
Definition: BulkLoadIterator.h:69
const Schema * m_key_schema
Definition: BulkLoadIterator.h:68
A Schema object stores the information for accessing an ordered set of typed fields either from a dis...
Definition: Schema.h:39
Definition: datum.h:28
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
unique_malloced_ptr unique_aligned_alloc(size_t alignment, size_t size)
Wraps an aligned_alloced'd memory space in a std::unique_ptr.
Definition: tdb_base.h:101
std::unique_ptr< void, AlignedAllocImpl::FreeMem > unique_malloced_ptr
Definition: tdb_base.h:94