Sha256: fb20d7e89ab05409154ed7051b68faf59806d4967826bbf4fd6e373150f8370f

Contents?: true

Size: 1.7 KB

Versions: 24

Compression:

Stored size: 1.7 KB

Contents

# frozen_string_literal: true

#  Copyright 2020-2022 Couchbase, 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 Couchbase
  module ConfigProfiles
    class Profiles
      attr_reader :profiles

      def initialize
        @profiles = {}
        register_profile("wan_development", DevelopmentProfile.new)
      end

      def register_profile(name, profile)
        @profiles[name] = profile
      end

      def apply(profile_name, options)
        raise ArgumentError, "#{profile_name} is not a registered profile" unless @profiles.key?(profile_name)

        @profiles[profile_name].apply(options)
      end
    end

    class Profile
      def apply(options); end
    end

    class DevelopmentProfile < Profile
      def apply(options)
        options.key_value_timeout = 20_000
        # TODO: Add `options.key_value_durable_timeout = 20_000` when key_value_durable_timeout is added to Options::Cluster
        options.connect_timeout = 20_000
        options.view_timeout = 120_000
        options.query_timeout = 120_000
        options.analytics_timeout = 120_000
        options.search_timeout = 120_000
        options.management_timeout = 120_000
      end
    end

    KNOWN_PROFILES = Profiles.new
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
couchbase-3.5.6 lib/couchbase/config_profiles.rb
couchbase-3.5.6-x86_64-linux-musl lib/couchbase/config_profiles.rb
couchbase-3.5.6-x86_64-linux lib/couchbase/config_profiles.rb
couchbase-3.5.6-x86_64-darwin lib/couchbase/config_profiles.rb
couchbase-3.5.6-arm64-darwin lib/couchbase/config_profiles.rb
couchbase-3.5.5 lib/couchbase/config_profiles.rb
couchbase-3.5.5-arm64-darwin lib/couchbase/config_profiles.rb
couchbase-3.5.5-x86_64-darwin lib/couchbase/config_profiles.rb
couchbase-3.5.5-x86_64-linux lib/couchbase/config_profiles.rb
couchbase-3.5.5-x86_64-linux-musl lib/couchbase/config_profiles.rb
couchbase-3.5.4 lib/couchbase/config_profiles.rb
couchbase-3.5.4-arm64-darwin lib/couchbase/config_profiles.rb
couchbase-3.5.4-x86_64-darwin lib/couchbase/config_profiles.rb
couchbase-3.5.4-x86_64-linux lib/couchbase/config_profiles.rb
couchbase-3.5.4-x86_64-linux-musl lib/couchbase/config_profiles.rb
couchbase-3.5.3-x86_64-linux-musl lib/couchbase/config_profiles.rb
couchbase-3.5.3 lib/couchbase/config_profiles.rb
couchbase-3.5.3-arm64-darwin lib/couchbase/config_profiles.rb
couchbase-3.5.3-x86_64-darwin lib/couchbase/config_profiles.rb
couchbase-3.5.3-x86_64-linux lib/couchbase/config_profiles.rb