本文整理汇总了Golang中github.com/kylelemons/go-rpcgen/webrpc.ServeMux类的典型用法代码示例。如果您正苦于以下问题:Golang ServeMux类的具体用法?Golang ServeMux怎么用?Golang ServeMux使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ServeMux类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: RegisterLearnerWeb
// Register a LearnerWeb implementation with the given webrpc ServeMux.
// If mux is nil, the default webrpc.ServeMux is used.
func RegisterLearnerWeb(this LearnerWeb, mux webrpc.ServeMux) error {
if mux == nil {
mux = webrpc.DefaultServeMux
}
if err := mux.Handle("/Learner/Lookup", func(c *webrpc.Call) error {
in, out := new(File), new(File)
if err := c.ReadRequest(in); err != nil {
return err
}
if err := this.Lookup(c.Request, in, out); err != nil {
return err
}
return c.WriteResponse(out)
}); err != nil {
return err
}
if err := mux.Handle("/Learner/Learn", func(c *webrpc.Call) error {
in, out := new(Proposal), new(Ack)
if err := c.ReadRequest(in); err != nil {
return err
}
if err := this.Learn(c.Request, in, out); err != nil {
return err
}
return c.WriteResponse(out)
}); err != nil {
return err
}
return nil
}
开发者ID:kylelemons,项目名称:go-paxos,代码行数:32,代码来源:rpc.pb.go
示例2: RegisterAcceptorWeb
// Register a AcceptorWeb implementation with the given webrpc ServeMux.
// If mux is nil, the default webrpc.ServeMux is used.
func RegisterAcceptorWeb(this AcceptorWeb, mux webrpc.ServeMux) error {
if mux == nil {
mux = webrpc.DefaultServeMux
}
if err := mux.Handle("/Acceptor/Propose", func(c *webrpc.Call) error {
in, out := new(Proposal), new(Promise)
if err := c.ReadRequest(in); err != nil {
return err
}
if err := this.Propose(c.Request, in, out); err != nil {
return err
}
return c.WriteResponse(out)
}); err != nil {
return err
}
if err := mux.Handle("/Acceptor/Accept", func(c *webrpc.Call) error {
in, out := new(Proposal), new(Ack)
if err := c.ReadRequest(in); err != nil {
return err
}
if err := this.Accept(c.Request, in, out); err != nil {
return err
}
return c.WriteResponse(out)
}); err != nil {
return err
}
return nil
}
开发者ID:kylelemons,项目名称:go-paxos,代码行数:32,代码来源:rpc.pb.go
示例3: RegisterAddServiceWeb
// Register a AddServiceWeb implementation with the given webrpc ServeMux.
// If mux is nil, the default webrpc.ServeMux is used.
func RegisterAddServiceWeb(this AddServiceWeb, mux webrpc.ServeMux) error {
if mux == nil {
mux = webrpc.DefaultServeMux
}
if err := mux.Handle("/AddService/Add", func(c *webrpc.Call) error {
in, out := new(AddMessage), new(SumMessage)
if err := c.ReadRequest(in); err != nil {
return err
}
if err := this.Add(c.Request, in, out); err != nil {
return err
}
return c.WriteResponse(out)
}); err != nil {
return err
}
return nil
}
开发者ID:kylelemons,项目名称:go-rpcgen,代码行数:20,代码来源:addservice.pb.go
示例4: RegisterWhoamiServiceWeb
// Register a WhoamiServiceWeb implementation with the given webrpc ServeMux.
// If mux is nil, the default webrpc.ServeMux is used.
func RegisterWhoamiServiceWeb(this WhoamiServiceWeb, mux webrpc.ServeMux) error {
if mux == nil {
mux = webrpc.DefaultServeMux
}
if err := mux.Handle("/WhoamiService/Whoami", func(c *webrpc.Call) error {
in, out := new(Empty), new(YouAre)
if err := c.ReadRequest(in); err != nil {
return err
}
if err := this.Whoami(c.Request, in, out); err != nil {
return err
}
return c.WriteResponse(out)
}); err != nil {
return err
}
return nil
}
开发者ID:kylelemons,项目名称:go-rpcgen,代码行数:20,代码来源:whoami.ae.go
示例5: RegisterConcatServiceWeb
// Register a ConcatServiceWeb implementation with the given webrpc ServeMux.
// If mux is nil, the default webrpc.ServeMux is used.
func RegisterConcatServiceWeb(this ConcatServiceWeb, mux webrpc.ServeMux) error {
if mux == nil {
mux = webrpc.DefaultServeMux
}
if err := mux.Handle("/ConcatService/Concat", func(c *webrpc.Call) error {
in, out := new(Args), new(Return)
if err := c.ReadRequest(in); err != nil {
return err
}
if err := this.Concat(c.Request, in, out); err != nil {
return err
}
return c.WriteResponse(out)
}); err != nil {
return err
}
return nil
}
开发者ID:kylelemons,项目名称:go-rpcgen,代码行数:20,代码来源:service.pb.go
示例6: RegisterOffloadServiceWeb
// Register a OffloadServiceWeb implementation with the given webrpc ServeMux.
// If mux is nil, the default webrpc.ServeMux is used.
func RegisterOffloadServiceWeb(this OffloadServiceWeb, mux webrpc.ServeMux) error {
if mux == nil {
mux = webrpc.DefaultServeMux
}
if err := mux.Handle("/OffloadService/Compute", func(c *webrpc.Call) error {
in, out := new(DataSet), new(ResultSet)
if err := c.ReadRequest(in); err != nil {
return err
}
if err := this.Compute(c.Request, in, out); err != nil {
return err
}
return c.WriteResponse(out)
}); err != nil {
return err
}
return nil
}
开发者ID:kylelemons,项目名称:go-rpcgen,代码行数:20,代码来源:offload.pb.go
注:本文中的github.com/kylelemons/go-rpcgen/webrpc.ServeMux类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论