server: support flushing the output
So we can get some progress output
This commit is contained in:
@ -78,12 +78,15 @@ struct Server::Private {
|
||||
//
|
||||
// output
|
||||
//
|
||||
void output_sexp(Sexp&& sexp) const
|
||||
void output_sexp(Sexp&& sexp, bool flush = false) const
|
||||
{
|
||||
if (output_)
|
||||
output_(std::move(sexp));
|
||||
output_(std::move(sexp), flush);
|
||||
}
|
||||
void output_sexp(Sexp::List&& lst, bool flush = false) const
|
||||
{
|
||||
output_sexp(Sexp::make_list(std::move(lst)), flush);
|
||||
}
|
||||
void output_sexp(Sexp::List&& lst) const { output_sexp(Sexp::make_list(std::move(lst))); }
|
||||
size_t output_results(const QueryResults& qres, size_t batch_size) const;
|
||||
|
||||
//
|
||||
|
||||
@ -33,8 +33,8 @@ namespace Mu {
|
||||
*
|
||||
*/
|
||||
class Server {
|
||||
public:
|
||||
using Output = std::function<void(Sexp&& sexp)>;
|
||||
public:
|
||||
using Output = std::function<void(Sexp&& sexp, bool flush)>;
|
||||
|
||||
/**
|
||||
* Construct a new server
|
||||
@ -59,7 +59,7 @@ class Server {
|
||||
*/
|
||||
bool invoke(const std::string& expr) noexcept;
|
||||
|
||||
private:
|
||||
private:
|
||||
struct Private;
|
||||
std::unique_ptr<Private> priv_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user