示例#1
0
// 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
}
示例#2
0
// 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
}
示例#3
0
// 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
}
示例#4
0
// 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
}
示例#5
0
// 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
}
示例#6
0
// 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
}