lib/perobs/TreeDB.rb in perobs-3.0.1 vs lib/perobs/TreeDB.rb in perobs-3.0.2

- old
+ new

@@ -101,11 +101,11 @@ def BTreeDB::delete_db(db_name) FileUtils.rm_rf(db_name) end # Return true if the object with given ID exists - # @param id [Fixnum or Bignum] + # @param id [Integer] def include?(id) !(blob = find_blob(id)).nil? && !blob.find(id).nil? end # Store a simple Hash as a JSON encoded file into the DB directory. @@ -141,11 +141,11 @@ def put_object(obj, id) find_blob(id, true).write_object(id, serialize(obj)) end # Load the given object from the filesystem. - # @param id [Fixnum or Bignum] object ID + # @param id [Integer] object ID # @return [Hash] Object as defined by PEROBS::ObjectBase or nil if ID does # not exist def get_object(id) return nil unless (blob = find_blob(id)) && (obj = blob.read_object(id)) deserialize(obj) @@ -164,17 +164,17 @@ each_blob { |blob| deleted_ids += blob.delete_unmarked_entries } deleted_ids end # Mark an object. - # @param id [Fixnum or Bignum] ID of the object to mark + # @param id [Integer] ID of the object to mark def mark(id) (blob = find_blob(id)) && blob.mark(id) end # Check if the object is marked. - # @param id [Fixnum or Bignum] ID of the object to check + # @param id [Integer] ID of the object to check # @param ignore_errors [Boolean] If set to true no errors will be raised # for non-existing objects. def is_marked?(id, ignore_errors = false) (blob = find_blob(id)) && blob.is_marked?(id, ignore_errors) end @@ -185,11 +185,11 @@ def check_db(repair = false) each_blob { |blob| blob.check(repair) } end # Check if the stored object is syntactically correct. - # @param id [Fixnum/Bignum] Object ID + # @param id [Integer] Object ID # @param repair [TrueClass/FalseClass] True if an repair attempt should be # made. # @return [TrueClass/FalseClass] True if the object is OK, otherwise # false. def check(id, repair) @@ -204,11 +204,11 @@ end # Store the given serialized object into the cluster files. This method is # for internal use only! # @param raw [String] Serialized Object as defined by PEROBS::ObjectBase - # @param id [Fixnum or Bignum] Object ID + # @param id [Integer] Object ID def put_raw_object(raw, id) find_blob(id, true).write_object(id, raw) end private @@ -224,10 +224,10 @@ end else Dir.glob(File.join(dir_name, '*.index')).each do |fqfn| # Extract the 01-part of the filename lsb_string = File.basename(fqfn)[0..-6] - # Convert the lsb_string into a Fixnum + # Convert the lsb_string into a Integer lsb = Integer('0b' + lsb_string) # Bit mask to match the LSBs mask = (2 ** lsb_string.length) - 1 if (id & mask) == lsb return TreeBlob.new(sub_dir_name, lsb_string, self)