Merge pull request #197 from opencloud-eu/disable-posix-fs-watcher

Add option to disable the posix fs watcher
This commit is contained in:
Ralf Haferkamp
2025-02-13 13:13:51 +01:00
committed by GitHub
8 changed files with 12 additions and 6 deletions

2
go.mod
View File

@@ -65,7 +65,7 @@ require (
github.com/onsi/ginkgo/v2 v2.22.2
github.com/onsi/gomega v1.36.2
github.com/open-policy-agent/opa v1.1.0
github.com/opencloud-eu/reva/v2 v2.27.3-0.20250213085913-418bbbbeed54
github.com/opencloud-eu/reva/v2 v2.27.3-0.20250213094151-e2328704b282
github.com/orcaman/concurrent-map v1.0.0
github.com/owncloud/libre-graph-api-go v1.0.5-0.20240829135935-80dc00d6f5ea
github.com/pkg/errors v0.9.1

4
go.sum
View File

@@ -860,8 +860,8 @@ github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8=
github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY=
github.com/open-policy-agent/opa v1.1.0 h1:HMz2evdEMTyNqtdLjmu3Vyx06BmhNYAx67Yz3Ll9q2s=
github.com/open-policy-agent/opa v1.1.0/go.mod h1:T1pASQ1/vwfTa+e2fYcfpLCvWgYtqtiUv+IuA/dLPQs=
github.com/opencloud-eu/reva/v2 v2.27.3-0.20250213085913-418bbbbeed54 h1:uxSuQctr5AewEerqsCx9GwdzpEv4PESwkg9nyd30X6U=
github.com/opencloud-eu/reva/v2 v2.27.3-0.20250213085913-418bbbbeed54/go.mod h1:kAdY6yRvrlyhiqLaOCYOz+fHPCl7X522eonD8cIiTVE=
github.com/opencloud-eu/reva/v2 v2.27.3-0.20250213094151-e2328704b282 h1:8/0R5f4uZONW6Rjq3dw1G1u7FpOqffU+4hO2c4N6d3Y=
github.com/opencloud-eu/reva/v2 v2.27.3-0.20250213094151-e2328704b282/go.mod h1:kAdY6yRvrlyhiqLaOCYOz+fHPCl7X522eonD8cIiTVE=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=

View File

@@ -205,6 +205,7 @@ type PosixDriver struct {
EnableFSRevisions bool `yaml:"enable_fs_revisions" env:"STORAGE_USERS_POSIX_ENABLE_FS_REVISIONS" desc:"Allow for generating revisions from changes done to the local storage. Note: This doubles the number of bytes stored on disk because a copy of the current revision is stored to be turned into a revision later."`
WatchFS bool `yaml:"watch_fs" env:"STORAGE_USERS_POSIX_WATCH_FS" desc:"Enable the filesystem watcher to detect changes to the filesystem. This is used to detect changes to the filesystem and update the metadata accordingly."`
WatchType string `yaml:"watch_type" env:"STORAGE_USERS_POSIX_WATCH_TYPE" desc:"Type of the watcher to use for getting notified about changes to the filesystem. Currently available options are 'inotifywait' (default), 'gpfswatchfolder' and 'gpfsfileauditlogging'." introductionVersion:"6.0.0"`
WatchPath string `yaml:"watch_path" env:"STORAGE_USERS_POSIX_WATCH_PATH" desc:"Path to the watch directory/file. Only applies to the 'gpfsfileauditlogging' and 'inotifywait' watcher, in which case it is the path of the file audit log file/base directory to watch." introductionVersion:"6.0.0"`
WatchFolderKafkaBrokers string `yaml:"watch_folder_kafka_hosts" env:"STORAGE_USERS_POSIX_WATCH_FOLDER_KAFKA_BROKERS" desc:"Comma-separated list of kafka brokers to read the watchfolder events from." introductionVersion:"6.0.0"`

View File

@@ -147,6 +147,7 @@ func DefaultConfig() *config.Config {
PermissionsEndpoint: "eu.opencloud.api.settings",
AsyncUploads: true,
ScanDebounceDelay: 1 * time.Second,
WatchFS: false,
EnableFSRevisions: false,
},
},

View File

@@ -85,7 +85,7 @@ func Local(cfg *config.Config) map[string]interface{} {
}
// Posix is the config mapping for the Posix storage driver
func Posix(cfg *config.Config, enableFSWatch bool) map[string]interface{} {
func Posix(cfg *config.Config, enableFSScan bool) map[string]interface{} {
return map[string]interface{}{
"root": cfg.Drivers.Posix.Root,
"personalspacepath_template": cfg.Drivers.Posix.PersonalSpacePathTemplate,
@@ -116,7 +116,8 @@ func Posix(cfg *config.Config, enableFSWatch bool) map[string]interface{} {
},
"use_space_groups": cfg.Drivers.Posix.UseSpaceGroups,
"enable_fs_revisions": cfg.Drivers.Posix.EnableFSRevisions,
"watch_fs": enableFSWatch,
"scan_fs": enableFSScan,
"watch_fs": cfg.Drivers.Posix.WatchFS,
"watch_type": cfg.Drivers.Posix.WatchType,
"watch_path": cfg.Drivers.Posix.WatchPath,
"watch_folder_kafka_brokers": cfg.Drivers.Posix.WatchFolderKafkaBrokers,

View File

@@ -39,6 +39,7 @@ type Options struct {
// a revision when the file is changed.
EnableFSRevisions bool `mapstructure:"enable_fs_revisions"`
ScanFS bool `mapstructure:"scan_fs"`
WatchFS bool `mapstructure:"watch_fs"`
WatchType string `mapstructure:"watch_type"`
WatchPath string `mapstructure:"watch_path"`

View File

@@ -144,6 +144,8 @@ func New(lu node.PathLookup, bs Blobstore, um usermapper.Mapper, trashbin *trash
if o.WatchFS {
go t.watcher.Watch(watchPath)
go t.workScanQueue()
}
if o.ScanFS {
go func() {
_ = t.WarmupIDCache(o.Root, true, false)
}()

2
vendor/modules.txt vendored
View File

@@ -1189,7 +1189,7 @@ github.com/open-policy-agent/opa/v1/types
github.com/open-policy-agent/opa/v1/util
github.com/open-policy-agent/opa/v1/util/decoding
github.com/open-policy-agent/opa/v1/version
# github.com/opencloud-eu/reva/v2 v2.27.3-0.20250213085913-418bbbbeed54
# github.com/opencloud-eu/reva/v2 v2.27.3-0.20250213094151-e2328704b282
## explicit; go 1.23.1
github.com/opencloud-eu/reva/v2/cmd/revad/internal/grace
github.com/opencloud-eu/reva/v2/cmd/revad/runtime