Skip to content

Commit

Permalink
Add a partSize parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
maobaolong committed Jul 20, 2020
1 parent 45b8d78 commit a7b9c4f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions api/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ type FlagStorage struct {
DebugFuse bool
DebugS3 bool
Foreground bool

// MPU
MPUPartSize uint64
}

func (flags *FlagStorage) GetMimeType(fileName string) (retMime *string) {
Expand Down
6 changes: 3 additions & 3 deletions internal/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ func (fh *FileHandle) partSize() uint64 {
var size uint64

if fh.lastPartId < 1000 {
size = 5 * 1024 * 1024
size = fh.inode.fs.flags.MPUPartSize
} else if fh.lastPartId < 2000 {
size = 25 * 1024 * 1024
size = 5 * fh.inode.fs.flags.MPUPartSize
} else {
size = 125 * 1024 * 1024
size = 5 * 5 * fh.inode.fs.flags.MPUPartSize
}

maxPartSize := fh.cloud.Capabilities().MaxMultipartSize
Expand Down
8 changes: 8 additions & 0 deletions internal/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ func NewApp() (app *cli.App) {
Usage: "GID owner of all inodes.",
},

cli.IntFlag{
Name: "MPUPartSize",
Value: 5 * 1024 * 1024,
Usage: "MPU part size.",
},
/////////////////////////
// S3
/////////////////////////
Expand Down Expand Up @@ -341,6 +346,9 @@ func PopulateFlags(c *cli.Context) (ret *FlagStorage) {
DebugFuse: c.Bool("debug_fuse"),
DebugS3: c.Bool("debug_s3"),
Foreground: c.Bool("f"),

// MPU
MPUPartSize: uint64(c.Int("MPUPartSize")),
}

// S3
Expand Down

0 comments on commit a7b9c4f

Please sign in to comment.