mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
json_stream: disentangle JSON handling from command.
We promote 'struct json_stream' to contain the membuf; we only attach the json_stream to the command when we actually call json_stream_success / json_stream_fail. This means we are closer to 'struct json_stream' being an independent layer; the tests are already modified to use it directly to create JSON. This is also the first step toward re-enabling non-serial command execution. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
db3f0ba965
commit
e17f69ce2d
@@ -159,17 +159,6 @@ bool json_tok_tok(struct command *cmd, const char *name,
|
||||
const jsmntok_t **out);
|
||||
|
||||
|
||||
/* Creating JSON output */
|
||||
|
||||
/* '"fieldname" : [ ' or '[ ' if fieldname is NULL */
|
||||
void json_array_start(struct json_stream *ptr, const char *fieldname);
|
||||
/* '"fieldname" : { ' or '{ ' if fieldname is NULL */
|
||||
void json_object_start(struct json_stream *ptr, const char *fieldname);
|
||||
/* ' ], ' */
|
||||
void json_array_end(struct json_stream *ptr);
|
||||
/* ' }, ' */
|
||||
void json_object_end(struct json_stream *ptr);
|
||||
|
||||
/**
|
||||
* json_stream_success - start streaming a successful json result.
|
||||
* @cmd: the command we're running.
|
||||
|
||||
Reference in New Issue
Block a user