Object.NetworkProxy (object v0.1.2)
Network proxy for transparent remote Object access.
Provides a local proxy that forwards method calls to remote Objects over the network. Handles connection management, caching, retries, and circuit breaking automatically.
Features
- Transparent proxy objects that behave like local objects
- Method call forwarding over network
- Response caching with TTL
- Automatic retry with exponential backoff
- Circuit breaker pattern for fault tolerance
- Latency-aware routing
- Connection pooling
Summary
Functions
Calls a method on the remote object.
Casts a message to the remote object (fire-and-forget).
Returns a specification to start this module under a supervisor.
Clears the method cache.
Creates a proxy for a remote object.
Gets statistics about the proxy.
Refreshes the remote node location.
Types
@type cached_result() :: %{ result: term(), timestamp: DateTime.t(), ttl: non_neg_integer() }
@type circuit_breaker_state() :: %{ state: :closed | :open | :half_open, failure_count: non_neg_integer(), last_failure: DateTime.t() | nil, success_count: non_neg_integer() }
@type node_info() :: %{ id: binary(), address: String.t(), port: non_neg_integer(), connection_id: String.t() | nil }
@type pending_call() :: %{ from: GenServer.from(), method: String.t(), args: list(), attempt: non_neg_integer(), start_time: DateTime.t() }
@type proxy_config() :: %{ timeout: timeout(), max_retries: non_neg_integer(), cache_ttl: non_neg_integer(), prefetch: boolean() }
@type proxy_state() :: %{ object_id: String.t(), remote_node: node_info() | nil, cache: %{required(String.t()) => cached_result()}, pending_calls: %{required(reference()) => pending_call()}, circuit_breaker: circuit_breaker_state(), stats: proxy_stats(), config: proxy_config() }
@type proxy_stats() :: %{ total_calls: non_neg_integer(), successful_calls: non_neg_integer(), failed_calls: non_neg_integer(), cache_hits: non_neg_integer(), avg_latency_ms: float() }
Functions
Calls a method on the remote object.
Casts a message to the remote object (fire-and-forget).
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec clear_cache(pid()) :: :ok
Clears the method cache.
Creates a proxy for a remote object.
@spec get_stats(pid()) :: proxy_stats()
Gets statistics about the proxy.
Refreshes the remote node location.