Class: OsCtld::DB::IdRanges

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

Instance Attribute Summary

Attributes inherited from List

#objects

Class Method Summary collapse

Methods inherited from PooledList

#contains?, #find

Methods inherited from List

#add, #contains?, #count, #find, #get, instance, #remove, #sync

Class Method Details

.setup(pool) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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 = 65536

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