-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpartitioned_array_database.rb
More file actions
63 lines (54 loc) · 2.96 KB
/
partitioned_array_database.rb
File metadata and controls
63 lines (54 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# rubocop:disable Style/MutableConstant, Metrics/MethodLength, Metrics/ParameterLists, Layout/LineLength, Lint/DuplicateMethods, Style/FrozenStringLiteralComment, Style/Documentation
require_relative 'file_context_managed_partitioned_array_manager'
# VERSION v0.0.7 - partition_addition_amount -> db_partition_addition_amount
# VERSION v0.0.6 - more aliases and sync with LineDB
# VERSION v0.0.5 - alias db pad
# VERSION v0.0.4 - sync with LineDB
# VERSION v0.0.3 - cleanup
# VERSION 0.0.2 - Database creation by superfolder
# VERSION 0.0.1 - Skeleton of the class created
class PartitionedArrayDatabase
attr_accessor :database_folder_name, :pad
FCMPAM_DB_INDEX_NAME = 'FCMPAM_DB_INDEX'
DB_NAME = 'FCMPAM_DB'
PARTITION_AMOUNT = 20
ENDLESS_ADD = true
HAS_CAPACITY = true
DB_SIZE = 200
DYNAMICALLY_ALLOCATES = true
TRAVERSE_HASH = true
PARTITION_ADDITION_AMOUNT = 15
LABEL_INTEGER = false
LABEL_RANGES = false
DATABASE_FOLDER_NAME = './default' # folder name in terms of a full or relative path
FCMPAM = FileContextManagedPartitionedArrayManager
# For a change of database variables, check the file constants in the file_context_managed_partitioned_array_manager.rb library, etc.
def initialize(partition_addition_amount: PARTITION_ADDITION_AMOUNT, label_integer: LABEL_INTEGER, label_ranges: LABEL_RANGES, traverse_hash: TRAVERSE_HASH, partition_amount: PARTITION_AMOUNT, database_folder_name: DATABASE_FOLDER_NAME, endless_add: ENDLESS_ADD, has_capacity: DB_HAS_CAPACITY, dynamically_allocates: DYNAMICALLY_ALLOCATES, db_size: DATABASE_SIZE) # rubocop:disable Layout/LineLength
@database_folder_name = database_folder_name
@endless_add = endless_add
@has_capacity = has_capacity
@db_size = db_size
@partition_amount = partition_amount
@dynamically_allocates = dynamically_allocates
@traverse_hash = traverse_hash
@label_integer = label_integer
@label_ranges = label_ranges
@partition_addition_amount = partition_addition_amount
# puts @partition_addition_amount
@pad = FCMPAM.new(db_partition_addition_amount: @partition_addition_amount, label_integer: @label_integer, label_ranges: @label_ranges, traverse_hash: @traverse_hash, db_partition_amount_and_offset: @partition_amount, db_has_capacity: @has_capacity, db_dynamically_allocates: @dynamically_allocates, db_size: @db_size, db_path: "#{database_folder_name}/#{DB_NAME}", fcmpa_db_folder_name: "#{database_folder_name}/#{FCMPAM_DB_INDEX_NAME}")
end
def pad # rubocop:disable Style/TrivialAccessors
# puts pad.traverse_hash
# p @pad.traverse_hash
@pad
end
alias db pad
alias DB pad
alias PAD pad
alias d pad
alias D pad
end
PAD = PartitionedArrayDatabase
# Path: lib/partitioned_array_database.rb
# a = PAD.new
# rubocop:enable Style/MutableConstant, Metrics/MethodLength, Metrics/ParameterLists, Layout/LineLength, Lint/DuplicateMethods, Style/FrozenStringLiteralComment, Style/Documentation