Class: OsCtld::DB::IdRanges

Inherits:
DB::PooledList
  • Object
show all
Defined in:
lib/osctld/db/id_ranges.rb

Class Method Summary collapse

Class Method Details

.setup(pool) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/osctld/db/id_ranges.rb', line 5

def self.setup(pool)
  range = IdRange.new(pool, 'default')
  add(range)
rescue Errno::ENOENT
  start_id = 1_000_000
  block_size = 65_536

  Commands::IdRange::Create.run!(
    pool:,
    name: 'default',
    start_id:,
    block_size:,
    block_count: ((2**32) - start_id) / block_size
  )
end