aboutsummaryrefslogtreecommitdiff
path: root/weed/mount
diff options
context:
space:
mode:
Diffstat (limited to 'weed/mount')
-rw-r--r--weed/mount/weedfs.go2
-rw-r--r--weed/mount/weedfs_grpc_server.go13
-rw-r--r--weed/mount/weedfs_quota.go11
3 files changed, 21 insertions, 5 deletions
diff --git a/weed/mount/weedfs.go b/weed/mount/weedfs.go
index 195a5bb27..169925427 100644
--- a/weed/mount/weedfs.go
+++ b/weed/mount/weedfs.go
@@ -6,6 +6,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/mount/meta_cache"
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
+ "github.com/chrislusf/seaweedfs/weed/pb/mount_pb"
"github.com/chrislusf/seaweedfs/weed/storage/types"
"github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/util/chunk_cache"
@@ -59,6 +60,7 @@ type WFS struct {
// https://dl.acm.org/doi/fullHtml/10.1145/3310148
// follow https://github.com/hanwen/go-fuse/blob/master/fuse/api.go
fuse.RawFileSystem
+ mount_pb.UnimplementedSeaweedMountServer
fs.Inode
option *Option
metaCache *meta_cache.MetaCache
diff --git a/weed/mount/weedfs_grpc_server.go b/weed/mount/weedfs_grpc_server.go
new file mode 100644
index 000000000..1227372d8
--- /dev/null
+++ b/weed/mount/weedfs_grpc_server.go
@@ -0,0 +1,13 @@
+package mount
+
+import (
+ "context"
+ "github.com/chrislusf/seaweedfs/weed/glog"
+ "github.com/chrislusf/seaweedfs/weed/pb/mount_pb"
+)
+
+func (wfs *WFS) Configure(ctx context.Context, request *mount_pb.ConfigureRequest) (*mount_pb.ConfigureResponse, error) {
+ glog.V(0).Infof("quota changed from %d to %d", wfs.option.Quota, request.CollectionCapacity)
+ wfs.option.Quota = request.GetCollectionCapacity()
+ return &mount_pb.ConfigureResponse{}, nil
+}
diff --git a/weed/mount/weedfs_quota.go b/weed/mount/weedfs_quota.go
index f9307a6b3..ac3e58e62 100644
--- a/weed/mount/weedfs_quota.go
+++ b/weed/mount/weedfs_quota.go
@@ -10,12 +10,14 @@ import (
func (wfs *WFS) loopCheckQuota() {
- if wfs.option.Quota <= 0 {
- return
- }
-
for {
+ time.Sleep(61 * time.Second)
+
+ if wfs.option.Quota <= 0 {
+ continue
+ }
+
err := wfs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {
request := &filer_pb.StatisticsRequest{
@@ -47,7 +49,6 @@ func (wfs *WFS) loopCheckQuota() {
glog.Warningf("read quota usage: %v", err)
}
- time.Sleep(61 * time.Second)
}
}