Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Reference License: MIT Go Version

vivid-protoVivid Actor 库提供基于 Protocol Buffers 的远程消息编解码器(Codec),用于 Remoting 跨节点通信时的消息序列化与反序列化。

特性

  • 实现 vivid.Codec 接口:可直接作为 WithActorSystemCodec 传入,与 Vivid Remoting 无缝集成
  • 类型名 + 载荷:通过包装消息(类型全名 + 二进制载荷)支持多 Proto 消息类型,无需为每种消息单独注册
  • 依赖精简:仅依赖 github.com/kercylan98/vividgoogle.golang.org/protobuf

系统要求与安装

  • Go:1.25.1+
  • 安装
go get github.com/kercylan98/vivid-proto

使用方式

  1. 在业务中定义 .proto 并生成 Go 代码(需在运行时被 protoregistry.GlobalTypes 注册,通常由 protoc 生成代码中的 init 完成)。
  2. 创建 Codec 并传给 Vivid 的 ActorSystem:
import (
    "github.com/kercylan98/vivid"
    "github.com/kercylan98/vivid-proto/pkg/codec"
    "github.com/kercylan98/vivid/pkg/bootstrap"
)

c := codec.New()
system := bootstrap.NewActorSystem(
    vivid.WithActorSystemRemoting("0.0.0.0:8080"),
    vivid.WithActorSystemCodec(c),
)

跨节点传递的消息须为 proto.Message;本地可继续使用任意类型,仅经 Remoting 发送的消息会经此 Codec 编解码。完整示例见 example

与 Vivid 的关系

  • vivid高性能、类型安全的 Go Actor 模型库,提供 Actor 系统、Remoting、监督策略等。
  • vivid-proto:为 Vivid 提供可选的 Proto Codec 实现,用于 Remoting 消息序列化。未使用 Remoting 或采用其他 Codec/RegisterCustomMessage 时无需本库。

许可证

MIT

About

Protocol Buffers Codec for Vivid Remoting — optional serialization for cross-node Actor messages.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages