Skip to content

Commit

Permalink
make cache size configurable (#118)
Browse files Browse the repository at this point in the history
Co-authored-by: Luke Lombardi <[email protected]>
  • Loading branch information
luke-lombardi and Luke Lombardi authored Mar 27, 2024
1 parent a83ee8f commit 33a23e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/storage/juicefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"log"
"os/exec"
"strconv"
"time"

"github.com/beam-cloud/beta9/internal/types"
Expand All @@ -25,12 +26,16 @@ func NewJuiceFsStorage(config types.JuiceFSConfig) (Storage, error) {
func (s *JuiceFsStorage) Mount(localPath string) error {
log.Printf("JuiceFS filesystem mounting to: '%s'\n", localPath)

cacheSize := strconv.FormatInt(s.config.CacheSize, 10)

s.mountCmd = exec.Command(
"juicefs",
"mount",
s.config.RedisURI,
localPath,
"-d",
"--cache-size",
cacheSize,
)

// Start the mount command in the background
Expand Down Expand Up @@ -77,6 +82,7 @@ func (s *JuiceFsStorage) Format(fsName string) error {
"--bucket", s.config.AWSS3Bucket,
s.config.RedisURI,
fsName,
"--no-update",
)

if s.config.AWSAccessKey != "" || s.config.AWSSecretKey != "" {
Expand Down
1 change: 1 addition & 0 deletions internal/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ type JuiceFSConfig struct {
AWSS3Bucket string `key:"awsS3Bucket" json:"aws_s3_bucket"`
AWSAccessKey string `key:"awsAccessKey" json:"aws_access_key"`
AWSSecretKey string `key:"awsSecretKey" json:"aws_secret_key"`
CacheSize int64 `key:"cacheSize" json:"cache_size"`
}

type MountPointConfig struct {
Expand Down

0 comments on commit 33a23e7

Please sign in to comment.