mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-22 19:56:39 +00:00
[chore]: Bump codeberg.org/gruf/go-cache/v3 from 3.1.7 to 3.1.8 (#1043)
Bumps codeberg.org/gruf/go-cache/v3 from 3.1.7 to 3.1.8. --- updated-dependencies: - dependency-name: codeberg.org/gruf/go-cache/v3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
96f11e757c
commit
8f2d3ca664
2
go.mod
2
go.mod
|
@ -6,7 +6,7 @@ require (
|
||||||
codeberg.org/gruf/go-bytesize v1.0.0
|
codeberg.org/gruf/go-bytesize v1.0.0
|
||||||
codeberg.org/gruf/go-byteutil v1.0.2
|
codeberg.org/gruf/go-byteutil v1.0.2
|
||||||
codeberg.org/gruf/go-cache/v2 v2.1.4
|
codeberg.org/gruf/go-cache/v2 v2.1.4
|
||||||
codeberg.org/gruf/go-cache/v3 v3.1.7
|
codeberg.org/gruf/go-cache/v3 v3.1.8
|
||||||
codeberg.org/gruf/go-debug v1.2.0
|
codeberg.org/gruf/go-debug v1.2.0
|
||||||
codeberg.org/gruf/go-errors/v2 v2.0.2
|
codeberg.org/gruf/go-errors/v2 v2.0.2
|
||||||
codeberg.org/gruf/go-kv v1.5.2
|
codeberg.org/gruf/go-kv v1.5.2
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -71,8 +71,8 @@ codeberg.org/gruf/go-byteutil v1.0.2 h1:OesVyK5VKWeWdeDR00zRJ+Oy8hjXx1pBhn7WVvcZ
|
||||||
codeberg.org/gruf/go-byteutil v1.0.2/go.mod h1:cWM3tgMCroSzqoBXUXMhvxTxYJp+TbCr6ioISRY5vSU=
|
codeberg.org/gruf/go-byteutil v1.0.2/go.mod h1:cWM3tgMCroSzqoBXUXMhvxTxYJp+TbCr6ioISRY5vSU=
|
||||||
codeberg.org/gruf/go-cache/v2 v2.1.4 h1:r+6wJiTHZn0qqf+p1VtAjGOgXXJl7s8txhPIwoSMZtI=
|
codeberg.org/gruf/go-cache/v2 v2.1.4 h1:r+6wJiTHZn0qqf+p1VtAjGOgXXJl7s8txhPIwoSMZtI=
|
||||||
codeberg.org/gruf/go-cache/v2 v2.1.4/go.mod h1:j7teiz814lG0PfSfnUs+6HA+2/jcjTAR71Ou3Wbt2Xk=
|
codeberg.org/gruf/go-cache/v2 v2.1.4/go.mod h1:j7teiz814lG0PfSfnUs+6HA+2/jcjTAR71Ou3Wbt2Xk=
|
||||||
codeberg.org/gruf/go-cache/v3 v3.1.7 h1:mWeLxh4CnIfBIbzxdCPlPsRjrernqIlFsMQdLQhUBMo=
|
codeberg.org/gruf/go-cache/v3 v3.1.8 h1:wbUef/QtRstEb7sSpQYHT5CtSFtKkeZr4ZhOTXqOpac=
|
||||||
codeberg.org/gruf/go-cache/v3 v3.1.7/go.mod h1:h6im2UVGdrGtNt4IVKARVeoW4kAdok5ts7CbH15UWXs=
|
codeberg.org/gruf/go-cache/v3 v3.1.8/go.mod h1:h6im2UVGdrGtNt4IVKARVeoW4kAdok5ts7CbH15UWXs=
|
||||||
codeberg.org/gruf/go-debug v1.2.0 h1:WBbTMnK1ArFKUmgv04aO2JiC/daTOB8zQGi521qb7OU=
|
codeberg.org/gruf/go-debug v1.2.0 h1:WBbTMnK1ArFKUmgv04aO2JiC/daTOB8zQGi521qb7OU=
|
||||||
codeberg.org/gruf/go-debug v1.2.0/go.mod h1:N+vSy9uJBQgpQcJUqjctvqFz7tBHJf+S/PIjLILzpLg=
|
codeberg.org/gruf/go-debug v1.2.0/go.mod h1:N+vSy9uJBQgpQcJUqjctvqFz7tBHJf+S/PIjLILzpLg=
|
||||||
codeberg.org/gruf/go-errors/v2 v2.0.0/go.mod h1:ZRhbdhvgoUA3Yw6e56kd9Ox984RrvbEFC2pOXyHDJP4=
|
codeberg.org/gruf/go-errors/v2 v2.0.0/go.mod h1:ZRhbdhvgoUA3Yw6e56kd9Ox984RrvbEFC2pOXyHDJP4=
|
||||||
|
|
35
vendor/codeberg.org/gruf/go-cache/v3/result/cache.go
generated
vendored
35
vendor/codeberg.org/gruf/go-cache/v3/result/cache.go
generated
vendored
|
@ -178,10 +178,8 @@ func (c *Cache[Value]) Load(lookup string, load func() (Value, error), keyParts
|
||||||
c.cache.Lock()
|
c.cache.Lock()
|
||||||
defer c.cache.Unlock()
|
defer c.cache.Unlock()
|
||||||
|
|
||||||
// Attempt to cache this result.
|
// Cache this result
|
||||||
if key, ok := c.storeResult(res); !ok {
|
c.storeResult(res)
|
||||||
return zero, ConflictError{key}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Catch and return error
|
// Catch and return error
|
||||||
|
@ -211,11 +209,8 @@ func (c *Cache[Value]) Store(value Value, store func() error) error {
|
||||||
c.cache.Lock()
|
c.cache.Lock()
|
||||||
defer c.cache.Unlock()
|
defer c.cache.Unlock()
|
||||||
|
|
||||||
// Attempt to cache result, only return conflict
|
// Cache this result
|
||||||
// error if the appropriate flag has been set.
|
c.storeResult(result)
|
||||||
if key, ok := c.storeResult(result); !ok {
|
|
||||||
return ConflictError{key}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -285,7 +280,7 @@ func (c *Cache[Value]) Cap() int {
|
||||||
return c.cache.Cache.Cap()
|
return c.cache.Cache.Cap()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cache[Value]) storeResult(res result[Value]) (string, bool) {
|
func (c *Cache[Value]) storeResult(res result[Value]) {
|
||||||
for _, key := range res.Keys {
|
for _, key := range res.Keys {
|
||||||
pkeys := key.key.pkeys
|
pkeys := key.key.pkeys
|
||||||
|
|
||||||
|
@ -293,18 +288,20 @@ func (c *Cache[Value]) storeResult(res result[Value]) (string, bool) {
|
||||||
pkey, ok := pkeys[key.value]
|
pkey, ok := pkeys[key.value]
|
||||||
|
|
||||||
if ok {
|
if ok {
|
||||||
// Look for overlap with non error keys,
|
// Get the overlapping result with this key.
|
||||||
// as an overlap for some but not all keys
|
|
||||||
// could produce inconsistent results.
|
|
||||||
entry, _ := c.cache.Cache.Get(pkey)
|
entry, _ := c.cache.Cache.Get(pkey)
|
||||||
if entry.Value.Error == nil {
|
|
||||||
return key.value, false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete existing error result
|
// From conflicting entry, drop this key, this
|
||||||
|
// will prevent eviction cleanup key confusion.
|
||||||
|
entry.Value.Keys.drop(key.key.name)
|
||||||
|
|
||||||
|
if len(entry.Value.Keys) == 0 {
|
||||||
|
// We just over-wrote the only lookup key for
|
||||||
|
// this value, so we drop its primary key too
|
||||||
c.cache.Cache.Delete(pkey)
|
c.cache.Cache.Delete(pkey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get primary key
|
// Get primary key
|
||||||
pkey := c.next
|
pkey := c.next
|
||||||
|
@ -324,13 +321,11 @@ func (c *Cache[Value]) storeResult(res result[Value]) (string, bool) {
|
||||||
}, func(_ int64, item *ttl.Entry[int64, result[Value]]) {
|
}, func(_ int64, item *ttl.Entry[int64, result[Value]]) {
|
||||||
c.cache.Evict(item)
|
c.cache.Evict(item)
|
||||||
})
|
})
|
||||||
|
|
||||||
return "", true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type result[Value any] struct {
|
type result[Value any] struct {
|
||||||
// keys accessible under
|
// keys accessible under
|
||||||
Keys []cachedKey
|
Keys cacheKeys
|
||||||
|
|
||||||
// cached value
|
// cached value
|
||||||
Value Value
|
Value Value
|
||||||
|
|
22
vendor/codeberg.org/gruf/go-cache/v3/result/error.go
generated
vendored
22
vendor/codeberg.org/gruf/go-cache/v3/result/error.go
generated
vendored
|
@ -1,22 +0,0 @@
|
||||||
package result
|
|
||||||
|
|
||||||
import "errors"
|
|
||||||
|
|
||||||
// ErrUnkownLookup ...
|
|
||||||
var ErrUnknownLookup = errors.New("unknown lookup identifier")
|
|
||||||
|
|
||||||
// IsConflictErr returns whether error is due to key conflict.
|
|
||||||
func IsConflictErr(err error) bool {
|
|
||||||
_, ok := err.(ConflictError)
|
|
||||||
return ok
|
|
||||||
}
|
|
||||||
|
|
||||||
// ConflictError is returned on cache key conflict.
|
|
||||||
type ConflictError struct {
|
|
||||||
Key string
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error returns the message for this key conflict error.
|
|
||||||
func (c ConflictError) Error() string {
|
|
||||||
return "cache conflict for key \"" + c.Key + "\""
|
|
||||||
}
|
|
13
vendor/codeberg.org/gruf/go-cache/v3/result/key.go
generated
vendored
13
vendor/codeberg.org/gruf/go-cache/v3/result/key.go
generated
vendored
|
@ -77,6 +77,19 @@ func (sk structKeys) generate(a any) []cachedKey {
|
||||||
return keys
|
return keys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type cacheKeys []cachedKey
|
||||||
|
|
||||||
|
// drop will drop the cachedKey with lookup name from receiving cacheKeys slice.
|
||||||
|
func (ck *cacheKeys) drop(name string) {
|
||||||
|
_ = *ck // move out of loop
|
||||||
|
for i := range *ck {
|
||||||
|
if (*ck)[i].key.name == name {
|
||||||
|
(*ck) = append((*ck)[:i], (*ck)[i+1:]...)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// cachedKey represents an actual cached key.
|
// cachedKey represents an actual cached key.
|
||||||
type cachedKey struct {
|
type cachedKey struct {
|
||||||
// key is a reference to the structKey this
|
// key is a reference to the structKey this
|
||||||
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
@ -16,7 +16,7 @@ codeberg.org/gruf/go-byteutil
|
||||||
# codeberg.org/gruf/go-cache/v2 v2.1.4
|
# codeberg.org/gruf/go-cache/v2 v2.1.4
|
||||||
## explicit; go 1.19
|
## explicit; go 1.19
|
||||||
codeberg.org/gruf/go-cache/v2
|
codeberg.org/gruf/go-cache/v2
|
||||||
# codeberg.org/gruf/go-cache/v3 v3.1.7
|
# codeberg.org/gruf/go-cache/v3 v3.1.8
|
||||||
## explicit; go 1.19
|
## explicit; go 1.19
|
||||||
codeberg.org/gruf/go-cache/v3/result
|
codeberg.org/gruf/go-cache/v3/result
|
||||||
codeberg.org/gruf/go-cache/v3/ttl
|
codeberg.org/gruf/go-cache/v3/ttl
|
||||||
|
|
Loading…
Reference in a new issue