xsync

package
v3.81.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLastUsage added in v3.65.0

func NewLastUsage(opts ...lastUsageOption) *lastUsage

func OnceFunc added in v3.58.0

func OnceFunc(f func(ctx context.Context) error) func(ctx context.Context) error

func WithClock added in v3.65.0

func WithClock(clock clockwork.Clock) lastUsageOption

func WithLock added in v3.77.0

func WithLock[T any](l mutex, f func() T) T

func WithRLock added in v3.77.0

func WithRLock[T any](l rwMutex, f func() T) T

Types

type EventBroadcast added in v3.38.0

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 added in v3.38.0

func (b *EventBroadcast) Broadcast()

func (*EventBroadcast) Waiter added in v3.38.0

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 added in v3.65.0

type LastUsage interface {
	Get() time.Time
	Start() (stop func())
}

type Map added in v3.75.1

type Map[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*Map[K, V]) Clear added in v3.75.1

func (m *Map[K, V]) Clear() (removed int)

func (*Map[K, V]) Delete added in v3.76.0

func (m *Map[K, V]) Delete(key K) bool

func (*Map[K, V]) Extract added in v3.76.2

func (m *Map[K, V]) Extract(key K) (value V, ok bool)

func (*Map[K, V]) Get added in v3.76.2

func (m *Map[K, V]) Get(key K) (value V, ok bool)

func (*Map[K, V]) Has added in v3.75.1

func (m *Map[K, V]) Has(key K) bool

func (*Map[K, V]) Len added in v3.79.1

func (m *Map[K, V]) Len() int

func (*Map[K, V]) Must added in v3.75.1

func (m *Map[K, V]) Must(key K) (value V)

func (*Map[K, V]) Range added in v3.75.1

func (m *Map[K, V]) Range(f func(key K, value V) bool)

func (*Map[K, V]) Set added in v3.76.2

func (m *Map[K, V]) Set(key K, value V)

type Mutex

type Mutex struct {
	sync.Mutex
}

func (*Mutex) WithLock

func (l *Mutex) WithLock(f func())

type Once added in v3.59.0

type Once[T closer.Closer] struct {
	// contains filtered or unexported fields
}

func OnceValue added in v3.58.0

func OnceValue[T closer.Closer](f func() (T, error)) *Once[T]

func (*Once[T]) Close added in v3.59.0

func (v *Once[T]) Close(ctx context.Context) (err error)

func (*Once[T]) Get added in v3.59.0

func (v *Once[T]) Get() (T, error)

func (*Once[T]) Must added in v3.75.1

func (v *Once[T]) Must() T

type OneTimeWaiter added in v3.38.0

type OneTimeWaiter struct {
	// contains filtered or unexported fields
}

func (*OneTimeWaiter) Done added in v3.38.0

func (w *OneTimeWaiter) Done() <-chan struct{}

type Pool added in v3.75.0

type Pool[T any] struct {
	New func() *T
	// contains filtered or unexported fields
}

func (*Pool[T]) GetOrNew added in v3.75.0

func (p *Pool[T]) GetOrNew() *T

func (*Pool[T]) GetOrNil added in v3.75.0

func (p *Pool[T]) GetOrNil() *T

func (*Pool[T]) Put added in v3.75.0

func (p *Pool[T]) Put(t *T)

type RWMutex

type RWMutex struct {
	sync.RWMutex
}

func (*RWMutex) WithLock

func (l *RWMutex) WithLock(f func())

func (*RWMutex) WithRLock

func (l *RWMutex) WithRLock(f func())

type Set added in v3.76.0

type Set[T comparable] struct {
	// contains filtered or unexported fields
}

func (*Set[T]) Add added in v3.76.0

func (s *Set[T]) Add(key T) bool

func (*Set[T]) Clear added in v3.76.0

func (s *Set[T]) Clear() (removed int)

func (*Set[T]) Has added in v3.76.0

func (s *Set[T]) Has(key T) bool

func (*Set[T]) Range added in v3.77.0

func (s *Set[T]) Range(f func(key T) bool)

func (*Set[T]) Remove added in v3.76.0

func (s *Set[T]) Remove(key T) bool

func (*Set[T]) Size added in v3.76.2

func (s *Set[T]) Size() int

func (*Set[T]) Values added in v3.77.0

func (s *Set[T]) Values() []T

type Value added in v3.77.0

type Value[T any] struct {
	// contains filtered or unexported fields
}

func NewValue added in v3.77.0

func NewValue[T any](initValue T) *Value[T]

func (*Value[T]) Change added in v3.77.0

func (v *Value[T]) Change(change func(old T) T)

func (*Value[T]) Get added in v3.77.0

func (v *Value[T]) Get() T

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL