overleaf/libraries/object-persistor/src/AbstractPersistor.js
Simon Detheridge e92b75a2f8 Create new module from overleaf/filestore persistors (#1)
* Create new module from overleaf/filestore persistors

* Convert persistors to ES6 classes with local settings

* Update README.md

Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>

* Update README.md

Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>

* Update .gitignore

Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>

* Switch to AGPL license

* Paginate S3 list-object results

* Remove S3 client caching

* Clean up S3 md5-verification mechanism

* Update README for recent changes

* Update README.md

Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>

* Remove package-lock

* Remove comment about FileHandler

* Add directory marker to FSPersistor.deleteDirectory

* Don't copy opts in GcsPersistor.getObjectStream

* Use Date.now instead of getTime

* Catch errors in migration persistor

* Check that settings.buckets exists

* Don't mutate options in ObserverStream constructor

* Update src/PersistorHelper.js

Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>

* Lint and format fixes

Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>
2020-07-02 14:19:45 +01:00

81 lines
2.4 KiB
JavaScript

const { NotImplementedError } = require('./Errors')
module.exports = class AbstractPersistor {
async sendFile(location, target, source) {
throw new NotImplementedError({
message: 'method not implemented in persistor',
info: { method: 'sendFile', location, target, source }
})
}
async sendStream(location, target, sourceStream, sourceMd5) {
throw new NotImplementedError({
message: 'method not implemented in persistor',
info: { method: 'sendStream', location, target, sourceMd5 }
})
}
// opts may be {start: Number, end: Number}
async getObjectStream(location, name, opts) {
throw new NotImplementedError({
message: 'method not implemented in persistor',
info: { method: 'getObjectStream', location, name, opts }
})
}
async getRedirectUrl(location, name) {
throw new NotImplementedError({
message: 'method not implemented in persistor',
info: { method: 'getRedirectUrl', location, name }
})
}
async getObjectSize(location, name) {
throw new NotImplementedError({
message: 'method not implemented in persistor',
info: { method: 'getObjectSize', location, name }
})
}
async getObjectMd5Hash(location, name) {
throw new NotImplementedError({
message: 'method not implemented in persistor',
info: { method: 'getObjectMd5Hash', location, name }
})
}
async copyObject(location, fromName, toName) {
throw new NotImplementedError({
message: 'method not implemented in persistor',
info: { method: 'copyObject', location, fromName, toName }
})
}
async deleteObject(location, name) {
throw new NotImplementedError({
message: 'method not implemented in persistor',
info: { method: 'deleteObject', location, name }
})
}
async deleteDirectory(location, name) {
throw new NotImplementedError({
message: 'method not implemented in persistor',
info: { method: 'deleteDirectory', location, name }
})
}
async checkIfObjectExists(location, name) {
throw new NotImplementedError({
message: 'method not implemented in persistor',
info: { method: 'checkIfObjectExists', location, name }
})
}
async directorySize(location, name) {
throw new NotImplementedError({
message: 'method not implemented in persistor',
info: { method: 'directorySize', location, name }
})
}
}