From edb5e398d8ddded9c12e3be5a3d8a400b78b9cdd Mon Sep 17 00:00:00 2001 From: svc-excavator-bot Date: Wed, 5 Nov 2025 06:18:35 +0000 Subject: [PATCH] Excavator: Bump go dependency github.com/palantir/pkg/refreshable/v2 --- go.mod | 2 +- go.sum | 4 +- .../palantir/pkg/refreshable/v2/godelw | 10 ++--- .../pkg/refreshable/v2/refreshable.go | 3 +- .../pkg/refreshable/v2/refreshable_file.go | 41 +++++++++++++++++++ .../refreshable/v2/refreshable_validating.go | 18 +++++--- vendor/modules.txt | 2 +- 7 files changed, 64 insertions(+), 16 deletions(-) create mode 100644 vendor/github.com/palantir/pkg/refreshable/v2/refreshable_file.go diff --git a/go.mod b/go.mod index 539b7d7..8e1a5bc 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/palantir/pkg/bytesbuffers v1.3.0 // indirect github.com/palantir/pkg/metrics v1.9.0 // indirect github.com/palantir/pkg/refreshable v1.6.0 // indirect - github.com/palantir/pkg/refreshable/v2 v2.2.0 // indirect + github.com/palantir/pkg/refreshable/v2 v2.3.0 // indirect github.com/palantir/pkg/safejson v1.2.0 // indirect github.com/palantir/pkg/tlsconfig v1.4.0 // indirect github.com/palantir/pkg/uuid v1.3.0 // indirect diff --git a/go.sum b/go.sum index 1517488..3de3ad2 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,8 @@ github.com/palantir/pkg/objmatcher v1.2.0 h1:cR0IX2NXAhR1hRFBFUwA7y/+m4CtpXUCm5t github.com/palantir/pkg/objmatcher v1.2.0/go.mod h1:ekDpUDezSoBcD47CUWo9xbYTGycIkiM2ODvxHCUR+lQ= github.com/palantir/pkg/refreshable v1.6.0 h1:yQHuckZ8o7EFjTbn8z9bxb1YTxZ0nSKv9QkW6At2Dz8= github.com/palantir/pkg/refreshable v1.6.0/go.mod h1:5mabB33zEMefdIyLuVtqiaiH9+3SsKqAlFTIWs04DFA= -github.com/palantir/pkg/refreshable/v2 v2.2.0 h1:3HS7/gGn9EoH3Ik9BK5legAiQorz3TQhfbRVg4O+mew= -github.com/palantir/pkg/refreshable/v2 v2.2.0/go.mod h1:J9xYa1WXGWqC/N5PxDz8VUtrJZGWlmr+rFx89Oy7X0Y= +github.com/palantir/pkg/refreshable/v2 v2.3.0 h1:/21R6OB96g0iXKJXoPohAITAAMpdX9sVDybz3NA0ic4= +github.com/palantir/pkg/refreshable/v2 v2.3.0/go.mod h1:0Og1iRoyMOHpjjk5wBuRhgazUbqLTo8KfdqJe1h9+0g= github.com/palantir/pkg/retry v1.3.0 h1:uHrY3sv4q3XefvVLyqKIK1frXE9ZxtCtNtvijAkwW4k= github.com/palantir/pkg/retry v1.3.0/go.mod h1:HzOR3eLw/9PiujskMpjaC6m3uU8fy53s6NszjbmpbOQ= github.com/palantir/pkg/safejson v1.2.0 h1:mNARH/UdpeDjHSUujUYXSqe4Rclul53xle2CLm6UG34= diff --git a/vendor/github.com/palantir/pkg/refreshable/v2/godelw b/vendor/github.com/palantir/pkg/refreshable/v2/godelw index b7d3b9e..0bd841f 100644 --- a/vendor/github.com/palantir/pkg/refreshable/v2/godelw +++ b/vendor/github.com/palantir/pkg/refreshable/v2/godelw @@ -3,11 +3,11 @@ set -euo pipefail # Version and checksums for godel. Values are populated by the godel "dist" task. -VERSION=2.137.0 -DARWIN_AMD64_CHECKSUM=36b638ba570aadd36e786673ca53a47d1d5c2c32cb69747fdccaeb17eb4cfaa6 -DARWIN_ARM64_CHECKSUM=f7b8b5f842b818b124b76416080847952a0e0a179ca743d618da49956e1a52da -LINUX_AMD64_CHECKSUM=837dec5b6222f2e12797819536c0333db40a573a452dd84c3af767be34bf2ebb -LINUX_ARM64_CHECKSUM=fab2aea38e211224c430132062cab4ac135c4e670126f41cdb2a548a173e6ec4 +VERSION=2.144.0 +DARWIN_AMD64_CHECKSUM=0832d85c200d026831f69c99ec086a9cb744f56bcaceb924e52ad88eb378a633 +DARWIN_ARM64_CHECKSUM=b22a8d0c71be33b4e398dda4ec17733bf6b8ea3c264e42a51206392e9c9268bd +LINUX_AMD64_CHECKSUM=bcf370920734943d5afb717b26bbfe5849a46fa6d9f4a45c443947a645206c7e +LINUX_ARM64_CHECKSUM=a32ac95dea4c90f817ef4fed51018ba2842689a1556551d1c7c2f5fd6a170b47 # Downloads file at URL to destination path using wget or curl. Prints an error and exits if wget or curl is not present. function download { diff --git a/vendor/github.com/palantir/pkg/refreshable/v2/refreshable.go b/vendor/github.com/palantir/pkg/refreshable/v2/refreshable.go index bd14687..fbdc22c 100644 --- a/vendor/github.com/palantir/pkg/refreshable/v2/refreshable.go +++ b/vendor/github.com/palantir/pkg/refreshable/v2/refreshable.go @@ -100,7 +100,8 @@ func MapContext[T any, M any](ctx context.Context, original Refreshable[T], mapF // of the input object in addition to returning an error. The returned validRefreshable will contain the mapped value. // An error is returned if the current original value fails to map. func MapWithError[T any, M any](original Refreshable[T], mapFn func(T) (M, error)) (Validated[M], UnsubscribeFunc, error) { - v, stop := newValidRefreshable(original, mapFn) + v := newValidRefreshable[M]() + stop := subscribeValidRefreshable(v, original, mapFn) _, err := v.Validation() return v, stop, err } diff --git a/vendor/github.com/palantir/pkg/refreshable/v2/refreshable_file.go b/vendor/github.com/palantir/pkg/refreshable/v2/refreshable_file.go new file mode 100644 index 0000000..03bedeb --- /dev/null +++ b/vendor/github.com/palantir/pkg/refreshable/v2/refreshable_file.go @@ -0,0 +1,41 @@ +// Copyright (c) 2025 Palantir Technologies. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package refreshable + +import ( + "context" + "os" + "time" +) + +const ( + fileRefreshableSyncPeriod = time.Second +) + +// NewFileRefreshable creates a Validated refreshable that reads from a file every second. +// It is equivalent to calling NewFileRefreshableWithTicker with time.Tick(time.Second). +func NewFileRefreshable(ctx context.Context, filePath string) Validated[[]byte] { + return NewFileRefreshableWithTicker(ctx, filePath, time.Tick(fileRefreshableSyncPeriod)) +} + +// NewFileRefreshableWithTicker returns a Validated refreshable whose current value is the bytes of the file at the provided path. +// This function reads the file once then starts a goroutine which re-reads the file on each tick until the provided context is cancelled. +// If reading the file fails, the Current() value will be unchanged. The error is present in v.Validation(). +func NewFileRefreshableWithTicker(ctx context.Context, filePath string, updateTicker <-chan time.Time) Validated[[]byte] { + v := newValidRefreshable[[]byte]() + updateValidRefreshable[string, []byte](v, filePath, os.ReadFile) + go func() { + for { + select { + case <-updateTicker: + // Read file and update refreshable. If ReadFile fails, the error is present in v.Validation(). + updateValidRefreshable[string, []byte](v, filePath, os.ReadFile) + case <-ctx.Done(): + return + } + } + }() + return v +} diff --git a/vendor/github.com/palantir/pkg/refreshable/v2/refreshable_validating.go b/vendor/github.com/palantir/pkg/refreshable/v2/refreshable_validating.go index b6fa8ad..eb6fd9e 100644 --- a/vendor/github.com/palantir/pkg/refreshable/v2/refreshable_validating.go +++ b/vendor/github.com/palantir/pkg/refreshable/v2/refreshable_validating.go @@ -23,18 +23,24 @@ func (v *validRefreshable[T]) Subscribe(consumer func(T)) UnsubscribeFunc { } // Validation returns the most recent upstream Refreshable and its validation result. -// If nil, the validRefreshable is up-to-date with its original. +// If the error is nil, the validRefreshable is up-to-date with its original and the value +// is equal to that returned by Current(). func (v *validRefreshable[T]) Validation() (T, error) { c := v.r.Current() return c.unvalidated, c.lastErr } -func newValidRefreshable[T any, M any](original Refreshable[T], mappingFn func(T) (M, error)) (*validRefreshable[M], UnsubscribeFunc) { - valid := &validRefreshable[M]{r: newDefault(validRefreshableContainer[M]{})} - stop := original.Subscribe(func(valueT T) { - updateValidRefreshable(valid, valueT, mappingFn) +func newValidRefreshable[M any]() *validRefreshable[M] { + valid := &validRefreshable[M]{ + r: newDefault(validRefreshableContainer[M]{}), + } + return valid +} + +func subscribeValidRefreshable[T, M any](v *validRefreshable[M], original Refreshable[T], mapFn func(T) (M, error)) UnsubscribeFunc { + return original.Subscribe(func(valueT T) { + updateValidRefreshable(v, valueT, mapFn) }) - return valid, stop } func updateValidRefreshable[T any, M any](valid *validRefreshable[M], value T, mapFn func(T) (M, error)) { diff --git a/vendor/modules.txt b/vendor/modules.txt index 2bcf83b..2d44cb0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -29,7 +29,7 @@ github.com/palantir/pkg/metrics # github.com/palantir/pkg/refreshable v1.6.0 ## explicit; go 1.20 github.com/palantir/pkg/refreshable -# github.com/palantir/pkg/refreshable/v2 v2.2.0 +# github.com/palantir/pkg/refreshable/v2 v2.3.0 ## explicit; go 1.25.0 github.com/palantir/pkg/refreshable/v2 # github.com/palantir/pkg/retry v1.3.0