lib/perobs/BTreeBlob.rb in perobs-3.0.1 vs lib/perobs/BTreeBlob.rb in perobs-3.0.2
- old
+ new
@@ -63,11 +63,11 @@
@blobs_file_name = File.join(dir, 'data')
read_index
end
# Write the given bytes with the given ID into the DB.
- # @param id [Fixnum or Bignum] ID
+ # @param id [Integer] ID
# @param raw [String] sequence of bytes
def write_object(id, raw)
if @entries.length > @btreedb.max_blob_size
# The blob has reached the maximum size. Replace the blob with a BTree
# node directory and distribute the blob entires into the sub-blobs of
@@ -85,19 +85,19 @@
write_index
end
end
# Read the entry for the given ID and return it as bytes.
- # @param id [Fixnum or Bignum] ID
+ # @param id [Integer] ID
# @return [String] sequence of bytes or nil if ID is unknown
def read_object(id)
return nil unless (index_entry = find(id))
read_from_blobs_file(index_entry)
end
# Find the data for the object with given id.
- # @param id [Fixnum or Bignum] Object ID
+ # @param id [Integer] Object ID
# @return [Array] Returns an Array that represents the index entry for the
# given object.
def find(id)
@entries_by_id[id]
end
@@ -107,11 +107,11 @@
@entries.each { |e| e[MARKED] = 0 }
write_index
end
# Set a mark on the entry with the given ID.
- # @param id [Fixnum or Bignum] ID of the entry
+ # @param id [Integer] ID of the entry
def mark(id)
found = false
@entries.each do |entry|
if entry[ID] == id
entry[MARKED] = 1
@@ -127,11 +127,11 @@
write_index
end
# Check if the entry for a given ID is marked.
- # @param id [Fixnum or Bignum] ID of the entry
+ # @param id [Integer] ID of the entry
# @param ignore_errors [Boolean] If set to true no errors will be raised
# for non-existing objects.
# @return [TrueClass or FalseClass] true if marked, false otherwise
def is_marked?(id, ignore_errors = false)
@entries.each do |entry|
@@ -203,12 +203,12 @@
private
# Write a string of bytes into the file at the given address.
# @param raw [String] bytes to write
- # @param address [Fixnum] offset in the file
- # @return [Fixnum] number of bytes written
+ # @param address [Integer] offset in the file
+ # @return [Integer] number of bytes written
def write_to_blobs_file(raw, address)
begin
File.write(@blobs_file_name, raw, address)
rescue IOError => e
PEROBS.log.fatal "Cannot write blobs file #{@blobs_file_name}: " +
@@ -234,12 +234,12 @@
raw
end
# Reserve the bytes needed for the specified number of bytes with the
# given ID.
- # @param id [Fixnum or Bignum] ID of the entry
- # @param bytes [Fixnum] number of bytes for this entry
- # @return [Fixnum] the start address of the reserved blob
+ # @param id [Integer] ID of the entry
+ # @param bytes [Integer] number of bytes for this entry
+ # @return [Integer] the start address of the reserved blob
def reserve_bytes(id, bytes, crc32)
# index of first blob after the last seen entry
end_of_last_entry = 0
# blob index of best fit segment
best_fit_start = nil