package xsync
import "github.com/ydb-platform/ydb-go-sdk/v3/internal/xsync"
Index ¶
- func NewLastUsage(opts ...lastUsageOption) *lastUsage
- func OnceFunc(f func(ctx context.Context) error) func(ctx context.Context) error
- func WithClock(clock clockwork.Clock) lastUsageOption
- func WithLock[T any](l mutex, f func() T) T
- func WithRLock[T any](l rwMutex, f func() T) T
- type EventBroadcast
- type LastUsage
- type Map
- func (m *Map[K, V]) Clear() (removed int)
- func (m *Map[K, V]) Delete(key K) bool
- func (m *Map[K, V]) Extract(key K) (value V, ok bool)
- func (m *Map[K, V]) Get(key K) (value V, ok bool)
- func (m *Map[K, V]) Has(key K) bool
- func (m *Map[K, V]) Len() int
- func (m *Map[K, V]) Must(key K) (value V)
- func (m *Map[K, V]) Range(f func(key K, value V) bool)
- func (m *Map[K, V]) Set(key K, value V)
- type Mutex
- type Once
- func OnceValue[T closer.Closer](f func() (T, error)) *Once[T]
- func (v *Once[T]) Close(ctx context.Context) (err error)
- func (v *Once[T]) Get() (T, error)
- func (v *Once[T]) Must() T
- type OneTimeWaiter
- type Pool
- type RWMutex
- type Set
- func (s *Set[T]) Add(key T) bool
- func (s *Set[T]) Clear() (removed int)
- func (s *Set[T]) Has(key T) bool
- func (s *Set[T]) Range(f func(key T) bool)
- func (s *Set[T]) Remove(key T) bool
- func (s *Set[T]) Size() int
- func (s *Set[T]) Values() []T
- type Value
Functions ¶
func NewLastUsage ¶
func NewLastUsage(opts ...lastUsageOption) *lastUsage
func OnceFunc ¶
func WithClock ¶
func WithLock ¶
func WithLock[T any](l mutex, f func() T) T
func WithRLock ¶
func WithRLock[T any](l rwMutex, f func() T) T
Types ¶
type EventBroadcast ¶
type EventBroadcast struct {
// contains filtered or unexported fields
}
EventBroadcast is implementation of broadcast notify about event Zero value is usable, must not copy after first call any method
func (*EventBroadcast) Broadcast ¶
func (b *EventBroadcast) Broadcast()
func (*EventBroadcast) Waiter ¶
func (b *EventBroadcast) Waiter() OneTimeWaiter
Waiter return channel, that will close when next event will be broadcast. For prevent race between subscribe and event client code must subscribe at first, then check condition if false - wait closing channed and check condition again
type LastUsage ¶
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
func (*Map[K, V]) Clear ¶
func (*Map[K, V]) Delete ¶
func (*Map[K, V]) Extract ¶
func (*Map[K, V]) Get ¶
func (*Map[K, V]) Has ¶
func (*Map[K, V]) Len ¶
func (*Map[K, V]) Must ¶
func (m *Map[K, V]) Must(key K) (value V)
func (*Map[K, V]) Range ¶
func (*Map[K, V]) Set ¶
func (m *Map[K, V]) Set(key K, value V)
type Mutex ¶
func (*Mutex) WithLock ¶
func (l *Mutex) WithLock(f func())
type Once ¶
func OnceValue ¶
func (*Once[T]) Close ¶
func (*Once[T]) Get ¶
func (*Once[T]) Must ¶
func (v *Once[T]) Must() T
type OneTimeWaiter ¶
type OneTimeWaiter struct {
// contains filtered or unexported fields
}
func (*OneTimeWaiter) Done ¶
func (w *OneTimeWaiter) Done() <-chan struct{}
type Pool ¶
type Pool[T any] struct { New func() *T // contains filtered or unexported fields }
func (*Pool[T]) GetOrNew ¶
func (p *Pool[T]) GetOrNew() *T
func (*Pool[T]) GetOrNil ¶
func (p *Pool[T]) GetOrNil() *T
func (*Pool[T]) Put ¶
func (p *Pool[T]) Put(t *T)
type RWMutex ¶
func (*RWMutex) WithLock ¶
func (l *RWMutex) WithLock(f func())
func (*RWMutex) WithRLock ¶
func (l *RWMutex) WithRLock(f func())
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
func (*Set[T]) Add ¶
func (*Set[T]) Clear ¶
func (*Set[T]) Has ¶
func (*Set[T]) Range ¶
func (*Set[T]) Remove ¶
func (*Set[T]) Size ¶
func (*Set[T]) Values ¶
func (s *Set[T]) Values() []T
type Value ¶
type Value[T any] struct { // contains filtered or unexported fields }
func NewValue ¶
func (*Value[T]) Change ¶
func (v *Value[T]) Change(change func(old T) T)
func (*Value[T]) Get ¶
func (v *Value[T]) Get() T
Source Files ¶
event_broadcast.go last_usage_guard.go last_usage_guard_start.go map.go mutex.go once.go pool.go set.go value.go
- Version
- v3.99.2
- Published
- Jan 31, 2025
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 2 minutes ago –
Tools for package owners.