diff options
author | Aleksander Mistewicz <a.mistewicz@samsung.com> | 2018-02-16 12:53:48 +0100 |
---|---|---|
committer | Maciej Wereski <m.wereski@partner.samsung.com> | 2018-03-05 18:28:02 +0100 |
commit | 5bd1a19b0a737f973cf3a459bd437795f0a492fc (patch) | |
tree | fa13de32f6d15769b3685e7f23bc9e490ba6e7c2 /rpc | |
parent | 65bf4f697192890bb8540c2e8c8b5d7edd8bbd53 (diff) | |
download | boruta-5bd1a19b0a737f973cf3a459bd437795f0a492fc.tar.gz boruta-5bd1a19b0a737f973cf3a459bd437795f0a492fc.tar.bz2 boruta-5bd1a19b0a737f973cf3a459bd437795f0a492fc.zip |
Add generated client and server for Dryad
It uses go-rpcgen which can be installed with the following command:
go get github.com/alecthomas/go-rpcgen
Command used to generate RPC stubs:
go-rpcgen --source=boruta.go --type=Dryad \
--target=rpc/dryad/dryad.go \
--package dryad \
--imports "net/rpc",".=git.tizen.org/tools/boruta"
Change-Id: I20ffdc4f5f93cb57bde8878a371f88b507c24864
Reviewed-on: https://mcdsrvbld02.digital.local/review/49762
Reviewed-by: Maciej Wereski <m.wereski@partner.samsung.com>
Tested-by: Maciej Wereski <m.wereski@partner.samsung.com>
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/dryad/dryad.go | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/rpc/dryad/dryad.go b/rpc/dryad/dryad.go new file mode 100644 index 0000000..d1a6796 --- /dev/null +++ b/rpc/dryad/dryad.go @@ -0,0 +1,113 @@ +// Generated by go-rpcgen. Do not modify. + +package dryad + +import ( + "crypto/rsa" + . "git.tizen.org/tools/boruta" + "net/rpc" +) + +// DryadService is generated service for Dryad interface. +type DryadService struct { + impl Dryad +} + +// NewDryadService creates a new DryadService instance. +func NewDryadService(impl Dryad) *DryadService { + return &DryadService{impl} +} + +// RegisterDryadService registers impl in server. +func RegisterDryadService(server *rpc.Server, impl Dryad) error { + return server.RegisterName("Dryad", NewDryadService(impl)) +} + +// DryadPutInMaintenanceRequest is a helper structure for PutInMaintenance method. +type DryadPutInMaintenanceRequest struct { + Msg string +} + +// DryadPutInMaintenanceResponse is a helper structure for PutInMaintenance method. +type DryadPutInMaintenanceResponse struct { +} + +// PutInMaintenance is RPC implementation of PutInMaintenance calling it. +func (s *DryadService) PutInMaintenance(request *DryadPutInMaintenanceRequest, response *DryadPutInMaintenanceResponse) (err error) { + err = s.impl.PutInMaintenance(request.Msg) + return +} + +// DryadPrepareRequest is a helper structure for Prepare method. +type DryadPrepareRequest struct { +} + +// DryadPrepareResponse is a helper structure for Prepare method. +type DryadPrepareResponse struct { + Key *rsa.PrivateKey +} + +// Prepare is RPC implementation of Prepare calling it. +func (s *DryadService) Prepare(request *DryadPrepareRequest, response *DryadPrepareResponse) (err error) { + response.Key, err = s.impl.Prepare() + return +} + +// DryadHealthcheckRequest is a helper structure for Healthcheck method. +type DryadHealthcheckRequest struct { +} + +// DryadHealthcheckResponse is a helper structure for Healthcheck method. +type DryadHealthcheckResponse struct { +} + +// Healthcheck is RPC implementation of Healthcheck calling it. +func (s *DryadService) Healthcheck(request *DryadHealthcheckRequest, response *DryadHealthcheckResponse) (err error) { + err = s.impl.Healthcheck() + return +} + +// DryadClient is generated client for Dryad interface. +type DryadClient struct { + client *rpc.Client +} + +// DialDryadClient connects to addr and creates a new DryadClient instance. +func DialDryadClient(addr string) (*DryadClient, error) { + client, err := rpc.Dial("tcp", addr) + return &DryadClient{client}, err +} + +// NewDryadClient creates a new DryadClient instance. +func NewDryadClient(client *rpc.Client) *DryadClient { + return &DryadClient{client} +} + +// Close terminates the connection. +func (_c *DryadClient) Close() error { + return _c.client.Close() +} + +// PutInMaintenance is part of implementation of Dryad calling corresponding method on RPC server. +func (_c *DryadClient) PutInMaintenance(msg string) (err error) { + _request := &DryadPutInMaintenanceRequest{msg} + _response := &DryadPutInMaintenanceResponse{} + err = _c.client.Call("Dryad.PutInMaintenance", _request, _response) + return err +} + +// Prepare is part of implementation of Dryad calling corresponding method on RPC server. +func (_c *DryadClient) Prepare() (key *rsa.PrivateKey, err error) { + _request := &DryadPrepareRequest{} + _response := &DryadPrepareResponse{} + err = _c.client.Call("Dryad.Prepare", _request, _response) + return _response.Key, err +} + +// Healthcheck is part of implementation of Dryad calling corresponding method on RPC server. +func (_c *DryadClient) Healthcheck() (err error) { + _request := &DryadHealthcheckRequest{} + _response := &DryadHealthcheckResponse{} + err = _c.client.Call("Dryad.Healthcheck", _request, _response) + return err +} |