forked from kubevela/pkg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: the concurrent number of zstd encoders in k8s container and supp…
…ort zstd configuration re-initialization(kubevela#92)
- Loading branch information
hanzhaoyang
committed
Feb 23, 2024
1 parent
325c22e
commit 7c6365a
Showing
4 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package compression | ||
|
||
import ( | ||
_ "go.uber.org/automaxprocs" | ||
|
||
"github.com/spf13/pflag" | ||
"runtime" | ||
) | ||
|
||
var ( | ||
EncoderLevel = 2 | ||
EnCoderConcurrent = runtime.GOMAXPROCS(0) | ||
) | ||
|
||
func AddFlags(fs *pflag.FlagSet) { | ||
AddZStdEncoderFlags(fs) | ||
} | ||
|
||
func AddZStdEncoderFlags(fs *pflag.FlagSet) { | ||
fs.IntVar(&EncoderLevel, "zstd-encoder-level", EncoderLevel, "specifies a predefined compression level") | ||
fs.IntVar(&EnCoderConcurrent, "zstd-encoder-concurrent", EnCoderConcurrent, "set the concurrency, meaning the maximum number of encoders to run concurrently") | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package compression | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/spf13/pflag" | ||
) | ||
|
||
func TestFlags(t *testing.T) { | ||
AddFlags(pflag.NewFlagSet("test", pflag.PanicOnError)) | ||
} |
This file contains 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
This file contains 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