forked from TrueCloudLab/frostfs-node
[#1715] compression: Decouple Config and Compressor
Refactoring. Change-Id: Ide2e1378f30c39045d4bacd13a902331bd4f764f Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
98308d0cad
commit
8c746a914a
12 changed files with 49 additions and 41 deletions
|
@ -17,8 +17,8 @@ type cfg struct {
|
|||
|
||||
Type func() string
|
||||
Path func() string
|
||||
SetCompressor func(cc *compression.Config)
|
||||
Compressor func() *compression.Config
|
||||
SetCompressor func(cc *compression.Compressor)
|
||||
Compressor func() *compression.Compressor
|
||||
SetReportErrorFunc func(f func(context.Context, string, error))
|
||||
|
||||
Get func(common.GetPrm) (common.GetRes, error)
|
||||
|
@ -45,11 +45,11 @@ func WithClose(f func() error) Option { return func(c *cfg) { c
|
|||
func WithType(f func() string) Option { return func(c *cfg) { c.overrides.Type = f } }
|
||||
func WithPath(f func() string) Option { return func(c *cfg) { c.overrides.Path = f } }
|
||||
|
||||
func WithSetCompressor(f func(*compression.Config)) Option {
|
||||
func WithSetCompressor(f func(*compression.Compressor)) Option {
|
||||
return func(c *cfg) { c.overrides.SetCompressor = f }
|
||||
}
|
||||
|
||||
func WithCompressor(f func() *compression.Config) Option {
|
||||
func WithCompressor(f func() *compression.Compressor) Option {
|
||||
return func(c *cfg) { c.overrides.Compressor = f }
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ func (s *TestStore) Path() string {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *TestStore) SetCompressor(cc *compression.Config) {
|
||||
func (s *TestStore) SetCompressor(cc *compression.Compressor) {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
switch {
|
||||
|
@ -129,7 +129,7 @@ func (s *TestStore) SetCompressor(cc *compression.Config) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *TestStore) Compressor() *compression.Config {
|
||||
func (s *TestStore) Compressor() *compression.Compressor {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
switch {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue