Module: Ratomic

Defined in:
lib/ratomic.rb,
lib/ratomic/map.rb,
lib/ratomic/pool.rb,
lib/ratomic/queue.rb,
lib/ratomic/counter.rb,
lib/ratomic/version.rb,
lib/ratomic/undefined.rb

Defined Under Namespace

Modules: CounterMethods, MapMethods, QueueMethods Classes: Error, Pool, Undefined

Constant Summary collapse

Map =

A Ractor-shareable concurrent map.

Map is a public alias for the native ConcurrentHashMap class. It is suitable for runtime state with shareable keys and values that are safe to access from multiple Ractors, such as counters or immutable offsets.

This is not a full Hash replacement. Iteration and arbitrary mutable object borrowing are intentionally absent.

Examples:

Store pipeline offsets

OFFSETS = Ratomic::Map.new
OFFSETS[:source_a] = 42
OFFSETS[:source_a] # => 42
ConcurrentHashMap
VERSION =
"0.2.0"
UNDEFINED =

Internal shareable missing-value sentinel.

Ractor.make_shareable(Undefined.new)