| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- const { NotImplementedError } = require('./Errors')
- module.exports = class AbstractPersistor {
- /**
- * @param location
- * @param target
- * @param {string} source
- * @return {Promise<void>}
- */
- async sendFile(location, target, source) {
- throw new NotImplementedError('method not implemented in persistor', {
- method: 'sendFile',
- location,
- target,
- source,
- })
- }
- /**
- * @param location
- * @param target
- * @param {NodeJS.ReadableStream} sourceStream
- * @param {Object} opts
- * @return {Promise<void>}
- */
- async sendStream(location, target, sourceStream, opts = {}) {
- throw new NotImplementedError('method not implemented in persistor', {
- method: 'sendStream',
- location,
- target,
- opts,
- })
- }
- /**
- * @param location
- * @param name
- * @param {Object} [opts]
- * @param {Number} [opts.start]
- * @param {Number} [opts.end]
- * @return {Promise<NodeJS.ReadableStream>}
- */
- async getObjectStream(location, name, opts = {}) {
- throw new NotImplementedError('method not implemented in persistor', {
- method: 'getObjectStream',
- location,
- name,
- opts,
- })
- }
- /**
- * @param {string} location
- * @param {string} name
- * @return {Promise<string>}
- */
- async getRedirectUrl(location, name) {
- throw new NotImplementedError('method not implemented in persistor', {
- method: 'getRedirectUrl',
- location,
- name,
- })
- }
- /**
- * @param {string} location
- * @param {string} name
- * @param {Object} opts
- * @return {Promise<number>}
- */
- async getObjectSize(location, name, opts) {
- throw new NotImplementedError('method not implemented in persistor', {
- method: 'getObjectSize',
- location,
- name,
- })
- }
- /**
- * @param {string} location
- * @param {string} name
- * @param {Object} opts
- * @return {Promise<string>}
- */
- async getObjectMd5Hash(location, name, opts) {
- throw new NotImplementedError('method not implemented in persistor', {
- method: 'getObjectMd5Hash',
- location,
- name,
- })
- }
- /**
- * @param {string} location
- * @param {string} fromName
- * @param {string} toName
- * @param {Object} opts
- * @return {Promise<void>}
- */
- async copyObject(location, fromName, toName, opts) {
- throw new NotImplementedError('method not implemented in persistor', {
- method: 'copyObject',
- location,
- fromName,
- toName,
- })
- }
- /**
- * @param {string} location
- * @param {string} name
- * @return {Promise<void>}
- */
- async deleteObject(location, name) {
- throw new NotImplementedError('method not implemented in persistor', {
- method: 'deleteObject',
- location,
- name,
- })
- }
- /**
- * @param {string} location
- * @param {string} name
- * @param {string} [continuationToken]
- * @return {Promise<void>}
- */
- async deleteDirectory(location, name, continuationToken) {
- throw new NotImplementedError('method not implemented in persistor', {
- method: 'deleteDirectory',
- location,
- name,
- })
- }
- /**
- * @param {string} location
- * @param {string} name
- * @param {Object} opts
- * @return {Promise<boolean>}
- */
- async checkIfObjectExists(location, name, opts) {
- throw new NotImplementedError('method not implemented in persistor', {
- method: 'checkIfObjectExists',
- location,
- name,
- })
- }
- /**
- * @param {string} location
- * @param {string} name
- * @param {string} [continuationToken]
- * @return {Promise<number>}
- */
- async directorySize(location, name, continuationToken) {
- throw new NotImplementedError('method not implemented in persistor', {
- method: 'directorySize',
- location,
- name,
- })
- }
- }
|