Giter VIP home page Giter VIP logo

littlerpc's People

Contributors

zbh255 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

littlerpc's Issues

完善client的负载均衡的功能

  • 提供选择器Selector来接入各种负载均衡算法,主要兼容一致性hash,
  • 提供重试选项配合选择器来让重新选择需要发送数据的节点

提供异步调用API

LittleRpc目前的提供的API是同步模式的,虽然性能上也能满足需求,但是其后续请求响应时间可能受限于一次响应比较慢的调用,响应比较慢可能是因为传输的数据量比较大等原因,所以提供异步调用的API以用来减少这种情况,让其不会阻塞后续比较小数据量的调用。

目前设计的API原型

AsyncCall(processName string,args ...interface{}) (rep []interface{},err error)
RegisterCallBack(processName string,fn func(rep []interface{},err err error))

生成器也必须生成一套支持异步调用语义的接口与实现

type TestHybridInter interface {
    Say(str sting) (string,error)
    SayAsync(str string) error
    RegisterSayCallBack(fn func(_ string,_ error))
}

优化捕捉到panic时输出的信息

主要优化使用到goroutine pool代码的client&server
优雅地打印堆栈信息以确定panic的原因, 最好还能像gin那样判断panic是携带的error类型, 不同类型做不同的处理

Rpc错误的新定义

旧的关于error定义和解析的API相当不友好, 也只能使用Json Codec, 不是一个好的设计
新的错误应该符合以下几个条件

  • 清晰明了的API
  • 易于扩展和自定义的
  • 可以兼容不同的Codec

目前的实现的缺点

  • 通过返回0来定义Nil错误
  • 只能使用Json Codec (在数据量大时效率低下)
  • 简易的API (难以使用)

v0.30 Release Plain

  • 支持自定义的Codec
  • Codec接口中新增新的API,来让Codec自己来处理littlerpc自动注入的error
UnmarshalError(data []byte,i interface{}) error
MarshalError(i interface{}) ([]byte,error)
  • 更改Client.Call的API约定,将所有远程过程的返回值都存放在Rep([]interface{})
  • 生成器pxtor能够生成符合新的API规范的代码
  • 完善一部分文档
  • 实现可以替换通信协议的接口

go test 覆盖率的问题

LittleRpc/impl中存放的是具体的client&server的具体实现,而其测试代码因为要同时用到client&server的API,不能将测试代码安排在client&server包中,所以被安排在了主目录下,但是在go test -v -cover ./...执行完毕后,test包中每个测试项都被执行了,impl中显示的覆盖率为%5.1
这显然是不正常的,在初步了解到了go test覆盖率计算的-coverpkg,也即测试的代码和被测试的代码不在同一个包中,我意识到要想保证正确的覆盖率,我需要一种新的测试方法。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.