Versions in this module Expand all Collapse all v0 v0.1.25 Jan 22, 2024 v0.1.24 Jan 22, 2024 v0.1.23 Jan 22, 2024 v0.1.22 Jan 22, 2024 v0.1.21 Jan 19, 2024 v0.1.20 Jan 13, 2024 v0.1.19 Jan 13, 2024 Changes in this version + var ErrFutureCanceled = errors.New("future canceled") + var ErrFutureNotFound = errors.New("future not found") + var ErrFutureReplyClosed = errors.New("future reply closed") + var ErrFutureRespIncorrectType = errors.New("future response has incorrect value type") + var ErrFutureTimeout = errors.New("future timeout") + var ErrFuturesClosed = errors.New("futures already closed") + func MakeFutureRespAsyncRet(fs IFutures, ctx context.Context, timeout ...time.Duration) (Future, RespAsyncRet) + func MakeFutureRespChan[T any](fs IFutures, ctx context.Context, timeout ...time.Duration) (Future, RespChan[T]) + type Deduplication struct + func MakeDeduplication() Deduplication + func (d *Deduplication) MakeSeq() int64 + func (d *Deduplication) Remove(remote string) + func (d *Deduplication) ValidateSeq(remote string, seq int64) (passed bool) + type Future struct + Finish context.Context + Id int64 + func MakeFuture[T Resp](fs IFutures, ctx context.Context, resp T, timeout ...time.Duration) Future + func (f Future) Cancel(err error) + func (f Future) Wait(ctx context.Context) + type Futures struct + Ctx context.Context + Id int64 + Timeout time.Duration + func MakeFutures(ctx context.Context, timeout time.Duration) Futures + func (fs *Futures) Make(ctx context.Context, resp Resp, timeout ...time.Duration) Future + func (fs *Futures) Request(ctx context.Context, handler RequestHandler, timeout ...time.Duration) runtime.AsyncRet + func (fs *Futures) Resolve(id int64, ret Ret[any]) error + type IDeduplication interface + MakeSeq func() int64 + Remove func(remote string) + ValidateSeq func(remote string, seq int64) bool + type IFutures interface + Make func(ctx context.Context, resp Resp, timeout ...time.Duration) Future + Request func(ctx context.Context, handler RequestHandler, timeout ...time.Duration) runtime.AsyncRet + Resolve func(id int64, ret Ret[any]) error + type Locked struct + func MakeLocked[T any](obj T) Locked[T] + func NewLocked[T any](obj T) *Locked[T] + func (l *Locked[T]) AutoLock(fun generic.Action1[*T]) + type LockedMap struct + func MakeLockedMap[K comparable, V any](size int) LockedMap[K, V] + func NewLockedMap[K comparable, V any](size int) *LockedMap[K, V] + func (lm *LockedMap[K, V]) Delete(k K) + func (lm *LockedMap[K, V]) Get(k K) (v V, ok bool) + func (lm *LockedMap[K, V]) Insert(k K, v V) + func (lm *LockedMap[K, V]) Len() (l int) + type LockedSlice struct + func MakeLockedSlice[T any](len, cap int) LockedSlice[T] + func NewLockedSlice[T any](len, cap int) *LockedSlice[T] + func (ls *LockedSlice[T]) Append(values ...T) + func (ls *LockedSlice[T]) Delete(idx ...int) + func (ls *LockedSlice[T]) Insert(idx int, values ...T) + func (ls *LockedSlice[T]) Len() (l int) + type RWLocked struct + func MakeRWLocked[T any](obj T) RWLocked[T] + func NewRWLocked[T any](obj T) *RWLocked[T] + func (l *RWLocked[T]) AutoLock(fun generic.Action1[*T]) + func (l *RWLocked[T]) AutoRLock(fun generic.Action1[*T]) + type Reply <-chan Ret[T] + func (reply Reply[T]) Wait(ctx context.Context) Ret[T] + type RequestHandler = generic.Action1[Future] + type Resp interface + Push func(ret Ret[any]) error + type RespAsyncRet chan runtime.Ret + func MakeRespAsyncRet() RespAsyncRet + func (resp RespAsyncRet) CastAsyncRet() runtime.AsyncRet + func (resp RespAsyncRet) Push(ret Ret[any]) error + type RespChan chan Ret[T] + func MakeRespChan[T any]() RespChan[T] + func (resp RespChan[T]) CastReply() Reply[T] + func (resp RespChan[T]) Push(ret Ret[any]) error + type RespDelegate generic.DelegateAction1[Ret[T]] + func (resp RespDelegate[T]) Push(ret Ret[any]) error + type RespFunc generic.Action1[Ret[T]] + func (resp RespFunc[T]) Push(ret Ret[any]) error + type Ret struct + Error error + Value T + func MakeRet[T any](val T, err error) Ret[T] + func (ret Ret[T]) OK() bool