Revision b9e12624 src/rpc-test.hs
b/src/rpc-test.hs | ||
---|---|---|
80 | 80 |
requestComp o = o { optShowComp = True } |
81 | 81 |
|
82 | 82 |
-- | The rpcs we support. Sadly this duplicates the RPC list. |
83 |
data KnownRpc = KRInstanceInfo RpcCallInstanceInfo |
|
84 |
| KRAllInstancesInfo RpcCallAllInstancesInfo |
|
85 |
| KRInstanceList RpcCallInstanceList |
|
86 |
| KRNodeInfo RpcCallNodeInfo |
|
87 |
| KRVersion RpcCallVersion |
|
88 |
| KRStorageList RpcCallStorageList |
|
89 |
| KRTestDelay RpcCallTestDelay |
|
90 |
| KRExportList RpcCallExportList |
|
83 |
data KnownRpc = KRInstanceInfo RpcCallInstanceInfo |
|
84 |
| KRAllInstancesInfo RpcCallAllInstancesInfo |
|
85 |
| KRInstanceConsoleInfo RpcCallInstanceConsoleInfo |
|
86 |
| KRInstanceList RpcCallInstanceList |
|
87 |
| KRNodeInfo RpcCallNodeInfo |
|
88 |
| KRVersion RpcCallVersion |
|
89 |
| KRStorageList RpcCallStorageList |
|
90 |
| KRTestDelay RpcCallTestDelay |
|
91 |
| KRExportList RpcCallExportList |
|
91 | 92 |
deriving (Show) |
92 | 93 |
|
93 | 94 |
-- | The command line options. |
... | ... | |
144 | 145 |
fromJResult "parsing rpc" (decode f) >>= Ok . KRInstanceInfo |
145 | 146 |
parseRpc "all_instances_info" f = |
146 | 147 |
fromJResult "parsing rpc" (decode f) >>= Ok . KRAllInstancesInfo |
148 |
parseRpc "console_instance_info" f = |
|
149 |
fromJResult "parsing rpc" (decode f) >>= Ok . KRConsoleInstanceInfo |
|
147 | 150 |
parseRpc "instance_list" f = |
148 | 151 |
fromJResult "parsing rpc" (decode f) >>= Ok . KRInstanceList |
149 | 152 |
parseRpc "node_info" f = |
... | ... | |
162 | 165 |
-- polymorphism of 'executeRpcCall', and the binding of the result |
163 | 166 |
-- based on the input rpc call. |
164 | 167 |
execRpc :: [Node] -> KnownRpc -> IO [[String]] |
165 |
execRpc n (KRInstanceInfo v) = formatRpcRes `fmap` executeRpcCall n v |
|
166 |
execRpc n (KRAllInstancesInfo v) = formatRpcRes `fmap` executeRpcCall n v |
|
167 |
execRpc n (KRInstanceList v) = formatRpcRes `fmap` executeRpcCall n v |
|
168 |
execRpc n (KRNodeInfo v) = formatRpcRes `fmap` executeRpcCall n v |
|
169 |
execRpc n (KRVersion v) = formatRpcRes `fmap` executeRpcCall n v |
|
170 |
execRpc n (KRStorageList v) = formatRpcRes `fmap` executeRpcCall n v |
|
171 |
execRpc n (KRTestDelay v) = formatRpcRes `fmap` executeRpcCall n v |
|
172 |
execRpc n (KRExportList v) = formatRpcRes `fmap` executeRpcCall n v |
|
168 |
execRpc n (KRInstanceInfo v) = formatRpcRes `fmap` executeRpcCall n v |
|
169 |
execRpc n (KRAllInstancesInfo v) = formatRpcRes `fmap` executeRpcCall n v |
|
170 |
execRpc n (KRConsoleInstanceInfo v) = formatRpcRes `fmap` executeRpcCall n v |
|
171 |
execRpc n (KRInstanceList v) = formatRpcRes `fmap` executeRpcCall n v |
|
172 |
execRpc n (KRNodeInfo v) = formatRpcRes `fmap` executeRpcCall n v |
|
173 |
execRpc n (KRVersion v) = formatRpcRes `fmap` executeRpcCall n v |
|
174 |
execRpc n (KRStorageList v) = formatRpcRes `fmap` executeRpcCall n v |
|
175 |
execRpc n (KRTestDelay v) = formatRpcRes `fmap` executeRpcCall n v |
|
176 |
execRpc n (KRExportList v) = formatRpcRes `fmap` executeRpcCall n v |
|
173 | 177 |
|
174 | 178 |
-- | Helper to format the RPC result such that it can be printed by |
175 | 179 |
-- 'printTable'. |
Also available in: Unified diff