aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/serialise.hh
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-04-05 03:51:45 +0200
committereldritch horrors <pennae@lix.systems>2024-04-05 20:13:02 +0000
commit821ad98beb1a915ea7a456c274bcfca9e059ba91 (patch)
tree8dc66cdeae3758eecd2515e568caf3783bd2ea56 /src/libutil/serialise.hh
parent6c777476c9e97abfc5232f0707985caf6df2baea (diff)
Revert "libutil: drop Fs{Source,Sink}::good"
This reverts commit 1340807e30dba4b3972c31f02861bbaeaeb60e61. Change-Id: I34d2a80eb3c3e9d79cb02b92cd1189da32d18cb6
Diffstat (limited to 'src/libutil/serialise.hh')
-rw-r--r--src/libutil/serialise.hh11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh
index e6290a652..d1c791823 100644
--- a/src/libutil/serialise.hh
+++ b/src/libutil/serialise.hh
@@ -18,6 +18,7 @@ struct Sink
{
virtual ~Sink() { }
virtual void operator () (std::string_view data) = 0;
+ virtual bool good() { return true; }
};
/**
@@ -79,6 +80,8 @@ struct Source
*/
virtual size_t read(char * data, size_t len) = 0;
+ virtual bool good() { return true; }
+
void drainInto(Sink & sink);
std::string drain();
@@ -133,6 +136,11 @@ struct FdSink : BufferedSink
~FdSink();
void writeUnbuffered(std::string_view data) override;
+
+ bool good() override;
+
+private:
+ bool _good = true;
};
@@ -157,8 +165,11 @@ struct FdSource : BufferedSource
return *this;
}
+ bool good() override;
protected:
size_t readUnbuffered(char * data, size_t len) override;
+private:
+ bool _good = true;
};