package xsync

import "github.com/ydb-platform/ydb-go-sdk/v3/internal/xsync"

Index

Functions

func NewLastUsage

func NewLastUsage(opts ...lastUsageOption) *lastUsage

func OnceFunc

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

func WithClock

func WithClock(clock clockwork.Clock) lastUsageOption

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 LastUsage interface {
	Get() time.Time
	Start() (stop func())
}

type Mutex

type Mutex struct {
	sync.Mutex
}

func (*Mutex) WithLock

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

type Once

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

func OnceValue

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

func (*Once[T]) Close

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

func (*Once[T]) Get

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

type OneTimeWaiter

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

func (*OneTimeWaiter) Done

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

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())

Source Files

event_broadcast.go last_usage_guard.go mutex.go once.go

Version
v3.67.1
Published
May 17, 2024
Platform
js/wasm
Imports
7 packages
Last checked
2 minutes ago

Tools for package owners.