Class: Partitioned::ByIntegerField
- Inherits:
-
PartitionedBase
- Object
- ActiveRecord::Base
- PartitionedBase
- Partitioned::ByIntegerField
- Defined in:
- lib/partitioned/by_integer_field.rb
Overview
Partitioned abstract class for all partitioned models based as a single integer field value.
Direct Known Subclasses
Class Method Summary collapse
- .partition_generate_range(start_value, end_value, step = :default) ⇒ Object
-
.partition_integer_field ⇒ String
the name of the partition key field.
-
.partition_normalize_key_value(integer_field_value) ⇒ Integer
the normalized key value for a given key value.
-
.partition_table_size ⇒ Integer
the size of each table.
Methods inherited from PartitionedBase
add_parent_table_rules, add_partition_table_index, add_references_to_partition_table, archive_old_partition, archive_old_partitions, arel_table_from_key_values, configurator, configurator_dsl, create_infrastructure, create_new_partition, create_new_partition_tables, create_new_partitions, create_partition_schema, create_partition_table, delete_infrastructure, drop_old_partition, drop_old_partitions, drop_partition_table, dynamic_arel_table, #dynamic_arel_table, from_partition, from_partition_without_alias, partition_key_values, partition_keys, partition_manager, partition_name, partition_table_alias_name, #partition_table_name, partition_table_name, partitioned, sql_adapter
Methods included from ActiveRecordOverrides
#arel_attributes_values, #delete
Class Method Details
.partition_generate_range(start_value, end_value, step = :default) ⇒ Object
26 27 28 29 |
# File 'lib/partitioned/by_integer_field.rb', line 26 def self.partition_generate_range(start_value, end_value, step = :default) step = partition_table_size if step == :default return Range.new(start_value, end_value).step(step) end |
.partition_integer_field ⇒ String
the name of the partition key field
16 17 18 |
# File 'lib/partitioned/by_integer_field.rb', line 16 def self.partition_integer_field raise MethodNotImplemented.new(self, :partition_integer_field) end |
.partition_normalize_key_value(integer_field_value) ⇒ Integer
the normalized key value for a given key value
22 23 24 |
# File 'lib/partitioned/by_integer_field.rb', line 22 def self.partition_normalize_key_value(integer_field_value) return integer_field_value / partition_table_size * partition_table_size end |
.partition_table_size ⇒ Integer
the size of each table
10 11 12 |
# File 'lib/partitioned/by_integer_field.rb', line 10 def self.partition_table_size return 1 end |