Sha256: 7cef188bc5e41e355fab7bb8609f059e2496a7227e6058c32d5747cfff1af330

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

# encoding: UTF-8

# --
# Copyright (C) 2008-2010 10gen Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ++

module Mongo
  class GridIO

    # This fixes a comparson issue in JRuby 1.9
    def get_md5
      md5_command            = BSON::OrderedHash.new
      md5_command['filemd5'] = @files_id
      md5_command['root']    = @fs_name
      @server_md5 = @files.db.command(md5_command)['md5']
      if @safe
        @client_md5 = @local_md5.hexdigest
        if @local_md5.to_s != @server_md5.to_s
          raise GridMD5Failure, "File on server failed MD5 check"
        end
      else
        @server_md5
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mongo-1.2.rc2 lib/mongo/gridfs/grid_io_fix.rb
mongo-1.2.rc1 lib/mongo/gridfs/grid_io_fix.rb
mongo-1.2.rc0 lib/mongo/gridfs/grid_io_fix.rb
mongo-1.1.5 lib/mongo/gridfs/grid_io_fix.rb
mongo-1.1.4 lib/mongo/gridfs/grid_io_fix.rb
mongo-1.1.3 lib/mongo/gridfs/grid_io_fix.rb
mongo-1.1.2 lib/mongo/gridfs/grid_io_fix.rb
mongo-1.1.1 lib/mongo/gridfs/grid_io_fix.rb