@@ -132,19 +132,22 @@ class RamGraphData : public absGraphData {
132
132
133
133
const VectorMetaData &
134
134
vectorMetaDataById (idType internal_id) const override {
135
- return * idToMetaData_[internal_id];
135
+ return idToMetaData_[internal_id];
136
136
}
137
137
138
138
VectorMetaData &
139
139
vectorMetaDataById (idType internal_id,
140
140
WriteBatch *) override {
141
- return * idToMetaData_[internal_id];
141
+ return idToMetaData_[internal_id];
142
142
}
143
143
144
144
// premanently delete the vector and the edges "free" the id
145
145
void
146
146
deleteVectorAndEdges (idType internalId,
147
- WriteBatch *) override ;
147
+ WriteBatch *wb) override {
148
+ vectorMetaDataById (internalId, wb).mark (
149
+ VectorMetaData::PERMANENT_DELETED);
150
+ }
148
151
149
152
150
153
// outgoing edges
@@ -176,17 +179,16 @@ class RamGraphData : public absGraphData {
176
179
public:
177
180
// helper methods needed by hnsw
178
181
179
- // get the first id that exists at level level
182
+ // get the first id that exists at level "level"
183
+ // at or after the statingId
180
184
virtual idType
181
185
getVectorIdByLevel (short level,
182
- idType startingId = 0 ) const = 0 ;
186
+ idType startingId = 0 ) const = 0 ;
183
187
184
- // get a pair of candidates to swap for the gc
185
- // first is a location that is permanent deleted
186
- // second is a location that is valid
187
- // start points is the last pair returned in the prev scan
188
+ // get a permanent deleted entry (at or after start point)
189
+ // to be used by the GC
188
190
virtual idType
189
- getGarbadgeCollectionTarget (idType startPoint = 0 ) const = 0 ;
191
+ getGarbadgeCollectionTarget (idType startingId = 0 ) const = 0 ;
190
192
191
193
virtual void
192
194
shrinkToFit () override ;
@@ -219,7 +221,7 @@ class RamGraphData : public absGraphData {
219
221
private:
220
222
vecsim_stl::vector<DataBlock> vectorBlocks_;
221
223
vecsim_stl::vector<DataBlock> graphDataBlocks_;
222
- vecsim_stl::vector<VectorMetaData * > idToMetaData_;
224
+ vecsim_stl::vector<VectorMetaData> idToMetaData_;
223
225
std::shared_ptr<VecSimAllocator> allocator_;
224
226
const size_t block_size_;
225
227
const size_t vector_size_bytes_;
0 commit comments