vici: Return a Python generator instead of a list for streamed responses

In addition that it may reduce memory usage and improve performance for large
responses, it returns immediate results. This is important for longer lasting
commands, such as initiate/terminate, where immediate log feedback is preferable
when interactively calling such commands.
This commit is contained in:
Martin Willi
2015-03-18 13:59:14 +01:00
parent 90e16837ba
commit a47e431ba9
2 changed files with 25 additions and 47 deletions
+4 -4
View File
@@ -900,10 +900,10 @@ An example to print the daemon version information is as simple as:
## A request with response iteration ##
The _Session_ class returns an iterable list for streamed events. Currently a
list is returned with all streamed event messages, but a future release might
provide more scalable object streaming. The following example lists all loaded
connections using the _list-conns_ command and implicitly the _list-conn_ event:
The _Session_ class returns an iterable Python generator for streamed events to
continuously stream objects to the caller. The following example lists all
loaded connections using the _list-conns_ command and implicitly the _list-conn_
event:
for conn in v.list_conns():
for key in conn: