mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
chore: add maxMB option for webdav (#5165)
This commit is contained in:
parent
4f6172f369
commit
3b62b338a5
|
@ -164,6 +164,7 @@ func init() {
|
||||||
webdavOptions.tlsCertificate = cmdServer.Flag.String("webdav.cert.file", "", "path to the TLS certificate file")
|
webdavOptions.tlsCertificate = cmdServer.Flag.String("webdav.cert.file", "", "path to the TLS certificate file")
|
||||||
webdavOptions.cacheDir = cmdServer.Flag.String("webdav.cacheDir", os.TempDir(), "local cache directory for file chunks")
|
webdavOptions.cacheDir = cmdServer.Flag.String("webdav.cacheDir", os.TempDir(), "local cache directory for file chunks")
|
||||||
webdavOptions.cacheSizeMB = cmdServer.Flag.Int64("webdav.cacheCapacityMB", 0, "local cache capacity in MB")
|
webdavOptions.cacheSizeMB = cmdServer.Flag.Int64("webdav.cacheCapacityMB", 0, "local cache capacity in MB")
|
||||||
|
webdavOptions.maxMB = cmdServer.Flag.Int("webdav.maxMB", 4, "split files larger than the limit")
|
||||||
webdavOptions.filerRootPath = cmdServer.Flag.String("webdav.filer.path", "/", "use this remote path from filer server")
|
webdavOptions.filerRootPath = cmdServer.Flag.String("webdav.filer.path", "/", "use this remote path from filer server")
|
||||||
|
|
||||||
mqBrokerOptions.port = cmdServer.Flag.Int("mq.broker.port", 17777, "message queue broker gRPC listen port")
|
mqBrokerOptions.port = cmdServer.Flag.Int("mq.broker.port", 17777, "message queue broker gRPC listen port")
|
||||||
|
|
|
@ -32,6 +32,7 @@ type WebDavOption struct {
|
||||||
tlsCertificate *string
|
tlsCertificate *string
|
||||||
cacheDir *string
|
cacheDir *string
|
||||||
cacheSizeMB *int64
|
cacheSizeMB *int64
|
||||||
|
maxMB *int
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -45,6 +46,7 @@ func init() {
|
||||||
webDavStandaloneOptions.tlsCertificate = cmdWebDav.Flag.String("cert.file", "", "path to the TLS certificate file")
|
webDavStandaloneOptions.tlsCertificate = cmdWebDav.Flag.String("cert.file", "", "path to the TLS certificate file")
|
||||||
webDavStandaloneOptions.cacheDir = cmdWebDav.Flag.String("cacheDir", os.TempDir(), "local cache directory for file chunks")
|
webDavStandaloneOptions.cacheDir = cmdWebDav.Flag.String("cacheDir", os.TempDir(), "local cache directory for file chunks")
|
||||||
webDavStandaloneOptions.cacheSizeMB = cmdWebDav.Flag.Int64("cacheCapacityMB", 0, "local cache capacity in MB")
|
webDavStandaloneOptions.cacheSizeMB = cmdWebDav.Flag.Int64("cacheCapacityMB", 0, "local cache capacity in MB")
|
||||||
|
webDavStandaloneOptions.maxMB = cmdWebDav.Flag.Int("maxMB", 4, "split files larger than the limit")
|
||||||
webDavStandaloneOptions.filerRootPath = cmdWebDav.Flag.String("filer.path", "/", "use this remote path from filer server")
|
webDavStandaloneOptions.filerRootPath = cmdWebDav.Flag.String("filer.path", "/", "use this remote path from filer server")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,6 +118,7 @@ func (wo *WebDavOption) startWebDav() bool {
|
||||||
Cipher: cipher,
|
Cipher: cipher,
|
||||||
CacheDir: util.ResolvePath(*wo.cacheDir),
|
CacheDir: util.ResolvePath(*wo.cacheDir),
|
||||||
CacheSizeMB: *wo.cacheSizeMB,
|
CacheSizeMB: *wo.cacheSizeMB,
|
||||||
|
MaxMB: *wo.maxMB,
|
||||||
})
|
})
|
||||||
if webdavServer_err != nil {
|
if webdavServer_err != nil {
|
||||||
glog.Fatalf("WebDav Server startup error: %v", webdavServer_err)
|
glog.Fatalf("WebDav Server startup error: %v", webdavServer_err)
|
||||||
|
|
|
@ -38,6 +38,7 @@ type WebDavOption struct {
|
||||||
Cipher bool
|
Cipher bool
|
||||||
CacheDir string
|
CacheDir string
|
||||||
CacheSizeMB int64
|
CacheSizeMB int64
|
||||||
|
MaxMB int
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebDavServer struct {
|
type WebDavServer struct {
|
||||||
|
@ -262,7 +263,7 @@ func (fs *WebDavFileSystem) OpenFile(ctx context.Context, fullFilePath string, f
|
||||||
fs: fs,
|
fs: fs,
|
||||||
name: fullFilePath,
|
name: fullFilePath,
|
||||||
isDirectory: false,
|
isDirectory: false,
|
||||||
bufWriter: buffered_writer.NewBufferedWriteCloser(4 * 1024 * 1024),
|
bufWriter: buffered_writer.NewBufferedWriteCloser(fs.option.MaxMB * 1024 * 1024),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +279,7 @@ func (fs *WebDavFileSystem) OpenFile(ctx context.Context, fullFilePath string, f
|
||||||
fs: fs,
|
fs: fs,
|
||||||
name: fullFilePath,
|
name: fullFilePath,
|
||||||
isDirectory: false,
|
isDirectory: false,
|
||||||
bufWriter: buffered_writer.NewBufferedWriteCloser(4 * 1024 * 1024),
|
bufWriter: buffered_writer.NewBufferedWriteCloser(fs.option.MaxMB * 1024 * 1024),
|
||||||
}, nil
|
}, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue