summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-11-10 12:36:59 +0100
committerLibravatar tobi <tobi.smethurst@protonmail.com>2025-11-17 14:13:24 +0100
commitac877bde815827f7aa1eeb3a6f0513d4c7503ad0 (patch)
tree7a315d820a5be3232dd5bfc96857017c38e906fd
parent[chore] update dependencies (#4542) (diff)
downloadgotosocial-ac877bde815827f7aa1eeb3a6f0513d4c7503ad0.tar.xz
[performance] add optional S3 object info caching (#4546)
This adds an optional S3 object info cache to the S3 storage driver backend (see [here](https://codeberg.org/gruf/go-storage/releases/tag/v0.4.0)) to reduce S3 calls largely during media cleanup operations, but it should also help in other situations cutting back on S3 calls when for example a key is already known to not exist. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4546 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
-rw-r--r--docs/configuration/storage.md13
-rw-r--r--example/config.yaml11
-rw-r--r--go.mod6
-rw-r--r--go.sum12
-rw-r--r--internal/config/config.go3
-rw-r--r--internal/config/defaults.go12
-rw-r--r--internal/config/helpers.gen.go442
-rw-r--r--internal/storage/storage.go11
-rwxr-xr-xtest/envparsing.sh1
-rw-r--r--vendor/codeberg.org/gruf/go-fastpath/v2/path.go10
-rw-r--r--vendor/codeberg.org/gruf/go-storage/s3/cache.go94
-rw-r--r--vendor/codeberg.org/gruf/go-storage/s3/cache/cache.go44
-rw-r--r--vendor/codeberg.org/gruf/go-storage/s3/errors.go31
-rw-r--r--vendor/codeberg.org/gruf/go-storage/s3/s3.go110
-rw-r--r--vendor/modules.txt7
15 files changed, 571 insertions, 236 deletions
diff --git a/docs/configuration/storage.md b/docs/configuration/storage.md
index 0c5b1e9ba..d4e264af3 100644
--- a/docs/configuration/storage.md
+++ b/docs/configuration/storage.md
@@ -101,7 +101,6 @@ storage-s3-secret-key: ""
# Default: ""
storage-s3-bucket: ""
-
# String. Key prefix to use for the S3 storage.
# This is optional.
#
@@ -127,6 +126,18 @@ storage-s3-key-prefix: ""
# Examples: ["path", "dns", "auto"]
# Default: "auto"
storage-s3-bucket-lookup: "auto"
+
+cache:
+ # cache.s3-object-info (if set) enables caching
+ # of S3 object information in the storage driver.
+ # This can help reduce S3 calls on metered buckets
+ # by caching simple information like whether an
+ # object exists, and if so, its size. Left unset,
+ # the cache will be disabled, which is the default.
+ # The given value determines the cache capacity.
+ # Examples: [0, 8000, 16000, 2560000]
+ # Default: 0
+ s3-object-info: 0
```
## AWS S3 Configuration
diff --git a/example/config.yaml b/example/config.yaml
index bf6be2573..a7c679f38 100644
--- a/example/config.yaml
+++ b/example/config.yaml
@@ -288,6 +288,17 @@ cache:
# Default: "100MiB"
memory-target: "100MiB"
+ # cache.s3-object-info (if set) enables caching
+ # of S3 object information in the storage driver.
+ # This can help reduce S3 calls on metered buckets
+ # by caching simple information like whether an
+ # object exists, and if so, its size. Left unset,
+ # the cache will be disabled, which is the default.
+ # The given value determines the cache capacity.
+ # Examples: [0, 8000, 16000, 2560000]
+ # Default: 0
+ s3-object-info: 0
+
######################
##### WEB CONFIG #####
######################
diff --git a/go.mod b/go.mod
index 5149fe63e..c2b46f783 100644
--- a/go.mod
+++ b/go.mod
@@ -17,8 +17,8 @@ require (
codeberg.org/gruf/go-debug v1.3.0
codeberg.org/gruf/go-errors/v2 v2.3.2
codeberg.org/gruf/go-fastcopy v1.1.3
- codeberg.org/gruf/go-fastpath/v2 v2.0.0
- codeberg.org/gruf/go-ffmpreg v0.6.12
+ codeberg.org/gruf/go-fastpath/v2 v2.0.1
+ codeberg.org/gruf/go-ffmpreg v0.6.14
codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf
codeberg.org/gruf/go-kv/v2 v2.0.7
codeberg.org/gruf/go-list v0.0.0-20240425093752-494db03d641f
@@ -28,7 +28,7 @@ require (
codeberg.org/gruf/go-runners v1.7.0
codeberg.org/gruf/go-sched v1.3.0
codeberg.org/gruf/go-split v1.2.0
- codeberg.org/gruf/go-storage v0.3.1
+ codeberg.org/gruf/go-storage v0.4.0
codeberg.org/gruf/go-structr v0.9.13
github.com/DmitriyVTitov/size v1.5.0
github.com/KimMachineGun/automemlimit v0.7.5
diff --git a/go.sum b/go.sum
index ef08dd9a0..9d583b7a7 100644
--- a/go.sum
+++ b/go.sum
@@ -24,10 +24,10 @@ codeberg.org/gruf/go-errors/v2 v2.3.2 h1:8ItWaOMfhDaqrJK1Pw8MO0Nu+o/tVcQtR5cJ58V
codeberg.org/gruf/go-errors/v2 v2.3.2/go.mod h1:LfzD9nkAAJpEDbkUqOZQ2jdaQ8VrK0pnR36zLOMFq6Y=
codeberg.org/gruf/go-fastcopy v1.1.3 h1:Jo9VTQjI6KYimlw25PPc7YLA3Xm+XMQhaHwKnM7xD1g=
codeberg.org/gruf/go-fastcopy v1.1.3/go.mod h1:GDDYR0Cnb3U/AIfGM3983V/L+GN+vuwVMvrmVABo21s=
-codeberg.org/gruf/go-fastpath/v2 v2.0.0 h1:iAS9GZahFhyWEH0KLhFEJR+txx1ZhMXxYzu2q5Qo9c0=
-codeberg.org/gruf/go-fastpath/v2 v2.0.0/go.mod h1:3pPqu5nZjpbRrOqvLyAK7puS1OfEtQvjd6342Cwz56Q=
-codeberg.org/gruf/go-ffmpreg v0.6.12 h1:mPdRx1TAQJQPhRkTOOHnRSY6omNCLJ7M6ajjuEMNNvE=
-codeberg.org/gruf/go-ffmpreg v0.6.12/go.mod h1:tGqIMh/I2cizqauxxNAN+WGkICI0j5G3xwF1uBkyw1E=
+codeberg.org/gruf/go-fastpath/v2 v2.0.1 h1:smCq3mpYiPibH4Na3SEN2rtr5oPmrY+cVRQ8nFCznJ4=
+codeberg.org/gruf/go-fastpath/v2 v2.0.1/go.mod h1:ABH9P8jc/bUub/RW9yTI7i+Gm/Oqe6ZHcIGEumvAOKk=
+codeberg.org/gruf/go-ffmpreg v0.6.14 h1:gBwVrBeuel1rbPRX7p76yPOgNhUkb0Cw6r+LIAq3/OA=
+codeberg.org/gruf/go-ffmpreg v0.6.14/go.mod h1:HBUcBiwGaI016ExeVI3/MFnpsOnBrIUdTeq23097q2A=
codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf h1:84s/ii8N6lYlskZjHH+DG6jyia8w2mXMZlRwFn8Gs3A=
codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf/go.mod h1:zZAICsp5rY7+hxnws2V0ePrWxE0Z2Z/KXcN3p/RQCfk=
codeberg.org/gruf/go-kv v1.6.5 h1:ttPf0NA8F79pDqBttSudPTVCZmGncumeNIxmeM9ztz0=
@@ -54,8 +54,8 @@ codeberg.org/gruf/go-sched v1.3.0 h1:3Y+Vb6p+rt05iUC6Oj3TDFc9GQZCDImDfTKSUKUI9WA
codeberg.org/gruf/go-sched v1.3.0/go.mod h1:qL9MdPdBFaNXzSfumpQ18TStBAwnRddCTD+wlrZUEgI=
codeberg.org/gruf/go-split v1.2.0 h1:PmzL23nVEVHm8VxjsJmv4m4wGQz2bGgQw52dgSSj65c=
codeberg.org/gruf/go-split v1.2.0/go.mod h1:0rejWJpqvOoFAd7nwm5tIXYKaAqjtFGOXmTqQV+VO38=
-codeberg.org/gruf/go-storage v0.3.1 h1:g66UIM/xXnEk9ejT+W0T9s/PODBZhXa/8ajzeY/MELI=
-codeberg.org/gruf/go-storage v0.3.1/go.mod h1:r43n/zi7YGOCl2iSl7AMI27D1zcWS65Bi2+5xDzypeo=
+codeberg.org/gruf/go-storage v0.4.0 h1:SNmSJNQYsFhtz95tYgtMsJ/0raegiKHvwndAinW+kTU=
+codeberg.org/gruf/go-storage v0.4.0/go.mod h1:shw9nx4xhbhO4O8PygolrM7ZRBuocWXQy3tn/5G4lm8=
codeberg.org/gruf/go-structr v0.9.13 h1:tTAR30OnSKrcvBomlGZdwE2nE+cfWhkX8UhX0GTAbMo=
codeberg.org/gruf/go-structr v0.9.13/go.mod h1:sP2ZSjM5X5XKlxuhAbTKuVQm9DWbHsrQRuTl3MUwbHw=
codeberg.org/gruf/go-xunsafe v0.0.0-20250809104800-512a9df57d73 h1:pRaOwIOS1WSZoPCAvE0H1zpv+D4gF37OVppybffqdI8=
diff --git a/internal/config/config.go b/internal/config/config.go
index dfc919f11..9ee321b56 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -215,7 +215,8 @@ type MediaConfiguration struct {
}
type CacheConfiguration struct {
- MemoryTarget bytesize.Size `name:"memory-target"`
+ S3ObjectInfo int `name:"s3-object-info" usage:"Enables caching of S3 object information in the storage driver to reduce S3 calls, value is cache capacity."`
+ MemoryTarget bytesize.Size `name:"memory-target" usage:"Sets a target limit that the application will *try* to keep *most* of its caches within."`
AccountMemRatio float64 `name:"account-mem-ratio"`
AccountNoteMemRatio float64 `name:"account-note-mem-ratio"`
AccountSettingsMemRatio float64 `name:"account-settings-mem-ratio"`
diff --git a/internal/config/defaults.go b/internal/config/defaults.go
index a4996e5c6..a1b4ec211 100644
--- a/internal/config/defaults.go
+++ b/internal/config/defaults.go
@@ -157,6 +157,18 @@ var Defaults = Configuration{
},
Cache: CacheConfiguration{
+ // We purposely leave this unset as
+ // guesstimating the number of media
+ // objects a server may have cached
+ // is quite difficult.
+ //
+ // And for example, on my extremely
+ // well federated single user instance
+ // I (kim) have over 2.5M media objects
+ // alone in storage. We'll leave this
+ // to those on metered S3 to tweak.
+ S3ObjectInfo: 0,
+
// Rough memory target that the total
// size of all State.Caches will attempt
// to remain with. Emphasis on *rough*.
diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go
index 217917bcf..078c67289 100644
--- a/internal/config/helpers.gen.go
+++ b/internal/config/helpers.gen.go
@@ -154,6 +154,7 @@ const (
MediaCleanupEveryFlag = "media-cleanup-every"
MediaFfmpegPoolSizeFlag = "media-ffmpeg-pool-size"
MediaThumbMaxPixelsFlag = "media-thumb-max-pixels"
+ CacheS3ObjectInfoFlag = "cache-s3-object-info"
CacheMemoryTargetFlag = "cache-memory-target"
CacheAccountMemRatioFlag = "cache-account-mem-ratio"
CacheAccountNoteMemRatioFlag = "cache-account-note-mem-ratio"
@@ -353,7 +354,8 @@ func (cfg *Configuration) RegisterFlags(flags *pflag.FlagSet) {
flags.Duration("media-cleanup-every", cfg.Media.CleanupEvery, "Period to elapse between cleanups, starting from media-cleanup-at.")
flags.Int("media-ffmpeg-pool-size", cfg.Media.FfmpegPoolSize, "Number of instances of the embedded ffmpeg WASM binary to add to the media processing pool. 0 or less uses GOMAXPROCS.")
flags.Int("media-thumb-max-pixels", cfg.Media.ThumbMaxPixels, "Max size in pixels of any one dimension of a thumbnail (as input media ratio is preserved).")
- flags.String("cache-memory-target", cfg.Cache.MemoryTarget.String(), "")
+ flags.Int("cache-s3-object-info", cfg.Cache.S3ObjectInfo, "Enables caching of S3 object information in the storage driver to reduce S3 calls, value is cache capacity.")
+ flags.String("cache-memory-target", cfg.Cache.MemoryTarget.String(), "Sets a target limit that the application will *try* to keep *most* of its caches within.")
flags.Float64("cache-account-mem-ratio", cfg.Cache.AccountMemRatio, "")
flags.Float64("cache-account-note-mem-ratio", cfg.Cache.AccountNoteMemRatio, "")
flags.Float64("cache-account-settings-mem-ratio", cfg.Cache.AccountSettingsMemRatio, "")
@@ -418,7 +420,7 @@ func (cfg *Configuration) RegisterFlags(flags *pflag.FlagSet) {
}
func (cfg *Configuration) MarshalMap() map[string]any {
- cfgmap := make(map[string]any, 196)
+ cfgmap := make(map[string]any, 197)
cfgmap["log-level"] = cfg.LogLevel
cfgmap["log-format"] = cfg.LogFormat
cfgmap["log-timestamp-format"] = cfg.LogTimestampFormat
@@ -544,6 +546,7 @@ func (cfg *Configuration) MarshalMap() map[string]any {
cfgmap["media-cleanup-every"] = cfg.Media.CleanupEvery
cfgmap["media-ffmpeg-pool-size"] = cfg.Media.FfmpegPoolSize
cfgmap["media-thumb-max-pixels"] = cfg.Media.ThumbMaxPixels
+ cfgmap["cache-s3-object-info"] = cfg.Cache.S3ObjectInfo
cfgmap["cache-memory-target"] = cfg.Cache.MemoryTarget.String()
cfgmap["cache-account-mem-ratio"] = cfg.Cache.AccountMemRatio
cfgmap["cache-account-note-mem-ratio"] = cfg.Cache.AccountNoteMemRatio
@@ -1655,6 +1658,14 @@ func (cfg *Configuration) UnmarshalMap(cfgmap map[string]any) error {
}
}
+ if ival, ok := cfgmap["cache-s3-object-info"]; ok {
+ var err error
+ cfg.Cache.S3ObjectInfo, err = cast.ToIntE(ival)
+ if err != nil {
+ return fmt.Errorf("error casting %#v -> int for 'cache-s3-object-info': %w", ival, err)
+ }
+ }
+
if ival, ok := cfgmap["cache-memory-target"]; ok {
t, err := cast.ToStringE(ival)
if err != nil {
@@ -2234,7 +2245,7 @@ func (st *ConfigState) GetLogLevel() (v string) {
st.mutex.RLock()
v = st.config.LogLevel
st.mutex.RUnlock()
- return v
+ return
}
// SetLogLevel safely sets the Configuration value for state's 'LogLevel' field
@@ -2256,7 +2267,7 @@ func (st *ConfigState) GetLogFormat() (v string) {
st.mutex.RLock()
v = st.config.LogFormat
st.mutex.RUnlock()
- return v
+ return
}
// SetLogFormat safely sets the Configuration value for state's 'LogFormat' field
@@ -2278,7 +2289,7 @@ func (st *ConfigState) GetLogTimestampFormat() (v string) {
st.mutex.RLock()
v = st.config.LogTimestampFormat
st.mutex.RUnlock()
- return v
+ return
}
// SetLogTimestampFormat safely sets the Configuration value for state's 'LogTimestampFormat' field
@@ -2300,7 +2311,7 @@ func (st *ConfigState) GetLogDbQueries() (v bool) {
st.mutex.RLock()
v = st.config.LogDbQueries
st.mutex.RUnlock()
- return v
+ return
}
// SetLogDbQueries safely sets the Configuration value for state's 'LogDbQueries' field
@@ -2322,7 +2333,7 @@ func (st *ConfigState) GetLogClientIP() (v bool) {
st.mutex.RLock()
v = st.config.LogClientIP
st.mutex.RUnlock()
- return v
+ return
}
// SetLogClientIP safely sets the Configuration value for state's 'LogClientIP' field
@@ -2344,7 +2355,7 @@ func (st *ConfigState) GetRequestIDHeader() (v string) {
st.mutex.RLock()
v = st.config.RequestIDHeader
st.mutex.RUnlock()
- return v
+ return
}
// SetRequestIDHeader safely sets the Configuration value for state's 'RequestIDHeader' field
@@ -2366,7 +2377,7 @@ func (st *ConfigState) GetConfigPath() (v string) {
st.mutex.RLock()
v = st.config.ConfigPath
st.mutex.RUnlock()
- return v
+ return
}
// SetConfigPath safely sets the Configuration value for state's 'ConfigPath' field
@@ -2388,7 +2399,7 @@ func (st *ConfigState) GetApplicationName() (v string) {
st.mutex.RLock()
v = st.config.ApplicationName
st.mutex.RUnlock()
- return v
+ return
}
// SetApplicationName safely sets the Configuration value for state's 'ApplicationName' field
@@ -2410,7 +2421,7 @@ func (st *ConfigState) GetLandingPageUser() (v string) {
st.mutex.RLock()
v = st.config.LandingPageUser
st.mutex.RUnlock()
- return v
+ return
}
// SetLandingPageUser safely sets the Configuration value for state's 'LandingPageUser' field
@@ -2432,7 +2443,7 @@ func (st *ConfigState) GetHost() (v string) {
st.mutex.RLock()
v = st.config.Host
st.mutex.RUnlock()
- return v
+ return
}
// SetHost safely sets the Configuration value for state's 'Host' field
@@ -2454,7 +2465,7 @@ func (st *ConfigState) GetAccountDomain() (v string) {
st.mutex.RLock()
v = st.config.AccountDomain
st.mutex.RUnlock()
- return v
+ return
}
// SetAccountDomain safely sets the Configuration value for state's 'AccountDomain' field
@@ -2476,7 +2487,7 @@ func (st *ConfigState) GetProtocol() (v string) {
st.mutex.RLock()
v = st.config.Protocol
st.mutex.RUnlock()
- return v
+ return
}
// SetProtocol safely sets the Configuration value for state's 'Protocol' field
@@ -2498,7 +2509,7 @@ func (st *ConfigState) GetBindAddress() (v string) {
st.mutex.RLock()
v = st.config.BindAddress
st.mutex.RUnlock()
- return v
+ return
}
// SetBindAddress safely sets the Configuration value for state's 'BindAddress' field
@@ -2520,7 +2531,7 @@ func (st *ConfigState) GetPort() (v int) {
st.mutex.RLock()
v = st.config.Port
st.mutex.RUnlock()
- return v
+ return
}
// SetPort safely sets the Configuration value for state's 'Port' field
@@ -2542,7 +2553,7 @@ func (st *ConfigState) GetTrustedProxies() (v []string) {
st.mutex.RLock()
v = st.config.TrustedProxies
st.mutex.RUnlock()
- return v
+ return
}
// SetTrustedProxies safely sets the Configuration value for state's 'TrustedProxies' field
@@ -2564,7 +2575,7 @@ func (st *ConfigState) GetSoftwareVersion() (v string) {
st.mutex.RLock()
v = st.config.SoftwareVersion
st.mutex.RUnlock()
- return v
+ return
}
// SetSoftwareVersion safely sets the Configuration value for state's 'SoftwareVersion' field
@@ -2586,7 +2597,7 @@ func (st *ConfigState) GetDbType() (v string) {
st.mutex.RLock()
v = st.config.DbType
st.mutex.RUnlock()
- return v
+ return
}
// SetDbType safely sets the Configuration value for state's 'DbType' field
@@ -2608,7 +2619,7 @@ func (st *ConfigState) GetDbAddress() (v string) {
st.mutex.RLock()
v = st.config.DbAddress
st.mutex.RUnlock()
- return v
+ return
}
// SetDbAddress safely sets the Configuration value for state's 'DbAddress' field
@@ -2630,7 +2641,7 @@ func (st *ConfigState) GetDbPort() (v int) {
st.mutex.RLock()
v = st.config.DbPort
st.mutex.RUnlock()
- return v
+ return
}
// SetDbPort safely sets the Configuration value for state's 'DbPort' field
@@ -2652,7 +2663,7 @@ func (st *ConfigState) GetDbUser() (v string) {
st.mutex.RLock()
v = st.config.DbUser
st.mutex.RUnlock()
- return v
+ return
}
// SetDbUser safely sets the Configuration value for state's 'DbUser' field
@@ -2674,7 +2685,7 @@ func (st *ConfigState) GetDbPassword() (v string) {
st.mutex.RLock()
v = st.config.DbPassword
st.mutex.RUnlock()
- return v
+ return
}
// SetDbPassword safely sets the Configuration value for state's 'DbPassword' field
@@ -2696,7 +2707,7 @@ func (st *ConfigState) GetDbDatabase() (v string) {
st.mutex.RLock()
v = st.config.DbDatabase
st.mutex.RUnlock()
- return v
+ return
}
// SetDbDatabase safely sets the Configuration value for state's 'DbDatabase' field
@@ -2718,7 +2729,7 @@ func (st *ConfigState) GetDbTLSMode() (v string) {
st.mutex.RLock()
v = st.config.DbTLSMode
st.mutex.RUnlock()
- return v
+ return
}
// SetDbTLSMode safely sets the Configuration value for state's 'DbTLSMode' field
@@ -2740,7 +2751,7 @@ func (st *ConfigState) GetDbTLSCACert() (v string) {
st.mutex.RLock()
v = st.config.DbTLSCACert
st.mutex.RUnlock()
- return v
+ return
}
// SetDbTLSCACert safely sets the Configuration value for state's 'DbTLSCACert' field
@@ -2762,7 +2773,7 @@ func (st *ConfigState) GetDbMaxOpenConnsMultiplier() (v int) {
st.mutex.RLock()
v = st.config.DbMaxOpenConnsMultiplier
st.mutex.RUnlock()
- return v
+ return
}
// SetDbMaxOpenConnsMultiplier safely sets the Configuration value for state's 'DbMaxOpenConnsMultiplier' field
@@ -2784,7 +2795,7 @@ func (st *ConfigState) GetDbSqliteJournalMode() (v string) {
st.mutex.RLock()
v = st.config.DbSqliteJournalMode
st.mutex.RUnlock()
- return v
+ return
}
// SetDbSqliteJournalMode safely sets the Configuration value for state's 'DbSqliteJournalMode' field
@@ -2806,7 +2817,7 @@ func (st *ConfigState) GetDbSqliteSynchronous() (v string) {
st.mutex.RLock()
v = st.config.DbSqliteSynchronous
st.mutex.RUnlock()
- return v
+ return
}
// SetDbSqliteSynchronous safely sets the Configuration value for state's 'DbSqliteSynchronous' field
@@ -2828,7 +2839,7 @@ func (st *ConfigState) GetDbSqliteCacheSize() (v bytesize.Size) {
st.mutex.RLock()
v = st.config.DbSqliteCacheSize
st.mutex.RUnlock()
- return v
+ return
}
// SetDbSqliteCacheSize safely sets the Configuration value for state's 'DbSqliteCacheSize' field
@@ -2850,7 +2861,7 @@ func (st *ConfigState) GetDbSqliteBusyTimeout() (v time.Duration) {
st.mutex.RLock()
v = st.config.DbSqliteBusyTimeout
st.mutex.RUnlock()
- return v
+ return
}
// SetDbSqliteBusyTimeout safely sets the Configuration value for state's 'DbSqliteBusyTimeout' field
@@ -2872,7 +2883,7 @@ func (st *ConfigState) GetDbPostgresConnectionString() (v string) {
st.mutex.RLock()
v = st.config.DbPostgresConnectionString
st.mutex.RUnlock()
- return v
+ return
}
// SetDbPostgresConnectionString safely sets the Configuration value for state's 'DbPostgresConnectionString' field
@@ -2894,7 +2905,7 @@ func (st *ConfigState) GetWebTemplateBaseDir() (v string) {
st.mutex.RLock()
v = st.config.WebTemplateBaseDir
st.mutex.RUnlock()
- return v
+ return
}
// SetWebTemplateBaseDir safely sets the Configuration value for state's 'WebTemplateBaseDir' field
@@ -2916,7 +2927,7 @@ func (st *ConfigState) GetWebAssetBaseDir() (v string) {
st.mutex.RLock()
v = st.config.WebAssetBaseDir
st.mutex.RUnlock()
- return v
+ return
}
// SetWebAssetBaseDir safely sets the Configuration value for state's 'WebAssetBaseDir' field
@@ -2938,7 +2949,7 @@ func (st *ConfigState) GetInstanceFederationMode() (v string) {
st.mutex.RLock()
v = st.config.InstanceFederationMode
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceFederationMode safely sets the Configuration value for state's 'InstanceFederationMode' field
@@ -2960,7 +2971,7 @@ func (st *ConfigState) GetInstanceFederationSpamFilter() (v bool) {
st.mutex.RLock()
v = st.config.InstanceFederationSpamFilter
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceFederationSpamFilter safely sets the Configuration value for state's 'InstanceFederationSpamFilter' field
@@ -2982,7 +2993,7 @@ func (st *ConfigState) GetInstanceExposePeers() (v bool) {
st.mutex.RLock()
v = st.config.InstanceExposePeers
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceExposePeers safely sets the Configuration value for state's 'InstanceExposePeers' field
@@ -3004,7 +3015,7 @@ func (st *ConfigState) GetInstanceExposeBlocklist() (v bool) {
st.mutex.RLock()
v = st.config.InstanceExposeBlocklist
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceExposeBlocklist safely sets the Configuration value for state's 'InstanceExposeBlocklist' field
@@ -3026,7 +3037,7 @@ func (st *ConfigState) GetInstanceExposeBlocklistWeb() (v bool) {
st.mutex.RLock()
v = st.config.InstanceExposeBlocklistWeb
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceExposeBlocklistWeb safely sets the Configuration value for state's 'InstanceExposeBlocklistWeb' field
@@ -3048,7 +3059,7 @@ func (st *ConfigState) GetInstanceExposeAllowlist() (v bool) {
st.mutex.RLock()
v = st.config.InstanceExposeAllowlist
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceExposeAllowlist safely sets the Configuration value for state's 'InstanceExposeAllowlist' field
@@ -3070,7 +3081,7 @@ func (st *ConfigState) GetInstanceExposeAllowlistWeb() (v bool) {
st.mutex.RLock()
v = st.config.InstanceExposeAllowlistWeb
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceExposeAllowlistWeb safely sets the Configuration value for state's 'InstanceExposeAllowlistWeb' field
@@ -3092,7 +3103,7 @@ func (st *ConfigState) GetInstanceExposePublicTimeline() (v bool) {
st.mutex.RLock()
v = st.config.InstanceExposePublicTimeline
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceExposePublicTimeline safely sets the Configuration value for state's 'InstanceExposePublicTimeline' field
@@ -3114,7 +3125,7 @@ func (st *ConfigState) GetInstanceExposeCustomEmojis() (v bool) {
st.mutex.RLock()
v = st.config.InstanceExposeCustomEmojis
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceExposeCustomEmojis safely sets the Configuration value for state's 'InstanceExposeCustomEmojis' field
@@ -3136,7 +3147,7 @@ func (st *ConfigState) GetInstanceDeliverToSharedInboxes() (v bool) {
st.mutex.RLock()
v = st.config.InstanceDeliverToSharedInboxes
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceDeliverToSharedInboxes safely sets the Configuration value for state's 'InstanceDeliverToSharedInboxes' field
@@ -3158,7 +3169,7 @@ func (st *ConfigState) GetInstanceInjectMastodonVersion() (v bool) {
st.mutex.RLock()
v = st.config.InstanceInjectMastodonVersion
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceInjectMastodonVersion safely sets the Configuration value for state's 'InstanceInjectMastodonVersion' field
@@ -3180,7 +3191,7 @@ func (st *ConfigState) GetInstanceLanguages() (v language.Languages) {
st.mutex.RLock()
v = st.config.InstanceLanguages
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceLanguages safely sets the Configuration value for state's 'InstanceLanguages' field
@@ -3202,7 +3213,7 @@ func (st *ConfigState) GetInstanceSubscriptionsProcessFrom() (v string) {
st.mutex.RLock()
v = st.config.InstanceSubscriptionsProcessFrom
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceSubscriptionsProcessFrom safely sets the Configuration value for state's 'InstanceSubscriptionsProcessFrom' field
@@ -3226,7 +3237,7 @@ func (st *ConfigState) GetInstanceSubscriptionsProcessEvery() (v time.Duration)
st.mutex.RLock()
v = st.config.InstanceSubscriptionsProcessEvery
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceSubscriptionsProcessEvery safely sets the Configuration value for state's 'InstanceSubscriptionsProcessEvery' field
@@ -3252,7 +3263,7 @@ func (st *ConfigState) GetInstanceStatsMode() (v string) {
st.mutex.RLock()
v = st.config.InstanceStatsMode
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceStatsMode safely sets the Configuration value for state's 'InstanceStatsMode' field
@@ -3274,7 +3285,7 @@ func (st *ConfigState) GetInstanceAllowBackdatingStatuses() (v bool) {
st.mutex.RLock()
v = st.config.InstanceAllowBackdatingStatuses
st.mutex.RUnlock()
- return v
+ return
}
// SetInstanceAllowBackdatingStatuses safely sets the Configuration value for state's 'InstanceAllowBackdatingStatuses' field
@@ -3296,7 +3307,7 @@ func (st *ConfigState) GetAccountsRegistrationOpen() (v bool) {
st.mutex.RLock()
v = st.config.AccountsRegistrationOpen
st.mutex.RUnlock()
- return v
+ return
}
// SetAccountsRegistrationOpen safely sets the Configuration value for state's 'AccountsRegistrationOpen' field
@@ -3318,7 +3329,7 @@ func (st *ConfigState) GetAccountsReasonRequired() (v bool) {
st.mutex.RLock()
v = st.config.AccountsReasonRequired
st.mutex.RUnlock()
- return v
+ return
}
// SetAccountsReasonRequired safely sets the Configuration value for state's 'AccountsReasonRequired' field
@@ -3340,7 +3351,7 @@ func (st *ConfigState) GetAccountsRegistrationDailyLimit() (v int) {
st.mutex.RLock()
v = st.config.AccountsRegistrationDailyLimit
st.mutex.RUnlock()
- return v
+ return
}
// SetAccountsRegistrationDailyLimit safely sets the Configuration value for state's 'AccountsRegistrationDailyLimit' field
@@ -3362,7 +3373,7 @@ func (st *ConfigState) GetAccountsRegistrationBacklogLimit() (v int) {
st.mutex.RLock()
v = st.config.AccountsRegistrationBacklogLimit
st.mutex.RUnlock()
- return v
+ return
}
// SetAccountsRegistrationBacklogLimit safely sets the Configuration value for state's 'AccountsRegistrationBacklogLimit' field
@@ -3384,7 +3395,7 @@ func (st *ConfigState) GetAccountsAllowCustomCSS() (v bool) {
st.mutex.RLock()
v = st.config.AccountsAllowCustomCSS
st.mutex.RUnlock()
- return v
+ return
}
// SetAccountsAllowCustomCSS safely sets the Configuration value for state's 'AccountsAllowCustomCSS' field
@@ -3406,7 +3417,7 @@ func (st *ConfigState) GetAccountsCustomCSSLength() (v int) {
st.mutex.RLock()
v = st.config.AccountsCustomCSSLength
st.mutex.RUnlock()
- return v
+ return
}
// SetAccountsCustomCSSLength safely sets the Configuration value for state's 'AccountsCustomCSSLength' field
@@ -3428,7 +3439,7 @@ func (st *ConfigState) GetAccountsMaxProfileFields() (v int) {
st.mutex.RLock()
v = st.config.AccountsMaxProfileFields
st.mutex.RUnlock()
- return v
+ return
}
// SetAccountsMaxProfileFields safely sets the Configuration value for state's 'AccountsMaxProfileFields' field
@@ -3450,7 +3461,7 @@ func (st *ConfigState) GetStorageBackend() (v string) {
st.mutex.RLock()
v = st.config.StorageBackend
st.mutex.RUnlock()
- return v
+ return
}
// SetStorageBackend safely sets the Configuration value for state's 'StorageBackend' field
@@ -3472,7 +3483,7 @@ func (st *ConfigState) GetStorageLocalBasePath() (v string) {
st.mutex.RLock()
v = st.config.StorageLocalBasePath
st.mutex.RUnlock()
- return v
+ return
}
// SetStorageLocalBasePath safely sets the Configuration value for state's 'StorageLocalBasePath' field
@@ -3494,7 +3505,7 @@ func (st *ConfigState) GetStorageS3Endpoint() (v string) {
st.mutex.RLock()
v = st.config.StorageS3Endpoint
st.mutex.RUnlock()
- return v
+ return
}
// SetStorageS3Endpoint safely sets the Configuration value for state's 'StorageS3Endpoint' field
@@ -3516,7 +3527,7 @@ func (st *ConfigState) GetStorageS3AccessKey() (v string) {
st.mutex.RLock()
v = st.config.StorageS3AccessKey
st.mutex.RUnlock()
- return v
+ return
}
// SetStorageS3AccessKey safely sets the Configuration value for state's 'StorageS3AccessKey' field
@@ -3538,7 +3549,7 @@ func (st *ConfigState) GetStorageS3SecretKey() (v string) {
st.mutex.RLock()
v = st.config.StorageS3SecretKey
st.mutex.RUnlock()
- return v
+ return
}
// SetStorageS3SecretKey safely sets the Configuration value for state's 'StorageS3SecretKey' field
@@ -3560,7 +3571,7 @@ func (st *ConfigState) GetStorageS3UseSSL() (v bool) {
st.mutex.RLock()
v = st.config.StorageS3UseSSL
st.mutex.RUnlock()
- return v
+ return
}
// SetStorageS3UseSSL safely sets the Configuration value for state's 'StorageS3UseSSL' field
@@ -3582,7 +3593,7 @@ func (st *ConfigState) GetStorageS3BucketName() (v string) {
st.mutex.RLock()
v = st.config.StorageS3BucketName
st.mutex.RUnlock()
- return v
+ return
}
// SetStorageS3BucketName safely sets the Configuration value for state's 'StorageS3BucketName' field
@@ -3604,7 +3615,7 @@ func (st *ConfigState) GetStorageS3Proxy() (v bool) {
st.mutex.RLock()
v = st.config.StorageS3Proxy
st.mutex.RUnlock()
- return v
+ return
}
// SetStorageS3Proxy safely sets the Configuration value for state's 'StorageS3Proxy' field
@@ -3626,7 +3637,7 @@ func (st *ConfigState) GetStorageS3RedirectURL() (v string) {
st.mutex.RLock()
v = st.config.StorageS3RedirectURL
st.mutex.RUnlock()
- return v
+ return
}
// SetStorageS3RedirectURL safely sets the Configuration value for state's 'StorageS3RedirectURL' field
@@ -3648,7 +3659,7 @@ func (st *ConfigState) GetStorageS3BucketLookup() (v string) {
st.mutex.RLock()
v = st.config.StorageS3BucketLookup
st.mutex.RUnlock()
- return v
+ return
}
// SetStorageS3BucketLookup safely sets the Configuration value for state's 'StorageS3BucketLookup' field
@@ -3670,7 +3681,7 @@ func (st *ConfigState) GetStorageS3KeyPrefix() (v string) {
st.mutex.RLock()
v = st.config.StorageS3KeyPrefix
st.mutex.RUnlock()
- return v
+ return
}
// SetStorageS3KeyPrefix safely sets the Configuration value for state's 'StorageS3KeyPrefix' field
@@ -3692,7 +3703,7 @@ func (st *ConfigState) GetStatusesMaxChars() (v int) {
st.mutex.RLock()
v = st.config.StatusesMaxChars
st.mutex.RUnlock()
- return v
+ return
}
// SetStatusesMaxChars safely sets the Configuration value for state's 'StatusesMaxChars' field
@@ -3714,7 +3725,7 @@ func (st *ConfigState) GetStatusesPollMaxOptions() (v int) {
st.mutex.RLock()
v = st.config.StatusesPollMaxOptions
st.mutex.RUnlock()
- return v
+ return
}
// SetStatusesPollMaxOptions safely sets the Configuration value for state's 'StatusesPollMaxOptions' field
@@ -3736,7 +3747,7 @@ func (st *ConfigState) GetStatusesPollOptionMaxChars() (v int) {
st.mutex.RLock()
v = st.config.StatusesPollOptionMaxChars
st.mutex.RUnlock()
- return v
+ return
}
// SetStatusesPollOptionMaxChars safely sets the Configuration value for state's 'StatusesPollOptionMaxChars' field
@@ -3758,7 +3769,7 @@ func (st *ConfigState) GetStatusesMediaMaxFiles() (v int) {
st.mutex.RLock()
v = st.config.StatusesMediaMaxFiles
st.mutex.RUnlock()
- return v
+ return
}
// SetStatusesMediaMaxFiles safely sets the Configuration value for state's 'StatusesMediaMaxFiles' field
@@ -3780,7 +3791,7 @@ func (st *ConfigState) GetScheduledStatusesMaxTotal() (v int) {
st.mutex.RLock()
v = st.config.ScheduledStatusesMaxTotal
st.mutex.RUnlock()
- return v
+ return
}
// SetScheduledStatusesMaxTotal safely sets the Configuration value for state's 'ScheduledStatusesMaxTotal' field
@@ -3802,7 +3813,7 @@ func (st *ConfigState) GetScheduledStatusesMaxDaily() (v int) {
st.mutex.RLock()
v = st.config.ScheduledStatusesMaxDaily
st.mutex.RUnlock()
- return v
+ return
}
// SetScheduledStatusesMaxDaily safely sets the Configuration value for state's 'ScheduledStatusesMaxDaily' field
@@ -3824,7 +3835,7 @@ func (st *ConfigState) GetLetsEncryptEnabled() (v bool) {
st.mutex.RLock()
v = st.config.LetsEncryptEnabled
st.mutex.RUnlock()
- return v
+ return
}
// SetLetsEncryptEnabled safely sets the Configuration value for state's 'LetsEncryptEnabled' field
@@ -3846,7 +3857,7 @@ func (st *ConfigState) GetLetsEncryptPort() (v int) {
st.mutex.RLock()
v = st.config.LetsEncryptPort
st.mutex.RUnlock()
- return v
+ return
}
// SetLetsEncryptPort safely sets the Configuration value for state's 'LetsEncryptPort' field
@@ -3868,7 +3879,7 @@ func (st *ConfigState) GetLetsEncryptCertDir() (v string) {
st.mutex.RLock()
v = st.config.LetsEncryptCertDir
st.mutex.RUnlock()
- return v
+ return
}
// SetLetsEncryptCertDir safely sets the Configuration value for state's 'LetsEncryptCertDir' field
@@ -3890,7 +3901,7 @@ func (st *ConfigState) GetLetsEncryptEmailAddress() (v string) {
st.mutex.RLock()
v = st.config.LetsEncryptEmailAddress
st.mutex.RUnlock()
- return v
+ return
}
// SetLetsEncryptEmailAddress safely sets the Configuration value for state's 'LetsEncryptEmailAddress' field
@@ -3912,7 +3923,7 @@ func (st *ConfigState) GetTLSCertificateChain() (v string) {
st.mutex.RLock()
v = st.config.TLSCertificateChain
st.mutex.RUnlock()
- return v
+ return
}
// SetTLSCertificateChain safely sets the Configuration value for state's 'TLSCertificateChain' field
@@ -3934,7 +3945,7 @@ func (st *ConfigState) GetTLSCertificateKey() (v string) {
st.mutex.RLock()
v = st.config.TLSCertificateKey
st.mutex.RUnlock()
- return v
+ return
}
// SetTLSCertificateKey safely sets the Configuration value for state's 'TLSCertificateKey' field
@@ -3956,7 +3967,7 @@ func (st *ConfigState) GetOIDCEnabled() (v bool) {
st.mutex.RLock()
v = st.config.OIDCEnabled
st.mutex.RUnlock()
- return v
+ return
}
// SetOIDCEnabled safely sets the Configuration value for state's 'OIDCEnabled' field
@@ -3978,7 +3989,7 @@ func (st *ConfigState) GetOIDCIdpName() (v string) {
st.mutex.RLock()
v = st.config.OIDCIdpName
st.mutex.RUnlock()
- return v
+ return
}
// SetOIDCIdpName safely sets the Configuration value for state's 'OIDCIdpName' field
@@ -4000,7 +4011,7 @@ func (st *ConfigState) GetOIDCSkipVerification() (v bool) {
st.mutex.RLock()
v = st.config.OIDCSkipVerification
st.mutex.RUnlock()
- return v
+ return
}
// SetOIDCSkipVerification safely sets the Configuration value for state's 'OIDCSkipVerification' field
@@ -4022,7 +4033,7 @@ func (st *ConfigState) GetOIDCIssuer() (v string) {
st.mutex.RLock()
v = st.config.OIDCIssuer
st.mutex.RUnlock()
- return v
+ return
}
// SetOIDCIssuer safely sets the Configuration value for state's 'OIDCIssuer' field
@@ -4044,7 +4055,7 @@ func (st *ConfigState) GetOIDCClientID() (v string) {
st.mutex.RLock()
v = st.config.OIDCClientID
st.mutex.RUnlock()
- return v
+ return
}
// SetOIDCClientID safely sets the Configuration value for state's 'OIDCClientID' field
@@ -4066,7 +4077,7 @@ func (st *ConfigState) GetOIDCClientSecret() (v string) {
st.mutex.RLock()
v = st.config.OIDCClientSecret
st.mutex.RUnlock()
- return v
+ return
}
// SetOIDCClientSecret safely sets the Configuration value for state's 'OIDCClientSecret' field
@@ -4088,7 +4099,7 @@ func (st *ConfigState) GetOIDCScopes() (v []string) {
st.mutex.RLock()
v = st.config.OIDCScopes
st.mutex.RUnlock()
- return v
+ return
}
// SetOIDCScopes safely sets the Configuration value for state's 'OIDCScopes' field
@@ -4110,7 +4121,7 @@ func (st *ConfigState) GetOIDCLinkExisting() (v bool) {
st.mutex.RLock()
v = st.config.OIDCLinkExisting
st.mutex.RUnlock()
- return v
+ return
}
// SetOIDCLinkExisting safely sets the Configuration value for state's 'OIDCLinkExisting' field
@@ -4132,7 +4143,7 @@ func (st *ConfigState) GetOIDCAllowedGroups() (v []string) {
st.mutex.RLock()
v = st.config.OIDCAllowedGroups
st.mutex.RUnlock()
- return v
+ return
}
// SetOIDCAllowedGroups safely sets the Configuration value for state's 'OIDCAllowedGroups' field
@@ -4154,7 +4165,7 @@ func (st *ConfigState) GetOIDCAdminGroups() (v []string) {
st.mutex.RLock()
v = st.config.OIDCAdminGroups
st.mutex.RUnlock()
- return v
+ return
}
// SetOIDCAdminGroups safely sets the Configuration value for state's 'OIDCAdminGroups' field
@@ -4176,7 +4187,7 @@ func (st *ConfigState) GetTracingEnabled() (v bool) {
st.mutex.RLock()
v = st.config.TracingEnabled
st.mutex.RUnlock()
- return v
+ return
}
// SetTracingEnabled safely sets the Configuration value for state's 'TracingEnabled' field
@@ -4198,7 +4209,7 @@ func (st *ConfigState) GetMetricsEnabled() (v bool) {
st.mutex.RLock()
v = st.config.MetricsEnabled
st.mutex.RUnlock()
- return v
+ return
}
// SetMetricsEnabled safely sets the Configuration value for state's 'MetricsEnabled' field
@@ -4220,7 +4231,7 @@ func (st *ConfigState) GetSMTPHost() (v string) {
st.mutex.RLock()
v = st.config.SMTPHost
st.mutex.RUnlock()
- return v
+ return
}
// SetSMTPHost safely sets the Configuration value for state's 'SMTPHost' field
@@ -4242,7 +4253,7 @@ func (st *ConfigState) GetSMTPPort() (v int) {
st.mutex.RLock()
v = st.config.SMTPPort
st.mutex.RUnlock()
- return v
+ return
}
// SetSMTPPort safely sets the Configuration value for state's 'SMTPPort' field
@@ -4264,7 +4275,7 @@ func (st *ConfigState) GetSMTPUsername() (v string) {
st.mutex.RLock()
v = st.config.SMTPUsername
st.mutex.RUnlock()
- return v
+ return
}
// SetSMTPUsername safely sets the Configuration value for state's 'SMTPUsername' field
@@ -4286,7 +4297,7 @@ func (st *ConfigState) GetSMTPPassword() (v string) {
st.mutex.RLock()
v = st.config.SMTPPassword
st.mutex.RUnlock()
- return v
+ return
}
// SetSMTPPassword safely sets the Configuration value for state's 'SMTPPassword' field
@@ -4308,7 +4319,7 @@ func (st *ConfigState) GetSMTPFrom() (v string) {
st.mutex.RLock()
v = st.config.SMTPFrom
st.mutex.RUnlock()
- return v
+ return
}
// SetSMTPFrom safely sets the Configuration value for state's 'SMTPFrom' field
@@ -4330,7 +4341,7 @@ func (st *ConfigState) GetSMTPDiscloseRecipients() (v bool) {
st.mutex.RLock()
v = st.config.SMTPDiscloseRecipients
st.mutex.RUnlock()
- return v
+ return
}
// SetSMTPDiscloseRecipients safely sets the Configuration value for state's 'SMTPDiscloseRecipients' field
@@ -4352,7 +4363,7 @@ func (st *ConfigState) GetSyslogEnabled() (v bool) {
st.mutex.RLock()
v = st.config.SyslogEnabled
st.mutex.RUnlock()
- return v
+ return
}
// SetSyslogEnabled safely sets the Configuration value for state's 'SyslogEnabled' field
@@ -4374,7 +4385,7 @@ func (st *ConfigState) GetSyslogProtocol() (v string) {
st.mutex.RLock()
v = st.config.SyslogProtocol
st.mutex.RUnlock()
- return v
+ return
}
// SetSyslogProtocol safely sets the Configuration value for state's 'SyslogProtocol' field
@@ -4396,7 +4407,7 @@ func (st *ConfigState) GetSyslogAddress() (v string) {
st.mutex.RLock()
v = st.config.SyslogAddress
st.mutex.RUnlock()
- return v
+ return
}
// SetSyslogAddress safely sets the Configuration value for state's 'SyslogAddress' field
@@ -4418,7 +4429,7 @@ func (st *ConfigState) GetAdvancedCookiesSamesite() (v string) {
st.mutex.RLock()
v = st.config.Advanced.CookiesSamesite
st.mutex.RUnlock()
- return v
+ return
}
// SetAdvancedCookiesSamesite safely sets the Configuration value for state's 'Advanced.CookiesSamesite' field
@@ -4440,7 +4451,7 @@ func (st *ConfigState) GetAdvancedSenderMultiplier() (v int) {
st.mutex.RLock()
v = st.config.Advanced.SenderMultiplier
st.mutex.RUnlock()
- return v
+ return
}
// SetAdvancedSenderMultiplier safely sets the Configuration value for state's 'Advanced.SenderMultiplier' field
@@ -4462,7 +4473,7 @@ func (st *ConfigState) GetAdvancedCSPExtraURIs() (v []string) {
st.mutex.RLock()
v = st.config.Advanced.CSPExtraURIs
st.mutex.RUnlock()
- return v
+ return
}
// SetAdvancedCSPExtraURIs safely sets the Configuration value for state's 'Advanced.CSPExtraURIs' field
@@ -4484,7 +4495,7 @@ func (st *ConfigState) GetAdvancedHeaderFilterMode() (v string) {
st.mutex.RLock()
v = st.config.Advanced.HeaderFilterMode
st.mutex.RUnlock()
- return v
+ return
}
// SetAdvancedHeaderFilterMode safely sets the Configuration value for state's 'Advanced.HeaderFilterMode' field
@@ -4506,7 +4517,7 @@ func (st *ConfigState) GetAdvancedRateLimitRequests() (v int) {
st.mutex.RLock()
v = st.config.Advanced.RateLimit.Requests
st.mutex.RUnlock()
- return v
+ return
}
// SetAdvancedRateLimitRequests safely sets the Configuration value for state's 'Advanced.RateLimit.Requests' field
@@ -4528,7 +4539,7 @@ func (st *ConfigState) GetAdvancedRateLimitExceptions() (v IPPrefixes) {
st.mutex.RLock()
v = st.config.Advanced.RateLimit.Exceptions
st.mutex.RUnlock()
- return v
+ return
}
// SetAdvancedRateLimitExceptions safely sets the Configuration value for state's 'Advanced.RateLimit.Exceptions' field
@@ -4550,7 +4561,7 @@ func (st *ConfigState) GetAdvancedThrottlingMultiplier() (v int) {
st.mutex.RLock()
v = st.config.Advanced.Throttling.Multiplier
st.mutex.RUnlock()
- return v
+ return
}
// SetAdvancedThrottlingMultiplier safely sets the Configuration value for state's 'Advanced.Throttling.Multiplier' field
@@ -4572,7 +4583,7 @@ func (st *ConfigState) GetAdvancedThrottlingRetryAfter() (v time.Duration) {
st.mutex.RLock()
v = st.config.Advanced.Throttling.RetryAfter
st.mutex.RUnlock()
- return v
+ return
}
// SetAdvancedThrottlingRetryAfter safely sets the Configuration value for state's 'Advanced.Throttling.RetryAfter' field
@@ -4594,7 +4605,7 @@ func (st *ConfigState) GetHTTPClientAllowIPs() (v []string) {
st.mutex.RLock()
v = st.config.HTTPClient.AllowIPs
st.mutex.RUnlock()
- return v
+ return
}
// SetHTTPClientAllowIPs safely sets the Configuration value for state's 'HTTPClient.AllowIPs' field
@@ -4616,7 +4627,7 @@ func (st *ConfigState) GetHTTPClientBlockIPs() (v []string) {
st.mutex.RLock()
v = st.config.HTTPClient.BlockIPs
st.mutex.RUnlock()
- return v
+ return
}
// SetHTTPClientBlockIPs safely sets the Configuration value for state's 'HTTPClient.BlockIPs' field
@@ -4638,7 +4649,7 @@ func (st *ConfigState) GetHTTPClientTimeout() (v time.Duration) {
st.mutex.RLock()
v = st.config.HTTPClient.Timeout
st.mutex.RUnlock()
- return v
+ return
}
// SetHTTPClientTimeout safely sets the Configuration value for state's 'HTTPClient.Timeout' field
@@ -4660,7 +4671,7 @@ func (st *ConfigState) GetHTTPClientTLSInsecureSkipVerify() (v bool) {
st.mutex.RLock()
v = st.config.HTTPClient.TLSInsecureSkipVerify
st.mutex.RUnlock()
- return v
+ return
}
// SetHTTPClientTLSInsecureSkipVerify safely sets the Configuration value for state's 'HTTPClient.TLSInsecureSkipVerify' field
@@ -4682,7 +4693,7 @@ func (st *ConfigState) GetHTTPClientInsecureOutgoing() (v bool) {
st.mutex.RLock()
v = st.config.HTTPClient.InsecureOutgoing
st.mutex.RUnlock()
- return v
+ return
}
// SetHTTPClientInsecureOutgoing safely sets the Configuration value for state's 'HTTPClient.InsecureOutgoing' field
@@ -4704,7 +4715,7 @@ func (st *ConfigState) GetMediaDescriptionMinChars() (v int) {
st.mutex.RLock()
v = st.config.Media.DescriptionMinChars
st.mutex.RUnlock()
- return v
+ return
}
// SetMediaDescriptionMinChars safely sets the Configuration value for state's 'Media.DescriptionMinChars' field
@@ -4726,7 +4737,7 @@ func (st *ConfigState) GetMediaDescriptionMaxChars() (v int) {
st.mutex.RLock()
v = st.config.Media.DescriptionMaxChars
st.mutex.RUnlock()
- return v
+ return
}
// SetMediaDescriptionMaxChars safely sets the Configuration value for state's 'Media.DescriptionMaxChars' field
@@ -4748,7 +4759,7 @@ func (st *ConfigState) GetMediaRemoteCacheDays() (v int) {
st.mutex.RLock()
v = st.config.Media.RemoteCacheDays
st.mutex.RUnlock()
- return v
+ return
}
// SetMediaRemoteCacheDays safely sets the Configuration value for state's 'Media.RemoteCacheDays' field
@@ -4770,7 +4781,7 @@ func (st *ConfigState) GetMediaEmojiLocalMaxSize() (v bytesize.Size) {
st.mutex.RLock()
v = st.config.Media.EmojiLocalMaxSize
st.mutex.RUnlock()
- return v
+ return
}
// SetMediaEmojiLocalMaxSize safely sets the Configuration value for state's 'Media.EmojiLocalMaxSize' field
@@ -4792,7 +4803,7 @@ func (st *ConfigState) GetMediaEmojiRemoteMaxSize() (v bytesize.Size) {
st.mutex.RLock()
v = st.config.Media.EmojiRemoteMaxSize
st.mutex.RUnlock()
- return v
+ return
}
// SetMediaEmojiRemoteMaxSize safely sets the Configuration value for state's 'Media.EmojiRemoteMaxSize' field
@@ -4814,7 +4825,7 @@ func (st *ConfigState) GetMediaImageSizeHint() (v bytesize.Size) {
st.mutex.RLock()
v = st.config.Media.ImageSizeHint
st.mutex.RUnlock()
- return v
+ return
}
// SetMediaImageSizeHint safely sets the Configuration value for state's 'Media.ImageSizeHint' field
@@ -4836,7 +4847,7 @@ func (st *ConfigState) GetMediaVideoSizeHint() (v bytesize.Size) {
st.mutex.RLock()
v = st.config.Media.VideoSizeHint
st.mutex.RUnlock()
- return v
+ return
}
// SetMediaVideoSizeHint safely sets the Configuration value for state's 'Media.VideoSizeHint' field
@@ -4858,7 +4869,7 @@ func (st *ConfigState) GetMediaLocalMaxSize() (v bytesize.Size) {
st.mutex.RLock()
v = st.config.Media.LocalMaxSize
st.mutex.RUnlock()
- return v
+ return
}
// SetMediaLocalMaxSize safely sets the Configuration value for state's 'Media.LocalMaxSize' field
@@ -4880,7 +4891,7 @@ func (st *ConfigState) GetMediaRemoteMaxSize() (v bytesize.Size) {
st.mutex.RLock()
v = st.config.Media.RemoteMaxSize
st.mutex.RUnlock()
- return v
+ return
}
// SetMediaRemoteMaxSize safely sets the Configuration value for state's 'Media.RemoteMaxSize' field
@@ -4902,7 +4913,7 @@ func (st *ConfigState) GetMediaCleanupFrom() (v string) {
st.mutex.RLock()
v = st.config.Media.CleanupFrom
st.mutex.RUnlock()
- return v
+ return
}
// SetMediaCleanupFrom safely sets the Configuration value for state's 'Media.CleanupFrom' field
@@ -4924,7 +4935,7 @@ func (st *ConfigState) GetMediaCleanupEvery() (v time.Duration) {
st.mutex.RLock()
v = st.config.Media.CleanupEvery
st.mutex.RUnlock()
- return v
+ return
}
// SetMediaCleanupEvery safely sets the Configuration value for state's 'Media.CleanupEvery' field
@@ -4946,7 +4957,7 @@ func (st *ConfigState) GetMediaFfmpegPoolSize() (v int) {
st.mutex.RLock()
v = st.config.Media.FfmpegPoolSize
st.mutex.RUnlock()
- return v
+ return
}
// SetMediaFfmpegPoolSize safely sets the Configuration value for state's 'Media.FfmpegPoolSize' field
@@ -4968,7 +4979,7 @@ func (st *ConfigState) GetMediaThumbMaxPixels() (v int) {
st.mutex.RLock()
v = st.config.Media.ThumbMaxPixels
st.mutex.RUnlock()
- return v
+ return
}
// SetMediaThumbMaxPixels safely sets the Configuration value for state's 'Media.ThumbMaxPixels' field
@@ -4985,12 +4996,34 @@ func GetMediaThumbMaxPixels() int { return global.GetMediaThumbMaxPixels() }
// SetMediaThumbMaxPixels safely sets the value for global configuration 'Media.ThumbMaxPixels' field
func SetMediaThumbMaxPixels(v int) { global.SetMediaThumbMaxPixels(v) }
+// GetCacheS3ObjectInfo safely fetches the Configuration value for state's 'Cache.S3ObjectInfo' field
+func (st *ConfigState) GetCacheS3ObjectInfo() (v int) {
+ st.mutex.RLock()
+ v = st.config.Cache.S3ObjectInfo
+ st.mutex.RUnlock()
+ return
+}
+
+// SetCacheS3ObjectInfo safely sets the Configuration value for state's 'Cache.S3ObjectInfo' field
+func (st *ConfigState) SetCacheS3ObjectInfo(v int) {
+ st.mutex.Lock()
+ defer st.mutex.Unlock()
+ st.config.Cache.S3ObjectInfo = v
+ st.reloadToViper()
+}
+
+// GetCacheS3ObjectInfo safely fetches the value for global configuration 'Cache.S3ObjectInfo' field
+func GetCacheS3ObjectInfo() int { return global.GetCacheS3ObjectInfo() }
+
+// SetCacheS3ObjectInfo safely sets the value for global configuration 'Cache.S3ObjectInfo' field
+func SetCacheS3ObjectInfo(v int) { global.SetCacheS3ObjectInfo(v) }
+
// GetCacheMemoryTarget safely fetches the Configuration value for state's 'Cache.MemoryTarget' field
func (st *ConfigState) GetCacheMemoryTarget() (v bytesize.Size) {
st.mutex.RLock()
v = st.config.Cache.MemoryTarget
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheMemoryTarget safely sets the Configuration value for state's 'Cache.MemoryTarget' field
@@ -5012,7 +5045,7 @@ func (st *ConfigState) GetCacheAccountMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.AccountMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheAccountMemRatio safely sets the Configuration value for state's 'Cache.AccountMemRatio' field
@@ -5034,7 +5067,7 @@ func (st *ConfigState) GetCacheAccountNoteMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.AccountNoteMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheAccountNoteMemRatio safely sets the Configuration value for state's 'Cache.AccountNoteMemRatio' field
@@ -5056,7 +5089,7 @@ func (st *ConfigState) GetCacheAccountSettingsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.AccountSettingsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheAccountSettingsMemRatio safely sets the Configuration value for state's 'Cache.AccountSettingsMemRatio' field
@@ -5078,7 +5111,7 @@ func (st *ConfigState) GetCacheAccountStatsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.AccountStatsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheAccountStatsMemRatio safely sets the Configuration value for state's 'Cache.AccountStatsMemRatio' field
@@ -5100,7 +5133,7 @@ func (st *ConfigState) GetCacheApplicationMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.ApplicationMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheApplicationMemRatio safely sets the Configuration value for state's 'Cache.ApplicationMemRatio' field
@@ -5122,7 +5155,7 @@ func (st *ConfigState) GetCacheBlockMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.BlockMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheBlockMemRatio safely sets the Configuration value for state's 'Cache.BlockMemRatio' field
@@ -5144,7 +5177,7 @@ func (st *ConfigState) GetCacheBlockIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.BlockIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheBlockIDsMemRatio safely sets the Configuration value for state's 'Cache.BlockIDsMemRatio' field
@@ -5166,7 +5199,7 @@ func (st *ConfigState) GetCacheBoostOfIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.BoostOfIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheBoostOfIDsMemRatio safely sets the Configuration value for state's 'Cache.BoostOfIDsMemRatio' field
@@ -5188,7 +5221,7 @@ func (st *ConfigState) GetCacheClientMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.ClientMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheClientMemRatio safely sets the Configuration value for state's 'Cache.ClientMemRatio' field
@@ -5210,7 +5243,7 @@ func (st *ConfigState) GetCacheConversationMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.ConversationMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheConversationMemRatio safely sets the Configuration value for state's 'Cache.ConversationMemRatio' field
@@ -5232,7 +5265,7 @@ func (st *ConfigState) GetCacheConversationLastStatusIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.ConversationLastStatusIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheConversationLastStatusIDsMemRatio safely sets the Configuration value for state's 'Cache.ConversationLastStatusIDsMemRatio' field
@@ -5258,7 +5291,7 @@ func (st *ConfigState) GetCacheDomainPermissionDraftMemRation() (v float64) {
st.mutex.RLock()
v = st.config.Cache.DomainPermissionDraftMemRation
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheDomainPermissionDraftMemRation safely sets the Configuration value for state's 'Cache.DomainPermissionDraftMemRation' field
@@ -5284,7 +5317,7 @@ func (st *ConfigState) GetCacheDomainPermissionSubscriptionMemRation() (v float6
st.mutex.RLock()
v = st.config.Cache.DomainPermissionSubscriptionMemRation
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheDomainPermissionSubscriptionMemRation safely sets the Configuration value for state's 'Cache.DomainPermissionSubscriptionMemRation' field
@@ -5310,7 +5343,7 @@ func (st *ConfigState) GetCacheEmojiMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.EmojiMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheEmojiMemRatio safely sets the Configuration value for state's 'Cache.EmojiMemRatio' field
@@ -5332,7 +5365,7 @@ func (st *ConfigState) GetCacheEmojiCategoryMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.EmojiCategoryMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheEmojiCategoryMemRatio safely sets the Configuration value for state's 'Cache.EmojiCategoryMemRatio' field
@@ -5354,7 +5387,7 @@ func (st *ConfigState) GetCacheFilterMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.FilterMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheFilterMemRatio safely sets the Configuration value for state's 'Cache.FilterMemRatio' field
@@ -5376,7 +5409,7 @@ func (st *ConfigState) GetCacheFilterIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.FilterIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheFilterIDsMemRatio safely sets the Configuration value for state's 'Cache.FilterIDsMemRatio' field
@@ -5398,7 +5431,7 @@ func (st *ConfigState) GetCacheFilterKeywordMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.FilterKeywordMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheFilterKeywordMemRatio safely sets the Configuration value for state's 'Cache.FilterKeywordMemRatio' field
@@ -5420,7 +5453,7 @@ func (st *ConfigState) GetCacheFilterStatusMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.FilterStatusMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheFilterStatusMemRatio safely sets the Configuration value for state's 'Cache.FilterStatusMemRatio' field
@@ -5442,7 +5475,7 @@ func (st *ConfigState) GetCacheFollowMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.FollowMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheFollowMemRatio safely sets the Configuration value for state's 'Cache.FollowMemRatio' field
@@ -5464,7 +5497,7 @@ func (st *ConfigState) GetCacheFollowIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.FollowIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheFollowIDsMemRatio safely sets the Configuration value for state's 'Cache.FollowIDsMemRatio' field
@@ -5486,7 +5519,7 @@ func (st *ConfigState) GetCacheFollowRequestMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.FollowRequestMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheFollowRequestMemRatio safely sets the Configuration value for state's 'Cache.FollowRequestMemRatio' field
@@ -5508,7 +5541,7 @@ func (st *ConfigState) GetCacheFollowRequestIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.FollowRequestIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheFollowRequestIDsMemRatio safely sets the Configuration value for state's 'Cache.FollowRequestIDsMemRatio' field
@@ -5530,7 +5563,7 @@ func (st *ConfigState) GetCacheFollowingTagIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.FollowingTagIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheFollowingTagIDsMemRatio safely sets the Configuration value for state's 'Cache.FollowingTagIDsMemRatio' field
@@ -5552,7 +5585,7 @@ func (st *ConfigState) GetCacheHomeAccountIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.HomeAccountIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheHomeAccountIDsMemRatio safely sets the Configuration value for state's 'Cache.HomeAccountIDsMemRatio' field
@@ -5574,7 +5607,7 @@ func (st *ConfigState) GetCacheInReplyToIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.InReplyToIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheInReplyToIDsMemRatio safely sets the Configuration value for state's 'Cache.InReplyToIDsMemRatio' field
@@ -5596,7 +5629,7 @@ func (st *ConfigState) GetCacheInstanceMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.InstanceMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheInstanceMemRatio safely sets the Configuration value for state's 'Cache.InstanceMemRatio' field
@@ -5618,7 +5651,7 @@ func (st *ConfigState) GetCacheInteractionRequestMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.InteractionRequestMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheInteractionRequestMemRatio safely sets the Configuration value for state's 'Cache.InteractionRequestMemRatio' field
@@ -5640,7 +5673,7 @@ func (st *ConfigState) GetCacheListMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.ListMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheListMemRatio safely sets the Configuration value for state's 'Cache.ListMemRatio' field
@@ -5662,7 +5695,7 @@ func (st *ConfigState) GetCacheListIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.ListIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheListIDsMemRatio safely sets the Configuration value for state's 'Cache.ListIDsMemRatio' field
@@ -5684,7 +5717,7 @@ func (st *ConfigState) GetCacheListedIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.ListedIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheListedIDsMemRatio safely sets the Configuration value for state's 'Cache.ListedIDsMemRatio' field
@@ -5706,7 +5739,7 @@ func (st *ConfigState) GetCacheMarkerMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.MarkerMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheMarkerMemRatio safely sets the Configuration value for state's 'Cache.MarkerMemRatio' field
@@ -5728,7 +5761,7 @@ func (st *ConfigState) GetCacheMediaMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.MediaMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheMediaMemRatio safely sets the Configuration value for state's 'Cache.MediaMemRatio' field
@@ -5750,7 +5783,7 @@ func (st *ConfigState) GetCacheMentionMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.MentionMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheMentionMemRatio safely sets the Configuration value for state's 'Cache.MentionMemRatio' field
@@ -5772,7 +5805,7 @@ func (st *ConfigState) GetCacheMoveMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.MoveMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheMoveMemRatio safely sets the Configuration value for state's 'Cache.MoveMemRatio' field
@@ -5794,7 +5827,7 @@ func (st *ConfigState) GetCacheNotificationMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.NotificationMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheNotificationMemRatio safely sets the Configuration value for state's 'Cache.NotificationMemRatio' field
@@ -5816,7 +5849,7 @@ func (st *ConfigState) GetCachePollMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.PollMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCachePollMemRatio safely sets the Configuration value for state's 'Cache.PollMemRatio' field
@@ -5838,7 +5871,7 @@ func (st *ConfigState) GetCachePollVoteMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.PollVoteMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCachePollVoteMemRatio safely sets the Configuration value for state's 'Cache.PollVoteMemRatio' field
@@ -5860,7 +5893,7 @@ func (st *ConfigState) GetCachePollVoteIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.PollVoteIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCachePollVoteIDsMemRatio safely sets the Configuration value for state's 'Cache.PollVoteIDsMemRatio' field
@@ -5882,7 +5915,7 @@ func (st *ConfigState) GetCacheReportMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.ReportMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheReportMemRatio safely sets the Configuration value for state's 'Cache.ReportMemRatio' field
@@ -5904,7 +5937,7 @@ func (st *ConfigState) GetCacheScheduledStatusMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.ScheduledStatusMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheScheduledStatusMemRatio safely sets the Configuration value for state's 'Cache.ScheduledStatusMemRatio' field
@@ -5926,7 +5959,7 @@ func (st *ConfigState) GetCacheSinBinStatusMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.SinBinStatusMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheSinBinStatusMemRatio safely sets the Configuration value for state's 'Cache.SinBinStatusMemRatio' field
@@ -5948,7 +5981,7 @@ func (st *ConfigState) GetCacheStatusMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.StatusMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheStatusMemRatio safely sets the Configuration value for state's 'Cache.StatusMemRatio' field
@@ -5970,7 +6003,7 @@ func (st *ConfigState) GetCacheStatusBookmarkMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.StatusBookmarkMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheStatusBookmarkMemRatio safely sets the Configuration value for state's 'Cache.StatusBookmarkMemRatio' field
@@ -5992,7 +6025,7 @@ func (st *ConfigState) GetCacheStatusBookmarkIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.StatusBookmarkIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheStatusBookmarkIDsMemRatio safely sets the Configuration value for state's 'Cache.StatusBookmarkIDsMemRatio' field
@@ -6014,7 +6047,7 @@ func (st *ConfigState) GetCacheStatusEditMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.StatusEditMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheStatusEditMemRatio safely sets the Configuration value for state's 'Cache.StatusEditMemRatio' field
@@ -6036,7 +6069,7 @@ func (st *ConfigState) GetCacheStatusFaveMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.StatusFaveMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheStatusFaveMemRatio safely sets the Configuration value for state's 'Cache.StatusFaveMemRatio' field
@@ -6058,7 +6091,7 @@ func (st *ConfigState) GetCacheStatusFaveIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.StatusFaveIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheStatusFaveIDsMemRatio safely sets the Configuration value for state's 'Cache.StatusFaveIDsMemRatio' field
@@ -6080,7 +6113,7 @@ func (st *ConfigState) GetCacheTagMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.TagMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheTagMemRatio safely sets the Configuration value for state's 'Cache.TagMemRatio' field
@@ -6102,7 +6135,7 @@ func (st *ConfigState) GetCacheThreadMuteMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.ThreadMuteMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheThreadMuteMemRatio safely sets the Configuration value for state's 'Cache.ThreadMuteMemRatio' field
@@ -6124,7 +6157,7 @@ func (st *ConfigState) GetCacheTokenMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.TokenMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheTokenMemRatio safely sets the Configuration value for state's 'Cache.TokenMemRatio' field
@@ -6146,7 +6179,7 @@ func (st *ConfigState) GetCacheTombstoneMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.TombstoneMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheTombstoneMemRatio safely sets the Configuration value for state's 'Cache.TombstoneMemRatio' field
@@ -6168,7 +6201,7 @@ func (st *ConfigState) GetCacheUserMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.UserMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheUserMemRatio safely sets the Configuration value for state's 'Cache.UserMemRatio' field
@@ -6190,7 +6223,7 @@ func (st *ConfigState) GetCacheUserMuteMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.UserMuteMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheUserMuteMemRatio safely sets the Configuration value for state's 'Cache.UserMuteMemRatio' field
@@ -6212,7 +6245,7 @@ func (st *ConfigState) GetCacheUserMuteIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.UserMuteIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheUserMuteIDsMemRatio safely sets the Configuration value for state's 'Cache.UserMuteIDsMemRatio' field
@@ -6234,7 +6267,7 @@ func (st *ConfigState) GetCacheWebfingerMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.WebfingerMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheWebfingerMemRatio safely sets the Configuration value for state's 'Cache.WebfingerMemRatio' field
@@ -6256,7 +6289,7 @@ func (st *ConfigState) GetCacheWebPushSubscriptionMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.WebPushSubscriptionMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheWebPushSubscriptionMemRatio safely sets the Configuration value for state's 'Cache.WebPushSubscriptionMemRatio' field
@@ -6280,7 +6313,7 @@ func (st *ConfigState) GetCacheWebPushSubscriptionIDsMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.WebPushSubscriptionIDsMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheWebPushSubscriptionIDsMemRatio safely sets the Configuration value for state's 'Cache.WebPushSubscriptionIDsMemRatio' field
@@ -6306,7 +6339,7 @@ func (st *ConfigState) GetCacheMutesMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.MutesMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheMutesMemRatio safely sets the Configuration value for state's 'Cache.MutesMemRatio' field
@@ -6328,7 +6361,7 @@ func (st *ConfigState) GetCacheStatusFilterMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.StatusFilterMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheStatusFilterMemRatio safely sets the Configuration value for state's 'Cache.StatusFilterMemRatio' field
@@ -6350,7 +6383,7 @@ func (st *ConfigState) GetCacheVisibilityMemRatio() (v float64) {
st.mutex.RLock()
v = st.config.Cache.VisibilityMemRatio
st.mutex.RUnlock()
- return v
+ return
}
// SetCacheVisibilityMemRatio safely sets the Configuration value for state's 'Cache.VisibilityMemRatio' field
@@ -6372,7 +6405,7 @@ func (st *ConfigState) GetAdminAccountUsername() (v string) {
st.mutex.RLock()
v = st.config.AdminAccountUsername
st.mutex.RUnlock()
- return v
+ return
}
// SetAdminAccountUsername safely sets the Configuration value for state's 'AdminAccountUsername' field
@@ -6394,7 +6427,7 @@ func (st *ConfigState) GetAdminAccountEmail() (v string) {
st.mutex.RLock()
v = st.config.AdminAccountEmail
st.mutex.RUnlock()
- return v
+ return
}
// SetAdminAccountEmail safely sets the Configuration value for state's 'AdminAccountEmail' field
@@ -6416,7 +6449,7 @@ func (st *ConfigState) GetAdminAccountPassword() (v string) {
st.mutex.RLock()
v = st.config.AdminAccountPassword
st.mutex.RUnlock()
- return v
+ return
}
// SetAdminAccountPassword safely sets the Configuration value for state's 'AdminAccountPassword' field
@@ -6438,7 +6471,7 @@ func (st *ConfigState) GetAdminTransPath() (v string) {
st.mutex.RLock()
v = st.config.AdminTransPath
st.mutex.RUnlock()
- return v
+ return
}
// SetAdminTransPath safely sets the Configuration value for state's 'AdminTransPath' field
@@ -6460,7 +6493,7 @@ func (st *ConfigState) GetAdminMediaPruneDryRun() (v bool) {
st.mutex.RLock()
v = st.config.AdminMediaPruneDryRun
st.mutex.RUnlock()
- return v
+ return
}
// SetAdminMediaPruneDryRun safely sets the Configuration value for state's 'AdminMediaPruneDryRun' field
@@ -6482,7 +6515,7 @@ func (st *ConfigState) GetAdminMediaListLocalOnly() (v bool) {
st.mutex.RLock()
v = st.config.AdminMediaListLocalOnly
st.mutex.RUnlock()
- return v
+ return
}
// SetAdminMediaListLocalOnly safely sets the Configuration value for state's 'AdminMediaListLocalOnly' field
@@ -6504,7 +6537,7 @@ func (st *ConfigState) GetAdminMediaListRemoteOnly() (v bool) {
st.mutex.RLock()
v = st.config.AdminMediaListRemoteOnly
st.mutex.RUnlock()
- return v
+ return
}
// SetAdminMediaListRemoteOnly safely sets the Configuration value for state's 'AdminMediaListRemoteOnly' field
@@ -6526,7 +6559,7 @@ func (st *ConfigState) GetTestrigSkipDBSetup() (v bool) {
st.mutex.RLock()
v = st.config.TestrigSkipDBSetup
st.mutex.RUnlock()
- return v
+ return
}
// SetTestrigSkipDBSetup safely sets the Configuration value for state's 'TestrigSkipDBSetup' field
@@ -6548,7 +6581,7 @@ func (st *ConfigState) GetTestrigSkipDBTeardown() (v bool) {
st.mutex.RLock()
v = st.config.TestrigSkipDBTeardown
st.mutex.RUnlock()
- return v
+ return
}
// SetTestrigSkipDBTeardown safely sets the Configuration value for state's 'TestrigSkipDBTeardown' field
@@ -6630,7 +6663,7 @@ func (st *ConfigState) GetTotalOfMemRatios() (total float64) {
total += st.config.Cache.StatusFilterMemRatio
total += st.config.Cache.VisibilityMemRatio
st.mutex.RUnlock()
- return total
+ return
}
// GetTotalOfMemRatios safely fetches the combined value for all the global state's mem ratio fields
@@ -6929,6 +6962,17 @@ func flattenConfigMap(cfgmap map[string]any) {
}
for _, key := range [][]string{
+ {"cache", "s3-object-info"},
+ } {
+ ival, ok := mapGet(cfgmap, key...)
+ if ok {
+ cfgmap["cache-s3-object-info"] = ival
+ nestedKeys[key[0]] = struct{}{}
+ break
+ }
+ }
+
+ for _, key := range [][]string{
{"cache", "memory-target"},
} {
ival, ok := mapGet(cfgmap, key...)
diff --git a/internal/storage/storage.go b/internal/storage/storage.go
index 2c47017b3..c513edafd 100644
--- a/internal/storage/storage.go
+++ b/internal/storage/storage.go
@@ -34,6 +34,7 @@ import (
"codeberg.org/gruf/go-cache/v3/ttl"
"codeberg.org/gruf/go-storage"
"codeberg.org/gruf/go-storage/s3"
+ s3cache "codeberg.org/gruf/go-storage/s3/cache"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
)
@@ -240,7 +241,14 @@ func NewS3Storage() (*Driver, error) {
bucketLookup = minio.BucketLookupAuto
}
- // Open the s3 storage implementation
+ var objCache s3.EntryCache
+
+ // Check if an S3 object info cache was requested.
+ if cap := config.GetCacheS3ObjectInfo(); cap > 0 {
+ objCache = s3cache.New(0, cap)
+ }
+
+ // Open the s3 storage backend with configuration.
s3, err := s3.Open(endpoint, bucket, &s3.Config{
KeyPrefix: config.GetStorageS3KeyPrefix(),
CoreOpts: minio.Options{
@@ -250,6 +258,7 @@ func NewS3Storage() (*Driver, error) {
},
PutChunkSize: 5 * 1024 * 1024, // 5MiB
ListSize: 200,
+ Cache: objCache,
})
if err != nil {
return nil, fmt.Errorf("error opening s3 storage: %w", err)
diff --git a/test/envparsing.sh b/test/envparsing.sh
index 206da0d07..e71a87cdc 100755
--- a/test/envparsing.sh
+++ b/test/envparsing.sh
@@ -67,6 +67,7 @@ EXPECT=$(cat << "EOF"
"cache-poll-vote-ids-mem-ratio": 2,
"cache-poll-vote-mem-ratio": 2,
"cache-report-mem-ratio": 1,
+ "cache-s3-object-info": 0,
"cache-scheduled-status-mem-ratio": 4,
"cache-sin-bin-status-mem-ratio": 0.5,
"cache-status-bookmark-ids-mem-ratio": 2,
diff --git a/vendor/codeberg.org/gruf/go-fastpath/v2/path.go b/vendor/codeberg.org/gruf/go-fastpath/v2/path.go
index 42cbfd4f7..91ebb5b36 100644
--- a/vendor/codeberg.org/gruf/go-fastpath/v2/path.go
+++ b/vendor/codeberg.org/gruf/go-fastpath/v2/path.go
@@ -33,12 +33,14 @@ func (b *Builder) Reset() {
b.set = false
}
-// Len returns the number of accumulated bytes in the Builder
+// Len returns the number of
+// accumulated bytes in the Builder.
func (b Builder) Len() int {
return len(b.B)
}
-// Cap returns the capacity of the underlying Builder buffer
+// Cap returns the capacity of
+// the underlying Builder buffer.
func (b Builder) Cap() int {
return cap(b.B)
}
@@ -50,7 +52,7 @@ func (b Builder) Bytes() []byte {
// String returns the accumulated path string.
func (b Builder) String() string {
- return *(*string)(unsafe.Pointer(&b.B))
+ return unsafe.String(unsafe.SliceData(b.B), len(b.B))
}
// Absolute returns whether current path is absolute (not relative).
@@ -139,7 +141,7 @@ func (b *Builder) AppendBytes(path []byte) {
return
}
b.Guarantee(len(path) + 1)
- b.append(*(*string)(unsafe.Pointer(&b)))
+ b.append(unsafe.String(unsafe.SliceData(path), len(path)))
}
// Append adds and cleans the supplied path string to the
diff --git a/vendor/codeberg.org/gruf/go-storage/s3/cache.go b/vendor/codeberg.org/gruf/go-storage/s3/cache.go
new file mode 100644
index 000000000..37ff9f321
--- /dev/null
+++ b/vendor/codeberg.org/gruf/go-storage/s3/cache.go
@@ -0,0 +1,94 @@
+package s3
+
+import (
+ "time"
+
+ "github.com/minio/minio-go/v7"
+)
+
+// EntryCache should provide a cache of
+// S3 object information for speeding up
+// Get(), Stat() and Remove() operations.
+type EntryCache interface {
+
+ // Get should return 'found' = true when information is cached,
+ // with 'info' optionally being nilable to allow caching errors.
+ Get(key string) (info *CachedObjectInfo, found bool)
+
+ // Put should cache the given information under key, with
+ // nil CachedObjectInfo{} meaning a 'not found' response.
+ Put(key string, info *CachedObjectInfo)
+}
+
+// CachedObjectInfo provides the minimum cacheable
+// set of S3 object information that may be returned
+// from a Get() or Stat() operation, or on Put().
+type CachedObjectInfo struct {
+ Key string
+ ETag string
+ Size int64
+ ContentType string
+ LastModified time.Time
+ VersionID string
+}
+
+// ToObjectInfo converts CachedObjectInfo to returnable minio.ObjectInfo.
+func (info *CachedObjectInfo) ToObjectInfo() minio.ObjectInfo {
+ return minio.ObjectInfo{
+ Key: info.Key,
+ ETag: info.ETag,
+ Size: info.Size,
+ ContentType: info.ContentType,
+ LastModified: info.LastModified,
+ VersionID: info.VersionID,
+ }
+}
+
+// cacheGet wraps cache.Get() operations to check if cache is nil.
+func cacheGet(cache EntryCache, key string) (*CachedObjectInfo, bool) {
+ if cache != nil {
+ return cache.Get(key)
+ }
+ return nil, false
+}
+
+// objectToCachedObjectInfo converts minio.ObjectInfo to CachedObjectInfo for caching.
+func objectToCachedObjectInfo(info minio.ObjectInfo) *CachedObjectInfo {
+ return &CachedObjectInfo{
+ Key: info.Key,
+ ETag: info.ETag,
+ Size: info.Size,
+ ContentType: info.ContentType,
+ LastModified: info.LastModified,
+ VersionID: info.VersionID,
+ }
+}
+
+// cacheObject wraps cache.Put() operations to check if cache is nil.
+func cacheObject(cache EntryCache, key string, info minio.ObjectInfo) {
+ if cache != nil {
+ cache.Put(key, objectToCachedObjectInfo(info))
+ }
+}
+
+// cacheUpload wraps cache.Put() operations to check if cache is nil, uses ContentType from given opts.
+func cacheUpload(cache EntryCache, key string, info minio.UploadInfo, opts minio.PutObjectOptions) {
+ if cache != nil {
+ cache.Put(key, &CachedObjectInfo{
+ Key: info.Key,
+ ETag: info.ETag,
+ Size: info.Size,
+ ContentType: opts.ContentType,
+ LastModified: info.LastModified,
+ VersionID: info.VersionID,
+ })
+ }
+}
+
+// cacheNotFound wraps cache.Put() to check if cache is
+// nil, storing a nil entry (i.e. not found) in cache.
+func cacheNotFound(cache EntryCache, key string) {
+ if cache != nil {
+ cache.Put(key, nil)
+ }
+}
diff --git a/vendor/codeberg.org/gruf/go-storage/s3/cache/cache.go b/vendor/codeberg.org/gruf/go-storage/s3/cache/cache.go
new file mode 100644
index 000000000..ce8aeb63b
--- /dev/null
+++ b/vendor/codeberg.org/gruf/go-storage/s3/cache/cache.go
@@ -0,0 +1,44 @@
+package cache
+
+import (
+ "time"
+
+ "codeberg.org/gruf/go-cache/v3/simple"
+ "codeberg.org/gruf/go-cache/v3/ttl"
+ "codeberg.org/gruf/go-storage/s3"
+)
+
+// check interface conformity.
+var _ s3.EntryCache = &EntryCache{}
+var _ s3.EntryCache = &EntryTTLCache{}
+
+// EntryCache provides a basic implementation
+// of an s3.EntryCache{}. Under the hood it is
+// a mutex locked ordered map with max capacity.
+type EntryCache struct {
+ simple.Cache[string, *s3.CachedObjectInfo]
+}
+
+func New(len, cap int) *EntryCache {
+ var cache EntryCache
+ cache.Init(len, cap)
+ return &cache
+}
+
+func (c *EntryCache) Put(key string, info *s3.CachedObjectInfo) {
+ c.Cache.Set(key, info)
+}
+
+type EntryTTLCache struct {
+ ttl.Cache[string, *s3.CachedObjectInfo]
+}
+
+func NewTTL(len, cap int, ttl time.Duration) *EntryTTLCache {
+ var cache EntryTTLCache
+ cache.Init(len, cap, ttl)
+ return &cache
+}
+
+func (c *EntryTTLCache) Put(key string, info *s3.CachedObjectInfo) {
+ c.Cache.Set(key, info)
+}
diff --git a/vendor/codeberg.org/gruf/go-storage/s3/errors.go b/vendor/codeberg.org/gruf/go-storage/s3/errors.go
index 1f4404469..0b2d3be62 100644
--- a/vendor/codeberg.org/gruf/go-storage/s3/errors.go
+++ b/vendor/codeberg.org/gruf/go-storage/s3/errors.go
@@ -3,9 +3,35 @@ package s3
import (
"strings"
+ "codeberg.org/gruf/go-storage"
+ "codeberg.org/gruf/go-storage/internal"
"github.com/minio/minio-go/v7"
)
+// CachedErrorResponse can be returned
+// when an S3 is configured with caching,
+// and the basic details of an error
+// response have been stored in the cache.
+type CachedErrorResponse struct {
+ Code string
+ Key string
+}
+
+func (err *CachedErrorResponse) Error() string {
+ return "cached '" + err.Code + "' response for key:" + err.Key
+}
+
+func (err *CachedErrorResponse) Is(other error) bool {
+ switch other {
+ case storage.ErrNotFound:
+ return err.Code == "NoSuchKey"
+ case storage.ErrAlreadyExists:
+ return err.Code == "Conflict"
+ default:
+ return false
+ }
+}
+
func isNotFoundError(err error) bool {
errRsp, ok := err.(minio.ErrorResponse)
return ok && errRsp.Code == "NoSuchKey"
@@ -19,3 +45,8 @@ func isConflictError(err error) bool {
func isObjectNameError(err error) bool {
return strings.HasPrefix(err.Error(), "Object name ")
}
+
+func cachedNotFoundError(key string) error {
+ err := CachedErrorResponse{Code: "NoSuchKey", Key: key}
+ return internal.WrapErr(&err, storage.ErrNotFound)
+}
diff --git a/vendor/codeberg.org/gruf/go-storage/s3/s3.go b/vendor/codeberg.org/gruf/go-storage/s3/s3.go
index c53560161..bf7eff02f 100644
--- a/vendor/codeberg.org/gruf/go-storage/s3/s3.go
+++ b/vendor/codeberg.org/gruf/go-storage/s3/s3.go
@@ -64,6 +64,11 @@ type Config struct {
// to include in each list request, made
// during calls to .WalkKeys().
ListSize int
+
+ // Cache is an optional type that may be
+ // provided to store simple entry information
+ // to speed up Get() / Stat() operations.
+ Cache EntryCache
}
// getS3Config returns valid (and owned!) Config for given ptr.
@@ -91,6 +96,7 @@ func getS3Config(cfg *Config) Config {
CoreOpts: cfg.CoreOpts,
PutChunkSize: cfg.PutChunkSize,
ListSize: cfg.ListSize,
+ Cache: cfg.Cache,
}
}
@@ -181,6 +187,15 @@ func (st *S3Storage) GetObject(ctx context.Context, key string, opts minio.GetOb
// Update given key with prefix.
key = st.config.KeyPrefix + key
+ // Check cache for possible known response.
+ cinfo, ok := cacheGet(st.config.Cache, key)
+ switch {
+ case !ok:
+ break
+ case cinfo == nil:
+ return nil, minio.ObjectInfo{}, nil, cachedNotFoundError(key)
+ }
+
// Query bucket for object data and info.
rc, info, hdr, err := st.client.GetObject(
ctx,
@@ -191,6 +206,9 @@ func (st *S3Storage) GetObject(ctx context.Context, key string, opts minio.GetOb
if err != nil {
if isNotFoundError(err) {
+ // On 'not found', cache this resp.
+ cacheNotFound(st.config.Cache, key)
+
// Wrap not found errors as our not found type.
err = internal.WrapErr(err, storage.ErrNotFound)
} else if isObjectNameError(err) {
@@ -198,6 +216,10 @@ func (st *S3Storage) GetObject(ctx context.Context, key string, opts minio.GetOb
err = internal.WrapErr(err, storage.ErrInvalidKey)
}
+ } else {
+
+ // On success, cache fetched obj info.
+ cacheObject(st.config.Cache, key, info)
}
return rc, info, hdr, err
@@ -246,6 +268,10 @@ func (st *S3Storage) PutObject(ctx context.Context, key string, r io.Reader, opt
err = internal.WrapErr(err, storage.ErrInvalidKey)
}
+ } else {
+
+ // On success, cache uploaded object info.
+ cacheUpload(st.config.Cache, key, info, opts)
}
return info, err
@@ -360,6 +386,10 @@ loop:
// Set correct size.
info.Size = total
+
+ // On success, cache uploaded object info.
+ cacheUpload(st.config.Cache, key, info, opts)
+
return info, nil
}
@@ -384,6 +414,17 @@ func (st *S3Storage) StatObject(ctx context.Context, key string, opts minio.Stat
// Update given key with prefix.
key = st.config.KeyPrefix + key
+ // Check cache for possible known response.
+ cinfo, ok := cacheGet(st.config.Cache, key)
+ switch {
+ case !ok:
+ break
+ case cinfo == nil:
+ return minio.ObjectInfo{}, cachedNotFoundError(key)
+ default:
+ return cinfo.ToObjectInfo(), nil
+ }
+
// Query bucket for object info.
info, err := st.client.StatObject(
ctx,
@@ -394,6 +435,9 @@ func (st *S3Storage) StatObject(ctx context.Context, key string, opts minio.Stat
if err != nil {
if isNotFoundError(err) {
+ // On 'not found', cache this resp.
+ cacheNotFound(st.config.Cache, key)
+
// Wrap not found errors as our not found type.
err = internal.WrapErr(err, storage.ErrNotFound)
} else if isObjectNameError(err) {
@@ -401,6 +445,10 @@ func (st *S3Storage) StatObject(ctx context.Context, key string, opts minio.Stat
err = internal.WrapErr(err, storage.ErrInvalidKey)
}
+ } else {
+
+ // On success, cache fetchedd obj info.
+ cacheObject(st.config.Cache, key, info)
}
return info, err
@@ -421,6 +469,15 @@ func (st *S3Storage) RemoveObject(ctx context.Context, key string, opts minio.Re
// Update given key with prefix.
key = st.config.KeyPrefix + key
+ // Check cache for possible known response.
+ cinfo, ok := cacheGet(st.config.Cache, key)
+ switch {
+ case !ok:
+ break
+ case cinfo == nil:
+ return cachedNotFoundError(key)
+ }
+
// Remove object from S3 bucket
err := st.client.RemoveObject(
ctx,
@@ -432,6 +489,9 @@ func (st *S3Storage) RemoveObject(ctx context.Context, key string, opts minio.Re
if err != nil {
if isNotFoundError(err) {
+ // On 'not found', cache this resp.
+ cacheNotFound(st.config.Cache, key)
+
// Wrap not found errors as our not found type.
err = internal.WrapErr(err, storage.ErrNotFound)
} else if isObjectNameError(err) {
@@ -439,6 +499,10 @@ func (st *S3Storage) RemoveObject(ctx context.Context, key string, opts minio.Re
err = internal.WrapErr(err, storage.ErrInvalidKey)
}
+ } else {
+
+ // Removed! also cache as 'not found'.
+ cacheNotFound(st.config.Cache, key)
}
return err
@@ -450,15 +514,32 @@ func (st *S3Storage) WalkKeys(ctx context.Context, opts storage.WalkKeysOpts) er
panic("nil step fn")
}
- var (
- prev string
- token string
- )
+ // Step function called on each listed object.
+ var step func(string, minio.ObjectInfo) error
+
+ if st.config.Cache == nil {
+ // No cache, simply pass straight through to opts.Step().
+ step = func(key string, info minio.ObjectInfo) error {
+ return opts.Step(storage.Entry{
+ Key: key,
+ Size: info.Size,
+ })
+ }
+ } else {
+ // Cache configured, store before passing to opts.Step().
+ step = func(key string, info minio.ObjectInfo) error {
+ st.config.Cache.Put(key, objectToCachedObjectInfo(info))
+ return opts.Step(storage.Entry{
+ Key: key,
+ Size: info.Size,
+ })
+ }
+ }
// Update options prefix to include global prefix.
opts.Prefix = st.config.KeyPrefix + opts.Prefix
- for {
+ for prev, token := "", ""; ; {
// List objects in bucket starting at marker.
result, err := st.client.ListObjectsV2(
st.bucket,
@@ -482,17 +563,13 @@ func (st *S3Storage) WalkKeys(ctx context.Context, opts storage.WalkKeysOpts) er
// Trim any global prefix from returned object key.
key := strings.TrimPrefix(obj.Key, st.config.KeyPrefix)
- // Skip filtered obj keys.
- if opts.Filter != nil &&
- opts.Filter(key) {
+ // Skip filtered keys.
+ if opts.Filter(key) {
continue
}
- // Pass each obj through step func.
- if err := opts.Step(storage.Entry{
- Key: key,
- Size: obj.Size,
- }); err != nil {
+ // Pass each object to step funcion.
+ if err := step(key, obj); err != nil {
return err
}
}
@@ -501,11 +578,8 @@ func (st *S3Storage) WalkKeys(ctx context.Context, opts storage.WalkKeysOpts) er
// Trim any global prefix from returned object key.
key := strings.TrimPrefix(obj.Key, st.config.KeyPrefix)
- // Pass each obj through step func.
- if err := opts.Step(storage.Entry{
- Key: key,
- Size: obj.Size,
- }); err != nil {
+ // Pass each object to step funcion.
+ if err := step(key, obj); err != nil {
return err
}
}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 5563b2445..e46f2e4ea 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -244,8 +244,8 @@ codeberg.org/gruf/go-errors/v2
# codeberg.org/gruf/go-fastcopy v1.1.3
## explicit; go 1.17
codeberg.org/gruf/go-fastcopy
-# codeberg.org/gruf/go-fastpath/v2 v2.0.0
-## explicit; go 1.14
+# codeberg.org/gruf/go-fastpath/v2 v2.0.1
+## explicit; go 1.20
codeberg.org/gruf/go-fastpath/v2
# codeberg.org/gruf/go-ffmpreg v0.6.12
## explicit; go 1.22.0
@@ -289,13 +289,14 @@ codeberg.org/gruf/go-sched
# codeberg.org/gruf/go-split v1.2.0
## explicit; go 1.20
codeberg.org/gruf/go-split
-# codeberg.org/gruf/go-storage v0.3.1
+# codeberg.org/gruf/go-storage v0.4.0
## explicit; go 1.23.0
codeberg.org/gruf/go-storage
codeberg.org/gruf/go-storage/disk
codeberg.org/gruf/go-storage/internal
codeberg.org/gruf/go-storage/memory
codeberg.org/gruf/go-storage/s3
+codeberg.org/gruf/go-storage/s3/cache
# codeberg.org/gruf/go-structr v0.9.13
## explicit; go 1.24.5
codeberg.org/gruf/go-structr