Compare commits

...

1 Commits

Author SHA1 Message Date
Florent Beauchamp
7baa5ac804 feat(@xen-orchestra/fs): impement null writer for performance testing 2023-03-28 10:04:07 +02:00
3 changed files with 18 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ import { parse } from 'xo-remote-parser'
import RemoteHandlerLocal from './local'
import RemoteHandlerNfs from './nfs'
import RemoteHandlerNull from './null'
import RemoteHandlerS3 from './s3'
import RemoteHandlerSmb from './smb'
export { DEFAULT_ENCRYPTION_ALGORITHM, UNENCRYPTED_ALGORITHM, isLegacyEncryptionAlgorithm } from './_encryptor'
@@ -10,6 +11,7 @@ export { DEFAULT_ENCRYPTION_ALGORITHM, UNENCRYPTED_ALGORITHM, isLegacyEncryption
const HANDLERS = {
file: RemoteHandlerLocal,
nfs: RemoteHandlerNfs,
null: RemoteHandlerNull,
s3: RemoteHandlerS3,
}

View File

@@ -0,0 +1,14 @@
import LocalHandler from './local'
export default class NullHandler extends LocalHandler {
get type() {
return 'null'
}
_outputStream() {}
_writeFile(file, data, options) {
if (file.indexOf('xo-vm-backups') === -1) {
// metadata, remote tests
return super._writeFile(file, data, options)
}
}
}

View File

@@ -38,8 +38,8 @@ const makeOptionList = options => {
export const parse = string => {
let object = {}
let [type, rest] = string.split('://')
if (type === 'file') {
object.type = 'file'
if (type === 'file' || type === 'null') {
object.type = type
let optionList
;[rest, optionList] = rest.split('?')
object.path = `/${trimStart(rest, '/')}` // the leading slash has been forgotten on client side first implementation