-=Remote Procedure Call=\r
-Databoard RPC is a method call interface. \r
-Server is an object that handles service requests. \r
-The server publishes an [[#Interfaces]] that contains a list of callable methods.\r
-\r
-===Network Protocol===\r
-The protocol is very simple. There are two conversing peers, one is ''the client'' and the other ''the server''.\r
-Both parties introduce callable ''network interface''. Typically, the server's has plenty of procedures, and client's \r
-has some callbacks. \r
-The connection starts with handshake and is then followed by repeating conversation of writing ''Requests'' and reading ''Responses''.\r
-\r
-In handshake, boths peers write their ''InterfaceDescription'' and message size limits. \r
-(See [[#Definitions|Definitions]]).\r
-Then both parties make a decision to whether accept or reject the other's interface.\r
-\r
-=Interfaces=\r
-''A function type'' can be constructed as <tt>D -> R</tt>, where <tt>D</tt> is the domain and <tt>R</tt> the range of the function.\r
-If the function can throw exceptions, it is denoted as <tt>D -> R throws E<sub>1</sub>, ..., E<sub>k</sub></tt>, where\r
-<tt>E<sub>i</sub></tt> is a datatype for an exception. Multi-parameter types can be defined using the tuple notation:\r
- Double -> Double\r
- () -> String\r
- (Integer,Integer) -> Integer\r
- Integer -> Integer throws IndexOutOfRange\r
-\r
-''A method definition'' is a combination of name and method type. \r
-The format is following, <tt>method M : T</tt>, where <tt>M</tt> is the name and <tt>T</tt> the type of the method. \r
-<tt>T</tt> has to be a function type. \r
- method getSamples : TimeSegment -> Sample[],\r
- method read : ReadRequest -> Sample,\r
- method getValueBounds : TimeSegment -> Sample[2]\r
-\r
-''Interface'' is a specification of fields and methods the interface has to have. \r
-The interface is defined as a record that contains fields and methods definitions in the curly braces.\r
- interface HistoryRecord = {\r
- records : TimeSeries,\r
- \r
- method getSamples : TimeSegment -> Sample[],\r
- method read : ReadRequest -> Sample,\r
- method getValueBounds : TimeSegment -> Sample[2]\r
- }\r
-\r
-Interfaces may extend other interfaces. This is denoted as <tt>interface I extends B<sub>1</sub>, ..., B<sub>k</sub> { ... }</tt>.\r
- interface MutableHistoryRecord extends HistoryRecord = {\r
- method write : Sample[] -> {},\r
- method clear : {} -> {}\r
- }\r
-\r
-====Request====\r
-Client sends RequestHeader, followed by a serialization of the message's request argument.\r
-The datatype and thus serialization format of the request argument was defined in MethodType which was informed by the server in the handshake. \r
-\r
-The server processes the procedure request.\r
-* On procedure success, ResponseHeader is sent, followed by a serialization of ResponseType. ResponseType serialization format was declared in MethodType.\r
-* On procedure failure, ExecutionError_ is sent, followed by a serialization of ErrorType. ErrorType format was declared in MethodType.\r
-* On unexpected error, Exception_ is sent\r
-* On invalid method number, InvalidMethodError is sent\r
-* On request or response message size exceeded, ResponseTooLargeError is sent\r
-\r
-\r
-==Definitions==\r
- type Interface = {\r
- methodDefinitions : Map(MethodTypeDefinition, {})\r
- }\r
- \r
- type InterfaceDefinition = {\r
- name : String,\r
- type : Interface\r
- }\r
- \r
- type MethodType = {\r
- requestType : DataType,\r
- responseType : DataType,\r
- errorType : UnionType\r
- }\r
- \r
- type MethodTypeDefinition = {\r
- name : String,\r
- type : MethodType\r
- }\r
-\r
- type Handshake = | Version0\r
- \r
- type Version0 = {\r
- recvMsgLimit : Integer,\r
- sendMsgLimit : Integer,\r
- methods : MethodTypeDefinition[]\r
- }\r
- \r
- type Message = | RequestHeader RequestHeader \r
- | ResponseHeader ResponseHeader\r
- | ExecutionError_ ExecutionError_\r
- | Exception_ Exception_\r
- | InvalidMethodError InvalidMethodError\r
- | ResponseTooLarge ResponseTooLarge\r
- \r
- type RequestHeader = {\r
- requestId : Integer,\r
- methodId : Integer\r
- }\r
- \r
- type ResponseHeader = {\r
- requestId : Integer\r
- }\r
- \r
- type ExecutionError_ = {\r
- requestId : Integer\r
- }\r
- \r
- type InvalidMethodError = {\r
- requestId : Integer\r
- }\r
- \r
- type Exception_ = {\r
- requestId : Integer, \r
- message : String\r
- }\r
- \r
- type ResponseTooLarge = {\r
- requestId : Integer \r
- }\r
+=Remote Procedure Call=
+Databoard RPC is a method call interface.
+Server is an object that handles service requests.
+The server publishes an [[#Interfaces]] that contains a list of callable methods.
+
+===Network Protocol===
+The protocol is very simple. There are two conversing peers, one is ''the client'' and the other ''the server''.
+Both parties introduce callable ''network interface''. Typically, the server's has plenty of procedures, and client's
+has some callbacks.
+The connection starts with handshake and is then followed by repeating conversation of writing ''Requests'' and reading ''Responses''.
+
+In handshake, boths peers write their ''InterfaceDescription'' and message size limits.
+(See [[#Definitions|Definitions]]).
+Then both parties make a decision to whether accept or reject the other's interface.
+
+=Interfaces=
+''A function type'' can be constructed as <tt>D -> R</tt>, where <tt>D</tt> is the domain and <tt>R</tt> the range of the function.
+If the function can throw exceptions, it is denoted as <tt>D -> R throws E<sub>1</sub>, ..., E<sub>k</sub></tt>, where
+<tt>E<sub>i</sub></tt> is a datatype for an exception. Multi-parameter types can be defined using the tuple notation:
+ Double -> Double
+ () -> String
+ (Integer,Integer) -> Integer
+ Integer -> Integer throws IndexOutOfRange
+
+''A method definition'' is a combination of name and method type.
+The format is following, <tt>method M : T</tt>, where <tt>M</tt> is the name and <tt>T</tt> the type of the method.
+<tt>T</tt> has to be a function type.
+ method getSamples : TimeSegment -> Sample[],
+ method read : ReadRequest -> Sample,
+ method getValueBounds : TimeSegment -> Sample[2]
+
+''Interface'' is a specification of fields and methods the interface has to have.
+The interface is defined as a record that contains fields and methods definitions in the curly braces.
+ interface HistoryRecord = {
+ records : TimeSeries,
+
+ method getSamples : TimeSegment -> Sample[],
+ method read : ReadRequest -> Sample,
+ method getValueBounds : TimeSegment -> Sample[2]
+ }
+
+Interfaces may extend other interfaces. This is denoted as <tt>interface I extends B<sub>1</sub>, ..., B<sub>k</sub> { ... }</tt>.
+ interface MutableHistoryRecord extends HistoryRecord = {
+ method write : Sample[] -> {},
+ method clear : {} -> {}
+ }
+
+====Request====
+Client sends RequestHeader, followed by a serialization of the message's request argument.
+The datatype and thus serialization format of the request argument was defined in MethodType which was informed by the server in the handshake.
+
+The server processes the procedure request.
+* On procedure success, ResponseHeader is sent, followed by a serialization of ResponseType. ResponseType serialization format was declared in MethodType.
+* On procedure failure, ExecutionError_ is sent, followed by a serialization of ErrorType. ErrorType format was declared in MethodType.
+* On unexpected error, Exception_ is sent
+* On invalid method number, InvalidMethodError is sent
+* On request or response message size exceeded, ResponseTooLargeError is sent
+
+
+==Definitions==
+ type Interface = {
+ methodDefinitions : Map(MethodTypeDefinition, {})
+ }
+
+ type InterfaceDefinition = {
+ name : String,
+ type : Interface
+ }
+
+ type MethodType = {
+ requestType : DataType,
+ responseType : DataType,
+ errorType : UnionType
+ }
+
+ type MethodTypeDefinition = {
+ name : String,
+ type : MethodType
+ }
+
+ type Handshake = | Version0
+
+ type Version0 = {
+ recvMsgLimit : Integer,
+ sendMsgLimit : Integer,
+ methods : MethodTypeDefinition[]
+ }
+
+ type Message = | RequestHeader RequestHeader
+ | ResponseHeader ResponseHeader
+ | ExecutionError_ ExecutionError_
+ | Exception_ Exception_
+ | InvalidMethodError InvalidMethodError
+ | ResponseTooLarge ResponseTooLarge
+
+ type RequestHeader = {
+ requestId : Integer,
+ methodId : Integer
+ }
+
+ type ResponseHeader = {
+ requestId : Integer
+ }
+
+ type ExecutionError_ = {
+ requestId : Integer
+ }
+
+ type InvalidMethodError = {
+ requestId : Integer
+ }
+
+ type Exception_ = {
+ requestId : Integer,
+ message : String
+ }
+
+ type ResponseTooLarge = {
+ requestId : Integer
+ }