aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/doc.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-04-12 20:03:21 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-04-12 20:03:21 +0800
commit8627680e24a29abd5f2aaaeaa2c1c852d8fb693b (patch)
tree1ad39e8b43d04e5a17c17c0b7314eece80620dd5 /rpc/doc.go
parent934f587bd5c38a36e8b8c8647a9e600d1751ff2f (diff)
parentaa9fff3e68b1def0a9a22009c233150bf9ba481f (diff)
downloadgo-tangerine-8627680e24a29abd5f2aaaeaa2c1c852d8fb693b.tar
go-tangerine-8627680e24a29abd5f2aaaeaa2c1c852d8fb693b.tar.gz
go-tangerine-8627680e24a29abd5f2aaaeaa2c1c852d8fb693b.tar.bz2
go-tangerine-8627680e24a29abd5f2aaaeaa2c1c852d8fb693b.tar.lz
go-tangerine-8627680e24a29abd5f2aaaeaa2c1c852d8fb693b.tar.xz
go-tangerine-8627680e24a29abd5f2aaaeaa2c1c852d8fb693b.tar.zst
go-tangerine-8627680e24a29abd5f2aaaeaa2c1c852d8fb693b.zip
Merge pull request #2359 from bas-vk/rpc-optional-args
rpc: several fixes and support for optional arguments
Diffstat (limited to 'rpc/doc.go')
-rw-r--r--rpc/doc.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/rpc/doc.go b/rpc/doc.go
index c9dba3270..77202634f 100644
--- a/rpc/doc.go
+++ b/rpc/doc.go
@@ -29,11 +29,23 @@ Methods that satisfy the following criteria are made available for remote access
- method returned value(s) must be exported or builtin types
An example method:
- func (s *CalcService) Div(a, b int) (int, error)
+ func (s *CalcService) Add(a, b int) (int, error)
When the returned error isn't nil the returned integer is ignored and the error is
send back to the client. Otherwise the returned integer is send back to the client.
+Optional arguments are supported by accepting pointer values as arguments. E.g.
+if we want to do the addition in an optional finite field we can accept a mod
+argument as pointer value.
+
+ func (s *CalService) Add(a, b int, mod *int) (int, error)
+
+This RPC method can be called with 2 integers and a null value as third argument.
+In that case the mod argument will be nil. Or it can be called with 3 integers,
+in that case mod will be pointing to the given third argument. Since the optional
+argument is the last argument the RPC package will also accept 2 integers as
+arguments. It will pass the mod argument as nil to the RPC method.
+
The server offers the ServeCodec method which accepts a ServerCodec instance. It will
read requests from the codec, process the request and sends the response back to the
client using the codec. The server can execute requests concurrently. Responses