summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2024-05-06 08:51:06 +0000
committerLibravatar GitHub <noreply@github.com>2024-05-06 08:51:06 +0000
commit8237e8d09e9561858c87e135df415b920b5d866d (patch)
tree723e0197feba016f4d8a6930621b7f70b65ec9c5 /vendor/codeberg.org
parent[chore]: Bump github.com/gin-contrib/gzip from 1.0.0 to 1.0.1 (#2899) (diff)
downloadgotosocial-8237e8d09e9561858c87e135df415b920b5d866d.tar.xz
[chore]: Bump codeberg.org/gruf/go-structr from 0.7.0 to 0.8.0 (#2902)
Bumps codeberg.org/gruf/go-structr from 0.7.0 to 0.8.0. --- updated-dependencies: - dependency-name: codeberg.org/gruf/go-structr dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/codeberg.org')
-rw-r--r--vendor/codeberg.org/gruf/go-structr/cache.go18
-rw-r--r--vendor/codeberg.org/gruf/go-structr/queue.go18
-rw-r--r--vendor/codeberg.org/gruf/go-structr/queue_ctx.go18
3 files changed, 54 insertions, 0 deletions
diff --git a/vendor/codeberg.org/gruf/go-structr/cache.go b/vendor/codeberg.org/gruf/go-structr/cache.go
index 1a2a07257..d9bcc58d3 100644
--- a/vendor/codeberg.org/gruf/go-structr/cache.go
+++ b/vendor/codeberg.org/gruf/go-structr/cache.go
@@ -527,6 +527,24 @@ func (c *Cache[T]) Len() int {
return l
}
+// Debug returns debug stats about cache.
+func (c *Cache[T]) Debug() map[string]any {
+ m := make(map[string]any)
+ c.mutex.Lock()
+ m["lru"] = c.lru.len
+ indices := make(map[string]any)
+ m["indices"] = indices
+ for i := range c.indices {
+ var n uint64
+ for _, list := range c.indices[i].data {
+ n += uint64(list.len)
+ }
+ indices[c.indices[i].name] = n
+ }
+ c.mutex.Unlock()
+ return m
+}
+
// Cap returns the maximum capacity (size) of cache.
func (c *Cache[T]) Cap() int {
c.mutex.Lock()
diff --git a/vendor/codeberg.org/gruf/go-structr/queue.go b/vendor/codeberg.org/gruf/go-structr/queue.go
index 70c18c839..91092790a 100644
--- a/vendor/codeberg.org/gruf/go-structr/queue.go
+++ b/vendor/codeberg.org/gruf/go-structr/queue.go
@@ -205,6 +205,24 @@ func (q *Queue[T]) Len() int {
return l
}
+// Debug returns debug stats about queue.
+func (q *Queue[T]) Debug() map[string]any {
+ m := make(map[string]any)
+ q.mutex.Lock()
+ m["queue"] = q.queue.len
+ indices := make(map[string]any)
+ m["indices"] = indices
+ for i := range q.indices {
+ var n uint64
+ for _, list := range q.indices[i].data {
+ n += uint64(list.len)
+ }
+ indices[q.indices[i].name] = n
+ }
+ q.mutex.Unlock()
+ return m
+}
+
func (q *Queue[T]) pop_n(n int, next func() *list_elem) []T {
if next == nil {
panic("nil fn")
diff --git a/vendor/codeberg.org/gruf/go-structr/queue_ctx.go b/vendor/codeberg.org/gruf/go-structr/queue_ctx.go
index d8843c1eb..766644c3c 100644
--- a/vendor/codeberg.org/gruf/go-structr/queue_ctx.go
+++ b/vendor/codeberg.org/gruf/go-structr/queue_ctx.go
@@ -64,6 +64,24 @@ func (q *QueueCtx[T]) Wait() <-chan struct{} {
return ctx
}
+// Debug returns debug stats about queue.
+func (q *QueueCtx[T]) Debug() map[string]any {
+ m := make(map[string]any)
+ q.mutex.Lock()
+ m["queue"] = q.queue.len
+ indices := make(map[string]any)
+ m["indices"] = indices
+ for i := range q.indices {
+ var n uint64
+ for _, list := range q.indices[i].data {
+ n += uint64(list.len)
+ }
+ indices[q.indices[i].name] = n
+ }
+ q.mutex.Unlock()
+ return m
+}
+
func (q *QueueCtx[T]) pop(ctx context.Context, next func() *list_elem) (T, bool) {
if next == nil {
panic("nil fn")