Documentation ¶
Index ¶
- Variables
- func MakeFutureRespAsyncRet(fs IFutures, ctx context.Context, timeout ...time.Duration) (Future, RespAsyncRet)
- func MakeFutureRespAsyncRetT[T any](fs IFutures, ctx context.Context, timeout ...time.Duration) (Future, RespAsyncRetT[T])
- type Deduplication
- type Future
- type Futures
- type IDeduplication
- type IFutures
- type IMapEachElement
- type ISliceEachElement
- type Locked
- type LockedMap
- type LockedSlice
- func (ls *LockedSlice[T]) Append(values ...T)
- func (ls *LockedSlice[T]) Delete(idx ...int)
- func (ls *LockedSlice[T]) Each(fun generic.Action1[T])
- func (ls *LockedSlice[T]) Insert(idx int, values ...T)
- func (ls *LockedSlice[T]) Len() (l int)
- func (ls *LockedSlice[T]) Range(fun generic.Func1[T, bool])
- type RWLocked
- type RequestHandler
- type Resp
- type RespAsyncRet
- type RespAsyncRetT
- type RespDelegate
- type RespFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrFuturesClosed = errors.New("futures already closed") // Future控制器已关闭 ErrFutureNotFound = errors.New("future not found") // Future未找到 ErrFutureCanceled = errors.New("future canceled") // Future被取消 ErrFutureTimeout = errors.New("future timeout") // Future超时 ErrFutureRespIncorrectType = errors.New("future response has incorrect value type") // Future响应的返回值类型错误 ErrFutureReplyClosed = errors.New("future reply closed") // Future答复已关闭 )
Functions ¶
func MakeFutureRespAsyncRet ¶
func MakeFutureRespAsyncRet(fs IFutures, ctx context.Context, timeout ...time.Duration) (Future, RespAsyncRet)
MakeFutureRespAsyncRet 创建future与接收响应返回值的异步调用结果
func MakeFutureRespAsyncRetT ¶ added in v0.1.77
func MakeFutureRespAsyncRetT[T any](fs IFutures, ctx context.Context, timeout ...time.Duration) (Future, RespAsyncRetT[T])
MakeFutureRespAsyncRetT 创建future与接收响应返回值的异步调用结果
Types ¶
type Deduplication ¶
type Deduplication struct {
// contains filtered or unexported fields
}
Deduplication 去重器,用于保持幂等性
type Future ¶
type Future struct { Finish context.Context // 上下文 Id int64 // Id // contains filtered or unexported fields }
Future 异步模型Future
func MakeFuture ¶
MakeFuture 创建Future
type Futures ¶
type Futures struct { Ctx context.Context // 上下文 Id int64 // 请求id生成器 Timeout time.Duration // 请求超时时间 // contains filtered or unexported fields }
Futures Future控制器
func MakeFutures ¶
MakeFutures 创建Future控制器
type IDeduplication ¶
type IDeduplication interface { // Make 创建序号 Make() int64 // Validate 验证序号 Validate(remote string, seq int64) bool // Remove 删除对端 Remove(remote string) }
IDeduplication 去重器接口
type IFutures ¶
type IFutures interface { // Make 创建Future Make(ctx context.Context, resp Resp, timeout ...time.Duration) Future // Request 请求 Request(ctx context.Context, handler RequestHandler, timeout ...time.Duration) async.AsyncRet // Resolve 解决 Resolve(id int64, ret async.Ret) error // contains filtered or unexported methods }
IFutures Future控制器接口
type IMapEachElement ¶ added in v0.1.32
type IMapEachElement[K comparable, V any] interface { Each(fun generic.Action2[K, V]) }
type ISliceEachElement ¶ added in v0.1.32
type Locked ¶
type Locked[T any] struct { // contains filtered or unexported fields }
func MakeLocked ¶
type LockedMap ¶
type LockedMap[K comparable, V any] struct { RWLocked[map[K]V] }
func MakeLockedMap ¶
func MakeLockedMap[K comparable, V any](size int) LockedMap[K, V]
func NewLockedMap ¶
func NewLockedMap[K comparable, V any](size int) *LockedMap[K, V]
type LockedSlice ¶
func MakeLockedSlice ¶
func MakeLockedSlice[T any](len, cap int) LockedSlice[T]
func NewLockedSlice ¶
func NewLockedSlice[T any](len, cap int) *LockedSlice[T]
func (*LockedSlice[T]) Append ¶
func (ls *LockedSlice[T]) Append(values ...T)
func (*LockedSlice[T]) Delete ¶
func (ls *LockedSlice[T]) Delete(idx ...int)
func (*LockedSlice[T]) Each ¶ added in v0.1.32
func (ls *LockedSlice[T]) Each(fun generic.Action1[T])
func (*LockedSlice[T]) Insert ¶
func (ls *LockedSlice[T]) Insert(idx int, values ...T)
func (*LockedSlice[T]) Len ¶
func (ls *LockedSlice[T]) Len() (l int)
type RWLocked ¶
type RWLocked[T any] struct { // contains filtered or unexported fields }
func MakeRWLocked ¶
func NewRWLocked ¶
type RequestHandler ¶
type RespAsyncRet ¶
RespAsyncRet 接收响应返回值的异步调用结果
func (RespAsyncRet) CastAsyncRet ¶
func (ch RespAsyncRet) CastAsyncRet() async.AsyncRet
CastAsyncRet 转换为异步调用结果
type RespAsyncRetT ¶ added in v0.1.77
RespAsyncRetT 接收响应返回值的channel
func MakeRespAsyncRetT ¶ added in v0.1.77
func MakeRespAsyncRetT[T any]() RespAsyncRetT[T]
MakeRespAsyncRetT 创建接收响应返回值的异步调用结果
func (RespAsyncRetT[T]) CastAsyncRetT ¶ added in v0.1.77
func (ch RespAsyncRetT[T]) CastAsyncRetT() async.AsyncRetT[T]
CastAsyncRetT 转换为异步调用结果
type RespDelegate ¶
type RespDelegate[T any] generic.DelegateAction1[async.RetT[T]]
RespDelegate 接收响应返回值的委托
Click to show internal directories.
Click to hide internal directories.