chore: format with Prettier

This commit is contained in:
Julien Fontanet 2022-10-11 16:40:10 +02:00
parent a2dcceb470
commit f1a1b922c7
2 changed files with 8 additions and 10 deletions

View File

@ -57,9 +57,7 @@ exports.mount = Disposable.factory(async function* mount(handler, diskPath, moun
}, },
read(path, fd, buf, len, pos, cb) { read(path, fd, buf, len, pos, cb) {
if (path === '/vhd0') { if (path === '/vhd0') {
return vhd return vhd.readRawData(pos, len, cache, buf).then(cb)
.readRawData(pos, len, cache, buf)
.then(cb)
} }
throw new Error(`read file ${path} not exists`) throw new Error(`read file ${path} not exists`)
}, },
@ -67,5 +65,5 @@ exports.mount = Disposable.factory(async function* mount(handler, diskPath, moun
return new Disposable( return new Disposable(
() => fromCallback(() => fuse.unmount()), () => fromCallback(() => fuse.unmount()),
fromCallback(() => fuse.mount()) fromCallback(() => fuse.mount())
) )
}) })

View File

@ -76,14 +76,16 @@ const debounceResourceFactory = factory =>
} }
class RemoteAdapter { class RemoteAdapter {
constructor(handler, { debounceResource = res => res, dirMode, vhdDirectoryCompression, useGetDiskLegacy=false } = {}) { constructor(
handler,
{ debounceResource = res => res, dirMode, vhdDirectoryCompression, useGetDiskLegacy = false } = {}
) {
this._debounceResource = debounceResource this._debounceResource = debounceResource
this._dirMode = dirMode this._dirMode = dirMode
this._handler = handler this._handler = handler
this._vhdDirectoryCompression = vhdDirectoryCompression this._vhdDirectoryCompression = vhdDirectoryCompression
this._readCacheListVmBackups = synchronized.withKey()(this._readCacheListVmBackups) this._readCacheListVmBackups = synchronized.withKey()(this._readCacheListVmBackups)
this._useGetDiskLegacy = useGetDiskLegacy this._useGetDiskLegacy = useGetDiskLegacy
} }
get handler() { get handler() {
@ -324,9 +326,7 @@ class RemoteAdapter {
return this.#useVhdDirectory() return this.#useVhdDirectory()
} }
async *#getDiskLegacy(diskId) { async *#getDiskLegacy(diskId) {
const RE_VHDI = /^vhdi(\d+)$/ const RE_VHDI = /^vhdi(\d+)$/
const handler = this._handler const handler = this._handler
@ -358,8 +358,8 @@ class RemoteAdapter {
} }
async *getDisk(diskId) { async *getDisk(diskId) {
if(this._useGetDiskLegacy){ if (this._useGetDiskLegacy) {
yield * this.#getDiskLegacy(diskId) yield* this.#getDiskLegacy(diskId)
return return
} }
const handler = this._handler const handler = this._handler