Exception: Redis::ImpendingCrossSlotError

Inherits:
CommandError show all
Defined in:
lib/redis/impending_cross_slot_error.rb

Overview

Captures the details from a potential CROSSSLOT error as identified by Redis::KeyHash.all_in_one_slot!.

Generally, this indicates we were about to risk a Redis operation which is likely to produce a Redis error result like:

(error) CROSSSLOT Keys in request don't hash to the same slot

TODO: rdoc

Redis::ImpendingCrossSlotError is a Redis::CommandError because the intention is to use Redis::KeyHash.all_in_one_slot! as a filter in front of Redis#eval, which will raise a Redis::CommandError when redis-server returns a CROSSSLOT error.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace, keys, namespaced_keys, problems) ⇒ ImpendingCrossSlotError

Returns a new instance of ImpendingCrossSlotError.



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/redis/impending_cross_slot_error.rb', line 35

def initialize(namespace,keys,namespaced_keys,problems)
  err  = "CROSSSLOT"
  err += " namespace=#{namespace.inspect}"
  err += " keys=#{keys.inspect}"
  err += " namespaced_keys=#{namespaced_keys.inspect}"
  err += " problems=#{problems.inspect}"
  super(err)
  @namespace       = namespace ? namespace.dup.freeze : nil
  @keys            = keys.dup.freeze
  @namespaced_keys = namespaced_keys.dup.freeze
  @problems        = problems.dup.freeze
end

Instance Attribute Details

#keysObject

Returns the value of attribute keys.



49
50
51
# File 'lib/redis/impending_cross_slot_error.rb', line 49

def keys
  @keys
end

#namespaceObject

Returns the value of attribute namespace.



48
49
50
# File 'lib/redis/impending_cross_slot_error.rb', line 48

def namespace
  @namespace
end

#namespaced_keysObject

Returns the value of attribute namespaced_keys.



50
51
52
# File 'lib/redis/impending_cross_slot_error.rb', line 50

def namespaced_keys
  @namespaced_keys
end

#problemsObject

Returns the value of attribute problems.



51
52
53
# File 'lib/redis/impending_cross_slot_error.rb', line 51

def problems
  @problems
end