X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=src%2Fdb%2Fbase.js;h=c5ea237c7e1f33c71abfd23f0e4b3136af507f9c;hb=1d571ced238ac89098fa690bd35f5c9f58cb18f2;hp=95c901068092eb93ea8218cca55e775b1ffa5f10;hpb=ed6dc5a66ce0eaf2dd61f9fb7a5ec048944c68ee;p=websub-hub diff --git a/src/db/base.js b/src/db/base.js index 95c9010..c5ea237 100644 --- a/src/db/base.js +++ b/src/db/base.js @@ -173,6 +173,8 @@ class Database { this._ensureTypes(data, ['content'], ['string', 'buffer']); this._ensureTypes(data, ['contentHash'], ['string']); this._ensureTypes(data, ['contentType'], ['string', 'null', 'undefined']); + this._ensureTypes(data, ['eTag'], ['string', 'null', 'undefined']); + this._ensureTypes(data, ['lastModified'], ['string', 'null', 'undefined']); } @@ -351,6 +353,16 @@ class Database { } + /** + * Remove any expired subscriptions to a topic. + * @param {*} dbCtx + * @param {*} topicId + */ + async subscriptionDeleteExpired(dbCtx, topicId) { + this._notImplemented('subscriptionDeleteExpired', arguments); + } + + /** * Claim subscriptions needing content updates attempted. * @param {*} dbCtx @@ -533,12 +545,14 @@ class Database { this._notImplemented('topicGetAll', arguments); } + /** * Get topic data, without content. * @param {*} dbCtx * @param {String} topicUrl + * @param {Boolean} applyDefaults */ - async topicGetByUrl(dbCtx, topicUrl) { + async topicGetByUrl(dbCtx, topicUrl, applyDefaults = true) { this._notImplemented('topicGetByUrl', arguments); } @@ -563,14 +577,27 @@ class Database { this._notImplemented('topicGetContentById', arguments); } - // /** - // * Call after an unsubscribe, to check if a topic is awaiting deletion, and that - // * was the last subscription belaying it. - // * @param {String|Integer} data topic url or id - // */ - // async topicPendingDelete(dbCtx, data) { - // this._notImplemented('topicPendingDelete', arguments); - // } + + /** + * Attempt to delete a topic, which must be set isDeleted, if there + * are no more subscriptions belaying its removal. + * @param {*} topicId + */ + async topicPendingDelete(dbCtx, topicId) { + this._notImplemented('topicPendingDelete', arguments); + } + + + /** + * Return an array of the counts of the last #days of topic updates. + * @param {*} dbCtx + * @param {*} topicId + * @param {Number} days + * @returns {Number[]} + */ + async topicPublishHistory(dbCtx, topicId, days) { + this._notImplemented('topicPublishHistory', arguments); + } /** @@ -586,10 +613,12 @@ class Database { /** * Updates a topic's content data and content update timestamp. * @param {Object} data - * @param {Integer} data.topicId + * @param {*} data.topicId * @param {String} data.content * @param {String} data.contentHash * @param {String=} data.contentType + * @param {String=} data.eTag + * @param {String=} data.lastModified */ async topicSetContent(dbCtx, data) { this._notImplemented('topicSetContent', arguments);