1 Star 0 Fork 0

jack/protoactor-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
middleware_chain.go 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
Roger Johansson 提交于 2022-04-14 21:01 . gofmpt
package actor
func makeReceiverMiddlewareChain(receiverMiddleware []ReceiverMiddleware, lastReceiver ReceiverFunc) ReceiverFunc {
if len(receiverMiddleware) == 0 {
return nil
}
h := receiverMiddleware[len(receiverMiddleware)-1](lastReceiver)
for i := len(receiverMiddleware) - 2; i >= 0; i-- {
h = receiverMiddleware[i](h)
}
return h
}
func makeSenderMiddlewareChain(senderMiddleware []SenderMiddleware, lastSender SenderFunc) SenderFunc {
if len(senderMiddleware) == 0 {
return nil
}
h := senderMiddleware[len(senderMiddleware)-1](lastSender)
for i := len(senderMiddleware) - 2; i >= 0; i-- {
h = senderMiddleware[i](h)
}
return h
}
func makeContextDecoratorChain(decorator []ContextDecorator, lastDecorator ContextDecoratorFunc) ContextDecoratorFunc {
if len(decorator) == 0 {
return nil
}
h := decorator[len(decorator)-1](lastDecorator)
for i := len(decorator) - 2; i >= 0; i-- {
h = decorator[i](h)
}
return h
}
func makeSpawnMiddlewareChain(spawnMiddleware []SpawnMiddleware, lastSpawn SpawnFunc) SpawnFunc {
if len(spawnMiddleware) == 0 {
return nil
}
h := spawnMiddleware[len(spawnMiddleware)-1](lastSpawn)
for i := len(spawnMiddleware) - 2; i >= 0; i-- {
h = spawnMiddleware[i](h)
}
return h
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wujianhai/protoactor-go.git
git@gitee.com:wujianhai/protoactor-go.git
wujianhai
protoactor-go
protoactor-go
99a34e4ec9eb

搜索帮助