MCPcopy Create free account
hub / github.com/apache/mesos / Writer

Class Writer

3rdparty/libprocess/include/process/http.hpp:354–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352 };
353
354 class Writer
355 {
356 public:
357 // Returns false if the data could not be written because
358 // either end of the pipe was already closed. Note that an
359 // empty write has no effect.
360 bool write(std::string s);
361
362 // Closing the write-end of the pipe will send end-of-file
363 // to the reader. Returns false if the write-end of the pipe
364 // was already closed or failed.
365 bool close();
366
367 // Closes the write-end of the pipe but sends a failure
368 // to the reader rather than end-of-file. Returns false
369 // if the write-end of the pipe was already closed or failed.
370 bool fail(const std::string& message);
371
372 // Returns Nothing when the read-end of the pipe is closed
373 // before the write-end is closed, which means the reader
374 // was unable to continue reading!
375 Future<Nothing> readerClosed() const;
376
377 // Comparison operators useful for checking connection equality.
378 bool operator==(const Writer& other) const { return data == other.data; }
379 bool operator!=(const Writer& other) const { return !(*this == other); }
380 private:
381 friend class Pipe;
382
383 enum State
384 {
385 OPEN,
386 CLOSED,
387 FAILED,
388 };
389
390 explicit Writer(const std::shared_ptr<Data>& _data)
391 : data(_data) {}
392
393 std::shared_ptr<Data> data;
394 };
395
396 Pipe()
397 : data(new Data()) {}

Callers 1

writerMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected