<commit_before>.. _ring_buffers_v2:

Ring Buffers
############

A :dfn:`ring buffer` is a circular buffer, whose contents are stored in
first-in-first-out order. Two content data modes are supported:

* **Data item mode**: Multiple 32-bit word data items with metadata
   can be enqueued and dequeued from the ring buffer in
   chunks of up to 1020 bytes.  Each data item also has two
   associated metadata values:  a type identifier and a 16-bit
   integer value, both of which are application-specific.
* **Byte mode**: raw bytes can be enqueued and dequeued.

.. contents::
    :local:
    :depth: 2

Concepts
********

Any number of ring buffers can be defined. Each ring buffer is referenced
by its memory address.

A ring buffer has the following key properties:

* A **data buffer** of 32-bit words or bytes. The data buffer contains the data
  items or raw bytes that have been added to the ring buffer but not yet
  removed.<commit_msg>doc: fix list formatting in ring_buffer<commit_after>.. _ring_buffers_v2:

Ring Buffers
############

A :dfn:`ring buffer` is a circular buffer, whose contents are stored in
first-in-first-out order. Two content data modes are supported:

* **Data item mode**: Multiple 32-bit word data items with metadata
  can be enqueued and dequeued from the ring buffer in
  chunks of up to 1020 bytes.  Each data item also has two
  associated metadata values:  a type identifier and a 16-bit
  integer value, both of which are application-specific.

* **Byte mode**: raw bytes can be enqueued and dequeued.

.. contents::
    :local:
    :depth: 2

Concepts
********

Any number of ring buffers can be defined. Each ring buffer is referenced
by its memory address.

A ring buffer has the following key properties:

* A **data buffer** of 32-bit words or bytes. The data buffer contains the data
  items or raw bytes that have been added to the ring buffer but not yet
  removed.
{'fraction_non_alphanumeric': 0.07885117493472585, 'fraction_numerical': 0.012532637075718016, 'mean_word_length': 3.7780548628428927, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5515673', 'n_tokens_mistral': 552, 'n_tokens_neox': 528, 'n_words': 286}