Files
rippled/include/xrpl/server/Writer.h
Bart 1eb0fdac65 refactor: Rename ripple namespace to xrpl (#5982)
This change renames all occurrences of `namespace ripple` and `ripple::` to `namespace xrpl` and `xrpl::`, respectively, as well as the names of test suites. It also provides a script to allow developers to replicate the changes in their local branch or fork to avoid conflicts.
2025-12-11 16:51:49 +00:00

43 lines
960 B
C++

#ifndef XRPL_SERVER_WRITER_H_INCLUDED
#define XRPL_SERVER_WRITER_H_INCLUDED
#include <boost/asio/buffer.hpp>
#include <functional>
#include <vector>
namespace xrpl {
class Writer
{
public:
virtual ~Writer() = default;
/** Returns `true` if there is no more data to pull. */
virtual bool
complete() = 0;
/** Removes bytes from the input sequence.
Can be called with 0.
*/
virtual void
consume(std::size_t bytes) = 0;
/** Add data to the input sequence.
@param bytes A hint to the number of bytes desired.
@param resume A functor to later resume execution.
@return `true` if the writer is ready to provide more data.
*/
virtual bool
prepare(std::size_t bytes, std::function<void(void)> resume) = 0;
/** Returns a ConstBufferSequence representing the input sequence. */
virtual std::vector<boost::asio::const_buffer>
data() = 0;
};
} // namespace xrpl
#endif