Sha256: f75721c8f585bebd3f32da0a82e7b300ca3b05a0a6fa8334fd9344cccfbfd27e

Contents?: true

Size: 918 Bytes

Versions: 2

Compression:

Stored size: 918 Bytes

Contents

require 'active_record'
require 'rflow/configuration/uuid_keyed'

class RFlow
  class Configuration
    # Represents a process shard in the SQLite database.
    class Shard < ConfigurationItem
      include UUIDKeyed
      include ActiveModel::Validations

      # Exception for when the shard is invalid.
      class ShardInvalid < StandardError; end

      # @!attribute components
      #   The {Component}s that are to run in this {Shard}.
      #   @return [Array<Component>]
      has_many :components, :primary_key => 'uuid', :foreign_key => 'shard_uuid'

      validates_uniqueness_of :name
      validates_numericality_of :count, :only_integer => true, :greater_than => 0
    end

    # Subclass of {Shard} representing a shard instantiated by a process.
    class ProcessShard < Shard; end
    # Subclass of {Shard} representing a shard instantiated by a thread.
    class ThreadShard < Shard; end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rflow-1.3.2 lib/rflow/configuration/shard.rb
rflow-1.3.1 lib/rflow/configuration/shard.rb