Module: CDC::Core::OrderingScope
- Defined in:
- lib/cdc/core/ordering_scope.rb
Overview
Canonical ordering scopes used by the CDC ecosystem.
Ordering scopes describe how related events should be grouped when a runtime or sink needs to preserve relative order.
Constant Summary collapse
- GLOBAL =
Preserve exact stream order.
:global- TRANSACTION =
Preserve transaction order and boundaries.
:transaction- RELATION =
Preserve ordering per relation/table.
:relation- PRIMARY_KEY =
Preserve ordering per primary key.
:primary_key- NONE =
Do not impose a strict ordering guarantee.
:none- SUPPORTED =
All supported ordering scopes.
Ractor.make_shareable([GLOBAL, TRANSACTION, RELATION, PRIMARY_KEY, NONE].freeze)
Class Method Summary collapse
-
.normalize(scope) ⇒ Symbol
Convert a scope-like value into a supported ordering scope symbol.
-
.supported?(scope) ⇒ Boolean
Check whether a scope-like value is supported.
Class Method Details
.normalize(scope) ⇒ Symbol
Convert a scope-like value into a supported ordering scope symbol.
31 32 33 34 35 36 37 38 |
# File 'lib/cdc/core/ordering_scope.rb', line 31 def normalize(scope) value = scope.to_sym return value if SUPPORTED.include?(value) raise InvalidOrderingScopeError, "unsupported CDC ordering scope: #{scope.inspect}" rescue NoMethodError raise InvalidOrderingScopeError, "unsupported CDC ordering scope: #{scope.inspect}" end |
.supported?(scope) ⇒ Boolean
Check whether a scope-like value is supported.
44 45 46 47 48 |
# File 'lib/cdc/core/ordering_scope.rb', line 44 def supported?(scope) SUPPORTED.include?(scope.to_sym) rescue NoMethodError false end |