Class: Aerospike::UnsupportedParticleTypeValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/aerospike/command/unsupported_particle_type_validator.rb

Instance Method Summary collapse

Constructor Details

#initialize(*particle_types) ⇒ UnsupportedParticleTypeValidator

Returns a new instance of UnsupportedParticleTypeValidator.



20
21
22
# File 'lib/aerospike/command/unsupported_particle_type_validator.rb', line 20

def initialize(*particle_types)
  @unsupported_types = particle_types.to_set
end

Instance Method Details

#call(*commands) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/aerospike/command/unsupported_particle_type_validator.rb', line 24

def call(*commands)
  used = commands.flat_map(&:write_bins).map(&:type)
  unsupported = @unsupported_types.intersection(used)
  unless unsupported.empty?
    fail Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::TYPE_NOT_SUPPORTED, "Particle type(s) not supported by cluster: #{@unsupported_types.to_a}")
  end
end