# README
stack
stack旨在为中国开发者提供通用的分布式服务微服务开发库(比如配置管理、服务发现、熔断降级、路由、服务代理、安全、主从选举等)。基于Stack,开发者可以快速投入自身的业务开发中,只需要极少的学习成本。Stack适用于中小规模的开发场景,她可以轻易在桌面电脑、服务器、容器集群中搭建分布式服务。
最新版本:v1.0.1-rc1
开发计划:Projects
开发手册
交流
公众号 | 讨论群 |
![]() | ![]() |
讨论群:微信搜索MicroHQ,备注来源:“github”
支持我们:点击右上方Star支持项目发展,捐赠链接
简单易用
启动一个微服务只需要如下代码
func main() {
service := stack.NewService(stack.Name("stack.rpc.greeter"))
service.Init()
service.Run()
}
我们封装了微服务内在的复杂度,比如服务注册与发现、配置管理等。用户只需要花极小的成本学习如何暴露接口,如何启动服务,剩下的精力完全投放在业务需求的开发上。
特性
stack既提供轻量的开发库,同时也提供对应高级别的扩展库,为大家带来开箱即用的开发体验。
支持的特性主要有:
- 分布式配置
- 服务注册与发现
- 服务路由
- 远程服务调用
- 负载均衡
- 链路中断与降级
- 分布式锁[todo]
- 主从选举[todo]
- 分布式广播
开始使用
我们为一直为大家准备持续开发、更新、愈加丰富的文档与资料:StackLabs
鸣谢
- 感谢Go-Micro库,提供优秀的扩展性极强的原始框架,stack作为衍生版本,受益颇多,同时Go-Micro的肄业也给stack创造了生命
- 感谢Spring-Cloud,作为使用最广泛的开源分布式开发库,我们参考了她许多优秀的设计与文档
- 感谢各位Go-Micro的历史提交者,他们的代码永远运行在大家的内存中
- 感谢各位支持StackLabs中国发展的贡献者们
# Packages
No description provided by the author
Package auth provides authentication and authorization capability.
Package broker is an interface used for asynchronous messaging.
Package client is an interface for an RPC client.
Package cmd is an interface for parsing the command line.
Package codec is an interface for encoding messages.
No description provided by the author
Package debug provides stack debug packages.
No description provided by the author
Package log provides a log interface.
Package monitor monitors service health.
No description provided by the author
No description provided by the author
Package proxy is a transparent proxy built on the stack/server.
Package registry is an interface for service discovery.
Package router provides a network routing control plane.
Package server is an interface for a stack server.
No description provided by the author
Package store is an interface for distribute data storage.
Package sync is a distributed synchronization framework.
No description provided by the author
Package transport is an interface for synchronous connection based communication.
No description provided by the author
# Functions
No description provided by the author
Address sets the address of the server.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Context specifies a context for the service.
No description provided by the author
FromContext retrieves a Service from the Context.
HandleSignal toggles automatic installation of the signal handler that traps TERM, INT, and QUIT.
Unique server id.
No description provided by the author
Metadata associated with the service.
Name of the service.
NewContext returns a new Context with the Service embedded within it.
NewGRPCService creates and returns a new web Service based on the packages within.
NewPublisher returns a new Publisher.
NewService creates and returns a new Service based on the packages within.
NewWebService creates and returns a new web Service based on the packages within.
Profile to be used for debug profile.
RegisterHandler is syntactic sugar for registering a handler.
RegisterInterval specifies the interval on which to re-register.
RegisterSubscriber is syntactic sugar for registering a subscriber.
RegisterTTL specifies the TTL to use when registering the service.
Registry sets the registry for the service and the underlying components.
Selector sets the selector for the service client.
No description provided by the author
Transport sets the transport for the service and the underlying components.
Version of the service.
No description provided by the author
No description provided by the author
No description provided by the author
WrapCall is a convenience method for wrapping a Client CallFunc.
WrapClient is a convenience method for wrapping a Client with some middleware component.
WrapHandler adds a handler Wrapper to a list of service.Options passed into the server.
WrapSubscriber adds a subscriber Wrapper to a list of service.Options passed into the server.
# Interfaces
Publisher is syntactic sugar for publishing.