@jbagatta/johnny-cache
Version:
A robust distributed dictionary for coordinating and caching expensive operations in a distributed environment
42 lines (41 loc) • 1.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.JetStreamDataStore = void 0;
// TODO Implement once nats client supports 2.11 per-message TTL feature
class JetStreamDataStore {
async tryReserve(key, reservationExpiryMs) {
// this should use Nats-TTL headers to set the reservationExpiryMs on the published message
// DiscaryNewPerSubject to ensure the lock is atomic and singular
// the payload when creating should include the buildId and a null buildResult
return null;
}
async has(key) {
// use direct get by subject
return null;
}
async get(key) {
// use direct get by subject
return null;
}
async tryUpdateReservation(key, buildId, result, expiry) {
// Nats-Rollup header to replace the previous message
// stream needs to allow rollup
// the payload when creating should include the buildId and result as the buildResult
// use expect.lastSubjectSequence option to ensure we're using the same reservation
return null;
}
async delete(key) {
// user purge by subject
return null;
}
async updateExpiry(key, expiry) {
// Nats-Rollup header to replace the previous message
// the payload should be identical to the existing one, just republished to reset ttl
return null;
}
async close() {
// i dont think we need to do anything here
return null;
}
}
exports.JetStreamDataStore = JetStreamDataStore;