Skip to content

Commit

Permalink
feat: add the arg batch-size
Browse files Browse the repository at this point in the history
to support the feature of small chunks mergence  in nydus, we need to add the arg batch-size

Signed-off-by: Desiki-high <ding_yadong@foxmail.com>
  • Loading branch information
Desiki-high committed Apr 20, 2023
1 parent d4ccae0 commit 5624225
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/converter/convert_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ func packFromTar(ctx context.Context, dest io.Writer, opt PackOption) (io.WriteC
PrefetchPatterns: opt.PrefetchPatterns,
AlignedChunk: opt.AlignedChunk,
ChunkSize: opt.ChunkSize,
BatchSize: opt.BatchSize,
Compressor: opt.Compressor,
Timeout: opt.Timeout,

Expand Down
4 changes: 4 additions & 0 deletions pkg/converter/tool/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type PackOption struct {
OCIRef bool
AlignedChunk bool
ChunkSize string
BatchSize string
Timeout *time.Duration

Features Features
Expand Down Expand Up @@ -132,6 +133,9 @@ func buildPackArgs(option PackOption) []string {
if option.ChunkSize != "" {
args = append(args, "--chunk-size", option.ChunkSize)
}
if option.BatchSize != "" {
args = append(args, "--batch-size", option.BatchSize)
}
args = append(args, option.SourcePath)

return args
Expand Down
2 changes: 2 additions & 0 deletions pkg/converter/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ type PackOption struct {
AlignedChunk bool
// ChunkSize sets the size of data chunks, must be power of two and between 0x1000-0x1000000.
ChunkSize string
// BacthSize sets the size of batch data chunks, must be power of two and between 0x1000-0x1000000 or zero.
BatchSize string
// Backend uploads blobs generated by nydus-image builder to a backend storage.
Backend Backend
// Timeout cancels execution once exceed the specified time.
Expand Down

0 comments on commit 5624225

Please sign in to comment.