Raxol.Terminal.Buffer.ConcurrentBuffer (Raxol v2.0.1)
View SourceA thread-safe buffer implementation using GenServer for concurrent access. Provides synchronous operations to ensure data integrity when multiple processes are reading/writing to the buffer simultaneously.
Summary
Functions
Performs a batch of operations atomically.
Performs a batch of operations from a list.
Returns a specification to start this module under a supervisor.
Clears the entire buffer.
Fills a region with a character.
Flushes any pending operations (for compatibility). Returns :ok immediately as operations are synchronous.
Gets the current buffer state for reading.
Gets a cell from the buffer.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Scrolls the buffer content.
Sets a cell in the buffer.
Starts a concurrent buffer server.
Stops the concurrent buffer server.
Writes text starting at the given position.
Functions
@spec batch(pid() | atom(), (Raxol.Terminal.Buffer.t() -> Raxol.Terminal.Buffer.t())) :: :ok | {:error, term()}
Performs a batch of operations atomically.
Performs a batch of operations from a list.
Returns a specification to start this module under a supervisor.
See Supervisor.
Clears the entire buffer.
@spec fill_region( pid() | atom(), integer(), integer(), integer(), integer(), String.t(), map() ) :: :ok
Fills a region with a character.
Flushes any pending operations (for compatibility). Returns :ok immediately as operations are synchronous.
@spec get_buffer(pid() | atom()) :: {:ok, Raxol.Terminal.Buffer.t()} | {:error, term()}
Gets the current buffer state for reading.
@spec get_cell(pid() | atom(), integer(), integer()) :: {:ok, Raxol.Terminal.Buffer.Cell.t()} | {:error, term()}
Gets a cell from the buffer.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Scrolls the buffer content.
@spec set_cell(pid() | atom(), integer(), integer(), Raxol.Terminal.Buffer.Cell.t()) :: :ok | {:error, term()}
Sets a cell in the buffer.
Starts a concurrent buffer server.
Options:
- :width - Buffer width (default: 80)
- :height - Buffer height (default: 24)
- :name - GenServer name (optional)
Stops the concurrent buffer server.
Writes text starting at the given position.