Skip to content

feat: add multi-volume split for vm package export/import#40

Open
lateautumn233 wants to merge 1 commit into
Droid-VM:masterfrom
lateautumn233:export_vm
Open

feat: add multi-volume split for vm package export/import#40
lateautumn233 wants to merge 1 commit into
Droid-VM:masterfrom
lateautumn233:export_vm

Conversation

@lateautumn233

Copy link
Copy Markdown
Contributor
  • split compressed stream into fixed-size .001/.002 sub-volumes with a metadata master holding header + manifest + volume index
  • verify sub-volume size and CRC32 on import and rebuild the logical byte stream
  • add volume_size input to export UI, default off (single file)
  • clean up partial and stale sub-volumes on export failure/re-run
  • reset volume status fields between operations to avoid stale UI

Copilot AI review requested due to automatic review settings July 15, 2026 04:28
- split compressed stream into fixed-size .001/.002 sub-volumes with a metadata master holding header + manifest + volume index
- verify sub-volume size and CRC32 on import and rebuild the logical byte stream
- add volume_size input to export UI, default off (single file)
- clean up partial and stale sub-volumes on export failure/re-run
- reset volume status fields between operations to avoid stale UI

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds multi-volume support to VM package export/import by splitting the compressed package data into fixed-size sub-volumes (.001/.002/...) while keeping a small “metadata master” file that contains the header, manifest, and a volume index. This allows exporting/importing large packages in chunked files with integrity checks and updated UI feedback.

Changes:

  • Add multi-volume export pipeline (split output stream + embedded volume index + UI/IPC parameter for volume_size).
  • Add multi-volume import pipeline (discover/validate sub-volumes, rebuild logical stream, show volume count in progress UI).
  • Add supporting utilities/constants and localized UI strings for volume sizing and status display.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
app/src/main/res/values/strings.xml Adds EN strings for volume size input/validation and volume-aware status text.
app/src/main/res/values-zh-rTW/strings.xml Adds zh-TW translations for volume size/status strings.
app/src/main/res/values-zh-rCN/strings.xml Adds zh-CN translations for volume size/status strings.
app/src/main/res/layout/activity_vmpkg_export.xml Adds a volume size input row and description to the export UI.
app/src/main/java/cn/classfun/droidvm/ui/vm/pkg/imports/VMPkgImportActivity.java Handles picking a sub-volume by redirecting preview/import to the metadata master; displays import volume count.
app/src/main/java/cn/classfun/droidvm/ui/vm/pkg/exports/VMPkgExportActivity.java Reads/validates volume size from UI, sends volume_size to daemon, and shows per-volume packing status.
app/src/main/java/cn/classfun/droidvm/lib/utils/BinaryUtils.java Adds writeZero(OutputStream, long) helper for writing padding to generic streams.
app/src/main/java/cn/classfun/droidvm/lib/pkg/VolumeSplitOutputStream.java New output stream that slices the compressed byte stream into .NNN volumes and records size/CRC32 entries.
app/src/main/java/cn/classfun/droidvm/lib/pkg/VolumeSet.java New reader-side discovery/validation of volume sets and reconstruction of the logical single-stream view.
app/src/main/java/cn/classfun/droidvm/lib/pkg/VolumeIndex.java New JSON volume index format (magic/version/data_size + per-volume CRC/size).
app/src/main/java/cn/classfun/droidvm/lib/pkg/PackageInput.java Adds manifest “peek” API and an open(..., dataSizeOverride) overload for volume-reconstructed streams.
app/src/main/java/cn/classfun/droidvm/lib/pkg/PackageHeader.java Extends header with volumeCount to distinguish single-file vs split packages.
app/src/main/java/cn/classfun/droidvm/lib/pkg/PackageConstants.java Adds multi-volume constants (min size, magic/version, suffix digits, max count).
app/src/main/java/cn/classfun/droidvm/lib/archive/ZeroInputStream.java New zero-filled bounded stream to reproduce alignment padding when reconstructing logical streams.
app/src/main/java/cn/classfun/droidvm/daemon/vm/pkg/VMImportTask.java Imports multi-volume packages by discovering/validating volumes and opening a reconstructed logical stream.
app/src/main/java/cn/classfun/droidvm/daemon/vm/pkg/VMExportUtils.java Writes volumeCount into the package header.
app/src/main/java/cn/classfun/droidvm/daemon/vm/pkg/VMExportTask.java Adds split export path, volume progress events, and stale/partial volume cleanup logic.
app/src/main/java/cn/classfun/droidvm/daemon/ipc/vm/ExportHandler.java Validates volume_size input against the minimum allowed size.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +198 to +200
crc.update(b, off, n);
remaining -= n;
return n;
"volume count mismatch: header %d, index %d",
hdr.volumeCount, index.volumes.size()
));
var subs = new ArrayList<File>();
}
long dataSize = subOut.dataSize();
finalVolumeCount = subOut.volumeCount();
writeMaster(manifestBytes, dataSize, subOut);
Comment on lines +80 to +84
* Opens a package, optionally overriding the data-region size. Multi-volume
* packages write a placeholder {@code dataSize} of 0 in the inline header
* (it is only known after streaming) and carry the real value in the volume
* trailer; pass it here as {@code dataSizeOverride}. Use -1 for the legacy
* single-file layout that patches its header in place.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants