File: base.rb

package info (click to toggle)
ruby-mongo 2.23.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,020 kB
  • sloc: ruby: 110,810; makefile: 5
file content (30 lines) | stat: -rw-r--r-- 752 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

require_relative '../base'

module Mongo
  module DriverBench
    module BSON
      # Abstract superclass for all BSON benchmarks.
      #
      # @api private
      class Base < Mongo::DriverBench::Base
        private

        # Common setup for these benchmarks.
        def setup
          # rubocop:disable Naming/MemoizedInstanceVariableName
          @dataset ||= load_file(file_name).first
          @dataset_size ||= size_of_file(file_name) * 10_000
          # rubocop:enable Naming/MemoizedInstanceVariableName
        end

        # Returns the name of the file name that contains
        # the dataset to use.
        def file_name
          raise NotImplementedError
        end
      end
    end
  end
end