-
Notifications
You must be signed in to change notification settings - Fork 0
/
Marker.js
33 lines (28 loc) · 873 Bytes
/
Marker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function Marker(opts, libs) {
var db = libs.db;
this.rollbacking = false;
this.rollback_markers = async function(sequence) {
var markers = await db.getMarkers();
for(var i in markers) {
if(markers[i].sequence > sequence) {
await db.setMarker(markers[i].apikey, sequence, 1);
}
}
}
this.delete_unused_markers = async function() {
var markers = await db.getMarkers();
for(var i in markers) {
var apikey = markers[i].apikey;
if(!opts.apikeys[apikey]) {
await db.delMarker(apikey);
}
}
}
this.delete_all_markers = async function() {
var markers = await db.getMarkers();
for(var i in markers) {
await db.delMarker(markers[i].apikey);
}
}
}
module.exports = Marker;