pw_ring_buffer: Add ring buffer iterator

To support walking through the ring buffers in crash contexts, it's
useful to have a mechanism that allows processing entries in the ring
buffer without requiring buffer copies (in favor of raw access). This
adds a new unsafe iteration class that can be used while the caller has
a guarantee that the underlying buffer is not being mutated.

The multisink is also updated to support this unsafe iteration by adding
an oldest entry reader that is used as a reference point for the
iterator class. This will additionally support late-drain attach flows
where a drain may want to match the oldest entry available in the
buffer, as opposed to the current logic that always starts it at the
write index.

Bug: b/190547664
Change-Id: I430bab37b47630dbdfba184ad94f818a5225f79a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/50262
Commit-Queue: Prashanth Swaminathan <prashanthsw@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
9 files changed
tree: 2c7fcde348cb94930fb52f1113ecb47d9348b1a4
  1. build_overrides/
  2. docker/
  3. docs/
  4. pw_allocator/
  5. pw_analog/
  6. pw_arduino_build/
  7. pw_assert/
  8. pw_assert_basic/
  9. pw_assert_log/
  10. pw_base64/
  11. pw_bloat/
  12. pw_blob_store/
  13. pw_boot_armv7m/
  14. pw_build/
  15. pw_bytes/
  16. pw_checksum/
  17. pw_chrono/
  18. pw_chrono_embos/
  19. pw_chrono_freertos/
  20. pw_chrono_stl/
  21. pw_chrono_threadx/
  22. pw_cli/
  23. pw_console/
  24. pw_containers/
  25. pw_cpu_exception/
  26. pw_cpu_exception_cortex_m/
  27. pw_crypto/
  28. pw_docgen/
  29. pw_doctor/
  30. pw_env_setup/
  31. pw_function/
  32. pw_fuzzer/
  33. pw_hdlc/
  34. pw_hex_dump/
  35. pw_i2c/
  36. pw_interrupt/
  37. pw_interrupt_cortex_m/
  38. pw_kvs/
  39. pw_libc/
  40. pw_log/
  41. pw_log_basic/
  42. pw_log_multisink/
  43. pw_log_null/
  44. pw_log_rpc/
  45. pw_log_sink/
  46. pw_log_tokenized/
  47. pw_malloc/
  48. pw_malloc_freelist/
  49. pw_metric/
  50. pw_minimal_cpp_stdlib/
  51. pw_module/
  52. pw_multisink/
  53. pw_package/
  54. pw_persistent_ram/
  55. pw_polyfill/
  56. pw_preprocessor/
  57. pw_presubmit/
  58. pw_protobuf/
  59. pw_protobuf_compiler/
  60. pw_random/
  61. pw_result/
  62. pw_ring_buffer/
  63. pw_router/
  64. pw_rpc/
  65. pw_snapshot/
  66. pw_span/
  67. pw_status/
  68. pw_stm32cube_build/
  69. pw_stream/
  70. pw_string/
  71. pw_sync/
  72. pw_sync_baremetal/
  73. pw_sync_embos/
  74. pw_sync_freertos/
  75. pw_sync_stl/
  76. pw_sync_threadx/
  77. pw_sys_io/
  78. pw_sys_io_arduino/
  79. pw_sys_io_baremetal_lm3s6965evb/
  80. pw_sys_io_baremetal_stm32f429/
  81. pw_sys_io_stdio/
  82. pw_target_runner/
  83. pw_thread/
  84. pw_thread_embos/
  85. pw_thread_freertos/
  86. pw_thread_stl/
  87. pw_thread_threadx/
  88. pw_tls_client/
  89. pw_tls_client_boringssl/
  90. pw_tls_client_mbedtls/
  91. pw_tokenizer/
  92. pw_tool/
  93. pw_toolchain/
  94. pw_trace/
  95. pw_trace_tokenized/
  96. pw_transfer/
  97. pw_unit_test/
  98. pw_varint/
  99. pw_watch/
  100. pw_web_ui/
  101. targets/
  102. third_party/
  103. .bazelignore
  104. .bazelrc
  105. .clang-format
  106. .eslintrc.json
  107. .gitattributes
  108. .gitignore
  109. .gn
  110. .prettierrc.js
  111. .pylintrc
  112. activate.bat
  113. AUTHORS
  114. bootstrap.bat
  115. bootstrap.sh
  116. BUILD
  117. BUILD.gn
  118. BUILDCONFIG.gn
  119. CMakeLists.txt
  120. LICENSE
  121. modules.gni
  122. OWNERS
  123. package.json
  124. PW_PLUGINS
  125. README.md
  126. tsconfig.json
  127. WORKSPACE
  128. yarn.lock
README.md

See our website: http://pigweed.dev