AbstractPersistor.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. const { NotImplementedError } = require('./Errors')
  2. module.exports = class AbstractPersistor {
  3. async sendFile(location, target, source) {
  4. throw new NotImplementedError('method not implemented in persistor', {
  5. method: 'sendFile',
  6. location,
  7. target,
  8. source
  9. })
  10. }
  11. async sendStream(location, target, sourceStream, opts = {}) {
  12. throw new NotImplementedError('method not implemented in persistor', {
  13. method: 'sendStream',
  14. location,
  15. target,
  16. opts
  17. })
  18. }
  19. // opts may be {start: Number, end: Number}
  20. async getObjectStream(location, name, opts) {
  21. throw new NotImplementedError('method not implemented in persistor', {
  22. method: 'getObjectStream',
  23. location,
  24. name,
  25. opts
  26. })
  27. }
  28. async getRedirectUrl(location, name) {
  29. throw new NotImplementedError('method not implemented in persistor', {
  30. method: 'getRedirectUrl',
  31. location,
  32. name
  33. })
  34. }
  35. async getObjectSize(location, name) {
  36. throw new NotImplementedError('method not implemented in persistor', {
  37. method: 'getObjectSize',
  38. location,
  39. name
  40. })
  41. }
  42. async getObjectMd5Hash(location, name) {
  43. throw new NotImplementedError('method not implemented in persistor', {
  44. method: 'getObjectMd5Hash',
  45. location,
  46. name
  47. })
  48. }
  49. async copyObject(location, fromName, toName) {
  50. throw new NotImplementedError('method not implemented in persistor', {
  51. method: 'copyObject',
  52. location,
  53. fromName,
  54. toName
  55. })
  56. }
  57. async deleteObject(location, name) {
  58. throw new NotImplementedError('method not implemented in persistor', {
  59. method: 'deleteObject',
  60. location,
  61. name
  62. })
  63. }
  64. async deleteDirectory(location, name) {
  65. throw new NotImplementedError('method not implemented in persistor', {
  66. method: 'deleteDirectory',
  67. location,
  68. name
  69. })
  70. }
  71. async checkIfObjectExists(location, name) {
  72. throw new NotImplementedError('method not implemented in persistor', {
  73. method: 'checkIfObjectExists',
  74. location,
  75. name
  76. })
  77. }
  78. async directorySize(location, name) {
  79. throw new NotImplementedError('method not implemented in persistor', {
  80. method: 'directorySize',
  81. location,
  82. name
  83. })
  84. }
  85. }