Skip to content

Commit

Permalink
remove duplicate isBlockBased
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeauchamp committed Jun 20, 2022
1 parent 2fd081e commit f93aa11
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
3 changes: 0 additions & 3 deletions packages/vhd-lib/Vhd/VhdAbstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,4 @@ exports.VhdAbstract = class VhdAbstract {
stream.length = footer.currentSize
return stream
}
isBlockBased() {
return false
}
}
9 changes: 3 additions & 6 deletions packages/vhd-lib/Vhd/VhdDirectory.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,17 @@ exports.VhdDirectory = class VhdDirectory extends VhdAbstract {
// and if the full block is modified in child ( which is the case with xcp)
// and if the compression type is same on both sides
async mergeBlock(child, blockId, isResumingMerge = false) {
const childBlockPath = child._getFullBlockPath?.(blockId)
if (
!child.isBlockBased() ||
childBlockPath !== undefined ||
this._handler !== child._handler ||
child.compressionType !== this.compressionType ||
child.compressionType === 'MIXED'
) {
return super.mergeBlock(child, blockId)
}
try {
await this._handler.rename(child._getFullBlockPath(blockId), this._getFullBlockPath(blockId))
await this._handler.rename(childBlockPath, this._getFullBlockPath(blockId))
} catch (error) {
if (error.code === 'ENOENT' && isResumingMerge === true) {
// when resuming, the blocks moved since the last merge state write are
Expand Down Expand Up @@ -307,8 +308,4 @@ exports.VhdDirectory = class VhdDirectory extends VhdAbstract {
})
this.#compressor = getCompressor(chunkFilters[0])
}

isBlockBased() {
return true
}
}
3 changes: 0 additions & 3 deletions packages/vhd-lib/Vhd/VhdSynthetic.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ const VhdSynthetic = class VhdSynthetic extends VhdAbstract {
const vhd = this.#getVhdWithBlock(blockId)
return vhd._getFullBlockPath(blockId)
}
isBlockBased() {
return this.#vhds.every(vhd => vhd.isBlockBased())
}
}

// add decorated static method
Expand Down

0 comments on commit f93aa11

Please sign in to comment.