Documentation
¶
Index ¶
- Variables
- func ActivityBatchIDFromContext(ctx context.Context) string
- func ActivityRuntimeContext(requestCtx, appCtx context.Context) context.Context
- func ApplyChanged[T comparable](target *T, value mo.Option[T]) bool
- func ApplyEncrypted(field *string, plaintext string) (bool, error)
- func ApplyNullable[T comparable](target **T, value mo.Option[T]) bool
- func ApplySliceChanged[S ~[]E, E comparable](target *S, value mo.Option[S]) bool
- func ExtractCategoryMetadata[T any]() map[string]map[string]string
- func IsAppLifecycleContext(ctx context.Context) bool
- func LookupEnvOrFile(name string) (value string, found, fromFile bool)
- func NormalizePasskeyAssertionExtensions(session protocol.SessionExtensions, ...)
- func PanicToError(r any) error
- func ParseKeywords(keywordsStr string) []string
- func ParseMetaTag(tag string) map[string]string
- func RecoverToError(errPtr *error, label string, args ...any)
- func UpdateInitiatorFromContext(ctx context.Context) (activitytypes.StartedBy, bool)
- func ValidActivityBatchID(id string) bool
- func WaitGroup(ctx context.Context, group *sync.WaitGroup) error
- func WithActivityBatchID(ctx context.Context, batchID string) context.Context
- func WithAppLifecycleContext(ctx context.Context) context.Context
- func WithUpdateInitiator(ctx context.Context, initiator activitytypes.StartedBy) context.Context
- type KeyedMutex
- type SyncGate
Constants ¶
This section is empty.
Variables ¶
var ( FilePerm os.FileMode = 0o644 DirPerm os.FileMode = 0o755 )
Functions ¶
func ActivityBatchIDFromContext ¶ added in v2.5.0
ActivityBatchIDFromContext returns the batch ID attached by WithActivityBatchID, or "" when none is set.
func ActivityRuntimeContext ¶
ActivityRuntimeContext returns a context suitable for activity-backed work.
func ApplyChanged ¶ added in v2.6.0
func ApplyChanged[T comparable](target *T, value mo.Option[T]) bool
ApplyChanged updates target when value is present and differs from the current value.
func ApplyEncrypted ¶ added in v2.15.0
ApplyEncrypted stores plaintext encrypted in field only when it differs from the stored value, so unchanged credentials keep their ciphertext. An empty plaintext clears the field. A stored value that no longer decrypts (for example after a key change) is replaced so the source of truth wins.
func ApplyNullable ¶ added in v2.6.0
func ApplyNullable[T comparable](target **T, value mo.Option[T]) bool
ApplyNullable updates target to the optional value when it differs from the current value.
func ApplySliceChanged ¶ added in v2.7.0
func ApplySliceChanged[S ~[]E, E comparable](target *S, value mo.Option[S]) bool
ApplySliceChanged updates target when value is present and its elements differ from the current slice. Nil and empty slices are treated as equal.
func ExtractCategoryMetadata ¶
ExtractCategoryMetadata extracts category metadata from T's fields with catmeta tags Returns a map of category ID to category metadata in field order
func IsAppLifecycleContext ¶
IsAppLifecycleContext reports whether ctx is tied to the application lifecycle.
func LookupEnvOrFile ¶ added in v2.15.0
LookupEnvOrFile is os.LookupEnv with Docker secret support: when NAME__FILE or NAME_FILE (checked in that order) names a readable file, its trimmed contents stand in for NAME. An unreadable file falls back to NAME. The booleans report whether a value was found and whether it came from a file.
func NormalizePasskeyAssertionExtensions ¶ added in v2.14.0
func NormalizePasskeyAssertionExtensions(session protocol.SessionExtensions, assertion *protocol.ParsedCredentialAssertionData)
NormalizePasskeyAssertionExtensions drops an unrequested appid=false output, which Safari reports even though it means the legacy AppID was not used.
func PanicToError ¶ added in v2.15.0
PanicToError converts a recovered panic value into an error.
func ParseKeywords ¶
ParseKeywords parses a comma-separated keywords string into a slice Returns an empty slice if the input is empty or contains only whitespace
func ParseMetaTag ¶
ParseMetaTag parses a struct tag meta value formatted as `k=v;other=val;...` Returns a map of key-value pairs extracted from the tag
func RecoverToError ¶ added in v2.6.0
RecoverToError converts a panic in the calling goroutine into an error and logs it. x/sync's errgroup does not recover worker panics — they crash the whole process — so every worker defers this as its first statement:
g.Go(func() (workerErr error) {
defer utils.RecoverToError(&workerErr, "image list worker")
...
})
It must be deferred directly (not wrapped in another closure) for recover() to observe the panic. errPtr may be nil when the caller has no error to report into (e.g. a fire-and-forget goroutine); the panic is still logged. args are extra slog attributes appended to the log record.
func UpdateInitiatorFromContext ¶ added in v2.14.0
func UpdateInitiatorFromContext(ctx context.Context) (activitytypes.StartedBy, bool)
UpdateInitiatorFromContext returns trusted proxied update attribution.
func ValidActivityBatchID ¶ added in v2.5.0
ValidActivityBatchID reports whether id is safe to persist as a batch ID.
func WaitGroup ¶ added in v2.7.0
WaitGroup waits for all work or returns when ctx ends. After a timeout, its waiter goroutine remains until the group eventually completes.
func WithActivityBatchID ¶ added in v2.5.0
WithActivityBatchID attaches a client-supplied batch ID that groups the activities spawned by one logical user action (e.g. a bulk container update). Invalid IDs are ignored.
func WithAppLifecycleContext ¶
WithAppLifecycleContext marks ctx as the application lifecycle context.
func WithUpdateInitiator ¶ added in v2.14.0
WithUpdateInitiator carries manager-authenticated attribution through an agent request without changing the authenticated agent identity.
Types ¶
type KeyedMutex ¶ added in v2.6.0
type KeyedMutex struct {
// contains filtered or unexported fields
}
KeyedMutex hands out one mutex per key, so unrelated keys proceed concurrently while work on the same key is serialized.
Entries are reference counted and dropped once nobody holds or awaits them. The naive version of this — a sync.Map of *sync.Mutex — either grows one entry per key ever seen, or, if entries are deleted on release, hands two callers different mutexes for the same key and silently loses mutual exclusion. The reference count is taken under the map lock, so a key with waiters is never removed.
The zero value is ready to use.
func (*KeyedMutex) Lock ¶ added in v2.6.0
func (k *KeyedMutex) Lock(key string) func()
Lock blocks until the key's mutex is held and returns its unlock function. Intended to be deferred at the point of acquisition:
defer locks.Lock(id)()
func (*KeyedMutex) LockContext ¶ added in v2.15.0
func (k *KeyedMutex) LockContext(ctx context.Context, key string) (func(), error)
LockContext is Lock bounded by ctx. When ctx ends first the key is left untouched and the waiter is released once the lock would have been taken.
func (*KeyedMutex) RLock ¶ added in v2.8.0
func (k *KeyedMutex) RLock(key string) func()
RLock blocks until the key's mutex is held for reading and returns its unlock function. Multiple readers for the same key may proceed concurrently.
func (*KeyedMutex) TryLock ¶ added in v2.6.0
func (k *KeyedMutex) TryLock(key string) (func(), bool)
TryLock acquires the key's mutex without blocking. It reports whether the lock was taken; the unlock function is only valid when it was.
type SyncGate ¶ added in v2.15.0
SyncGate remembers the SHA-256 of the last payload delivered per scope and key so periodic re-syncs skip the network when nothing changed, and serializes deliveries for one key so overlapping pushes reach the target in the order they are remembered. Only the digest is retained. Expiry bounds how long a delivery is trusted (zero means forever) so a target rebuilt behind an unchanged status still converges. The zero value is ready to use.
func (*SyncGate) Begin ¶ added in v2.15.0
func (g *SyncGate) Begin(ctx context.Context, scope, key string, body []byte) (unchanged bool, finish func(delivered bool), err error)
Begin reports whether body is already delivered for scope and key. When it is not, the key stays locked until finish runs; finish(true) remembers the delivery unless the scope was forgotten in between. Callers must invoke finish exactly once. Waiting for an in-flight delivery ends with ctx.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package acfs maps ACFS protocol types to Arcane workspace contracts.
|
Package acfs maps ACFS protocol types to Arcane workspace contracts. |
|
Package backupbrowser provides deterministic backup-tree construction, paging, and restore-selection validation.
|
Package backupbrowser provides deterministic backup-tree construction, paging, and restore-selection validation. |
|
Package dbutil provides small generic helpers around GORM that consolidate repetitive single-row lookup and transaction boilerplate found across services.
|
Package dbutil provides small generic helpers around GORM that consolidate repetitive single-row lookup and transaction boilerplate found across services. |
|
Package francis owns the embedded Francis host lifecycle.
|
Package francis owns the embedded Francis host lifecycle. |
|
testing
Package testing starts isolated Francis hosts for owning-logic tests.
|
Package testing starts isolated Francis hosts for owning-logic tests. |
|
Package iconcatalog resolves Arcane icon metadata into catalog URLs.
|
Package iconcatalog resolves Arcane icon metadata into catalog URLs. |
|
Package imageref contains shared image-reference parsing operations.
|
Package imageref contains shared image-reference parsing operations. |
|
Package s3 provides reusable S3 configuration and connectivity helpers.
|
Package s3 provides reusable S3 configuration and connectivity helpers. |
|
Package tracing holds shared helpers for Arcane's own OpenTelemetry spans.
|
Package tracing holds shared helpers for Arcane's own OpenTelemetry spans. |