feat(common): 添加无锁并发工具包依赖
新增 lockfree-1.1.3 工具包到 go.work 文件中,为项目提供无锁并发数据结构支持, 提升高并发场景下的性能表现。
This commit is contained in:
16
common/utils/lockfree-1.1.3/handler.go
Normal file
16
common/utils/lockfree-1.1.3/handler.go
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) THL A29 Limited, a Tencent company. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
*/
|
||||
|
||||
package lockfree
|
||||
|
||||
// EventHandler 事件处理器接口
|
||||
// 整个无锁队列中唯一需要用户实现的接口,该接口描述消费端收到消息时该如何处理
|
||||
// 使用泛型,通过编译阶段确定事件类型,提高性能
|
||||
type EventHandler[T any] interface {
|
||||
// OnEvent 用户侧实现,事件处理方法
|
||||
OnEvent(t T)
|
||||
}
|
||||
Reference in New Issue
Block a user