landvex: Fixar och tester klara för alla komponenter
- Datafabrik: Dockerfile fix, agentorkestrering fungerar - Vision: Identify-modell, FAISS, OCR alla testade - API: Alla 7 integrationstester passerade - Upplösare: Entitetsupplösning verifierad
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* this is a set which automatically forgets
|
||||
* a given entry when a new entry is set and the ttl
|
||||
* of the old one is over
|
||||
*/
|
||||
export declare class ObliviousSet<T = any> {
|
||||
readonly ttl: number;
|
||||
readonly set: Set<unknown>;
|
||||
readonly timeMap: Map<any, any>;
|
||||
constructor(ttl: number);
|
||||
has(value: T): boolean;
|
||||
add(value: T): void;
|
||||
clear(): void;
|
||||
}
|
||||
/**
|
||||
* Removes all entries from the set
|
||||
* where the TTL has expired
|
||||
*/
|
||||
export declare function removeTooOldValues(obliviousSet: ObliviousSet): void;
|
||||
export declare function now(): number;
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* this is a set which automatically forgets
|
||||
* a given entry when a new entry is set and the ttl
|
||||
* of the old one is over
|
||||
*/
|
||||
var ObliviousSet = /** @class */ (function () {
|
||||
function ObliviousSet(ttl) {
|
||||
this.ttl = ttl;
|
||||
this.set = new Set();
|
||||
this.timeMap = new Map();
|
||||
}
|
||||
ObliviousSet.prototype.has = function (value) {
|
||||
return this.set.has(value);
|
||||
};
|
||||
ObliviousSet.prototype.add = function (value) {
|
||||
var _this = this;
|
||||
this.timeMap.set(value, now());
|
||||
this.set.add(value);
|
||||
/**
|
||||
* When a new value is added,
|
||||
* start the cleanup at the next tick
|
||||
* to not block the cpu for more important stuff
|
||||
* that might happen.
|
||||
*/
|
||||
setTimeout(function () {
|
||||
removeTooOldValues(_this);
|
||||
}, 0);
|
||||
};
|
||||
ObliviousSet.prototype.clear = function () {
|
||||
this.set.clear();
|
||||
this.timeMap.clear();
|
||||
};
|
||||
return ObliviousSet;
|
||||
}());
|
||||
export { ObliviousSet };
|
||||
/**
|
||||
* Removes all entries from the set
|
||||
* where the TTL has expired
|
||||
*/
|
||||
export function removeTooOldValues(obliviousSet) {
|
||||
var olderThen = now() - obliviousSet.ttl;
|
||||
var iterator = obliviousSet.set[Symbol.iterator]();
|
||||
/**
|
||||
* Because we can assume the new values are added at the bottom,
|
||||
* we start from the top and stop as soon as we reach a non-too-old value.
|
||||
*/
|
||||
while (true) {
|
||||
var value = iterator.next().value;
|
||||
if (!value) {
|
||||
return; // no more elements
|
||||
}
|
||||
var time = obliviousSet.timeMap.get(value);
|
||||
if (time < olderThen) {
|
||||
obliviousSet.timeMap.delete(value);
|
||||
obliviousSet.set.delete(value);
|
||||
}
|
||||
else {
|
||||
// We reached a value that is not old enough
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
export function now() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH;IAGI,sBACoB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;QAHf,QAAG,GAAG,IAAI,GAAG,EAAE,CAAC;QAChB,YAAO,GAAG,IAAI,GAAG,EAAE,CAAC;IAGhC,CAAC;IAEL,0BAAG,GAAH,UAAI,KAAQ;QACR,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,0BAAG,GAAH,UAAI,KAAQ;QAAZ,iBAaC;QAZG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QAC/B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEpB;;;;;WAKG;QACH,UAAU,CAAC;YACP,kBAAkB,CAAC,KAAI,CAAC,CAAC;QAC7B,CAAC,EAAE,CAAC,CAAC,CAAC;IACV,CAAC;IAED,4BAAK,GAAL;QACI,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACjB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IACL,mBAAC;AAAD,CAAC,AA9BD,IA8BC;;AAGD;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAC9B,YAA0B;IAE1B,IAAM,SAAS,GAAG,GAAG,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC;IAC3C,IAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IAErD;;;OAGG;IACH,OAAO,IAAI,EAAE;QACT,IAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;QACpC,IAAI,CAAC,KAAK,EAAE;YACR,OAAO,CAAC,mBAAmB;SAC9B;QACD,IAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,IAAI,GAAG,SAAS,EAAE;YAClB,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SAClC;aAAM;YACH,4CAA4C;YAC5C,OAAO;SACV;KACJ;AACL,CAAC;AAED,MAAM,UAAU,GAAG;IACf,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;AAChC,CAAC"}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* this is a set which automatically forgets
|
||||
* a given entry when a new entry is set and the ttl
|
||||
* of the old one is over
|
||||
*/
|
||||
export declare class ObliviousSet<T = any> {
|
||||
readonly ttl: number;
|
||||
readonly set: Set<unknown>;
|
||||
readonly timeMap: Map<any, any>;
|
||||
constructor(ttl: number);
|
||||
has(value: T): boolean;
|
||||
add(value: T): void;
|
||||
clear(): void;
|
||||
}
|
||||
/**
|
||||
* Removes all entries from the set
|
||||
* where the TTL has expired
|
||||
*/
|
||||
export declare function removeTooOldValues(obliviousSet: ObliviousSet): void;
|
||||
export declare function now(): number;
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.now = exports.removeTooOldValues = exports.ObliviousSet = void 0;
|
||||
/**
|
||||
* this is a set which automatically forgets
|
||||
* a given entry when a new entry is set and the ttl
|
||||
* of the old one is over
|
||||
*/
|
||||
var ObliviousSet = /** @class */ (function () {
|
||||
function ObliviousSet(ttl) {
|
||||
this.ttl = ttl;
|
||||
this.set = new Set();
|
||||
this.timeMap = new Map();
|
||||
}
|
||||
ObliviousSet.prototype.has = function (value) {
|
||||
return this.set.has(value);
|
||||
};
|
||||
ObliviousSet.prototype.add = function (value) {
|
||||
var _this = this;
|
||||
this.timeMap.set(value, now());
|
||||
this.set.add(value);
|
||||
/**
|
||||
* When a new value is added,
|
||||
* start the cleanup at the next tick
|
||||
* to not block the cpu for more important stuff
|
||||
* that might happen.
|
||||
*/
|
||||
setTimeout(function () {
|
||||
removeTooOldValues(_this);
|
||||
}, 0);
|
||||
};
|
||||
ObliviousSet.prototype.clear = function () {
|
||||
this.set.clear();
|
||||
this.timeMap.clear();
|
||||
};
|
||||
return ObliviousSet;
|
||||
}());
|
||||
exports.ObliviousSet = ObliviousSet;
|
||||
/**
|
||||
* Removes all entries from the set
|
||||
* where the TTL has expired
|
||||
*/
|
||||
function removeTooOldValues(obliviousSet) {
|
||||
var olderThen = now() - obliviousSet.ttl;
|
||||
var iterator = obliviousSet.set[Symbol.iterator]();
|
||||
/**
|
||||
* Because we can assume the new values are added at the bottom,
|
||||
* we start from the top and stop as soon as we reach a non-too-old value.
|
||||
*/
|
||||
while (true) {
|
||||
var value = iterator.next().value;
|
||||
if (!value) {
|
||||
return; // no more elements
|
||||
}
|
||||
var time = obliviousSet.timeMap.get(value);
|
||||
if (time < olderThen) {
|
||||
obliviousSet.timeMap.delete(value);
|
||||
obliviousSet.set.delete(value);
|
||||
}
|
||||
else {
|
||||
// We reached a value that is not old enough
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.removeTooOldValues = removeTooOldValues;
|
||||
function now() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
exports.now = now;
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AACA;;;;GAIG;AACH;IAGI,sBACoB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;QAHf,QAAG,GAAG,IAAI,GAAG,EAAE,CAAC;QAChB,YAAO,GAAG,IAAI,GAAG,EAAE,CAAC;IAGhC,CAAC;IAEL,0BAAG,GAAH,UAAI,KAAQ;QACR,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,0BAAG,GAAH,UAAI,KAAQ;QAAZ,iBAaC;QAZG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QAC/B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEpB;;;;;WAKG;QACH,UAAU,CAAC;YACP,kBAAkB,CAAC,KAAI,CAAC,CAAC;QAC7B,CAAC,EAAE,CAAC,CAAC,CAAC;IACV,CAAC;IAED,4BAAK,GAAL;QACI,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACjB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IACL,mBAAC;AAAD,CAAC,AA9BD,IA8BC;AA9BY,oCAAY;AAiCzB;;;GAGG;AACH,SAAgB,kBAAkB,CAC9B,YAA0B;IAE1B,IAAM,SAAS,GAAG,GAAG,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC;IAC3C,IAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IAErD;;;OAGG;IACH,OAAO,IAAI,EAAE;QACT,IAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;QACpC,IAAI,CAAC,KAAK,EAAE;YACR,OAAO,CAAC,mBAAmB;SAC9B;QACD,IAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,IAAI,GAAG,SAAS,EAAE;YAClB,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SAClC;aAAM;YACH,4CAA4C;YAC5C,OAAO;SACV;KACJ;AACL,CAAC;AAxBD,gDAwBC;AAED,SAAgB,GAAG;IACf,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;AAChC,CAAC;AAFD,kBAEC"}
|
||||
Reference in New Issue
Block a user