feat: add multi-volume split for vm package export/import#40
Open
lateautumn233 wants to merge 1 commit into
Open
feat: add multi-volume split for vm package export/import#40lateautumn233 wants to merge 1 commit into
lateautumn233 wants to merge 1 commit into
Conversation
lateautumn233
commented
Jul 15, 2026
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
- 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
There was a problem hiding this comment.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.