Module: Pinot

Defined in:
lib/pinot/config.rb,
lib/pinot/request.rb,
lib/pinot/version.rb,
lib/pinot/response.rb,
lib/pinot/transport.rb,
lib/pinot/connection.rb,
lib/pinot/broker_selector.rb,
lib/pinot/connection_factory.rb,
lib/pinot/prepared_statement.rb,
lib/pinot/controller_response.rb,
lib/pinot/simple_broker_selector.rb,
lib/pinot/table_aware_broker_selector.rb,
lib/pinot/controller_based_broker_selector.rb

Defined Under Namespace

Modules: BrokerSelector, PreparedStatement Classes: AggregationResult, BrokerDto, BrokerResponse, ClientConfig, Connection, ControllerBasedBrokerSelector, ControllerConfig, ControllerResponse, HttpClient, JsonHttpTransport, JsonNumber, PinotException, PreparedStatementImpl, Request, RespSchema, ResultTable, SelectionResults, SimpleBrokerSelector, TableAwareBrokerSelector

Constant Summary collapse

VERSION =
"1.0.2"
INT32_MAX =
2_147_483_647
INT32_MIN =
-2_147_483_648
INT64_MAX =
9_223_372_036_854_775_807
INT64_MIN =
-9_223_372_036_854_775_808
FLOAT32_MAX =
3.4028235e+38

Class Method Summary collapse

Class Method Details

.from_broker_list(broker_list, http_client: nil) ⇒ Object



2
3
4
5
# File 'lib/pinot/connection_factory.rb', line 2

def self.from_broker_list(broker_list, http_client: nil)
  config = ClientConfig.new(broker_list: broker_list)
  from_config(config, http_client: http_client)
end

.from_config(config, http_client: nil) ⇒ Object

Raises:

  • (ArgumentError)


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/pinot/connection_factory.rb', line 14

def self.from_config(config, http_client: nil)
  inner = http_client || HttpClient.new(timeout: config.http_timeout)

  transport = JsonHttpTransport.new(
    http_client: inner,
    extra_headers: config.extra_http_header || {}
  )

  selector = build_selector(config, inner)
  raise ArgumentError, "must specify broker_list or controller_config" unless selector

  conn = Connection.new(
    transport: transport,
    broker_selector: selector,
    use_multistage_engine: config.use_multistage_engine || false
  )

  selector.init
  conn
end

.from_controller(controller_address, http_client: nil) ⇒ Object



7
8
9
10
11
12
# File 'lib/pinot/connection_factory.rb', line 7

def self.from_controller(controller_address, http_client: nil)
  config = ClientConfig.new(
    controller_config: ControllerConfig.new(controller_address: controller_address)
  )
  from_config(config, http_client: http_client)
end