Class: Ignis::Collective::NetworkDirect::Connector

Inherits:
Object
  • Object
show all
Defined in:
lib/nvruby/collective/net/nd_adapter.rb

Overview

Connector for RDMA connection establishment

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter) ⇒ Connector

Returns a new instance of Connector.



377
378
379
380
381
382
# File 'lib/nvruby/collective/net/nd_adapter.rb', line 377

def initialize(adapter)
  @adapter = adapter
  @handle = nil
  @bound = false
  @connected = false
end

Instance Attribute Details

#adapterAdapter (readonly)

Returns Parent adapter.

Returns:



372
373
374
# File 'lib/nvruby/collective/net/nd_adapter.rb', line 372

def adapter
  @adapter
end

#handleFFI::Pointer (readonly)

Returns Native connector handle.

Returns:

  • (FFI::Pointer)

    Native connector handle



375
376
377
# File 'lib/nvruby/collective/net/nd_adapter.rb', line 375

def handle
  @handle
end

Instance Method Details

#accept(qp:, private_data: nil) ⇒ void

This method returns an undefined value.

Accept connection (server side)

Parameters:

  • qp (QueuePair)

    Queue pair for the connection

  • private_data (String, nil) (defaults to: nil)

    Response private data

Raises:



418
419
420
421
422
423
424
425
426
427
428
# File 'lib/nvruby/collective/net/nd_adapter.rb', line 418

def accept(qp:, private_data: nil)
  raise RDMAError, "Not bound" unless @bound

  # In real implementation:
  # 1. Listen for incoming connection
  # 2. GetConnectionRequest
  # 3. Accept with QP

  @connected = true
  qp.set_connected!
end

#bind(address:, port:) ⇒ void

This method returns an undefined value.

Bind to local address

Parameters:

  • address (String)

    Local IP address

  • port (Integer)

    Local port



388
389
390
391
392
393
394
395
# File 'lib/nvruby/collective/net/nd_adapter.rb', line 388

def bind(address:, port:)
  return if @bound

  # In real implementation: IND2Connector::Bind
  @local_address = address
  @local_port = port
  @bound = true
end

#close!void

This method returns an undefined value.

Close the connector



441
442
443
444
445
446
# File 'lib/nvruby/collective/net/nd_adapter.rb', line 441

def close!
  disconnect! if @connected
  # Release handle
  @handle = nil
  @bound = false
end

#connect(qp:, remote_address:, remote_port:, private_data: nil) ⇒ void

This method returns an undefined value.

Connect to remote peer (client side)

Parameters:

  • qp (QueuePair)

    Queue pair to connect

  • remote_address (String)

    Remote IP address

  • remote_port (Integer)

    Remote port

  • private_data (String, nil) (defaults to: nil)

    Connection private data

Raises:



403
404
405
406
407
408
409
410
411
412
# File 'lib/nvruby/collective/net/nd_adapter.rb', line 403

def connect(qp:, remote_address:, remote_port:, private_data: nil)
  raise RDMAError, "Not bound" unless @bound

  # In real implementation: IND2Connector::Connect
  # Then poll for completion
  # Then CompleteConnect

  @connected = true
  qp.set_connected!
end

#disconnect!void

This method returns an undefined value.

Disconnect



432
433
434
435
436
437
# File 'lib/nvruby/collective/net/nd_adapter.rb', line 432

def disconnect!
  return unless @connected

  # In real implementation: IND2Connector::Disconnect
  @connected = false
end