提交 a9d533a3 编写于 作者: D Davies Liu

move compress lib out of utils

上级 740791d4
......@@ -28,6 +28,7 @@ import (
"time"
"github.com/google/uuid"
"github.com/juicedata/juicefs/pkg/compress"
"github.com/juicedata/juicefs/pkg/meta"
"github.com/juicedata/juicefs/pkg/object"
"github.com/juicedata/juicefs/pkg/version"
......@@ -138,6 +139,11 @@ func format(c *cli.Context) error {
if c.Args().Len() < 2 {
logger.Fatalf("Please give it a name")
}
compressor := compress.NewCompressor(c.String("compress"))
if compressor == nil {
logger.Fatalf("Unsupported compress algorithm: %s", c.String("compress"))
}
format := meta.Format{
Name: c.Args().Get(1),
UUID: uuid.New().String(),
......
......@@ -28,6 +28,7 @@ import (
"sync"
"time"
"github.com/juicedata/juicefs/pkg/compress"
"github.com/juicedata/juicefs/pkg/object"
"github.com/juicedata/juicefs/pkg/utils"
)
......@@ -561,7 +562,7 @@ type cachedStore struct {
currentUpload chan bool
pendingKeys map[string]bool
pendingMutex sync.Mutex
compressor utils.Compressor
compressor compress.Compressor
seekable bool
}
......@@ -619,7 +620,7 @@ func (store *cachedStore) load(key string, page *Page, cache bool) (err error) {
// NewCachedStore create a cached store.
func NewCachedStore(storage object.ObjectStorage, config Config) ChunkStore {
compressor := utils.NewCompressor(config.Compress)
compressor := compress.NewCompressor(config.Compress)
if compressor == nil {
logger.Fatalf("unknown compress algorithm: %s", config.Compress)
}
......
......@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package utils
package compress
import (
"fmt"
......
......@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package utils
package compress
import (
"io"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册