Sha256: a9c6402a62e99b00ca35a5da20c1c42b74623434144f6212e5445337ca67afd0
Contents?: true
Size: 964 Bytes
Versions: 5
Compression:
Stored size: 964 Bytes
Contents
module MixedGauge # Mapping of slot -> connection_name. class ClusterConfig attr_reader :name # @param [Symbol] name def initialize(name) @name = name @connection_registry = {} end # @param [Range] slots # @return [nil] def define_slots(slots) @slots = slots nil end # @param [Range] slots # @param [Symbol] connection connection name # @return [nil] def register(slots, connection) @connection_registry[slots] = connection nil end def validate_config! # TODO end # @return [Integer] def slot_count @slots.count end # @param [Integer] slot # @return [Symbol] registered connection name def fetch(slot) @connection_registry.find {|slot_range, name| slot_range.cover?(slot) }[1] end # @return [Array<Symbol>] An array of connection name def connections @connection_registry.values end end end
Version data entries
5 entries across 5 versions & 1 rubygems