summaryrefslogtreecommitdiff
path: root/docs/data/remote/rpc_client.loopback.json
blob: c3052551c194bc5d784236608b245a44fb2b3455 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
{
	"format": 1,
	"id": "saw-rpc_client-loopback",
	"kind": "class",
	"name": "rpc_client",
	"namespace": "saw",
	"module": "remote",
	"header": "modules/remote/c++/remote_loopback.hpp",
	"is_special": true,
	"specializes": "saw-rpc_client",
	"arguments": ["Iface", "Encoding", "rmt::Loopback"],
	"brief_description": "Calls an rpc server in the same process.",
	"detailed_description": [
		[
			"Holds one",
			{"name": "data_client", "id": "saw-data_client-loopback"},
			"per schema the interface mentions, all of them handles on the data servers the server is already bound to. A parameter which is not on the remote yet goes through the data layer first, and only its id reaches the rpc layer."
		]
	],
	"templates": [
		{"name": "Iface", "kind": "type"},
		{"name": "Encoding", "kind": "type"}
	],
	"aliases": {
		"saw-rpc_client-loopback-ServerT": {
			"id": "saw-rpc_client-loopback-ServerT",
			"name": "ServerT",
			"type": [{"name": "rpc_server", "id": "saw-rpc_server-loopback"}, "< Iface, Encoding, rmt::Loopback >"]
		},
		"saw-rpc_client-loopback-TypeGroup": {
			"id": "saw-rpc_client-loopback-TypeGroup",
			"name": "TypeGroup",
			"type": ["typename schema_iface_type_group< Iface >::Type"],
			"brief_description": "Every schema the interface mentions, reduced to unique types."
		},
		"saw-rpc_client-loopback-DataClients": {
			"id": "saw-rpc_client-loopback-DataClients",
			"name": "DataClients",
			"type": ["std::tuple<", {"name": "data_client", "id": "saw-data_client-loopback"}, "< T, Encoding, rmt::Loopback >... >"],
			"brief_description": "One data client per schema in the type group."
		}
	},
	"functions": {
		"saw-rpc_client-loopback-get_data_client": {
			"id": "saw-rpc_client-loopback-get_data_client",
			"name": "get_data_client",
			"type": [{"name": "data_client", "id": "saw-data_client-loopback"}, "< IdT, Encoding, rmt::Loopback > &"],
			"brief_description": "The data client of one of the interface types.",
			"detailed_description": [
				["Useful when a parameter is meant to be sent once and reused in several calls."]
			],
			"templates": [
				{"name": "IdT", "kind": "type", "brief_description": "One of the schemas the interface mentions."}
			],
			"examples": [
				{
					"title": "Sending a parameter once and calling with it twice",
					"description": [
						[
							"Handing a value to call sends it every time. Sending it once and passing the id instead keeps it on the remote, which is the point of",
							{"name": "data_or_id", "id": "saw-data_or_id"}
						]
					],
					"language": "cpp",
					"code": "data<schema::UInt32, encode::Native> inp{21};\n\nauto& u32_client = client.get_data_client<schema::UInt32>();\nauto eo_param = u32_client.send(inp);\nauto param = eo_param.get_value();\n\n/// Both calls refer to the same value on the remote.\nauto first = client.call<\"foo\">(param).take();\nauto second = client.call<\"foo\">(param).take();\n"
				}
			]
		},
		"saw-rpc_client-loopback-request_data": {
			"id": "saw-rpc_client-loopback-request_data",
			"name": "request_data",
			"type": [{"name": "remote_data", "id": "saw-remote_data-loopback"}, "< IdT, Encoding, rmt::Loopback >"],
			"brief_description": "Requests the data from the remote.",
			"templates": [
				{"name": "IdT", "kind": "type"}
			],
			"parameters": [
				{"name": "dat_id", "type": ["id< IdT >"]}
			]
		},
		"saw-rpc_client-loopback-call-1": {
			"id": "saw-rpc_client-loopback-call-1",
			"name": "call",
			"type": ["conveyor<", {"name": "remote_data", "id": "saw-remote_data-loopback"}, "< ResponseT, Encoding, rmt::Loopback > >"],
			"brief_description": "Calls a function on the remote.",
			"detailed_description": [
				[
					"The parameter is either already present on the remote, in which case only its id is handed over, or it is sent through the data layer first."
				],
				[
					"The id of the response is picked by the server and travels back with the answer, so this is asynchronous in the id as well, not only in the data."
				]
			],
			"templates": [
				{
					"name": "Name",
					"kind": "non_type",
					"type": "string_literal",
					"brief_description": "Name of the interface member to call."
				}
			],
			"parameters": [
				{
					"name": "input",
					"type": [{"name": "data_or_id", "id": "saw-data_or_id"}, "< RequestT, Encoding >"],
					"brief_description": "The parameter, or the id of one already on the remote."
				}
			]
		},
		"saw-rpc_client-loopback-call-2": {
			"id": "saw-rpc_client-loopback-call-2",
			"name": "call",
			"type": ["conveyor<", {"name": "remote_data", "id": "saw-remote_data-loopback"}, "< ResponseT, Encoding, rmt::Loopback > >"],
			"brief_description": "Calls a function and stores the response in a slot allocated beforehand.",
			"templates": [
				{
					"name": "Name",
					"kind": "non_type",
					"type": "string_literal",
					"brief_description": "Name of the interface member to call."
				}
			],
			"parameters": [
				{
					"name": "input",
					"type": [{"name": "data_or_id", "id": "saw-data_or_id"}, "< RequestT, Encoding >"]
				},
				{
					"name": "resp_id",
					"type": ["id< ResponseT >"],
					"brief_description": "Slot the answer has to end up in."
				}
			]
		}
	}
}