class Movie::Remote::StripedConnectionPool

Overview

StripedConnectionPool maintains multiple parallel connections to a remote system. Actors are deterministically mapped to connections to preserve message ordering while enabling parallel sending across different actors.

Defined in:

movie/remote/connection_pool.cr

Constant Summary

DEFAULT_STRIPE_COUNT = 8

Default number of parallel connections (should match CPU cores)

Log = ::Log.for(self)

Constructors

Instance Method Summary

Constructor Detail

def self.new(address : Address, path_registry : Movie::PathRegistry, system : Movie::AbstractActorSystem, local_address : Proc(Address), node_uid : String, stripe_count : Int32 = DEFAULT_STRIPE_COUNT, settings : AssociationSettings = AssociationSettings.new, on_message : Proc(WireEnvelope, Nil) | Nil = nil) #

[View source]

Instance Method Detail

def address : Address #

[View source]
def close #

Closes all connections.


[View source]
def connect : Bool #

Connects all stripes in parallel. Returns true if all connections succeeded.


[View source]
def connected? : Bool #

[View source]
def connection_for(actor_path : ActorPath) : Connection #

Returns the connection for a specific actor path. Uses consistent hashing to ensure messages to the same actor always go through the same connection (preserving order).


[View source]
def connection_for(path_str : String) : Connection #

Returns the connection for a path string.


[View source]
def next_connection : Connection #

Returns the next connection in round-robin order. Use for messages where ordering doesn't matter.


[View source]
def send(envelope : WireEnvelope) : Bool #

Sends an envelope through the appropriate stripe based on target path.


[View source]
def send_control(envelope : WireEnvelope) : Bool #

[View source]
def send_round_robin(envelope : WireEnvelope) : Bool #

Sends an envelope through a specific stripe (for load balancing).


[View source]
def stats : PoolStats #

Returns connection statistics.


[View source]
def stopped? : Bool #

[View source]
def stripe(index : Int32) : Connection #

Returns a specific stripe by index.


[View source]
def stripe_count : Int32 #

[View source]