Skip to content

Commit dc1906a

Browse files
committed
Add expiry support to sift loading
1 parent 33eeea6 commit dc1906a

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/main/java/SIFTLoader.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ public static void main(String[] args) throws IOException {
166166
Option mutate = new Option("mutate", true, "mutate");
167167
options.addOption(mutate);
168168

169+
Option maxTTL = new Option("maxTTL", true, "Expiry Time");
170+
options.addOption(maxTTL);
171+
172+
Option maxTTLUnit = new Option("maxTTLUnit", true, "Expiry Time unit");
173+
options.addOption(maxTTLUnit);
174+
169175
options.addOption(new Option("baseVectorsFilePath", true, "baseVectorsFilePath"));
170176

171177
options.addOption(new Option("siftURL", true, "siftURL"));
@@ -244,6 +250,9 @@ public static void main(String[] args) throws IOException {
244250
} else if(Integer.parseInt(cmd.getOptionValue("up", "0"))>0) {
245251
start_offset = Integer.parseInt(cmd.getOptionValue(DRConstants.update_s, "0"));
246252
end_offset = Integer.parseInt(cmd.getOptionValue(DRConstants.update_e, "0"));
253+
} else if(Integer.parseInt(cmd.getOptionValue("ex", "0"))>0) {
254+
start_offset = Integer.parseInt(cmd.getOptionValue(DRConstants.expiry_s, "0"));
255+
end_offset = Integer.parseInt(cmd.getOptionValue(DRConstants.expiry_e, "0"));
247256
}
248257
int k = 0;
249258
while(!(steps[k] <= start_offset && start_offset < steps[k+1]))
@@ -286,8 +295,8 @@ public static void main(String[] args) throws IOException {
286295
dr.put(DRConstants.touch_e, Long.parseLong(cmd.getOptionValue(DRConstants.touch_e, "0")));
287296
dr.put(DRConstants.replace_s, Long.parseLong(cmd.getOptionValue(DRConstants.replace_s, "0")));
288297
dr.put(DRConstants.replace_e, Long.parseLong(cmd.getOptionValue(DRConstants.replace_e, "0")));
289-
dr.put(DRConstants.expiry_s, Long.parseLong(cmd.getOptionValue(DRConstants.expiry_s, "0")));
290-
dr.put(DRConstants.expiry_e, Long.parseLong(cmd.getOptionValue(DRConstants.expiry_e, "0")));
298+
dr.put(DRConstants.expiry_s, start + step * i);
299+
dr.put(DRConstants.expiry_e, start + step * (i+1));
291300

292301
DocRange range = new DocRange(dr);
293302
ws.dr = range;

src/main/java/utils/val/siftBigANN.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ else if(this.ws.updates > 0) {
4242
this.mutateCount = this.ws.dr.update_e - this.ws.dr.update_s - this.ws.mutated;
4343
if(this.ws.mutated > 0)
4444
this.mutateInputStream = new FileInputStream(this.ws.baseVectorsFilePath);
45+
} else if(this.ws.expiry > 0) {
46+
this.inputStream.skip(ws.dr.expiry_s * 132);
47+
this.mutateCount = this.ws.dr.expiry_e - this.ws.dr.expiry_s;
4548
}
4649
this.remainingCount = this.ws.mutated;
4750
} catch (IOException e) {

0 commit comments

Comments
 (0)