Idris2Doc : Data.LSMRRBVector

Data.LSMRRBVector

(source)
Log-Structured Merge RRB Vector (LSMRRBVector)

Reexports

import public Data.LSMRRBVector.Internal
import public Data.LSMRRBVector.Types
import public Data.RRBVector

Definitions

append : LSMRRBVector World a -> RebuildService Poll -> ThreadId -> a -> Async Poll [Errno] ()
  Appends a value onto the logical end of the vector.

Effect:
- Adds an Append operation to the thread-local buffer.

Totality: total
Visibility: export
prepend : LSMRRBVector World a -> RebuildService Poll -> ThreadId -> a -> Async Poll [Errno] ()
  Prepends a value onto the logical beginning of the vector.

Effect:
- Adds a Prepend operation to the thread-local buffer.

Totality: total
Visibility: export
insert : LSMRRBVector World a -> RebuildService Poll -> ThreadId -> Nat -> a -> Async Poll [Errno] ()
  Inserts a value at a specified logical index.

Effect:
- Adds an Insert operation to the thread-local buffer.

Totality: total
Visibility: export
delete : LSMRRBVector World a -> RebuildService Poll -> ThreadId -> Nat -> Async Poll [Errno] ()
  Removes a value at a specified logical index.

Effect:
- Adds a Delete operation to the thread-local buffer.

Totality: total
Visibility: export
update : LSMRRBVector World a -> RebuildService Poll -> ThreadId -> Nat -> a -> Async Poll [Errno] ()
  Replaces a value at a specified logical index.

Effect:
- Adds an Update operation to the thread-local buffer.

Totality: total
Visibility: export
toList : LSMRRBVector World a -> ThreadId -> IO (List a)
  Converts the current published snapshot into a list.

Behavior:
- Reads the current immutable snapshot.
- Converts the snapshot contents into a List.

Properties:
- Observes a consistent snapshot.
- Does not block writers or rebuild activity.
- Reader participation is cleaned up automatically.

Notes:
- Concurrent writes published after acquisition are not visible.

Complexity:
- Snapshot acquisition: O(1)
- Conversion: O(n)

Totality: total
Visibility: export
length : LSMRRBVector World a -> ThreadId -> IO Nat
  Returns the number of elements in the current published snapshot.

Behavior:
- Reads the current immutable snapshot.
- Returns its logical length.

Properties:
- Observes a consistent snapshot.
- Does not block writers or rebuild activity.
- Reader participation is cleaned up automatically.

Notes:
- Concurrent writes published after acquisition are not visible.

Complexity:
- O(1)

Totality: total
Visibility: export
lookup : LSMRRBVector World a -> ThreadId -> Nat -> IO (Maybe a)
  Looks up an element by index.

Behavior:
- Reads the current immutable snapshot.
- Returns Nothing if the index is out of bounds.

Properties:
- Observes a consistent snapshot.
- Does not block writers or rebuild activity.
- Reader participation is cleaned up automatically.

Notes:
- Concurrent writes published after acquisition are not visible.

Complexity:
- O(log n)

Totality: total
Visibility: export
null : LSMRRBVector World a -> ThreadId -> IO Bool
  Tests whether the current published snapshot is empty.

Behavior:
- Reads the current immutable snapshot.
- Returns True when no elements exist.

Properties:
- Observes a consistent snapshot.
- Does not block writers or rebuild activity.
- Reader participation is cleaned up automatically.

Notes:
- Concurrent writes published after acquisition are not visible.

Complexity:
- O(1)

Totality: total
Visibility: export
defaultconfig : LSMRRBVectorConfig
  Default log-structured merge vector configuration.

Current defaults favor balanced throughput and latency.

Totality: total
Visibility: export
runEmptyWith : Ord (Entry a) => LSMRRBVectorConfig -> List (LSMRRBVector World a -> RebuildService Poll -> RebuildServiceState -> Async Poll [Errno] ()) -> List (LSMRRBVector World a -> Async Poll [Errno] ()) -> IO ()
  Run an empty log-structured merge vector using a user-provided configuration.

Parameters:
- initialbatchwindow: Starting adaptive batching target.

Notes:
- Smaller values rebuild more aggressively.
- Larger values favor write throughput.

Visibility: export
runFastWritesEmpty : Ord (Entry a) => List (LSMRRBVector World a -> RebuildService Poll -> RebuildServiceState -> Async Poll [Errno] ()) -> List (LSMRRBVector World a -> Async Poll [Errno] ()) -> IO ()
  Runs an empty log-structured merge vector tuned for high sustained write throughput.

Configuration:
- Initial adaptive batch window: 512

Behavior:
- Favors larger rebuild batches.
- Reduces rebuild frequency under heavy write load.
- May increase visibility latency for newly written values.

Notes:
- Intended for write-heavy workloads.

Visibility: export
runLowLatencyEmpty : Ord (Entry a) => List (LSMRRBVector World a -> RebuildService Poll -> RebuildServiceState -> Async Poll [Errno] ()) -> List (LSMRRBVector World a -> Async Poll [Errno] ()) -> IO ()
  Runs an empty log-structured merge vector tuned for low publication latency.

Configuration:
- Initial adaptive batch window: 16

Behavior:
- Favors frequent rebuild cycles.
- Reduces time between writes and publication.
- May increase rebuild overhead under heavy load.

Notes:
- Intended for latency-sensitive workloads.

Visibility: export
runEmpty : Ord (Entry a) => List (LSMRRBVector World a -> RebuildService Poll -> RebuildServiceState -> Async Poll [Errno] ()) -> List (LSMRRBVector World a -> Async Poll [Errno] ()) -> IO ()
  Runs an empty log-structured merge vector.

Visibility: export