Ice.ObjectPrx¶
- class Ice.ObjectPrx¶
Bases:
ObjectPrxThe base class for all Ice proxies.
- static uncheckedCast(proxy: ObjectPrx | None, facet: str | None = None) ObjectPrx | None¶
Creates a new proxy from an existing proxy.
- static checkedCast(proxy: ObjectPrx | None, facet: str | None = None, context: dict[str, str] | None = None) ObjectPrx | None¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
- Returns:
A new proxy with the requested facet, or
Noneif the source proxy isNoneor if the target object/facet does not support the requested type.- Return type:
ObjectPrx | None
- static checkedCastAsync(proxy: ObjectPrx | None, facet: str | None = None, context: dict[str, str] | None = None) Awaitable[ObjectPrx | None]¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- static ice_staticId() str¶
Returns the Slice type ID associated with this type.
- Returns:
The Slice type ID.
- Return type:
- ice_getCommunicator() Communicator¶
Gets the communicator that created this proxy.
- Returns:
The communicator that created this proxy.
- Return type:
- Raises:
CommunicatorDestroyedException – If the communicator has been destroyed.
- ice_isA(id: str, context: dict[str, str] | None = None) bool¶
Tests whether this object supports a specific Slice interface.
- ice_isAAsync(id: str, context: dict[str, str] | None = None) Awaitable[bool]¶
Tests whether this object supports a specific Slice interface.
- ice_ping(context: dict[str, str] | None = None)¶
Tests whether the target object of this proxy can be reached.
- ice_pingAsync(context: dict[str, str] | None = None) Awaitable[None]¶
Tests whether the target object of this proxy can be reached.
- ice_ids(context: dict[str, str] | None = None) list[str]¶
Returns the Slice interfaces supported by this object as a list of Slice type IDs.
- ice_idsAsync(context: dict[str, str] | None = None) Awaitable[list[str]]¶
Returns the Slice interfaces supported by this object as a list of Slice type IDs.
- ice_id(context: dict[str, str] | None = None) str¶
Returns the type ID of the most-derived Slice interface supported by this object.
- ice_idAsync(context: dict[str, str] | None = None) Awaitable[str]¶
Returns the type ID of the most-derived Slice interface supported by this object.
- ice_invoke(operation: str, mode: OperationMode, inParams: bytes, ctx: dict[str, str] | None = None) tuple[bool, bytes]¶
Invokes an operation dynamically.
- Parameters:
operation (str) – The name of the operation to invoke.
mode (OperationMode) – The operation mode (normal or idempotent).
inParams (bytes) – An encapsulation containing the encoded in-parameters for the operation. You can pass an empty byte string when the operation takes no in-parameters; the Ice runtime then marshals an empty encapsulation.
ctx (dict[str, str] | None, optional) – The request context.
- Returns:
A success flag and an encapsulation. If the operation completed successfully, the flag is
Trueand the encapsulation contains the encoded out-parameters and return value (the return value follows any out-parameters). If the operation raised a user exception, the flag isFalseand the encapsulation contains the encoded user exception. If the operation raised a runtime exception, this method raises it directly. When this proxy is a oneway, datagram, or batch proxy, the flag is alwaysTrueand the encapsulation is empty.- Return type:
- ice_invokeAsync(operation: str, mode: OperationMode, inParams: bytes, ctx: dict[str, str] | None = None) Awaitable[tuple[bool, bytes]]¶
Invokes an operation dynamically.
- Parameters:
operation (str) – The name of the operation to invoke.
mode (OperationMode) – The operation mode (normal or idempotent).
inParams (bytes) – An encapsulation containing the encoded in-parameters for the operation. You can pass an empty byte string when the operation takes no in-parameters; the Ice runtime then marshals an empty encapsulation.
ctx (dict[str, str] | None, optional) – The request context.
- Returns:
An
Awaitablethat completes when the invocation completes. It holds a success flag and an encapsulation. If the operation completed successfully, the flag isTrueand the encapsulation contains the encoded out-parameters and return value (the return value follows any out-parameters). If the operation raised a user exception, the flag isFalseand the encapsulation contains the encoded user exception. If the operation raised a runtime exception, theAwaitableraises it directly. When this proxy is a oneway, datagram, or batch proxy, the flag is alwaysTrueand the encapsulation is empty.- Return type:
- ice_getIdentity() Identity¶
Gets the identity embedded in this proxy.
- Returns:
The identity of the target object.
- Return type:
- ice_identity(newIdentity: Identity) ObjectPrx¶
Creates a proxy that is identical to this proxy, except for the identity.
- ice_context(new_context: dict[str, str]) Self¶
Creates a proxy that is identical to this proxy, except for the per-proxy context.
- ice_getFacet() str¶
Gets the facet for this proxy.
- Returns:
The facet for this proxy. If the proxy uses the default facet, the return value is the empty string.
- Return type:
- ice_facet(new_facet: str) ObjectPrx¶
Creates a proxy that is identical to this proxy, except for the facet.
- ice_getAdapterId() str¶
Gets the adapter ID for this proxy.
- Returns:
The adapter ID. If the proxy does not have an adapter ID, the return value is the empty string.
- Return type:
- ice_adapterId(newAdapterId: str) Self¶
Creates a proxy that is identical to this proxy, except for the adapter ID.
- Parameters:
newAdapterId (str) – The adapter ID for the new proxy.
- Returns:
A proxy with the new adapter ID.
- Return type:
Self
- ice_getEndpoints() tuple[Endpoint, ...]¶
Gets the endpoints used by this proxy.
- Returns:
The endpoints used by this proxy.
- Return type:
tuple[Ice.Endpoint, …]
- ice_endpoints(newEndpoints: tuple[Endpoint, ...] | list[Endpoint]) Self¶
Creates a proxy that is identical to this proxy, except for the endpoints.
- Parameters:
newEndpoints (tuple[Ice.Endpoint, ...] | list[Ice.Endpoint]) – The endpoints for the new proxy.
- Returns:
A proxy with the new endpoints.
- Return type:
Self
- ice_getLocatorCacheTimeout() int¶
Gets the locator cache timeout of this proxy.
- Returns:
The locator cache timeout value (in seconds).
- Return type:
- ice_locatorCacheTimeout(timeout: int) Self¶
Creates a proxy that is identical to this proxy, except for the locator cache timeout.
- Parameters:
timeout (int) – The new locator cache timeout (in seconds).
- Returns:
A proxy with the new timeout.
- Return type:
Self
- ice_invocationTimeout(timeout: int) Self¶
Creates a proxy that is identical to this proxy, except for the invocation timeout.
- Parameters:
timeout (int) – The new invocation timeout (in milliseconds).
- Returns:
A proxy with the new timeout.
- Return type:
Self
- ice_getInvocationTimeout() int¶
Gets the invocation timeout of this proxy.
- Returns:
The invocation timeout value (in milliseconds).
- Return type:
- ice_isConnectionCached() bool¶
Determines whether this proxy caches connections.
- Returns:
Trueif this proxy caches connections,Falseotherwise.- Return type:
- ice_connectionCached(newCache: bool) Self¶
Creates a proxy that is identical to this proxy, except for connection caching.
- Parameters:
newCache (bool) –
Trueif the new proxy should cache connections,Falseotherwise.- Returns:
A proxy with the specified caching policy.
- Return type:
Self
- ice_getEndpointSelection() EndpointSelectionType¶
Gets the endpoint selection policy for this proxy (randomly or ordered).
- Returns:
The endpoint selection policy.
- Return type:
- ice_endpointSelection(newType: EndpointSelectionType) Self¶
Creates a proxy that is identical to this proxy, except for the endpoint selection policy.
- Parameters:
newType (EndpointSelectionType) – The new endpoint selection policy.
- Returns:
A proxy with the specified endpoint selection policy.
- Return type:
Self
- ice_encodingVersion(version: EncodingVersion) Self¶
Creates a proxy that is identical to this proxy, except for the encoding used to marshal parameters.
- Parameters:
version (EncodingVersion) – The encoding version to use to marshal request parameters.
- Returns:
A proxy with the specified encoding version.
- Return type:
Self
- ice_getEncodingVersion() EncodingVersion¶
Gets the encoding version used to marshal request parameters.
- Returns:
The encoding version.
- Return type:
- ice_getRouter() RouterPrx | None¶
Gets the router for this proxy.
- Returns:
The router for the proxy. If no router is configured for the proxy, the return value is
None.- Return type:
RouterPrx | None
- ice_router(router: RouterPrx | None) Self¶
Creates a proxy that is identical to this proxy, except for the router.
- Parameters:
router (RouterPrx | None) – The router for the new proxy.
- Returns:
A proxy with the specified router.
- Return type:
Self
- ice_getLocator() LocatorPrx | None¶
Gets the locator for this proxy.
- Returns:
The locator for this proxy. If no locator is configured, the return value is
None.- Return type:
LocatorPrx | None
- ice_locator(locator: LocatorPrx | None) Self¶
Creates a proxy that is identical to this proxy, except for the locator.
- Parameters:
locator (LocatorPrx | None) – The locator for the new proxy.
- Returns:
A proxy with the specified locator.
- Return type:
Self
- ice_isCollocationOptimized() bool¶
Determines whether this proxy has collocation optimization enabled.
- Returns:
Trueif this proxy has collocation optimization enabled,Falseotherwise.- Return type:
See also
- ice_collocationOptimized(collocated: bool) Self¶
Creates a proxy that is identical to this proxy, except for collocation optimization.
- Parameters:
collocated (bool) –
Trueif the new proxy enables collocation optimization,Falseotherwise.- Returns:
A proxy with the specified collocation optimization.
- Return type:
Self
- ice_twoway() Self¶
Creates a proxy that is identical to this proxy, but uses twoway invocations.
- Returns:
A proxy that uses twoway invocations.
- Return type:
Self
- ice_isTwoway() bool¶
Determines whether this proxy uses twoway invocations.
- Returns:
Trueif this proxy uses twoway invocations,Falseotherwise.- Return type:
- ice_oneway() Self¶
Creates a proxy that is identical to this proxy, but uses oneway invocations.
- Returns:
A proxy that uses oneway invocations.
- Return type:
Self
- ice_isOneway() bool¶
Determines whether this proxy uses oneway invocations.
- Returns:
Trueif this proxy uses oneway invocations,Falseotherwise.- Return type:
- ice_batchOneway() Self¶
Creates a proxy that is identical to this proxy, but uses batch oneway invocations.
- Returns:
A proxy that uses batch oneway invocations.
- Return type:
Self
- ice_isBatchOneway() bool¶
Determines whether this proxy uses batch oneway invocations.
- Returns:
Trueif this proxy uses batch oneway invocations,Falseotherwise.- Return type:
- ice_datagram() Self¶
Creates a proxy that is identical to this proxy, but uses datagram invocations.
- Returns:
A proxy that uses datagram invocations.
- Return type:
Self
- ice_isDatagram() bool¶
Determines whether this proxy uses datagram invocations.
- Returns:
Trueif this proxy uses datagram invocations,Falseotherwise.- Return type:
- ice_batchDatagram() Self¶
Creates a proxy that is identical to this proxy, but uses batch datagram invocations.
- Returns:
A proxy that uses batch datagram invocations.
- Return type:
Self
- ice_isBatchDatagram() bool¶
Determines whether this proxy uses batch datagram invocations.
- Returns:
Trueif this proxy uses batch datagram invocations,Falseotherwise.- Return type:
- ice_compress(compress: bool) Self¶
Creates a proxy that is identical to this proxy, except for its compression setting which overrides the compression setting from the proxy endpoints.
- Parameters:
compress (bool) –
Trueenables compression for the new proxy,Falsedisables compression.- Returns:
A proxy with the specified compression override setting.
- Return type:
Self
- ice_getCompress() bool | None¶
Gets the compression override setting of this proxy.
- Returns:
The compression override setting. If
Noneis returned, no override is set. Otherwise,Trueif compression is enabled,Falseotherwise.- Return type:
bool | None
- ice_connectionId(connectionId: str) Self¶
Creates a proxy that is identical to this proxy, except for its connection ID.
- Parameters:
connectionId (str) – The connection ID for the new proxy. An empty string removes the connection ID.
- Returns:
A proxy with the specified connection ID.
- Return type:
Self
- ice_getConnectionId() str¶
Gets the connection ID of this proxy.
- Returns:
The connection ID.
- Return type:
- ice_fixed(connection: Connection) Self¶
Creates a proxy that is identical to this proxy, except it’s a fixed proxy bound to the given connection.
- Parameters:
connection (Connection) – The fixed proxy connection.
- Returns:
A fixed proxy bound to the given connection.
- Return type:
Self
- ice_isFixed() bool¶
Determines whether this proxy is a fixed proxy.
- Returns:
Trueif this proxy is a fixed proxy,Falseotherwise.- Return type:
- ice_getConnection() Connection | None¶
Gets the connection for this proxy. If the proxy does not yet have an established connection or its connection is closed or being closed, it first attempts to create a new connection. For a fixed proxy, this method returns the connection this proxy is bound to, even when this connection is closed.
- Returns:
The Connection for this proxy.
- Return type:
Connection | None
Notes
You can call this method to establish a connection or associate the proxy with an existing connection and ignore the return value.
When this proxy reaches its target object through collocation optimization (see
ice_collocationOptimized()), this method returnsNone: collocated invocations don’t use a connection.
- ice_getConnectionAsync() Awaitable[Connection | None]¶
Gets the connection for this proxy. If the proxy does not yet have an established connection or its connection is closed or being closed, it first attempts to create a new connection. For a fixed proxy, the returned
Awaitableholds the connection this proxy is bound to, even when this connection is closed.- Returns:
An
Awaitablethat completes when the connection is available. It holds the Connection for this proxy.- Return type:
Awaitable[Connection | None]
Notes
You can call this method to establish a connection or associate the proxy with an existing connection and ignore the result.
When this proxy reaches its target object through collocation optimization (see
ice_collocationOptimized()), theAwaitableholdsNone: collocated invocations don’t use a connection.
- ice_getCachedConnection() Connection | None¶
Gets the Connection cached by this proxy. Once this proxy has been associated with a connection (typically during its first invocation), it caches this connection and continues using it for subsequent invocations, until an invocation on this proxy fails. This method never attempts to establish a connection. For a fixed proxy, this method returns the connection this proxy is bound to, even when this connection is closed. This method never raises an exception.
- Returns:
The cached connection, or
Noneif this proxy doesn’t have a cached connection. The returned connection can be closed.- Return type:
Connection | None
Notes
A proxy with connection caching disabled (see
ice_connectionCached()) never caches a connection: for such a proxy, this method always returnsNone. This method also returnsNonewhen this proxy reaches its target object through collocation optimization (seeice_collocationOptimized()): collocated invocations don’t use a connection.
- ice_flushBatchRequests() None¶
Flushes any pending batched requests for this proxy. The call blocks until the flush is complete.
- Return type:
None