From 201b95029419d4929987acdeec10b76aeed8715a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Mar 2025 06:54:17 +0000 Subject: [PATCH] [chore]: Bump codeberg.org/gruf/go-structr from 0.9.0 to 0.9.1 Bumps codeberg.org/gruf/go-structr from 0.9.0 to 0.9.1. --- updated-dependencies: - dependency-name: codeberg.org/gruf/go-structr dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 4 +- go.sum | 4 +- .../codeberg.org/gruf/go-structr/timeline.go | 48 +++++++++++++++++++ vendor/modules.txt | 2 +- 4 files changed, 53 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index ca64fae33..77748ecd2 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/superseriousbusiness/gotosocial go 1.23.0 -toolchain go1.23.3 +toolchain go1.24.1 // Replace go-swagger with our version that fixes (ours particularly) use of Go1.23 replace github.com/go-swagger/go-swagger => codeberg.org/superseriousbusiness/go-swagger v0.31.0-gts-go1.23-fix @@ -27,7 +27,7 @@ require ( codeberg.org/gruf/go-runners v1.6.3 codeberg.org/gruf/go-sched v1.2.4 codeberg.org/gruf/go-storage v0.2.0 - codeberg.org/gruf/go-structr v0.9.0 + codeberg.org/gruf/go-structr v0.9.1 codeberg.org/superseriousbusiness/activity v1.12.0-gts codeberg.org/superseriousbusiness/exif-terminator v0.10.0 codeberg.org/superseriousbusiness/httpsig v1.3.0-SSB diff --git a/go.sum b/go.sum index c7af9162d..4d99fad14 100644 --- a/go.sum +++ b/go.sum @@ -38,8 +38,8 @@ codeberg.org/gruf/go-sched v1.2.4 h1:ddBB9o0D/2oU8NbQ0ldN5aWxogpXPRBATWi58+p++Hw codeberg.org/gruf/go-sched v1.2.4/go.mod h1:wad6l+OcYGWMA2TzNLMmLObsrbBDxdJfEy5WvTgBjNk= codeberg.org/gruf/go-storage v0.2.0 h1:mKj3Lx6AavEkuXXtxqPhdq+akW9YwrnP16yQBF7K5ZI= codeberg.org/gruf/go-storage v0.2.0/go.mod h1:o3GzMDE5QNUaRnm/daUzFqvuAaC4utlgXDXYO79sWKU= -codeberg.org/gruf/go-structr v0.9.0 h1:UYw8igp3I4UBnlsRyDR2AbF3g7NPEP7HBrQs1I15218= -codeberg.org/gruf/go-structr v0.9.0/go.mod h1:mUvBvn4q1iM/I+d3Fj1w/gxGUU/Ve9GpiNo6dPmBJnk= +codeberg.org/gruf/go-structr v0.9.1 h1:Muzu11K+UkWu3xb6WyR/JmaEq6NZO4bX5moJ14wj8SM= +codeberg.org/gruf/go-structr v0.9.1/go.mod h1:mUvBvn4q1iM/I+d3Fj1w/gxGUU/Ve9GpiNo6dPmBJnk= codeberg.org/superseriousbusiness/activity v1.12.0-gts h1:frNGTENLmOIQHKfOw/jj3UVj/GjHBljDx+CFAAK+m6Q= codeberg.org/superseriousbusiness/activity v1.12.0-gts/go.mod h1:enxU1Lva4OcK6b/NBXscoHSEgEMsKJvdHrQFifQxp4o= codeberg.org/superseriousbusiness/exif-terminator v0.10.0 h1:FiLX/AK07tzceS36I+kOP2aEH+aytjPSIlFoYePMEyg= diff --git a/vendor/codeberg.org/gruf/go-structr/timeline.go b/vendor/codeberg.org/gruf/go-structr/timeline.go index 7a9c17f70..45e70bb2e 100644 --- a/vendor/codeberg.org/gruf/go-structr/timeline.go +++ b/vendor/codeberg.org/gruf/go-structr/timeline.go @@ -387,6 +387,54 @@ func (t *Timeline[T, PK]) Range(dir Direction) func(yield func(T) bool) { } } +// RangeUnsafe is functionally similar to Range(), except it does not pass *copies* of +// data. It allows you to operate on the data directly and modify it. As such it can also +// be more performant to use this function, even for read-write operations. +// +// Please note that the entire Timeline{} will be locked for the duration of the range +// operation, i.e. from the beginning of the first yield call until the end of the last. +func (t *Timeline[T, PK]) RangeUnsafe(dir Direction) func(yield func(T) bool) { + return func(yield func(T) bool) { + if t.copy == nil { + panic("not initialized") + } else if yield == nil { + panic("nil func") + } + + // Acquire lock. + t.mutex.Lock() + defer t.mutex.Unlock() + + switch dir { + case Asc: + // Iterate through linked list from bottom (i.e. tail). + for prev := t.list.tail; prev != nil; prev = prev.prev { + + // Extract item from list element. + item := (*timeline_item)(prev.data) + + // Pass to given function. + if !yield(item.data.(T)) { + break + } + } + + case Desc: + // Iterate through linked list from top (i.e. head). + for next := t.list.head; next != nil; next = next.next { + + // Extract item from list element. + item := (*timeline_item)(next.data) + + // Pass to given function. + if !yield(item.data.(T)) { + break + } + } + } + } +} + // RangeKeys will iterate over all values for given keys in the given index. // // Please note that the entire Timeline{} will be locked for the duration of the range diff --git a/vendor/modules.txt b/vendor/modules.txt index 4f5ca928e..3c281cd14 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -63,7 +63,7 @@ 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-structr v0.9.0 +# codeberg.org/gruf/go-structr v0.9.1 ## explicit; go 1.22 codeberg.org/gruf/go-structr # codeberg.org/superseriousbusiness/activity v1.12.0-gts