Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple ztoc creation and compression algorithm #346

Merged
merged 1 commit into from
Feb 8, 2023

Conversation

djdongjin
Copy link
Contributor

@djdongjin djdongjin commented Jan 24, 2023

Signed-off-by: Jin Dong jindon@amazon.com

Issue #, if available: Fix #233

Description of changes:

Decouple ztoc creation and compression by adding a ztoc.Builder which has:

  1. A single ztoc.TocBuilder that builds TOC and works with both gzip and zstd.
  2. One ztoc.ZinfoBuilder per compression algorithm (currently, only gzip).

ztoc.Builder has one export func BuildZtoc which checks compression algorithm and builds Ztoc(TOC via TocBuilder, Zinfo via ZinfoBuilder).

ztoc.TocBuilder has one export func TocFromFile which creates TOC given compress algorithm and tar filename. It supports different compression by creating different tar readers through compression libraries (e.g., gzip.NewReader, zstd.NewReader).

ztoc.ZinfoBuilder interface has one export func ZinfoFromFile which creates Zinfo given compress tar filename and span size. Currently it has one implementation for gzip (gzipZinfoBuilder).

Testing performed:

make test && make integration

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@djdongjin djdongjin force-pushed the refactor-ztoc-create branch 6 times, most recently from 126a5de to f10b4ce Compare January 25, 2023 02:59
@djdongjin djdongjin marked this pull request as ready for review January 25, 2023 15:40
@djdongjin djdongjin requested a review from a team as a code owner January 25, 2023 15:40
@djdongjin djdongjin changed the title [WIP] Decouple ztoc creation and compression algorithm Decouple ztoc creation and compression algorithm Jan 25, 2023
soci/soci_index.go Outdated Show resolved Hide resolved
soci/soci_index.go Outdated Show resolved Hide resolved
soci/soci_index.go Outdated Show resolved Hide resolved
util/testutil/tar.go Show resolved Hide resolved
ztoc/toc_builder.go Show resolved Hide resolved
ztoc/ztoc_builder.go Outdated Show resolved Hide resolved
@djdongjin djdongjin force-pushed the refactor-ztoc-create branch 4 times, most recently from c81dd55 to 62e5d5b Compare January 27, 2023 19:19
soci/soci_index.go Outdated Show resolved Hide resolved
ztoc/ztoc_builder.go Outdated Show resolved Hide resolved
ztoc/ztoc_builder.go Outdated Show resolved Hide resolved
soci/soci_index.go Outdated Show resolved Hide resolved
soci/soci_index.go Outdated Show resolved Hide resolved
ztoc/ztoc_builder.go Outdated Show resolved Hide resolved
@djdongjin djdongjin force-pushed the refactor-ztoc-create branch 5 times, most recently from 9cb84f8 to a15cfe7 Compare January 30, 2023 21:08
@djdongjin djdongjin requested a review from Kern-- January 30, 2023 21:09
@djdongjin djdongjin force-pushed the refactor-ztoc-create branch 5 times, most recently from 75b8202 to fbad924 Compare February 6, 2023 20:33
Signed-off-by: Jin Dong <jindon@amazon.com>
@djdongjin djdongjin force-pushed the refactor-ztoc-create branch from fbad924 to 92afcc6 Compare February 6, 2023 22:47
@djdongjin djdongjin merged commit 2115854 into awslabs:main Feb 8, 2023
@djdongjin djdongjin deleted the refactor-ztoc-create branch February 8, 2023 23:24
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.

Refactor the Ztoc creation
4 participants