usage.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com)
  2. *
  3. * Distributed under the Boost Software License, Version 1.0. (See
  4. * accompanying file LICENSE.txt)
  5. */
  6. #ifndef BOOST_REDIS_USAGE_HPP
  7. #define BOOST_REDIS_USAGE_HPP
  8. #include <cstddef>
  9. namespace boost::redis {
  10. /** @brief Connection usage information.
  11. *
  12. * @note To simplify the implementation, @ref commands_sent and
  13. * @ref bytes_sent are computed just before writing to
  14. * the socket. On error, they might not represent exactly
  15. * what has been received by the Redis server.
  16. */
  17. struct usage {
  18. /// Number of commands sent.
  19. std::size_t commands_sent = 0;
  20. /// Number of bytes sent.
  21. std::size_t bytes_sent = 0;
  22. /// Number of responses received.
  23. std::size_t responses_received = 0;
  24. /// Number of pushes received.
  25. std::size_t pushes_received = 0;
  26. /// Number of response-bytes received.
  27. std::size_t response_bytes_received = 0;
  28. /// Number of push-bytes received.
  29. std::size_t push_bytes_received = 0;
  30. /// Number of bytes rotated in the read buffer.
  31. std::size_t bytes_rotated = 0;
  32. };
  33. } // namespace boost::redis
  34. #endif // BOOST_REDIS_USAGE_HPP