Ice package¶
Module contents¶
Ice module
- exception Ice.AdapterAlreadyActiveException¶
Bases:
UserException
The exception that is thrown when a server application tries to register endpoints for an object adapter that is already active.
- Return type:
None
- exception Ice.AdapterNotFoundException¶
Bases:
UserException
The exception that is thrown by a
Ice.LocatorPrx
implementation when it cannot find an object adapter with the provided adapter ID.- Return type:
None
- exception Ice.AlreadyRegisteredException(kindOfObject: str, id: str, msg: str)¶
Bases:
LocalException
An attempt was made to register something more than once with the Ice run time. This exception is raised if an attempt is made to register a servant, servant locator, facet, plug-in, or object adapter more than once for the same ID.
- Parameters:
kindOfObject (str)
id (str)
msg (str)
- property id¶
The ID (or name) of the object that is already registered.
- Returns:
The ID of the registered object.
- Return type:
str
- property kindOfObject¶
The kind of object that could not be removed.
This property can have one of the following values:
“servant”
“facet”
“object”
“default servant”
“servant locator”
“plugin”
“object adapter”
“object adapter with router”
“replica group”
- Returns:
The kind of object that could not be removed.
- Return type:
str
- class Ice.Blobject¶
Bases:
Object
,ABC
Special-purpose servant base class that allows a subclass to handle synchronous Ice invocations as “blobs” of bytes.
This class serves as a base for creating servants that can process encoded Ice operation arguments and return results or exceptions in an encoded form. Subclasses must implement the ice_invoke method to handle the invocation logic.
- abstractmethod ice_invoke(bytes: bytes, current: Current) tuple[bool, bytes] | Awaitable[tuple[bool, bytes]] ¶
Dispatches a synchronous Ice invocation.
The operation’s arguments are encoded in the bytes parameter. The return value must be a tuple of two values: the first is a boolean indicating whether the operation succeeded (True) or raised a user exception (False), and the second is the encoded form of the operation’s results or the user exception.
- Parameters:
bytes (bytes) – The encoded operation arguments.
current (Ice.Current) – The current invocation context.
- Returns:
bool True if the operation succeeded, False if it raised a user exception.
bytes The encoded form of the operation’s results or the user exception.
- Return type:
tuple of (bool, bytes) or awaitable of tuple of (bool, bytes)
- exception Ice.CloseConnectionException¶
Bases:
ProtocolException
This exception indicates that the connection has been gracefully shut down by the server. The operation call that caused this exception has not been executed by the server. In most cases you will not get this exception, because the client will automatically retry the operation call in case the server shut down the connection. However, if upon retry the server shuts down the connection again, and the retry limit has been reached, then this exception is propagated to the application code.
- exception Ice.CloseTimeoutException¶
Bases:
TimeoutException
This exception indicates a connection closure timeout condition.
- class Ice.Communicator(impl: IcePy.Communicator, eventLoopAdapter: EventLoopAdapter | None = None)¶
Bases:
object
The main entry point to the Ice runtime, represented by the
Communicator
class.Example
The following example shows how to create a communicator and use the
async with
statement to ensure that the communicator is properly destroyed.async def main(): async with Ice.initialize( sys.argv, eventLoop=asyncio.get_running_loop() ) as communicator: ... if __name__ == "__main__": asyncio.run(main())
- Parameters:
impl (IcePy.Communicator)
eventLoopAdapter (EventLoopAdapter | None)
- addAdminFacet(servant: Object | None, facet: str) None ¶
Adds a new facet to the Admin object.
This method adds a new servant implementing the specified Admin facet.
- Parameters:
servant (Object) – The servant that implements the new Admin facet.
facet (str) – The name of the new Admin facet.
- Raises:
AlreadyRegisteredException – If the facet is already registered.
- Return type:
None
- createAdmin(adminAdapter: ObjectAdapter | None, adminId: Identity) ObjectPrx ¶
Add the Admin object with all its facets to the provided object adapter.
If
Ice.Admin.ServerId
is set and the provided object adapter has a Locator,createAdmin
registers the Admin’s Process facet with the Locator’s LocatorRegistry.createAdmin
must only be called once; subsequent calls raise InitializationException.- Parameters:
adminAdapter (ObjectAdapter | None) – The object adapter used to host the Admin object. If None and Ice.Admin.Endpoints is set, create, activate, and use the Admin object adapter.
adminId (Identity) – The identity of the Admin object.
- Returns:
A proxy to the main (“”) facet of the Admin object.
- Return type:
- Raises:
InitializationException – If the method is called more than once.
- createObjectAdapter(name: str) ObjectAdapter ¶
Create a new object adapter.
The endpoints for the object adapter are taken from the property
name.Endpoints
. It is legal to create an object adapter with an empty string as its name. Such an object adapter is accessible via bidirectional connections or by collocated invocations that originate from the same communicator as is used by the adapter. Attempts to create a named object adapter for which no configuration can be found raise an InitializationException.- Parameters:
name (str) – The object adapter name.
- Returns:
The new object adapter.
- Return type:
- createObjectAdapterWithEndpoints(name: str, endpoints: str) ObjectAdapter ¶
Create a new object adapter with endpoints.
This operation sets the property name.Endpoints and then calls createObjectAdapter. It is provided as a convenience function. Calling this operation with an empty name will result in a UUID being generated for the name.
- Parameters:
name (str) – The object adapter name.
endpoints (str) – The endpoints for the object adapter.
- Returns:
The new object adapter.
- Return type:
- createObjectAdapterWithRouter(name: str, router: RouterPrx) ObjectAdapter ¶
Create a new object adapter with a router.
This operation creates a routed object adapter. Calling this operation with an empty name will result in a UUID being generated for the name.
- Parameters:
name (str) – The object adapter name.
router (RouterPrx) – The router.
- Returns:
The new object adapter.
- Return type:
- destroy() None ¶
Destroys this communicator. This method calls shutdown implicitly. Calling destroy destroys all object adapters, and closes all outgoing connections. destroy waits for all outstanding dispatches to complete before returning. This includes “bidirectional dispatches” that execute on outgoing connections.
- Return type:
None
- destroyAsync() Awaitable[None] ¶
Destroys this communicator asynchronously. This method calls shutdown implicitly. Calling destroy destroys all object adapters, and closes all outgoing connections. destroy waits for all outstanding dispatches to complete before returning. This includes “bidirectional dispatches” that execute on outgoing connections.
- Return type:
Awaitable[None]
- property eventLoopAdapter: EventLoopAdapter | None¶
The event loop adapter associated with this communicator, or None if the communicator does not have one.
- Returns:
The event loop adapter used for integrating Ice with a custom event loop.
- Return type:
EventLoopAdapter | None
- findAdminFacet(facet: str) Object | None ¶
Return a facet of the Admin object.
- Parameters:
facet (str) – The name of the Admin facet.
- Returns:
The servant associated with the specified Admin facet, or None if no facet is registered with the given name.
- Return type:
Object | None
- findAllAdminFacets() dict[str, Object] ¶
Return a dictionary of all facets of the Admin object.
- Returns:
A dictionary where the keys are facet names and the values are the associated servants.
- Return type:
dict[str, Object]
- flushBatchRequests(compress: CompressBatch)¶
Flush any pending batch requests for this communicator. This means all batch requests invoked on fixed proxies for all connections associated with the communicator. Any errors that occur while flushing a connection are ignored.
- Parameters:
compress (CompressBatch) – Specifies whether or not the queued batch requests should be compressed before being sent over the wire.
- flushBatchRequestsAsync(compress: CompressBatch) Awaitable[None] ¶
Flush any pending batch requests for this communicator asynchronously. This means all batch requests invoked on fixed proxies for all connections associated with the communicator. Any errors that occur while flushing a connection are ignored.
- Parameters:
compress (CompressBatch) – Specifies whether or not the queued batch requests should be compressed before being sent over the wire.
- Return type:
Awaitable[None]
- getAdmin() ObjectPrx | None ¶
Get a proxy to the main facet of the Admin object.
This method also creates the Admin object and activates the
Ice.Admin
object adapter to host this Admin object ifIce.Admin.Endpoints
property is set. The identity of the Admin object created by getAdmin is{value of Ice.Admin.InstanceName}/admin
, or{UUID}/admin
whenIce.Admin.InstanceName
property is not set. IfIce.Admin.DelayCreation
property is 0 or not set, getAdmin is called by the communicator initialization, after initialization of all plugins.- Returns:
A proxy to the main (“”) facet of the Admin object, or None if no Admin object is configured.
- Return type:
ObjectPrx | None
- getDefaultLocator() LocatorPrx | None ¶
Get the default locator for this communicator.
- Returns:
The default locator for this communicator, or None if no default locator has been set.
- Return type:
LocatorPrx | None
- getDefaultObjectAdapter() ObjectAdapter | None ¶
Get the object adapter that is associated by default with new outgoing connections created by this communicator. This method returns None unless you set a default object adapter using createDefaultObjectAdapter.
- Returns:
The object adapter associated by default with new outgoing connections.
- Return type:
ObjectAdapter | None
- getDefaultRouter()¶
Get the default router for this communicator.
- Returns:
The default router for this communicator, or None if no default router has been set.
- Return type:
RouterPrx | None
- getImplicitContext()¶
Get the implicit context associated with this communicator.
- Returns:
The implicit context associated with this communicator, or None if the property Ice.ImplicitContext is not set or is set to
"None"
.- Return type:
ImplicitContext or None
- getLogger()¶
Get the logger for this communicator.
- Returns:
The logger associated with this communicator.
- Return type:
- getProperties() Properties ¶
Get the properties for this communicator.
- Returns:
The properties associated with this communicator.
- Return type:
- identityToString(identity: Identity) str ¶
Convert an identity into a string.
- Parameters:
identity (Identity) – The identity to convert into a string.
- Returns:
The string representation of the identity.
- Return type:
str
- isShutdown() bool ¶
Checks whether or not shutdown was called on this communicator.
- Returns:
True if shutdown was called on this communicator; False otherwise.
- Return type:
bool
- propertyToProxy(property: str) ObjectPrx ¶
Convert a set of proxy properties into a proxy.
The “base” name supplied in the property argument refers to a property containing a stringified proxy, such as MyProxy=id:tcp -h localhost -p 10000.
- Parameters:
property (str) – The base property name.
- Returns:
The proxy.
- Return type:
- proxyToProperty(proxy: ObjectPrx, property: str) dict[str, str] ¶
Convert a proxy to a set of properties.
- Parameters:
proxy (ObjectPrx) – The proxy to convert.
property (str) – The base property name.
- Returns:
The property set.
- Return type:
dict[str, str]
- proxyToString(proxy: ObjectPrx | None) str ¶
Convert a proxy into a string.
- Parameters:
proxy (ObjectPrx | None) – The proxy to convert into a string representation.
- Returns:
The proxy string representation, or an empty string if the proxy is None.
- Return type:
str
- removeAdminFacet(facet: str) Object ¶
Remove the specified facet from the Admin object.
Removing a facet that was not previously registered throws a NotRegisteredException.
- Parameters:
facet (str) – The name of the Admin facet to be removed.
- Returns:
The servant associated with the removed Admin facet.
- Return type:
- Raises:
NotRegisteredException – If the facet is not registered.
- setDefaultLocator(locator: LocatorPrx | None)¶
Set a default Ice locator for this communicator.
All newly created proxies and object adapters will use this default locator. To disable the default locator, pass None. Note that this operation has no effect on existing proxies or object adapters.
You can also set a locator for an individual proxy by calling the method ObjectPrx.ice_locator on the proxy, or for an object adapter by calling ObjectAdapter.setLocator on the object adapter.
- Parameters:
locator (LocatorPrx | None) – The default locator to use for this communicator.
- setDefaultObjectAdapter(adapter: ObjectAdapter | None)¶
Set the object adapter that is associated by default with new outgoing connections created by this communicator.
- Parameters:
adapter (ObjectAdapter | None) – The object adapter to associate with new outgoing connections.
- setDefaultRouter(router: RouterPrx | None)¶
Set a default router for this communicator.
All newly created proxies will use this default router. To disable the default router, pass None. Note that this operation has no effect on existing proxies.
You can also set a router for an individual proxy by calling the method ObjectPrx.ice_router on the proxy.
- Parameters:
router (RouterPrx | None) – The default router to use for this communicator.
- shutdown() None ¶
Shuts down this communicator. This method calls deactivate on all object adapters created by this communicator. Shutting down a communicator has no effect on outgoing connections.
- Return type:
None
- shutdownCompleted() Awaitable[None] ¶
Return an awaitable that completes when the communicator’s shutdown completes.
The returned Future always completes successfully.
- Returns:
An awaitable that completes upon shutdown completion.
- Return type:
Awaitable[None]
- stringToProxy(str: str) ObjectPrx | None ¶
Convert a proxy string representation into a proxy.
For example, MyCategory/MyObject:tcp -h some_host -p 10000 creates a proxy that refers to the Ice object having an identity with a name “MyObject” and a category “MyCategory”, with the server running on host “some_host”, port 10000. If the proxy string representation does not parse correctly, the operation throws ParseException. Refer to the Ice manual for a detailed description of the syntax supported by proxy strings.
- Parameters:
proxyString (str) – The proxy string representation to convert into a proxy.
str (str)
- Returns:
The proxy, or None if the string is empty.
- Return type:
ObjectPrx | None
- Raises:
ParseException – If the proxy string representation does not parse correctly.
- waitForShutdown() None ¶
Waits for shutdown to complete. This method calls waitForDeactivate on all object adapters created by this communicator. In a client application that does not accept incoming connections, this method returns as soon as another thread calls shutdown or destroy on this communicator.
- Return type:
None
- exception Ice.CommunicatorDestroyedException¶
Bases:
LocalException
This exception is raised if the Communicator has been destroyed.
- class Ice.CompressBatch(*values)¶
Bases:
Enum
The batch compression option when flushing queued batch requests.
Enumerators:
- Yes:
Compress the batch requests.
- No:
Don’t compress the batch requests.
- BasedOnProxy:
Compress the batch requests if at least one request was made on a compressed proxy.
- exception Ice.ConnectFailedException¶
Bases:
SocketException
This exception indicates connection failures.
- exception Ice.ConnectTimeoutException¶
Bases:
TimeoutException
This exception indicates a connection establishment timeout condition.
- exception Ice.ConnectionAbortedException(closedByApplication: bool, msg: str)¶
Bases:
LocalException
This exception indicates that a connection has been closed forcefully.
- Parameters:
closedByApplication (bool)
msg (str)
- exception Ice.ConnectionClosedException(closedByApplication: bool, msg: str)¶
Bases:
LocalException
This exception indicates that a connection has been closed gracefully.
- Parameters:
closedByApplication (bool)
msg (str)
- exception Ice.ConnectionLostException¶
Bases:
SocketException
This exception indicates a lost connection.
- exception Ice.ConnectionRefusedException¶
Bases:
ConnectFailedException
This exception indicates a connection failure for which the server host actively refuses a connection.
- class Ice.Current(adapter: ObjectAdapter, con: Connection | None, id: Identity, facet: str, operation: str, mode: OperationMode, ctx: dict[str, str], requestId: int, encoding: EncodingVersion)¶
Bases:
object
Provides information about an incoming request being dispatched.
- Parameters:
adapter (ObjectAdapter)
con (Connection | None)
id (Identity)
facet (str)
operation (str)
mode (OperationMode)
ctx (dict[str, str])
requestId (int)
encoding (EncodingVersion)
- adapter¶
The object adapter that received the request.
- Type:
- con¶
The connection that received the request. It’s None when the invocation and dispatch are collocated.
- Type:
IcePy.Connection | None
- id¶
The identity of the target Ice object.
- Type:
- facet¶
The facet of the target Ice object.
- Type:
str
- operation¶
The name of the operation.
- Type:
str
- mode¶
The operation mode (idempotent or not).
- Type:
- ctx¶
The request context.
- Type:
dict[str, str]
- requestId¶
The request ID. 0 means the request is a one-way request.
- Type:
int
- encoding¶
The encoding of the request payload.
- Type:
- exception Ice.DNSException¶
Bases:
SyscallException
This exception indicates a DNS problem.
- exception Ice.DatagramLimitException¶
Bases:
ProtocolException
A datagram exceeds the configured size. This exception is raised if a datagram exceeds the configured send or receive buffer size, or exceeds the maximum payload size of a UDP packet (65507 bytes).
- exception Ice.DispatchException(replyStatus: int | None, msg: str = '')¶
Bases:
LocalException
The dispatch failed. This is the base class for local exceptions that can be marshaled and transmitted “over the wire”.
- Parameters:
replyStatus (int | None)
msg (str)
- property replyStatus¶
Gets the reply status of this exception.
- Returns:
The reply status, as an int in the range 2..255.
- Return type:
int
- class Ice.EncodingVersion(major: int = 0, minor: int = 0)¶
Bases:
object
Represents a version of the Slice encoding. Ice supports version 1.0 and 1.1 of this encoding.
- Parameters:
major (int)
minor (int)
- major¶
The major version of the Slice encoding.
- Type:
int
- minor¶
The minor version of the Slice encoding.
- Type:
int
Notes
The Slice encoding is also known as the Ice encoding.
- class Ice.EndpointSelectionType(*values)¶
Bases:
Enum
Determines the order in which the Ice runtime uses the endpoints in a proxy when establishing a connection.
Enumerators¶
- RandomEndpointSelectionType
Random causes the endpoints to be arranged in a random order.
- OrderedEndpointSelectionType
Ordered forces the Ice runtime to use the endpoints in the order they appeared in the proxy.
- class Ice.EventLoopAdapter¶
Bases:
ABC
An adapter that allows applications to execute asynchronous code in a custom event loop.
- abstractmethod runCoroutine(coroutine: Coroutine) FutureLike ¶
Run a coroutine in the application configured event loop. The Ice run time will call this method to run coroutines returned by async dispatch methods. This method is called from the Ice dispatch thread.
- Parameters:
coroutine (Coroutine) – The coroutine to run.
- Returns:
A Future-like object that can be used to wait for the completion of the coroutine.
- Return type:
- abstractmethod wrapFuture(future: Future) Awaitable ¶
Wraps an Ice.Future so that it can be awaited in the application event loop. The Ice run time calls this method before returning a future to the application.
- Parameters:
future (Ice.Future) – The future to wrap.
- Returns:
An awaitable object that can be awaited in the application event loop.
- Return type:
Awaitable
- exception Ice.Exception¶
Bases:
Exception
The base class for all Ice exceptions.
- ice_id()¶
Return the type ID of this exception.
For exceptions defined in Slice, this corresponds to the Slice type ID. For other exceptions, it is a fully scoped name in the same format. For example: “::Ice::CommunicatorDestroyedException”.
- Returns:
The type ID of the exception.
- Return type:
str
- exception Ice.FacetNotExistException(id: Identity | None = None, facet: str = '', operation: str = '', msg: str = '')¶
Bases:
RequestFailedException
The dispatch could not find a servant for the identity + facet carried by the request.
- Parameters:
id (Identity | None)
facet (str)
operation (str)
msg (str)
- exception Ice.FeatureNotSupportedException¶
Bases:
LocalException
This exception is raised if an unsupported feature is used.
- exception Ice.FixedProxyException¶
Bases:
LocalException
This exception indicates that an attempt has been made to change the connection properties of a fixed proxy.
- class Ice.FormatType(*values)¶
Bases:
Enum
This enumeration describes the possible formats for classes and exceptions.
- class Ice.Future¶
Bases:
Awaitable
[_T
]A Future object representing the result of an asynchronous operation.
- add_done_callback(fn: Callable) None ¶
Attach a callback to be executed when the future completes.
The callback fn is called with the future as its only argument once the future completes or is cancelled. Registered callbacks are executed in the order they were added.
If the future is already complete, fn is called immediately from the calling thread.
- Parameters:
fn (callable) – The function to execute upon completion. Takes the future as its argument.
- Return type:
None
- cancel()¶
Attempt to cancel the operation.
If the operation is already running or has completed, it cannot be cancelled, and the method returns False. Otherwise, the operation is cancelled, and the method returns True.
- Returns:
True if the operation was cancelled, False otherwise.
- Return type:
bool
- cancelled()¶
Check if the future has been cancelled.
- Returns:
True if the future was cancelled using cancel(), otherwise False.
- Return type:
bool
- done()¶
Check if the future has completed or been cancelled.
- Returns:
True if the operation has completed (successfully or with an exception) or has been cancelled, otherwise False.
- Return type:
bool
- exception(timeout: int | float | None = None) BaseException | None ¶
Retrieve the exception raised by the operation.
If the operation has not completed, this method waits up to timeout seconds for it to finish. If the timeout is reached, a TimeoutException is raised.
If the future was cancelled before completing, an InvocationCanceledException is raised.
If the operation completed successfully without raising an exception, None is returned.
- Parameters:
timeout (int | float, optional) – Maximum time (in seconds) to wait for the exception. If None, the method waits indefinitely until the operation completes.
- Returns:
The exception raised by the operation, or None if the operation completed successfully.
- Return type:
BaseException or None
- Raises:
TimeoutException – If the operation has not completed within the specified timeout.
InvocationCanceledException – If the operation was cancelled before completing.
- result(timeout: int | float | None = None) _T ¶
Retrieve the result of the future.
If the operation has not completed, this method waits up to timeout seconds for it to finish. If the timeout is reached, a TimeoutException is raised.
If the future was cancelled before completing, an InvocationCanceledException is raised.
If the operation raised an exception, this method raises the same exception.
- Parameters:
timeout (int | float, optional) – Maximum time (in seconds) to wait for the result. If None, the method waits indefinitely until the operation completes.
- Returns:
The result of the operation.
- Return type:
object
- Raises:
TimeoutException – If the operation has not completed within the specified timeout.
InvocationCanceledException – If the operation was cancelled before completing.
Exception – If the operation raised an exception.
- running()¶
Check if the future is still running.
- Returns:
True if the operation is currently executing and cannot be cancelled, otherwise False.
- Return type:
bool
- set_exception(ex: BaseException)¶
Set an exception for the future and mark it as completed.
This method stores the provided exception ex and transitions the future’s state to “done”. Any registered callbacks are executed after the state update.
If the future is not in a running state, this method has no effect.
- Parameters:
ex (BaseException) – The exception to store in the future.
- set_result(result: _T)¶
Set the result of the future and mark it as completed.
This method stores the provided result and transitions the future’s state to “done”. Any registered callbacks are executed after the state update.
If the future is not in a running state, this method has no effect.
- Parameters:
result (object) – The result value to store in the future.
- class Ice.FutureLike(*args, **kwargs)¶
Bases:
Protocol
[_T_co
]A protocol that defines the interface for objects that behave like a Future.
- add_done_callback(callback: Callable[[FutureLike], Any], /) None ¶
Add a callback to be run when the Future is done.
- Parameters:
callback (Callable[[FutureLike], Any]) – A callable that takes the Future object as its only argument. Will be called when the Future completes (successfully, with exception, or cancelled).
- Return type:
None
- Note: Using positional-only parameter (/) to match both asyncio and
concurrent.futures implementations regardless of parameter name.
- result(timeout: int | float | None = None) _T_co ¶
Return the result of the Future.
- Parameters:
timeout (int | float | None)
- Return type:
_T_co
- class Ice.Identity(name: str = '', category: str = '')¶
Bases:
object
Represents the identity of an Ice object. It is comparable to the path of a URI. Its string representation is
name
when the category is empty, andcategory/name
when the category is not empty.- Parameters:
name (str)
category (str)
- name¶
The name of the Ice object. An empty name is not valid.
- Type:
str
- category¶
The category of the object.
- Type:
str
- class Ice.ImplicitContext(impl: ImplicitContext)¶
Bases:
object
An interface to associate implicit contexts with communicators.
When you make a remote invocation without an explicit context parameter, Ice uses the per-proxy context (if any) combined with the ImplicitContext associated with the communicator.
Ice provides several implementations of ImplicitContext. The implementation used depends on the value of the Ice.ImplicitContext property.
- None (default)
No implicit context at all.
- PerThread
The implementation maintains a context per thread.
- Shared
The implementation maintains a single context shared by all threads.
ImplicitContext also provides a number of operations to create, update, or retrieve an entry in the underlying context without first retrieving a copy of the entire context.
- Parameters:
impl (ImplicitContext)
- containsKey(key: str) bool ¶
Check if this key has an associated value in the underlying context.
- Parameters:
key (str) – The key to check.
- Returns:
True if the key has an associated value, False otherwise.
- Return type:
bool
- get(key: str) str ¶
Get the value associated with the given key in the underlying context.
Returns an empty string if no value is associated with the key. Use containsKey to distinguish between an empty-string value and no value at all.
- Parameters:
key (str) – The key to retrieve the value for.
- Returns:
The value associated with the key, or an empty string if no value is associated with the key.
- Return type:
str
- getContext() dict[str, str] ¶
Get a copy of the underlying context.
- Returns:
A copy of the underlying context.
- Return type:
dict
- put(key: str, value: str) str | None ¶
Create or update a key/value entry in the underlying context.
- Parameters:
key (str) – The key to create or update.
value (str) – The value to associate with the key.
- Returns:
The previous value associated with the key, if any, otherwise None.
- Return type:
str | None
- remove(key: str) str | None ¶
Remove the entry for the given key in the underlying context.
- Parameters:
key (str) – The key to remove.
- Returns:
The value associated with the key, if any, otherwise None.
- Return type:
str | None
- setContext(newContext: dict[str, str])¶
Set the underlying context.
- Parameters:
newContext (dict) – The new context to set.
- class Ice.InitializationData(properties: Properties | None = None, logger: Logger | None = None, threadStart: Callable[[], None] | None = None, threadStop: Callable[[], None] | None = None, executor: Callable[[Callable[[], None], Connection], None] | None = None, batchRequestInterceptor: Callable[[BatchRequest, int, int], None] | None = None, eventLoopAdapter: EventLoopAdapter | None = None, sliceLoader: Callable[[str], Value | UserException | None] | None = None)¶
Bases:
object
The attributes of this class are used to initialize a new communicator instance.
- Parameters:
properties (Properties | None)
logger (Logger | None)
threadStart (Callable[[], None] | None)
threadStop (Callable[[], None] | None)
executor (Callable[[Callable[[], None], Connection], None] | None)
batchRequestInterceptor (Callable[[BatchRequest, int, int], None] | None)
eventLoopAdapter (EventLoopAdapter | None)
sliceLoader (Callable[[str], Value | UserException | None] | None)
- properties¶
You can use the Ice.createProperties function to create a new property set.
- Type:
Ice.Properties | None
- threadStart¶
A callable that is invoked for each new Ice thread that is started.
- Type:
Callable[[], None] | None
- threadStop¶
A callable that is invoked when an Ice thread is stopped.
- Type:
Callable[[], None] | None
- executor¶
A callable that is invoked when Ice needs to execute an activity. The callable receives two arguments: a callable and an Ice.Connection object. The executor must eventually invoke the callable with no arguments.
- Type:
Callable[[Callable[[], None], Connection], None] | None
- batchRequestInterceptor¶
A callable that will be invoked when a batch request is queued. The callable receives three arguments: a BatchRequest object, an integer representing the number of requests in the queue, and an integer representing the number of bytes consumed by the requests in the queue. The interceptor must eventually invoke the enqueue method on the BatchRequest object.
- Type:
Callable[[BatchRequest, int, int], None] | None
- eventLoopAdapter¶
An event loop adapter used to run coroutines and wrap futures. If provided. This adapter is responsible for executing coroutines returned by Ice asynchronous dispatch methods and for wrapping Ice futures (from Ice Async APIs) into futures that can be awaited in the application’s event loop.
- Type:
Ice.EventLoopAdapter | None
- sliceLoader¶
A callable that creates class and exception instances from Slice type IDs. The callable receives a type ID or compact type ID as a string argument and returns a new instance of the class or exception identified by this ID. The implementation returns None when it cannot find the corresponding class.
- Type:
Callable[[str], Value | UserException | None] | None
- exception Ice.InitializationException¶
Bases:
LocalException
This exception is raised when a failure occurs during initialization.
- reason¶
The reason for the failure.
- Type:
str
- exception Ice.InvalidReplicaGroupIdException¶
Bases:
UserException
The exception that is thrown when the provided replica group is invalid.
- Return type:
None
- exception Ice.InvocationCanceledException¶
Bases:
LocalException
This exception indicates that an asynchronous invocation failed because it was canceled explicitly by the user.
- class Ice.InvocationFuture(asyncInvocationContext: AsyncInvocationContext)¶
Bases:
Future
A Future object representing the result of an AMI (Asynchronous Method Invocation) request.
InvocationFuture objects are returned by AMI requests. The application can use an InvocationFuture object to wait for the result of the AMI request or register a callback that will be invoked when the result becomes available.
This class provides the same functionality as Future, with the addition of “sent callbacks,” which are invoked when the request is sent.
- Parameters:
asyncInvocationContext (AsyncInvocationContext)
- add_sent_callback(fn: Callable) None ¶
Attach a callback to be executed when the invocation is sent.
The callback fn is called with the future as its first argument and a boolean as its second argument, indicating whether the invocation was sent synchronously.
If the future has already been sent, fn is called immediately from the calling thread.
- Parameters:
fn (Callable) – The function to execute when the invocation is sent.
- Return type:
None
- cancel() bool ¶
Cancels the invocation.
This method invokes
Future.cancel()
to cancel the underlying future. If the cancellation is successful, the associated invocation is also cancelled.Cancelling an invocation prevents a queued invocation from being sent. If the invocation has already been sent, cancellation ensures that any reply from the server is ignored.
Cancellation is a local operation with no effect on the server.
After cancellation,
done()
returnsTrue
, and attempting to retrieve the result raises anIce.InvocationCanceledException
.- Returns:
True
if the operation was successfully cancelled,False
otherwise.- Return type:
bool
- is_sent() bool ¶
Check if the request has been sent.
- Returns:
True if the request has been sent, otherwise False.
- Return type:
bool
- is_sent_synchronously() bool ¶
Check if the request was sent synchronously.
- Returns:
True if the request was sent synchronously, otherwise False.
- Return type:
bool
- sent(timeout: int | float | None = None) bool ¶
Wait for the operation to be sent.
This method waits up to timeout seconds for the operation to be sent and then returns whether it was sent synchronously.
If the operation has not been sent within the specified time, a TimeoutException is raised. If the future was cancelled before being sent, an InvocationCanceledException is raised.
- Parameters:
timeout (int | float, optional) – Maximum time (in seconds) to wait for the operation to be sent. If None, the method waits indefinitely.
- Returns:
True if the operation was sent synchronously, otherwise False.
- Return type:
bool
- Raises:
TimeoutException – If the operation was not sent within the specified timeout.
InvocationCanceledException – If the operation was cancelled before it was sent.
- exception Ice.InvocationTimeoutException¶
Bases:
TimeoutException
This exception indicates that an invocation failed because it timed out.
- class Ice.Locator¶
Bases:
Object
,ABC
- abstractmethod findAdapterById(id: str, current: Current) ObjectPrx | None | Awaitable[ObjectPrx | None] ¶
Finds an object adapter by adapter ID and returns a dummy proxy with the object adapter’s endpoint(s).
- Parameters:
id (str) – The adapter ID.
current (Ice.Current) – The Current object for the dispatch.
- Returns:
A dummy proxy with the adapter’s endpoints, or null if an object adapter with
id
was not found.- Return type:
- Raises:
AdapterNotFoundException – Thrown when an object adapter with this adapter ID was not found. The caller should treat this exception like a null return value.
- abstractmethod findObjectById(id: Identity, current: Current) ObjectPrx | None | Awaitable[ObjectPrx | None] ¶
Finds an object by identity and returns a dummy proxy with the endpoint(s) that can be used to reach this object. This dummy proxy may be an indirect proxy that requires further resolution using
Ice.LocatorPrx.findAdapterById()
.- Parameters:
id (Identity) – The identity.
current (Ice.Current) – The Current object for the dispatch.
- Returns:
A dummy proxy, or null if an object with the requested identity was not found.
- Return type:
- Raises:
ObjectNotFoundException – Thrown when an object with the requested identity was not found. The caller should treat this exception like a null return value.
- abstractmethod getRegistry(current: Current) LocatorRegistryPrx | None | Awaitable[LocatorRegistryPrx | None] ¶
Gets a proxy to the locator registry.
- Parameters:
current (Ice.Current) – The Current object for the dispatch.
- Returns:
A proxy to the locator registry, or null if this locator has no associated registry.
- Return type:
LocatorRegistryPrx | None | Awaitable[LocatorRegistryPrx | None]
- static ice_staticId() str ¶
Obtain the type ID of the Slice interface.
- Returns:
The type ID.
- Return type:
str
- class Ice.LocatorFinder¶
Bases:
Object
,ABC
- abstractmethod getLocator(current: Current) LocatorPrx | None | Awaitable[LocatorPrx | None] ¶
Gets a proxy to the associated
Ice.LocatorPrx
. The proxy might point to several replicas.- Parameters:
current (Ice.Current) – The Current object for the dispatch.
- Returns:
The locator proxy. This proxy is never null.
- Return type:
LocatorPrx | None | Awaitable[LocatorPrx | None]
- static ice_staticId() str ¶
Obtain the type ID of the Slice interface.
- Returns:
The type ID.
- Return type:
str
- class Ice.LocatorFinderPrx¶
Bases:
ObjectPrx
- static checkedCast(proxy: ObjectPrx | None, facet: str | None = None, context: dict[str, str] | None = None) LocatorFinderPrx | None ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object 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[LocatorFinderPrx | None] ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object does not support the requested type.
- Return type:
ObjectPrx | None
- getLocator(context: dict[str, str] | None = None) LocatorPrx | None ¶
Gets a proxy to the associated
Ice.LocatorPrx
. The proxy might point to several replicas.- Parameters:
context (dict[str, str]) – The request context for the invocation.
- Returns:
The locator proxy. This proxy is never null.
- Return type:
LocatorPrx | None
- getLocatorAsync(context: dict[str, str] | None = None) Awaitable[LocatorPrx | None] ¶
Gets a proxy to the associated
Ice.LocatorPrx
. The proxy might point to several replicas.- Parameters:
context (dict[str, str]) – The request context for the invocation.
- Returns:
The locator proxy. This proxy is never null.
- Return type:
Awaitable[LocatorPrx | None]
- static ice_staticId() str ¶
Gets the Slice type ID of the interface associated with this proxy.
- Returns:
The type ID, “::Ice::Object”.
- Return type:
str
- static uncheckedCast(proxy: ObjectPrx | None, facet: str | None = None) LocatorFinderPrx | None ¶
Creates a new proxy from an existing proxy.
- class Ice.LocatorPrx¶
Bases:
ObjectPrx
- static checkedCast(proxy: ObjectPrx | None, facet: str | None = None, context: dict[str, str] | None = None) LocatorPrx | None ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object 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[LocatorPrx | None] ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object does not support the requested type.
- Return type:
ObjectPrx | None
- findAdapterById(id: str, context: dict[str, str] | None = None) ObjectPrx | None ¶
Finds an object adapter by adapter ID and returns a dummy proxy with the object adapter’s endpoint(s).
- Parameters:
id (str) – The adapter ID.
context (dict[str, str]) – The request context for the invocation.
- Returns:
A dummy proxy with the adapter’s endpoints, or null if an object adapter with
id
was not found.- Return type:
ObjectPrx | None
- Raises:
AdapterNotFoundException – Thrown when an object adapter with this adapter ID was not found. The caller should treat this exception like a null return value.
- findAdapterByIdAsync(id: str, context: dict[str, str] | None = None) Awaitable[ObjectPrx | None] ¶
Finds an object adapter by adapter ID and returns a dummy proxy with the object adapter’s endpoint(s).
- Parameters:
id (str) – The adapter ID.
context (dict[str, str]) – The request context for the invocation.
- Returns:
A dummy proxy with the adapter’s endpoints, or null if an object adapter with
id
was not found.- Return type:
Awaitable[ObjectPrx | None]
- findObjectById(id: Identity, context: dict[str, str] | None = None) ObjectPrx | None ¶
Finds an object by identity and returns a dummy proxy with the endpoint(s) that can be used to reach this object. This dummy proxy may be an indirect proxy that requires further resolution using
Ice.LocatorPrx.findAdapterById()
.- Parameters:
id (Identity) – The identity.
context (dict[str, str]) – The request context for the invocation.
- Returns:
A dummy proxy, or null if an object with the requested identity was not found.
- Return type:
ObjectPrx | None
- Raises:
ObjectNotFoundException – Thrown when an object with the requested identity was not found. The caller should treat this exception like a null return value.
- findObjectByIdAsync(id: Identity, context: dict[str, str] | None = None) Awaitable[ObjectPrx | None] ¶
Finds an object by identity and returns a dummy proxy with the endpoint(s) that can be used to reach this object. This dummy proxy may be an indirect proxy that requires further resolution using
Ice.LocatorPrx.findAdapterById()
.
- getRegistry(context: dict[str, str] | None = None) LocatorRegistryPrx | None ¶
Gets a proxy to the locator registry.
- Parameters:
context (dict[str, str]) – The request context for the invocation.
- Returns:
A proxy to the locator registry, or null if this locator has no associated registry.
- Return type:
LocatorRegistryPrx | None
- getRegistryAsync(context: dict[str, str] | None = None) Awaitable[LocatorRegistryPrx | None] ¶
Gets a proxy to the locator registry.
- Parameters:
context (dict[str, str]) – The request context for the invocation.
- Returns:
A proxy to the locator registry, or null if this locator has no associated registry.
- Return type:
Awaitable[LocatorRegistryPrx | None]
- static ice_staticId() str ¶
Gets the Slice type ID of the interface associated with this proxy.
- Returns:
The type ID, “::Ice::Object”.
- Return type:
str
- static uncheckedCast(proxy: ObjectPrx | None, facet: str | None = None) LocatorPrx | None ¶
Creates a new proxy from an existing proxy.
- class Ice.LocatorRegistry¶
Bases:
Object
,ABC
- static ice_staticId() str ¶
Obtain the type ID of the Slice interface.
- Returns:
The type ID.
- Return type:
str
- abstractmethod setAdapterDirectProxy(id: str, proxy: ObjectPrx | None, current: Current) None | Awaitable[None] ¶
Registers or unregisters the endpoints of an object adapter.
- Parameters:
id (str) – The adapter ID.
proxy (ObjectPrx | None) – A dummy proxy created by the object adapter.
proxy
carries the object adapter’s endpoints. The locator considers an object adapter to be active after it has registered its endpoints. Whenproxy
is null, the endpoints are unregistered and the locator considers the object adapter inactive.current (Ice.Current) – The Current object for the dispatch.
- Returns:
None or an awaitable that completes when the dispatch completes.
- Return type:
None | Awaitable[None]
- Raises:
AdapterAlreadyActiveException – Thrown when an object adapter with the same adapter ID has already registered its endpoints. Since this operation is marked idempotent, this exception may be thrown when the Ice client runtime retries an invocation with a non-null
proxy
.AdapterNotFoundException – Thrown when the locator only allows registered object adapters to register their endpoints and no object adapter with this adapter ID was registered with the locator.
- abstractmethod setReplicatedAdapterDirectProxy(adapterId: str, replicaGroupId: str, proxy: ObjectPrx | None, current: Current) None | Awaitable[None] ¶
Registers or unregisters the endpoints of an object adapter. This object adapter is a member of a replica group.
- Parameters:
adapterId (str) – The adapter ID.
replicaGroupId (str) – The replica group ID.
proxy (ObjectPrx | None) – A dummy proxy created by the object adapter.
proxy
carries the object adapter’s endpoints. The locator considers an object adapter to be active after it has registered its endpoints. Whenproxy
is null, the endpoints are unregistered and the locator considers the object adapter inactive.current (Ice.Current) – The Current object for the dispatch.
- Returns:
None or an awaitable that completes when the dispatch completes.
- Return type:
None | Awaitable[None]
- Raises:
AdapterAlreadyActiveException – Thrown when an object adapter with the same adapter ID has already registered its endpoints. Since this operation is marked idempotent, this exception may be thrown when the Ice client runtime retries an invocation with a non-null
proxy
.AdapterNotFoundException – Thrown when the locator only allows registered object adapters to register their endpoints and no object adapter with this adapter ID was registered with the locator.
InvalidReplicaGroupIdException – Thrown when the given replica group does not match the replica group associated with the adapter ID in the locator’s database.
- abstractmethod setServerProcessProxy(id: str, proxy: ProcessPrx | None, current: Current) None | Awaitable[None] ¶
Registers a proxy to the
Ice.ProcessPrx
object of a server application.- Parameters:
id (str) – The server ID.
proxy (ProcessPrx | None) – A proxy to the
Ice.ProcessPrx
object of the server. This proxy is never null.current (Ice.Current) – The Current object for the dispatch.
- Returns:
None or an awaitable that completes when the dispatch completes.
- Return type:
None | Awaitable[None]
- Raises:
ServerNotFoundException – Thrown when the locator does not know a server application with a server ID of
id
.
- class Ice.LocatorRegistryPrx¶
Bases:
ObjectPrx
- static checkedCast(proxy: ObjectPrx | None, facet: str | None = None, context: dict[str, str] | None = None) LocatorRegistryPrx | None ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object 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[LocatorRegistryPrx | None] ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object does not support the requested type.
- Return type:
ObjectPrx | None
- static ice_staticId() str ¶
Gets the Slice type ID of the interface associated with this proxy.
- Returns:
The type ID, “::Ice::Object”.
- Return type:
str
- setAdapterDirectProxy(id: str, proxy: ObjectPrx | None, context: dict[str, str] | None = None) None ¶
Registers or unregisters the endpoints of an object adapter.
- Parameters:
id (str) – The adapter ID.
proxy (ObjectPrx | None) – A dummy proxy created by the object adapter.
proxy
carries the object adapter’s endpoints. The locator considers an object adapter to be active after it has registered its endpoints. Whenproxy
is null, the endpoints are unregistered and the locator considers the object adapter inactive.context (dict[str, str]) – The request context for the invocation.
- Raises:
AdapterAlreadyActiveException – Thrown when an object adapter with the same adapter ID has already registered its endpoints. Since this operation is marked idempotent, this exception may be thrown when the Ice client runtime retries an invocation with a non-null
proxy
.AdapterNotFoundException – Thrown when the locator only allows registered object adapters to register their endpoints and no object adapter with this adapter ID was registered with the locator.
- Return type:
None
- setAdapterDirectProxyAsync(id: str, proxy: ObjectPrx | None, context: dict[str, str] | None = None) Awaitable[None] ¶
Registers or unregisters the endpoints of an object adapter.
- Parameters:
id (str) – The adapter ID.
proxy (ObjectPrx | None) – A dummy proxy created by the object adapter.
proxy
carries the object adapter’s endpoints. The locator considers an object adapter to be active after it has registered its endpoints. Whenproxy
is null, the endpoints are unregistered and the locator considers the object adapter inactive.context (dict[str, str]) – The request context for the invocation.
- Returns:
An awaitable that is completed when the invocation completes.
- Return type:
Awaitable[None]
- setReplicatedAdapterDirectProxy(adapterId: str, replicaGroupId: str, proxy: ObjectPrx | None, context: dict[str, str] | None = None) None ¶
Registers or unregisters the endpoints of an object adapter. This object adapter is a member of a replica group.
- Parameters:
adapterId (str) – The adapter ID.
replicaGroupId (str) – The replica group ID.
proxy (ObjectPrx | None) – A dummy proxy created by the object adapter.
proxy
carries the object adapter’s endpoints. The locator considers an object adapter to be active after it has registered its endpoints. Whenproxy
is null, the endpoints are unregistered and the locator considers the object adapter inactive.context (dict[str, str]) – The request context for the invocation.
- Raises:
AdapterAlreadyActiveException – Thrown when an object adapter with the same adapter ID has already registered its endpoints. Since this operation is marked idempotent, this exception may be thrown when the Ice client runtime retries an invocation with a non-null
proxy
.AdapterNotFoundException – Thrown when the locator only allows registered object adapters to register their endpoints and no object adapter with this adapter ID was registered with the locator.
InvalidReplicaGroupIdException – Thrown when the given replica group does not match the replica group associated with the adapter ID in the locator’s database.
- Return type:
None
- setReplicatedAdapterDirectProxyAsync(adapterId: str, replicaGroupId: str, proxy: ObjectPrx | None, context: dict[str, str] | None = None) Awaitable[None] ¶
Registers or unregisters the endpoints of an object adapter. This object adapter is a member of a replica group.
- Parameters:
adapterId (str) – The adapter ID.
replicaGroupId (str) – The replica group ID.
proxy (ObjectPrx | None) – A dummy proxy created by the object adapter.
proxy
carries the object adapter’s endpoints. The locator considers an object adapter to be active after it has registered its endpoints. Whenproxy
is null, the endpoints are unregistered and the locator considers the object adapter inactive.context (dict[str, str]) – The request context for the invocation.
- Returns:
An awaitable that is completed when the invocation completes.
- Return type:
Awaitable[None]
- setServerProcessProxy(id: str, proxy: ProcessPrx | None, context: dict[str, str] | None = None) None ¶
Registers a proxy to the
Ice.ProcessPrx
object of a server application.- Parameters:
id (str) – The server ID.
proxy (ProcessPrx | None) – A proxy to the
Ice.ProcessPrx
object of the server. This proxy is never null.context (dict[str, str]) – The request context for the invocation.
- Raises:
ServerNotFoundException – Thrown when the locator does not know a server application with a server ID of
id
.- Return type:
None
- setServerProcessProxyAsync(id: str, proxy: ProcessPrx | None, context: dict[str, str] | None = None) Awaitable[None] ¶
Registers a proxy to the
Ice.ProcessPrx
object of a server application.- Parameters:
id (str) – The server ID.
proxy (ProcessPrx | None) – A proxy to the
Ice.ProcessPrx
object of the server. This proxy is never null.context (dict[str, str]) – The request context for the invocation.
- Returns:
An awaitable that is completed when the invocation completes.
- Return type:
Awaitable[None]
- static uncheckedCast(proxy: ObjectPrx | None, facet: str | None = None) LocatorRegistryPrx | None ¶
Creates a new proxy from an existing proxy.
- class Ice.LogMessage(type: LogMessageType = LogMessageType.PrintMessage, timestamp: int = 0, traceCategory: str = '', message: str = '')¶
Bases:
object
Represents a full log message.
- Parameters:
type (LogMessageType)
timestamp (int)
traceCategory (str)
message (str)
- type¶
The type of message sent to the
Ice.RemoteLoggerPrx
.- Type:
- timestamp¶
The date and time when the
Ice.RemoteLoggerPrx
received this message, expressed as the number of microseconds since the Unix Epoch (00:00:00 UTC on 1 January 1970).- Type:
int
- traceCategory¶
For a message of type ‘trace’, the trace category of this log message; otherwise, the empty string.
- Type:
str
- message¶
The log message itself.
- Type:
str
- class Ice.LogMessageType(*values)¶
Bases:
Enum
Represents the different types of log messages.
Enumerators:
- PrintMessage:
The
Ice.RemoteLoggerPrx
received a print message.
- TraceMessage:
The
Ice.RemoteLoggerPrx
received a trace message.
- WarningMessage:
The
Ice.RemoteLoggerPrx
received a warning message.
- ErrorMessage:
The
Ice.RemoteLoggerPrx
received an error message.
- class Ice.Logger¶
Bases:
ABC
The Ice message logger.
Applications can provide their own logger by implementing this interface and installing it in a communicator.
- abstractmethod cloneWithPrefix(prefix: str) Logger ¶
Return a clone of the logger with a new prefix.
- Parameters:
prefix (str) – The new prefix for the logger.
- Returns:
A new logger instance with the specified prefix.
- Return type:
- abstractmethod error(message: str)¶
Log an error message.
- Parameters:
message (str) – The error message to log.
- abstractmethod getPrefix() str ¶
Get this logger’s prefix.
- Returns:
The prefix of this logger.
- Return type:
str
- abstractmethod print(message: str)¶
Print a message.
The message is printed literally, without any decorations such as executable name or timestamp.
- Parameters:
message (str) – The message to log.
- abstractmethod trace(category: str, message: str)¶
Log a trace message.
- Parameters:
category (str) – The trace category.
message (str) – The trace message to log.
- abstractmethod warning(message: str)¶
Log a warning message.
- Parameters:
message (str) – The warning message to log.
- class Ice.LoggerAdmin¶
Bases:
Object
,ABC
- abstractmethod attachRemoteLogger(prx: RemoteLoggerPrx | None, messageTypes: list[LogMessageType], traceCategories: list[str], messageMax: int, current: Current) None | Awaitable[None] ¶
Attaches a
Ice.RemoteLoggerPrx
object to the local logger. This operation callsIce.RemoteLoggerPrx.init()
onprx
.- Parameters:
prx (RemoteLoggerPrx | None) – A proxy to the remote logger.
messageTypes (list[LogMessageType]) – The list of message types that the remote logger wishes to receive. An empty list means no filtering (send all message types).
traceCategories (list[str]) – The categories of traces that the remote logger wishes to receive. This parameter is ignored if
messageTypes
is not empty and does not include trace. An empty list means no filtering (send all trace categories).messageMax (int) – The maximum number of log messages (of all types) to be provided to
Ice.RemoteLoggerPrx.init()
. A negative value requests all messages available.current (Ice.Current) – The Current object for the dispatch.
- Returns:
None or an awaitable that completes when the dispatch completes.
- Return type:
None | Awaitable[None]
- Raises:
RemoteLoggerAlreadyAttachedException – Thrown if this remote logger is already attached to this admin object.
- abstractmethod detachRemoteLogger(prx: RemoteLoggerPrx | None, current: Current) bool | Awaitable[bool] ¶
Detaches a
Ice.RemoteLoggerPrx
object from the local logger.- Parameters:
prx (RemoteLoggerPrx | None) – A proxy to the remote logger.
current (Ice.Current) – The Current object for the dispatch.
- Returns:
true
if the provided remote logger proxy was detached, andfalse
otherwise.- Return type:
bool | Awaitable[bool]
- abstractmethod getLog(messageTypes: list[LogMessageType], traceCategories: list[str], messageMax: int, current: Current) tuple[Sequence[LogMessage], str] | Awaitable[tuple[Sequence[LogMessage], str]] ¶
Retrieves recently logged log messages.
- Parameters:
messageTypes (list[LogMessageType]) – The list of message types that the caller wishes to receive. An empty list means no filtering (send all message types).
traceCategories (list[str]) – The categories of traces that caller wish to receive. This parameter is ignored if
messageTypes
is not empty and does not include trace. An empty list means no filtering (send all trace categories).messageMax (int) – The maximum number of log messages (of all types) to be returned. A negative value requests all messages available.
current (Ice.Current) – The Current object for the dispatch.
- Returns:
- A tuple containing:
Sequence[LogMessage] The Log messages.
str The prefix of the associated local logger.
- Return type:
tuple[Sequence[LogMessage], str] | Awaitable[tuple[Sequence[LogMessage], str]]
- static ice_staticId() str ¶
Obtain the type ID of the Slice interface.
- Returns:
The type ID.
- Return type:
str
- class Ice.LoggerAdminPrx¶
Bases:
ObjectPrx
- attachRemoteLogger(prx: RemoteLoggerPrx | None, messageTypes: Sequence[LogMessageType], traceCategories: Sequence[str], messageMax: int, context: dict[str, str] | None = None) None ¶
Attaches a
Ice.RemoteLoggerPrx
object to the local logger. This operation callsIce.RemoteLoggerPrx.init()
onprx
.- Parameters:
prx (RemoteLoggerPrx | None) – A proxy to the remote logger.
messageTypes (Sequence[LogMessageType]) – The list of message types that the remote logger wishes to receive. An empty list means no filtering (send all message types).
traceCategories (Sequence[str]) – The categories of traces that the remote logger wishes to receive. This parameter is ignored if
messageTypes
is not empty and does not include trace. An empty list means no filtering (send all trace categories).messageMax (int) – The maximum number of log messages (of all types) to be provided to
Ice.RemoteLoggerPrx.init()
. A negative value requests all messages available.context (dict[str, str]) – The request context for the invocation.
- Raises:
RemoteLoggerAlreadyAttachedException – Thrown if this remote logger is already attached to this admin object.
- Return type:
None
- attachRemoteLoggerAsync(prx: RemoteLoggerPrx | None, messageTypes: Sequence[LogMessageType], traceCategories: Sequence[str], messageMax: int, context: dict[str, str] | None = None) Awaitable[None] ¶
Attaches a
Ice.RemoteLoggerPrx
object to the local logger. This operation callsIce.RemoteLoggerPrx.init()
onprx
.- Parameters:
prx (RemoteLoggerPrx | None) – A proxy to the remote logger.
messageTypes (Sequence[LogMessageType]) – The list of message types that the remote logger wishes to receive. An empty list means no filtering (send all message types).
traceCategories (Sequence[str]) – The categories of traces that the remote logger wishes to receive. This parameter is ignored if
messageTypes
is not empty and does not include trace. An empty list means no filtering (send all trace categories).messageMax (int) – The maximum number of log messages (of all types) to be provided to
Ice.RemoteLoggerPrx.init()
. A negative value requests all messages available.context (dict[str, str]) – The request context for the invocation.
- Returns:
An awaitable that is completed when the invocation completes.
- Return type:
Awaitable[None]
- static checkedCast(proxy: ObjectPrx | None, facet: str | None = None, context: dict[str, str] | None = None) LoggerAdminPrx | None ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object 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[LoggerAdminPrx | None] ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object does not support the requested type.
- Return type:
ObjectPrx | None
- detachRemoteLogger(prx: RemoteLoggerPrx | None, context: dict[str, str] | None = None) bool ¶
Detaches a
Ice.RemoteLoggerPrx
object from the local logger.- Parameters:
prx (RemoteLoggerPrx | None) – A proxy to the remote logger.
context (dict[str, str]) – The request context for the invocation.
- Returns:
true
if the provided remote logger proxy was detached, andfalse
otherwise.- Return type:
bool
- detachRemoteLoggerAsync(prx: RemoteLoggerPrx | None, context: dict[str, str] | None = None) Awaitable[bool] ¶
Detaches a
Ice.RemoteLoggerPrx
object from the local logger.- Parameters:
prx (RemoteLoggerPrx | None) – A proxy to the remote logger.
context (dict[str, str]) – The request context for the invocation.
- Returns:
true
if the provided remote logger proxy was detached, andfalse
otherwise.- Return type:
Awaitable[bool]
- getLog(messageTypes: Sequence[LogMessageType], traceCategories: Sequence[str], messageMax: int, context: dict[str, str] | None = None) tuple[list[LogMessage], str] ¶
Retrieves recently logged log messages.
- Parameters:
messageTypes (Sequence[LogMessageType]) – The list of message types that the caller wishes to receive. An empty list means no filtering (send all message types).
traceCategories (Sequence[str]) – The categories of traces that caller wish to receive. This parameter is ignored if
messageTypes
is not empty and does not include trace. An empty list means no filtering (send all trace categories).messageMax (int) – The maximum number of log messages (of all types) to be returned. A negative value requests all messages available.
context (dict[str, str]) – The request context for the invocation.
- Returns:
- A tuple containing:
list[LogMessage] The Log messages.
str The prefix of the associated local logger.
- Return type:
tuple[list[LogMessage], str]
- getLogAsync(messageTypes: Sequence[LogMessageType], traceCategories: Sequence[str], messageMax: int, context: dict[str, str] | None = None) Awaitable[tuple[list[LogMessage], str]] ¶
Retrieves recently logged log messages.
- Parameters:
messageTypes (Sequence[LogMessageType]) – The list of message types that the caller wishes to receive. An empty list means no filtering (send all message types).
traceCategories (Sequence[str]) – The categories of traces that caller wish to receive. This parameter is ignored if
messageTypes
is not empty and does not include trace. An empty list means no filtering (send all trace categories).messageMax (int) – The maximum number of log messages (of all types) to be returned. A negative value requests all messages available.
context (dict[str, str]) – The request context for the invocation.
- Returns:
- A tuple containing:
list[LogMessage] The Log messages.
str The prefix of the associated local logger.
- Return type:
Awaitable[tuple[list[LogMessage], str]]
- static ice_staticId() str ¶
Gets the Slice type ID of the interface associated with this proxy.
- Returns:
The type ID, “::Ice::Object”.
- Return type:
str
- static uncheckedCast(proxy: ObjectPrx | None, facet: str | None = None) LoggerAdminPrx | None ¶
Creates a new proxy from an existing proxy.
- exception Ice.MarshalException¶
Bases:
ProtocolException
This exception reports an error during marshaling or unmarshaling.
- exception Ice.NoEndpointException¶
Bases:
LocalException
This exception is raised if no suitable endpoint is available.
- exception Ice.NotRegisteredException(kindOfObject: str, id: str, msg: str)¶
Bases:
LocalException
An attempt was made to find or deregister something that is not registered with Ice.
- Parameters:
kindOfObject (str)
id (str)
msg (str)
- property id¶
The ID (or name) of the object that is not registered.
- Returns:
The ID of the object that is not registered.
- Return type:
str
- property kindOfObject¶
The kind of object that is not registered.
- Returns:
The kind of object that is not registered.
- Return type:
str
- class Ice.Object¶
Bases:
object
The base class for servants.
- ice_id(current: Current) str | Awaitable[str] ¶
Obtain the type ID corresponding to the most-derived Slice interface supported by the target object.
- Parameters:
current (Current) – The current context.
- Returns:
The type ID.
- Return type:
str
- ice_ids(current: Current) Sequence[str] | Awaitable[Sequence[str]] ¶
Obtain the type IDs corresponding to the Slice interfaces that are supported by the target object.
- Parameters:
current (Current) – The current context.
- Returns:
A list of type IDs.
- Return type:
Sequence[str]
- ice_isA(id: str, current: Current) bool | Awaitable[bool] ¶
Determine whether the target object supports the interface denoted by the given Slice type ID.
- Parameters:
id (str) – The Slice type ID.
current (Current) – The current context.
- Returns:
True if the target object supports the interface, False otherwise.
- Return type:
bool
- ice_ping(current: Current) None | Awaitable[None] ¶
A reachability test for the target object.
- Parameters:
current (Current) – The current context.
- Return type:
None | Awaitable[None]
- static ice_staticId() str ¶
Obtain the type ID of the Slice interface.
- Returns:
The type ID.
- Return type:
str
- class Ice.ObjectAdapter(impl: ObjectAdapter)¶
Bases:
object
The object adapter provides an up-call interface from the Ice runtime to the implementation of Ice objects.
The object adapter is responsible for receiving requests from endpoints, and for mapping between servants, identities, and proxies.
- Parameters:
impl (IcePy.ObjectAdapter)
- activate() None ¶
Activate all endpoints that belong to this object adapter.
After activation, the object adapter can dispatch requests received through its endpoints.
- Return type:
None
- add(servant: Object, id: Identity) ObjectPrx ¶
Add a servant to this object adapter’s Active Servant Map.
Note that one servant can implement several Ice objects by registering the servant with multiple identities. Adding a servant with an identity that is already in the map throws AlreadyRegisteredException.
- addDefaultServant(servant: Object, category: str) None ¶
Add a default servant to handle requests for a specific category.
Adding a default servant for a category for which a default servant is already registered throws AlreadyRegisteredException. To dispatch operation calls on servants, the object adapter tries to find a servant for a given Ice object identity and facet in the following order:
The object adapter tries to find a servant for the identity and facet in the Active Servant Map.
If no servant has been found in the Active Servant Map, the object adapter tries to find a default servant for the category component of the identity.
If no servant has been found by any of the preceding steps, the object adapter tries to find a default servant for an empty category, regardless of the category contained in the identity.
If no servant has been found by any of the preceding steps, the object adapter gives up and the caller receives ObjectNotExistException or FacetNotExistException.
- Parameters:
servant (Object) – The default servant.
category (str) – The category for which the default servant is registered. An empty category means it will handle all categories.
- Return type:
None
- addFacet(servant: Object, id: Identity, facet: str = '') ObjectPrx ¶
Add a servant with a facet to this object adapter’s Active Servant Map.
Calling add(servant, id) is equivalent to calling addFacet with an empty facet.
- Parameters:
- Returns:
A proxy that matches the given identity, facet, and this object adapter.
- Return type:
- addFacetWithUUID(servant: Object, facet: str) ObjectPrx ¶
Add a servant with a facet to this object adapter’s Active Servant Map, using an automatically generated UUID as its identity.
Calling addWithUUID(servant) is equivalent to calling addFacetWithUUID with an empty facet.
- addServantLocator(locator: ServantLocator, category: str) None ¶
Add a Servant Locator to this object adapter.
Adding a servant locator for a category for which a servant locator is already registered throws AlreadyRegisteredException. To dispatch operation calls on servants, the object adapter tries to find a servant for a given Ice object identity and facet in the following order:
The object adapter tries to find a servant for the identity and facet in the Active Servant Map.
If no servant has been found in the Active Servant Map, the object adapter tries to find a servant locator for the category component of the identity. If a locator is found, the object adapter tries to find a servant using this locator.
If no servant has been found by any of the preceding steps, the object adapter tries to find a locator for an empty category, regardless of the category contained in the identity. If a locator is found, the object adapter tries to find a servant using this locator.
If no servant has been found by any of the preceding steps, the object adapter gives up and the caller receives ObjectNotExistException or FacetNotExistException.
Only one locator for the empty category can be installed.
- Parameters:
locator (ServantLocator) – The locator to add.
category (str) – The category for which the Servant Locator can locate servants, or an empty string if the Servant Locator does not belong to any specific category.
- Return type:
None
- addWithUUID(servant: Object) ObjectPrx ¶
Add a servant to this object adapter’s Active Servant Map, using an automatically generated UUID as its identity.
Note that the generated UUID identity can be accessed using the proxy’s ice_getIdentity operation.
- createDirectProxy(id: Identity) ObjectPrx ¶
Create a direct proxy for the object with the given identity.
The returned proxy contains this object adapter’s published endpoints.
- createIndirectProxy(id: Identity) ObjectPrx ¶
Create an indirect proxy for the object with the given identity.
If this object adapter is configured with an adapter ID, the return value refers to the adapter ID. Otherwise, the return value contains only the object identity.
- createProxy(id: Identity) ObjectPrx ¶
Create a proxy for the object with the given identity.
If this object adapter is configured with an adapter ID, the return value is an indirect proxy that refers to the adapter ID. If a replica group ID is also defined, the return value is an indirect proxy that refers to the replica group ID. Otherwise, if no adapter ID is defined, the return value is a direct proxy containing this object adapter’s published endpoints.
- deactivate() None ¶
Deactivates this object adapter: stop accepting new connections from clients and close gracefully all incoming connections created by this object adapter once all outstanding dispatches have completed.
If this object adapter is indirect, this method also unregisters the object adapter from the Locator. This method does not cancel outstanding dispatches–it lets them execute until completion. A new incoming request on an existing connection will be accepted and can delay the closure of the connection. A deactivated object adapter cannot be reactivated again; it can only be destroyed.
- Return type:
None
- destroy() None ¶
Destroys this object adapter and cleans up all resources held by this object adapter.
Once this method has returned, it is possible to create another object adapter with the same name.
- Return type:
None
- find(id: Identity) Object | None ¶
Look up a servant in this object adapter’s Active Servant Map by the identity of the Ice object it implements.
This operation only tries to look up a servant in the Active Servant Map. It does not attempt to find a servant by using any installed ServantLocator.
- findAllFacets(id: Identity) dict[str, Object] ¶
Find all facets with the given identity in the Active Servant Map.
- findByProxy(proxy: ObjectPrx) Object | None ¶
Look up a servant in this object adapter’s Active Servant Map, given a proxy.
This operation only tries to look up a servant in the Active Servant Map. It does not attempt to find a servant by using any installed ServantLocator.
- findDefaultServant(category: str) Object | None ¶
Find the default servant for a specific category.
- Parameters:
category (str) – The category of the default servant to find.
- Returns:
The default servant, or None if no default servant was registered for the category.
- Return type:
Object or None
- findFacet(id: Identity, facet: str) Object | None ¶
Look up a servant in this object adapter’s Active Servant Map by the identity and facet of the Ice object it implements.
Calling find(id) is equivalent to calling findFacet with an empty facet.
- Parameters:
id (Identity) – The identity of the Ice object for which the servant should be returned.
facet (str) – The facet. An empty facet means the default facet.
- Returns:
The servant that implements the Ice object with the given identity and facet, or None if no such servant has been found.
- Return type:
Object | None
- findServantLocator(category: str) ServantLocator | None ¶
Find a Servant Locator installed with this object adapter.
- Parameters:
category (str) – The category for which the Servant Locator can locate servants, or an empty string if the Servant Locator does not belong to any specific category.
- Returns:
The Servant Locator, or None if no Servant Locator was found for the given category.
- Return type:
ServantLocator | None
- getCommunicator() Communicator ¶
Get the communicator this object adapter belongs to.
- Returns:
The communicator this object adapter belongs to.
- Return type:
- getEndpoints() tuple[Endpoint, ...] ¶
Get the set of endpoints configured with this object adapter.
- Returns:
The set of endpoints.
- Return type:
tuple[IcePy.Endpoint, …]
- getLocator() LocatorPrx | None ¶
Get the Ice locator used by this object adapter.
- Returns:
The locator used by this object adapter, or None if no locator is used by this object adapter.
- Return type:
LocatorPrx | None
- getName() str ¶
Get the name of this object adapter.
- Returns:
The name of this object adapter.
- Return type:
str
- getPublishedEndpoints() tuple[Endpoint, ...] ¶
Get the set of endpoints that proxies created by this object adapter will contain.
- Returns:
The set of published endpoints.
- Return type:
tuple[IcePy.Endpoint, …]
- hold() None ¶
Temporarily hold receiving and dispatching requests.
The object adapter can be reactivated with the activate operation. Holding is not immediate; i.e., after hold returns, the object adapter might still be active for some time. You can use waitForHold to wait until holding is complete.
- Return type:
None
- isDeactivated() bool ¶
Checks if this object adapter has been deactivated.
- Returns:
True if deactivate has been called on this object adapter; otherwise, False.
- Return type:
bool
- remove(id: Identity) Object ¶
Remove a servant (that is, the default facet) from the object adapter’s Active Servant Map.
Removing an identity that is not in the map throws NotRegisteredException.
- removeAllFacets(id: Identity) dict[str, Object] ¶
Remove all facets with the given identity from the Active Servant Map.
The operation completely removes the Ice object, including its default facet. Removing an identity that is not in the map throws NotRegisteredException.
- removeDefaultServant(category: str) Object ¶
Remove the default servant for a specific category.
Attempting to remove a default servant for a category that is not registered throws NotRegisteredException.
- Parameters:
category (str) – The category of the default servant to remove.
- Returns:
The default servant.
- Return type:
- removeFacet(id: Identity, facet: str) Object ¶
Remove a servant with a facet from the object adapter’s Active Servant Map.
Calling remove(id) is equivalent to calling removeFacet with an empty facet.
- removeServantLocator(category: str) ServantLocator ¶
Remove a Servant Locator from this object adapter.
- Parameters:
category (str) – The category for which the Servant Locator can locate servants, or an empty string if the Servant Locator does not belong to any specific category.
- Returns:
The Servant Locator.
- Return type:
- Raises:
NotRegisteredException – If no Servant Locator was found for the given category.
- setLocator(locator: LocatorPrx) None ¶
Set an Ice locator for this object adapter.
By doing so, the object adapter will register itself with the locator registry when it is activated for the first time. Furthermore, the proxies created by this object adapter will contain the adapter identifier instead of its endpoints. The adapter identifier must be configured using the AdapterId property.
- Parameters:
locator (LocatorPrx) – The locator used by this object adapter.
- Return type:
None
- setPublishedEndpoints(newEndpoints: tuple[Endpoint, ...] | list[Endpoint]) None ¶
Set the endpoints that proxies created by this object adapter will contain.
- Parameters:
newEndpoints (tuple[IcePy.Endpoint, ...] | list[IcePy.Endpoint]) – The new set of endpoints that the object adapter will embed in proxies.
- Return type:
None
- waitForDeactivate() None ¶
Wait until deactivate is called on this object adapter and all connections accepted by this object adapter are closed.
A connection is closed only after all outstanding dispatches on this connection have completed.
- Return type:
None
- waitForHold() None ¶
Wait until the object adapter holds requests.
Calling hold initiates holding of requests, and waitForHold only returns when holding of requests has been completed.
- Return type:
None
- exception Ice.ObjectAdapterDeactivatedException¶
Bases:
LocalException
This exception is raised if an attempt is made to use a deactivated ObjectAdapter.
- exception Ice.ObjectAdapterDestroyedException¶
Bases:
LocalException
This exception is raised if an attempt is made to use a destroyed ObjectAdapter.
- exception Ice.ObjectAdapterIdInUseException¶
Bases:
LocalException
This exception is raised if an ObjectAdapter cannot be activated. This happens if the Locator detects another active ObjectAdapter with the same adapter id.
- exception Ice.ObjectNotExistException(id: Identity | None = None, facet: str = '', operation: str = '', msg: str = '')¶
Bases:
RequestFailedException
The dispatch could not find a servant for the identity carried by the request.
- Parameters:
id (Identity | None)
facet (str)
operation (str)
msg (str)
- exception Ice.ObjectNotFoundException¶
Bases:
UserException
The exception that is thrown by a
Ice.LocatorPrx
implementation when it cannot find an object with the provided identity.- Return type:
None
- class Ice.ObjectPrx¶
Bases:
ObjectPrx
The base class for all proxies.
- 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:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object does not support the requested type.
- Return type:
ObjectPrx | None
- static checkedCastAsync(proxy: ObjectPrx, 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.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object does not support the requested type.
- Return type:
ObjectPrx | None
- ice_adapterId(newAdapterId: str) Self ¶
Creates a new proxy that is identical to this proxy, except for the adapter ID.
- Parameters:
newAdapterId (str) – The adapter ID for the new proxy.
- Returns:
The proxy with the new adapter ID.
- Return type:
- ice_batchDatagram() Self ¶
Creates a new proxy that is identical to this proxy, but uses batch datagram invocations.
- Returns:
A new proxy that uses batch datagram invocations.
- Return type:
- ice_batchOneway() Self ¶
Creates a new proxy that is identical to this proxy, but uses batch oneway invocations.
- Returns:
A new proxy that uses batch oneway invocations.
- Return type:
- ice_collocationOptimized(collocated: bool) Self ¶
Creates a new proxy that is identical to this proxy, except for collocation optimization.
- Parameters:
collocated (bool) – True if the new proxy enables collocation optimization; False otherwise.
- Returns:
The new proxy with the specified collocation optimization.
- Return type:
- ice_compress(compress: bool) Self ¶
Creates a new proxy that is identical to this proxy, except for compression.
- Parameters:
compress (bool) – True enables compression for the new proxy; False disables compression.
- Returns:
A new proxy with the specified compression setting.
- Return type:
- ice_connectionCached(newCache: bool) Self ¶
Creates a new proxy that is identical to this proxy, except for connection caching.
- Parameters:
newCache (bool) – True if the new proxy should cache connections; False otherwise.
- Returns:
The new proxy with the specified caching policy.
- Return type:
- ice_connectionId(connectionId: str) Self ¶
Creates a new 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 new proxy with the specified connection ID.
- Return type:
- ice_context(new_context: dict[str, str]) Self ¶
Creates a new proxy that is identical to this proxy, except for the per-proxy context.
- Parameters:
new_context (dict[str, str]) – The context for the new proxy.
- Returns:
The proxy with the new per-proxy context.
- Return type:
- ice_datagram() Self ¶
Creates a new proxy that is identical to this proxy, but uses datagram invocations.
- Returns:
A new proxy that uses datagram invocations.
- Return type:
- ice_encodingVersion(version: EncodingVersion) Self ¶
Creates a new 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 requests parameters.
- Returns:
The new proxy with the specified encoding version.
- Return type:
- ice_endpointSelection(newType: EndpointSelectionType) Self ¶
Creates a new proxy that is identical to this proxy, except for the endpoint selection policy.
- Parameters:
newType (EndpointSelectionType) – The new endpoint selection policy.
- Returns:
The new proxy with the specified endpoint selection policy.
- Return type:
- ice_endpoints(newEndpoints: tuple[Endpoint, ...] | list[Endpoint]) Self ¶
Creates a new proxy that is identical to this proxy, except for the endpoints.
- Parameters:
newEndpoints (tuple[IcePy.Endpoint, ...] | list[IcePy.Endpoint]) – The endpoints for the new proxy.
- Returns:
The proxy with the new endpoints.
- Return type:
- ice_facet(new_facet: str) Self ¶
Creates a new proxy that is identical to this proxy, except for the facet.
- Parameters:
new_facet (str) – The facet for the new proxy.
- Returns:
The proxy with the new facet.
- Return type:
- ice_fixed(connection: Connection) Self ¶
Returns a proxy that is identical to this proxy, except it’s a fixed proxy bound to the given connection.
- Parameters:
connection (IcePy.Connection) – The fixed proxy connection.
- Returns:
A fixed proxy bound to the given connection.
- Return type:
- ice_flushBatchRequests() None ¶
Flushes any pending batched requests for this proxy. The call blocks until the flush is complete.
- Return type:
None
- ice_getAdapterId() str ¶
Returns 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:
str
- ice_getCachedConnection() Connection | None ¶
Returns the cached Connection for this proxy. If the proxy does not yet have an established connection, it does not attempt to create a connection.
- Returns:
The cached Connection for this proxy (None if the proxy does not have an established connection).
- Return type:
Connection | None
- ice_getCommunicator() Communicator ¶
Return the communicator that created this proxy.
- Returns:
The communicator that created this proxy.
- Return type:
- ice_getCompress() bool | None ¶
Obtains the compression override setting of this proxy.
- Returns:
The compression override setting. If no optional value is present, no override is set. Otherwise, true if compression is enabled, false otherwise.
- Return type:
bool or None
- ice_getConnection() Connection | None ¶
Returns the Connection for this proxy. If the proxy does not yet have an established connection, it first attempts to create a connection.
- Returns:
The Connection for this proxy, or null when the target object is collocated.
- Return type:
Connection | None
- ice_getConnectionId() str ¶
Returns the connection id of this proxy.
- Returns:
The connection id.
- Return type:
str
- ice_getContext() dict[str, str] | None ¶
Returns the per-proxy context for this proxy.
- Returns:
The per-proxy context. If the proxy does not have a per-proxy (implicit) context, the return value is None.
- Return type:
dict[str, str] | None
- ice_getEncodingVersion() EncodingVersion ¶
Returns the encoding version used to marshal requests parameters.
- Returns:
The encoding version.
- Return type:
- ice_getEndpointSelection() EndpointSelectionType ¶
Returns how this proxy selects endpoints (randomly or ordered).
- Returns:
The endpoint selection policy.
- Return type:
- ice_getEndpoints() tuple[Endpoint, ...] ¶
Returns the endpoints used by this proxy.
- Returns:
The endpoints used by this proxy.
- Return type:
tuple[IcePy.Endpoint, …]
- ice_getFacet() str ¶
Returns 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:
str
- ice_getIdentity() Identity ¶
Return the identity embedded in this proxy.
- Returns:
The identity of the target object.
- Return type:
- ice_getInvocationTimeout() int ¶
Returns the invocation timeout of this proxy.
- Returns:
The invocation timeout value (in seconds).
- Return type:
int
- ice_getLocator() LocatorPrx | None ¶
Returns the locator for this proxy.
- Returns:
The locator for this proxy. If no locator is configured, the return value is None.
- Return type:
LocatorPrx or None
- ice_getLocatorCacheTimeout() int ¶
Returns the locator cache timeout of this proxy.
- Returns:
The locator cache timeout value (in seconds).
- Return type:
int
- ice_getRouter() RouterPrx | None ¶
Returns 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 or None
- ice_id(context: dict[str, str] | None = None) str ¶
Return the Slice type ID of the most-derived interface supported by the target object of this proxy.
- Parameters:
context (dict[str, str], optional) – The context dictionary for the invocation.
- Returns:
The Slice type ID of the most-derived interface.
- Return type:
str
- ice_idAsync(context: dict[str, str] | None = None) Awaitable[str] ¶
Return the Slice type ID of the most-derived interface supported by the target object of this proxy.
- Parameters:
context (dict[str, str], optional) – The context dictionary for the invocation.
- Returns:
The Slice type ID of the most-derived interface.
- Return type:
str
- ice_identity(newIdentity: Identity) Self ¶
Create a new proxy that is identical to this proxy, except for the per-proxy context.
- ice_ids(context: dict[str, str] | None = None) list[str] ¶
Return the Slice type IDs of the interfaces supported by the target object of this proxy.
- Parameters:
context (dict[str, str], optional) – The context dictionary for the invocation.
- Returns:
The Slice type IDs of the interfaces supported by the target object, in alphabetical order.
- Return type:
list of str
- ice_idsAsync(context: dict[str, str] | None = None) Awaitable[list[str]] ¶
Return the Slice type IDs of the interfaces supported by the target object of this proxy.
- Parameters:
context (dict[str, str], optional) – The context dictionary for the invocation.
- Returns:
The Slice type IDs of the interfaces supported by the target object, in alphabetical order.
- Return type:
list of str
- ice_invocationTimeout(timeout: int) Self ¶
Creates a new proxy that is identical to this proxy, except for the invocation timeout.
- Parameters:
timeout (int) – The new invocation timeout (in seconds).
- Returns:
The proxy with the new invocation timeout.
- Return type:
- ice_isA(id: str, context: dict[str, str] | None = None) bool ¶
Test whether this object supports a specific Slice interface.
- Parameters:
id (str) – The type ID of the Slice interface to test against.
context (dict[str, str], optional) – The context dictionary for the invocation.
- Returns:
True if the target object has the interface specified by id or derives from the interface specified by id.
- Return type:
bool
- ice_isAAsync(id: str, context: dict[str, str] | None = None) Awaitable[bool] ¶
Test whether this object supports a specific Slice interface.
- Parameters:
id (str) – The type ID of the Slice interface to test against.
context (dict[str, str], optional) – The context dictionary for the invocation.
- Returns:
True if the target object has the interface specified by id or derives from the interface specified by id.
- Return type:
bool
- ice_isBatchDatagram() bool ¶
Returns whether this proxy uses batch datagram invocations.
- Returns:
True if this proxy uses batch datagram invocations; False otherwise.
- Return type:
bool
- ice_isBatchOneway() bool ¶
Returns whether this proxy uses batch oneway invocations.
- Returns:
True if this proxy uses batch oneway invocations; False otherwise.
- Return type:
bool
- ice_isCollocationOptimized() bool ¶
Returns whether this proxy uses collocation optimization.
- Returns:
True if the proxy uses collocation optimization; False otherwise.
- Return type:
bool
- ice_isConnectionCached() bool ¶
Returns whether this proxy caches connections.
- Returns:
True if this proxy caches connections; False otherwise.
- Return type:
bool
- ice_isDatagram() bool ¶
Returns whether this proxy uses datagram invocations.
- Returns:
True if this proxy uses datagram invocations; False otherwise.
- Return type:
bool
- ice_isFixed() bool ¶
Returns whether this proxy is a fixed proxy.
- Returns:
True if this is a fixed proxy; False otherwise.
- Return type:
bool
- ice_isOneway() bool ¶
Returns whether this proxy uses oneway invocations.
- Returns:
True if this proxy uses oneway invocations; False otherwise.
- Return type:
bool
- ice_isTwoway() bool ¶
Returns whether this proxy uses twoway invocations.
- Returns:
True if this proxy uses twoway invocations; False otherwise.
- Return type:
bool
- ice_locator(locator: LocatorPrx | None) Self ¶
Creates a new proxy that is identical to this proxy, except for the locator.
- Parameters:
locator (LocatorPrx or None) – The locator for the new proxy.
- Returns:
The new proxy with the specified locator.
- Return type:
- ice_locatorCacheTimeout(timeout: int) Self ¶
Creates a new proxy that is identical to this proxy, except for the locator cache timeout.
- Parameters:
timeout (int) – The new locator cache timeout (in seconds).
- Returns:
The proxy with the new locator cache timeout.
- Return type:
- ice_oneway() Self ¶
Creates a new proxy that is identical to this proxy, but uses oneway invocations.
- Returns:
A new proxy that uses oneway invocations.
- Return type:
- ice_ping(context: dict[str, str] | None = None)¶
Test whether the target object of this proxy can be reached.
- Parameters:
context (dict[str, str], optional) – The context dictionary for the invocation.
Examples
>>> obj.ice_ping(context={"key": "value"})
- ice_pingAsync(context: dict[str, str] | None = None)¶
Test whether the target object of this proxy can be reached.
- Parameters:
context (dict[str, str], optional) – The context dictionary for the invocation.
Examples
>>> obj.ice_ping(context={"key": "value"})
- ice_router(router: RouterPrx | None) Self ¶
Creates a new proxy that is identical to this proxy, except for the router.
- static ice_staticId() str ¶
Gets the Slice type ID of the interface associated with this proxy.
- Returns:
The type ID, “::Ice::Object”.
- Return type:
str
- ice_twoway() Self ¶
Creates a new proxy that is identical to this proxy, but uses twoway invocations.
- Returns:
A new proxy that uses twoway invocations.
- Return type:
- class Ice.OperationMode(*values)¶
Bases:
Enum
Specifies if an operation is idempotent, which affects the retry behavior of the Ice client runtime.
Enumerators:
- Normal:
A non-idempotent operation (the default). The Ice client runtime guarantees that it will not violate at-most-once semantics for operations with this mode.
- Nonmutating:
Equivalent to
Ice.OperationMode.Idempotent
, but deprecated.
- Idempotent:
An idempotent operation. The Ice client runtime does not guarantee at-most-once semantics for such an operation.
- exception Ice.OperationNotExistException(id: Identity | None = None, facet: str = '', operation: str = '', msg: str = '')¶
Bases:
RequestFailedException
The dispatch could not find the operation carried by the request on the target servant. This is typically due to a mismatch in the Slice definitions, such as the client using Slice definitions newer than the server’s.
- Parameters:
id (Identity | None)
facet (str)
operation (str)
msg (str)
- exception Ice.ParseException¶
Bases:
LocalException
This exception is raised if there was an error while parsing a string.
- class Ice.Process¶
Bases:
Object
,ABC
- static ice_staticId() str ¶
Obtain the type ID of the Slice interface.
- Returns:
The type ID.
- Return type:
str
- abstractmethod shutdown(current: Current) None | Awaitable[None] ¶
Initiates a graceful shutdown of the server application.
- Parameters:
current (Ice.Current) – The Current object for the dispatch.
- Returns:
None or an awaitable that completes when the dispatch completes.
- Return type:
None | Awaitable[None]
- abstractmethod writeMessage(message: str, fd: int, current: Current) None | Awaitable[None] ¶
Writes a message on the server application’s stdout or stderr.
- Parameters:
message (str) – The message to write.
fd (int) – 1 for stdout, 2 for stderr.
current (Ice.Current) – The Current object for the dispatch.
- Returns:
None or an awaitable that completes when the dispatch completes.
- Return type:
None | Awaitable[None]
- class Ice.ProcessPrx¶
Bases:
ObjectPrx
- static checkedCast(proxy: ObjectPrx | None, facet: str | None = None, context: dict[str, str] | None = None) ProcessPrx | None ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object 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[ProcessPrx | None] ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object does not support the requested type.
- Return type:
ObjectPrx | None
- static ice_staticId() str ¶
Gets the Slice type ID of the interface associated with this proxy.
- Returns:
The type ID, “::Ice::Object”.
- Return type:
str
- shutdown(context: dict[str, str] | None = None) None ¶
Initiates a graceful shutdown of the server application.
- Parameters:
context (dict[str, str]) – The request context for the invocation.
- Return type:
None
- shutdownAsync(context: dict[str, str] | None = None) Awaitable[None] ¶
Initiates a graceful shutdown of the server application.
- Parameters:
context (dict[str, str]) – The request context for the invocation.
- Returns:
An awaitable that is completed when the invocation completes.
- Return type:
Awaitable[None]
- static uncheckedCast(proxy: ObjectPrx | None, facet: str | None = None) ProcessPrx | None ¶
Creates a new proxy from an existing proxy.
- writeMessage(message: str, fd: int, context: dict[str, str] | None = None) None ¶
Writes a message on the server application’s stdout or stderr.
- Parameters:
message (str) – The message to write.
fd (int) – 1 for stdout, 2 for stderr.
context (dict[str, str]) – The request context for the invocation.
- Return type:
None
- writeMessageAsync(message: str, fd: int, context: dict[str, str] | None = None) Awaitable[None] ¶
Writes a message on the server application’s stdout or stderr.
- Parameters:
message (str) – The message to write.
fd (int) – 1 for stdout, 2 for stderr.
context (dict[str, str]) – The request context for the invocation.
- Returns:
An awaitable that is completed when the invocation completes.
- Return type:
Awaitable[None]
- class Ice.Properties(impl: Properties)¶
Bases:
object
A property set used to configure Ice and Ice applications. Properties are key/value pairs, with both keys and values being strings. By convention, property keys should have the form application-name[.category[.sub-category]].name.
- Parameters:
impl (Properties)
- clone() Properties ¶
Create a copy of this property set.
- Returns:
A copy of this property set.
- Return type:
- getCommandLineOptions() list[str] ¶
Get a sequence of command-line options that is equivalent to this property set.
Each element of the returned sequence is a command-line option of the form –key=value.
- Returns:
The command line options for this property set.
- Return type:
list of str
- getIceProperty(key: str) str ¶
Get an Ice property by key.
If the property is not set, its default value is returned.
- Parameters:
key (str) – The property key.
- Returns:
The property value, or the default value if the property is not set.
- Return type:
str
- Raises:
PropertyException – When the property is not a known Ice property.
- getIcePropertyAsInt(key: str) int ¶
Get an Ice property as an integer.
If the property is not set, its default value is returned.
- Parameters:
key (str) – The property key.
- Returns:
The property value interpreted as an integer, or the default value if the property is not set.
- Return type:
int
- Raises:
PropertyException – When the property is not a known Ice property or the property value is not a valid integer.
- getIcePropertyAsList(key: str) list[str] ¶
Get an Ice property as a list of strings.
The strings must be separated by whitespace or comma. If the property is not set, its default value is returned. The strings in the list can contain whitespace and commas if they are enclosed in single or double quotes. If quotes are mismatched, the default value is returned. Within single or double quotes, you can escape the quote in question with a backslash, e.g., O’Reilly can be written as O’Reilly, “O’Reilly” or ‘O’Reilly’.
- Parameters:
key (str) – The property key.
- Returns:
The property value interpreted as a list of strings, or the default value if the property is not set.
- Return type:
list of str
- Raises:
PropertyException – When the property is not a known Ice property.
- getPropertiesForPrefix(prefix: str) dict[str, str] ¶
Get all properties whose keys begin with the given prefix.
If the prefix is an empty string, then all properties are returned.
- Parameters:
prefix (str) – The prefix to search for (empty string if none).
- Returns:
The matching property set with keys and values as strings.
- Return type:
dict[str, str]
- getProperty(key: str) str ¶
Get a property by key.
If the property is not set, an empty string is returned.
- Parameters:
key (str) – The property key.
- Returns:
The property value, or an empty string if the property is not set.
- Return type:
str
- getPropertyAsInt(key: str) int ¶
Get a property as an integer.
If the property is not set, 0 is returned.
- Parameters:
key (str) – The property key.
- Returns:
The property value interpreted as an integer, or 0 if the property is not set.
- Return type:
int
- Raises:
PropertyException – When the property value is not a valid integer.
- getPropertyAsIntWithDefault(key: str, value: int) int ¶
Get a property as an integer.
If the property is not set, the given default value is returned.
- Parameters:
key (str) – The property key.
value (int) – The default value to use if the property does not exist.
- Returns:
The property value interpreted as an integer, or the default value if the property does not exist.
- Return type:
int
- Raises:
PropertyException – When the property value is not a valid integer.
- getPropertyAsList(key: str) list[str] ¶
Get a property as a list of strings.
The strings must be separated by whitespace or comma. If the property is not set, an empty list is returned. The strings in the list can contain whitespace and commas if they are enclosed in single or double quotes. If quotes are mismatched, an empty list is returned. Within single or double quotes, you can escape the quote in question with a backslash, e.g., O’Reilly can be written as O’Reilly, “O’Reilly” or ‘O’Reilly’.
- Parameters:
key (str) – The property key.
- Returns:
The property value interpreted as a list of strings.
- Return type:
list of str
- getPropertyAsListWithDefault(key: str, value: list[str]) list[str] ¶
Get a property as a list of strings.
The strings must be separated by whitespace or comma. If the property is not set, the default value is returned. The strings in the list can contain whitespace and commas if they are enclosed in single or double quotes. If quotes are mismatched, the default value is returned. Within single or double quotes, you can escape the quote in question with a backslash, e.g., O’Reilly can be written as O’Reilly, “O’Reilly” or ‘O’Reilly’.
- Parameters:
key (str) – The property key.
value (list of str) – The default value to use if the property is not set.
- Returns:
The property value interpreted as a list of strings, or the default value if the property is not set.
- Return type:
list of str
- getPropertyWithDefault(key: str, value: str) str ¶
Get a property by key.
If the property is not set, the given default value is returned.
- Parameters:
key (str) – The property key.
value (str) – The default value to use if the property does not exist.
- Returns:
The property value, or the default value if the property does not exist.
- Return type:
str
- load(file: str) None ¶
Load properties from a file.
- Parameters:
file (str) – The property file.
- Return type:
None
- parseCommandLineOptions(prefix: str, options: list[str]) list[str] ¶
Convert a sequence of command-line options into properties.
All options that begin with –prefix. are converted into properties. If the prefix is empty, all options that begin with – are converted to properties.
- Parameters:
prefix (str) – The property prefix, or an empty string to convert all options starting with –.
options (list of str) – The command-line options.
- Returns:
The command-line options that do not start with the specified prefix, in their original order.
- Return type:
list of str
- parseIceCommandLineOptions(options: list[str]) list[str] ¶
Convert a sequence of command-line options into properties.
All options that begin with one of the following prefixes are converted into properties: –Ice, –IceBox, –IceGrid, –IceSSL, –IceStorm, and –Glacier2.
- Parameters:
options (list of str) – The command-line options.
- Returns:
The command-line options that do not start with one of the listed prefixes, in their original order.
- Return type:
list of str
- setProperty(key: str, value: str) None ¶
Set a property.
To unset a property, set it to the empty string.
- Parameters:
key (str) – The property key.
value (str) – The property value.
- Return type:
None
- class Ice.PropertiesAdmin¶
Bases:
Object
,ABC
- abstractmethod getPropertiesForPrefix(prefix: str, current: Current) Mapping[str, str] | Awaitable[Mapping[str, str]] ¶
Gets all properties whose keys begin with
prefix
. Ifprefix
is the empty string then all properties are returned.- Parameters:
prefix (str) – The prefix to search for. May be empty.
current (Ice.Current) – The Current object for the dispatch.
- Returns:
The matching property set.
- Return type:
Mapping[str, str] | Awaitable[Mapping[str, str]]
- abstractmethod getProperty(key: str, current: Current) str | Awaitable[str] ¶
Gets a property by key.
- Parameters:
key (str) – The property key.
current (Ice.Current) – The Current object for the dispatch.
- Returns:
The property value. This value is empty if the property is not set.
- Return type:
str | Awaitable[str]
- static ice_staticId() str ¶
Obtain the type ID of the Slice interface.
- Returns:
The type ID.
- Return type:
str
- abstractmethod setProperties(newProperties: dict[str, str], current: Current) None | Awaitable[None] ¶
Updates the communicator’s properties with the given property set. If an entry in
newProperties
matches the name of an existing property, that property’s value is replaced with the new value. If the new value is the empty string, the property is removed. Existing properties that are not modified or removed by the entries innewProperties
are not affected by this update.- Parameters:
newProperties (dict[str, str]) – Properties to add, change, or remove.
current (Ice.Current) – The Current object for the dispatch.
- Returns:
None or an awaitable that completes when the dispatch completes.
- Return type:
None | Awaitable[None]
- class Ice.PropertiesAdminPrx¶
Bases:
ObjectPrx
- static checkedCast(proxy: ObjectPrx | None, facet: str | None = None, context: dict[str, str] | None = None) PropertiesAdminPrx | None ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object 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[PropertiesAdminPrx | None] ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object does not support the requested type.
- Return type:
ObjectPrx | None
- getPropertiesForPrefix(prefix: str, context: dict[str, str] | None = None) dict[str, str] ¶
Gets all properties whose keys begin with
prefix
. Ifprefix
is the empty string then all properties are returned.- Parameters:
prefix (str) – The prefix to search for. May be empty.
context (dict[str, str]) – The request context for the invocation.
- Returns:
The matching property set.
- Return type:
dict[str, str]
- getPropertiesForPrefixAsync(prefix: str, context: dict[str, str] | None = None) Awaitable[dict[str, str]] ¶
Gets all properties whose keys begin with
prefix
. Ifprefix
is the empty string then all properties are returned.- Parameters:
prefix (str) – The prefix to search for. May be empty.
context (dict[str, str]) – The request context for the invocation.
- Returns:
The matching property set.
- Return type:
Awaitable[dict[str, str]]
- getProperty(key: str, context: dict[str, str] | None = None) str ¶
Gets a property by key.
- Parameters:
key (str) – The property key.
context (dict[str, str]) – The request context for the invocation.
- Returns:
The property value. This value is empty if the property is not set.
- Return type:
str
- getPropertyAsync(key: str, context: dict[str, str] | None = None) Awaitable[str] ¶
Gets a property by key.
- Parameters:
key (str) – The property key.
context (dict[str, str]) – The request context for the invocation.
- Returns:
The property value. This value is empty if the property is not set.
- Return type:
Awaitable[str]
- static ice_staticId() str ¶
Gets the Slice type ID of the interface associated with this proxy.
- Returns:
The type ID, “::Ice::Object”.
- Return type:
str
- setProperties(newProperties: Mapping[str, str], context: dict[str, str] | None = None) None ¶
Updates the communicator’s properties with the given property set. If an entry in
newProperties
matches the name of an existing property, that property’s value is replaced with the new value. If the new value is the empty string, the property is removed. Existing properties that are not modified or removed by the entries innewProperties
are not affected by this update.- Parameters:
newProperties (Mapping[str, str]) – Properties to add, change, or remove.
context (dict[str, str]) – The request context for the invocation.
- Return type:
None
- setPropertiesAsync(newProperties: Mapping[str, str], context: dict[str, str] | None = None) Awaitable[None] ¶
Updates the communicator’s properties with the given property set. If an entry in
newProperties
matches the name of an existing property, that property’s value is replaced with the new value. If the new value is the empty string, the property is removed. Existing properties that are not modified or removed by the entries innewProperties
are not affected by this update.- Parameters:
newProperties (Mapping[str, str]) – Properties to add, change, or remove.
context (dict[str, str]) – The request context for the invocation.
- Returns:
An awaitable that is completed when the invocation completes.
- Return type:
Awaitable[None]
- static uncheckedCast(proxy: ObjectPrx | None, facet: str | None = None) PropertiesAdminPrx | None ¶
Creates a new proxy from an existing proxy.
- exception Ice.PropertyException¶
Bases:
LocalException
This exception is raised when there is an error while getting or setting a property. For example, when trying to set an unknown Ice property.
- exception Ice.ProtocolException¶
Bases:
LocalException
The base class for Ice protocol exceptions.
- class Ice.ProtocolVersion(major: int = 0, minor: int = 0)¶
Bases:
object
Represents a version of the Ice protocol. The only version implemented and supported by Ice is version 1.0.
- Parameters:
major (int)
minor (int)
- major¶
The major version of the Ice protocol.
- Type:
int
- minor¶
The minor version of the Ice protocol.
- Type:
int
- class Ice.RemoteLogger¶
Bases:
Object
,ABC
- static ice_staticId() str ¶
Obtain the type ID of the Slice interface.
- Returns:
The type ID.
- Return type:
str
- abstractmethod init(prefix: str, logMessages: list[LogMessage], current: Current) None | Awaitable[None] ¶
Attaches a remote logger to the local logger.
- Parameters:
prefix (str) – The prefix of the associated local Logger.
logMessages (list[LogMessage]) – Old log messages generated before “now”.
current (Ice.Current) – The Current object for the dispatch.
- Returns:
None or an awaitable that completes when the dispatch completes.
- Return type:
None | Awaitable[None]
- abstractmethod log(message: LogMessage, current: Current) None | Awaitable[None] ¶
Logs a LogMessage.
- Parameters:
message (LogMessage) – The message to log.
current (Ice.Current) – The Current object for the dispatch.
- Returns:
None or an awaitable that completes when the dispatch completes.
- Return type:
None | Awaitable[None]
Notes
Ice.RemoteLoggerPrx.log()
may be called byIce.LoggerAdminPrx
beforeIce.RemoteLoggerPrx.init()
.
- exception Ice.RemoteLoggerAlreadyAttachedException¶
Bases:
UserException
Thrown when the provided
Ice.RemoteLoggerPrx
was previously attached to aIce.LoggerAdminPrx
.- Return type:
None
- class Ice.RemoteLoggerPrx¶
Bases:
ObjectPrx
- static checkedCast(proxy: ObjectPrx | None, facet: str | None = None, context: dict[str, str] | None = None) RemoteLoggerPrx | None ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object 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[RemoteLoggerPrx | None] ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object does not support the requested type.
- Return type:
ObjectPrx | None
- static ice_staticId() str ¶
Gets the Slice type ID of the interface associated with this proxy.
- Returns:
The type ID, “::Ice::Object”.
- Return type:
str
- init(prefix: str, logMessages: Sequence[LogMessage], context: dict[str, str] | None = None) None ¶
Attaches a remote logger to the local logger.
- Parameters:
prefix (str) – The prefix of the associated local Logger.
logMessages (Sequence[LogMessage]) – Old log messages generated before “now”.
context (dict[str, str]) – The request context for the invocation.
- Return type:
None
- initAsync(prefix: str, logMessages: Sequence[LogMessage], context: dict[str, str] | None = None) Awaitable[None] ¶
Attaches a remote logger to the local logger.
- Parameters:
prefix (str) – The prefix of the associated local Logger.
logMessages (Sequence[LogMessage]) – Old log messages generated before “now”.
context (dict[str, str]) – The request context for the invocation.
- Returns:
An awaitable that is completed when the invocation completes.
- Return type:
Awaitable[None]
- log(message: LogMessage, context: dict[str, str] | None = None) None ¶
Logs a LogMessage.
- Parameters:
message (LogMessage) – The message to log.
context (dict[str, str]) – The request context for the invocation.
- Return type:
None
Notes
Ice.RemoteLoggerPrx.log()
may be called byIce.LoggerAdminPrx
beforeIce.RemoteLoggerPrx.init()
.
- logAsync(message: LogMessage, context: dict[str, str] | None = None) Awaitable[None] ¶
Logs a LogMessage.
- Parameters:
message (LogMessage) – The message to log.
context (dict[str, str]) – The request context for the invocation.
- Returns:
An awaitable that is completed when the invocation completes.
- Return type:
Awaitable[None]
Notes
Ice.RemoteLoggerPrx.log()
may be called byIce.LoggerAdminPrx
beforeIce.RemoteLoggerPrx.init()
.
- static uncheckedCast(proxy: ObjectPrx | None, facet: str | None = None) RemoteLoggerPrx | None ¶
Creates a new proxy from an existing proxy.
- class Ice.ReplyStatus(*values)¶
Bases:
Enum
Represents the status of a reply. A reply status can have any value in the range 0..255. Do not use this enum to marshal or unmarshal a reply status unless you know its value corresponds to one of the enumerators defined below.
Enumerators:
- Ok:
The dispatch completed successfully.
- UserException:
The dispatch completed with a Slice user exception.
- ObjectNotExist:
The dispatch could not find an implementation for the target object.
- FacetNotExist:
The dispatch found an implementation for the target object but could not find the requested facet.
- OperationNotExist:
The dispatch found an implementation for the target object but could not find the requested operation.
- UnknownLocalException:
The dispatch failed with an Ice local exception.
- UnknownUserException:
The dispatch failed with a Slice user exception that does not conform to the exception specification of the operation.
- UnknownException:
The dispatch failed with some other exception (neither an Ice local exception nor a Slice user exception).
- InvalidData:
The dispatch failed because the request payload could not be unmarshaled. It is typically due to a mismatch in the Slice definitions used by the client and the server.
- Unauthorized:
The caller is not authorized to access the requested resource.
- exception Ice.RequestFailedException(replyStatus: int, id: Identity | None = None, facet: str = '', operation: str = '', msg: str = '')¶
Bases:
DispatchException
The base exception for the 3 NotExist exceptions.
- Parameters:
replyStatus (int)
id (Identity | None)
facet (str)
operation (str)
msg (str)
- property facet¶
Gets the facet to which the request was sent.
- Returns:
The facet to which the request was sent.
- Return type:
str
- property id: Identity¶
Gets the identity of the Ice Object to which the request was sent.
- Returns:
The identity of the Ice Object to which the request was sent.
- Return type:
- property operation¶
Gets the operation name of the request.
- Returns:
The operation name of the request.
- Return type:
str
- class Ice.Router¶
Bases:
Object
,ABC
- abstractmethod addProxies(proxies: list[ObjectPrx | None], current: Current) Sequence[ObjectPrx | None] | Awaitable[Sequence[ObjectPrx | None]] ¶
Adds new proxy information to the router’s routing table.
- Parameters:
proxies (list[ObjectPrx | None]) – The proxies to add. Adding a null proxy is an error.
current (Ice.Current) – The Current object for the dispatch.
- Returns:
Proxies discarded by the router. These proxies are all non-null.
- Return type:
Sequence[ObjectPrx | None] | Awaitable[Sequence[ObjectPrx | None]]
- abstractmethod getClientProxy(current: Current) tuple[ObjectPrx | None, bool | None] | Awaitable[tuple[ObjectPrx | None, bool | None]] ¶
Gets the router’s client proxy, i.e. the proxy to use for forwarding requests from the client to the router. If a null proxy is returned, the client will forward requests to the router’s endpoints.
- Parameters:
current (Ice.Current) – The Current object for the dispatch.
- Returns:
- A tuple containing:
ObjectPrx | None The router’s client proxy.
bool | None Indicates whether or not the router supports a routing table. If
true
, the Ice runtime will callIce.RouterPrx.addProxies()
to populate the routing table. The Ice runtime assumes the router has a routing table whenhasRoutingTable
is not set.
- Return type:
tuple[ObjectPrx | None, bool | None] | Awaitable[tuple[ObjectPrx | None, bool | None]]
Notes
Introduced in Ice 3.7.
- abstractmethod getServerProxy(current: Current) ObjectPrx | None | Awaitable[ObjectPrx | None] ¶
Gets the router’s server proxy, i.e. the proxy to use for forwarding requests from the server to the router. The Ice runtime uses the endpoints of this proxy as the published endpoints of bi-dir object adapters.
- Parameters:
current (Ice.Current) – The Current object for the dispatch.
- Returns:
The router’s server proxy.
- Return type:
- static ice_staticId() str ¶
Obtain the type ID of the Slice interface.
- Returns:
The type ID.
- Return type:
str
- class Ice.RouterFinder¶
Bases:
Object
,ABC
- abstractmethod getRouter(current: Current) RouterPrx | None | Awaitable[RouterPrx | None] ¶
Gets a proxy to the associated
Ice.RouterPrx
. The proxy might point to several replicas.- Parameters:
current (Ice.Current) – The Current object for the dispatch.
- Returns:
The router proxy. This proxy is never null.
- Return type:
- static ice_staticId() str ¶
Obtain the type ID of the Slice interface.
- Returns:
The type ID.
- Return type:
str
- class Ice.RouterFinderPrx¶
Bases:
ObjectPrx
- static checkedCast(proxy: ObjectPrx | None, facet: str | None = None, context: dict[str, str] | None = None) RouterFinderPrx | None ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object 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[RouterFinderPrx | None] ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object does not support the requested type.
- Return type:
ObjectPrx | None
- getRouter(context: dict[str, str] | None = None) RouterPrx | None ¶
Gets a proxy to the associated
Ice.RouterPrx
. The proxy might point to several replicas.- Parameters:
context (dict[str, str]) – The request context for the invocation.
- Returns:
The router proxy. This proxy is never null.
- Return type:
RouterPrx | None
- getRouterAsync(context: dict[str, str] | None = None) Awaitable[RouterPrx | None] ¶
Gets a proxy to the associated
Ice.RouterPrx
. The proxy might point to several replicas.- Parameters:
context (dict[str, str]) – The request context for the invocation.
- Returns:
The router proxy. This proxy is never null.
- Return type:
Awaitable[RouterPrx | None]
- static ice_staticId() str ¶
Gets the Slice type ID of the interface associated with this proxy.
- Returns:
The type ID, “::Ice::Object”.
- Return type:
str
- static uncheckedCast(proxy: ObjectPrx | None, facet: str | None = None) RouterFinderPrx | None ¶
Creates a new proxy from an existing proxy.
- class Ice.RouterPrx¶
Bases:
ObjectPrx
- addProxies(proxies: Sequence[ObjectPrx | None], context: dict[str, str] | None = None) list[ObjectPrx | None] ¶
Adds new proxy information to the router’s routing table.
- addProxiesAsync(proxies: Sequence[ObjectPrx | None], context: dict[str, str] | None = None) Awaitable[list[ObjectPrx | None]] ¶
Adds new proxy information to the router’s routing table.
- static checkedCast(proxy: ObjectPrx | None, facet: str | None = None, context: dict[str, str] | None = None) RouterPrx | None ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object 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[RouterPrx | None] ¶
Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.
- Parameters:
proxy (ObjectPrx | None) – The source proxy.
facet (str, optional) – A facet name.
context (dict[str, str], optional) – The request context.
- Returns:
A new proxy with the requested type, or None if the source proxy is None or if the target object does not support the requested type.
- Return type:
ObjectPrx | None
- getClientProxy(context: dict[str, str] | None = None) tuple[ObjectPrx | None, bool | None] ¶
Gets the router’s client proxy, i.e. the proxy to use for forwarding requests from the client to the router. If a null proxy is returned, the client will forward requests to the router’s endpoints.
- Parameters:
context (dict[str, str]) – The request context for the invocation.
- Returns:
- A tuple containing:
ObjectPrx | None The router’s client proxy.
bool | None Indicates whether or not the router supports a routing table. If
true
, the Ice runtime will callIce.RouterPrx.addProxies()
to populate the routing table. The Ice runtime assumes the router has a routing table whenhasRoutingTable
is not set.
- Return type:
tuple[ObjectPrx | None, bool | None]
Notes
Introduced in Ice 3.7.
- getClientProxyAsync(context: dict[str, str] | None = None) Awaitable[tuple[ObjectPrx | None, bool | None]] ¶
Gets the router’s client proxy, i.e. the proxy to use for forwarding requests from the client to the router. If a null proxy is returned, the client will forward requests to the router’s endpoints.
- Parameters:
context (dict[str, str]) – The request context for the invocation.
- Returns:
- A tuple containing:
ObjectPrx | None The router’s client proxy.
bool | None Indicates whether or not the router supports a routing table. If
true
, the Ice runtime will callIce.RouterPrx.addProxies()
to populate the routing table. The Ice runtime assumes the router has a routing table whenhasRoutingTable
is not set.
- Return type:
Awaitable[tuple[ObjectPrx | None, bool | None]]
Notes
Introduced in Ice 3.7.
- getServerProxy(context: dict[str, str] | None = None) ObjectPrx | None ¶
Gets the router’s server proxy, i.e. the proxy to use for forwarding requests from the server to the router. The Ice runtime uses the endpoints of this proxy as the published endpoints of bi-dir object adapters.
- Parameters:
context (dict[str, str]) – The request context for the invocation.
- Returns:
The router’s server proxy.
- Return type:
ObjectPrx | None
- getServerProxyAsync(context: dict[str, str] | None = None) Awaitable[ObjectPrx | None] ¶
Gets the router’s server proxy, i.e. the proxy to use for forwarding requests from the server to the router. The Ice runtime uses the endpoints of this proxy as the published endpoints of bi-dir object adapters.
- Parameters:
context (dict[str, str]) – The request context for the invocation.
- Returns:
The router’s server proxy.
- Return type:
Awaitable[ObjectPrx | None]
- static ice_staticId() str ¶
Gets the Slice type ID of the interface associated with this proxy.
- Returns:
The type ID, “::Ice::Object”.
- Return type:
str
- exception Ice.SecurityException¶
Bases:
LocalException
This exception indicates a failure in a security subsystem, such as the SSL transport.
- class Ice.ServantLocator¶
Bases:
ABC
A servant locator is called by an object adapter to locate a servant that is not found in its active servant map.
- abstractmethod deactivate(category: str)¶
Called when the object adapter in which this servant locator is installed is destroyed.
- Parameters:
category (str) – Indicates for which category the servant locator is being deactivated.
- abstractmethod finished(current: Current, servant: Object, cookie: object | None)¶
Called by the object adapter after a request has been made.
This operation is only called if locate was called prior to the request and returned a non-null servant. This operation can be used for cleanup purposes after a request.
The finished method can throw any user exception. If it does, that exception is marshaled back to the client. If the Slice definition for the corresponding operation includes that user exception, the client receives that user exception; otherwise, the client receives UnknownUserException. If both the operation and finished throw an exception, the exception thrown by finished is marshaled back to the client.
- Parameters:
- Raises:
UserException – The implementation can raise a UserException and the runtime will marshal it as the result of the invocation.
- abstractmethod locate(current: Current) tuple[Object | None, object | None] ¶
Called before a request is dispatched if a servant cannot be found in the object adapter’s active servant map.
Note that the object adapter does not automatically insert the returned servant into its active servant map. This must be done by the servant locator implementation, if desired. The locate method can throw any user exception. If it does, that exception is marshaled back to the client. If the Slice definition for the corresponding operation includes that user exception, the client receives that user exception; otherwise, the client receives UnknownUserException.
If locate throws any exception, the Ice runtime does not call finished. If you call locate from your own code, you must also call finished when you have finished using the servant, provided that locate returned a non-null servant.
- Parameters:
current (Current) – Information about the current operation for which a servant is required.
- Returns:
- A tuple containing the following:
- retvalObject or None
The located servant, or None if no suitable servant has been found.
- cookieobject | None
A “cookie” that will be passed to finished.
- Return type:
tuple[Object | None, object | None]
- Raises:
UserException – The implementation can raise a UserException and the runtime will marshal it as the result of the invocation.
- exception Ice.ServerNotFoundException¶
Bases:
UserException
The exception that is thrown when a server was not found.
- Return type:
None
- class Ice.SliceInfo¶
Bases:
object
Encapsulates the details of a slice with an unknown type.
- typeId¶
The Slice type ID for this slice.
- Type:
str
- compactId¶
The Slice compact type ID for this slice.
- Type:
int
- bytes¶
The encoded bytes for this slice, including the leading size integer.
- Type:
bytes
- hasOptionalMembers¶
Whether or not the slice contains optional members.
- Type:
bool
- isLastSlice¶
Whether or not this is the last slice.
- Type:
bool
- class Ice.SlicedData¶
Bases:
object
Holds class slices that cannot be unmarshaled because their types are not known locally.
- exception Ice.SocketException¶
Bases:
SyscallException
This exception indicates socket errors.
- exception Ice.SyscallException¶
Bases:
LocalException
This exception is raised if a system error occurred in the server or client process.
- exception Ice.TimeoutException¶
Bases:
LocalException
This exception indicates a timeout condition.
- class Ice.ToStringMode(*values)¶
Bases:
Enum
The output mode for xxxToString methods such as identityToString and proxyToString. The actual encoding format for the string is the same for all modes: you don’t need to specify an encoding format or mode when reading such a string.
Enumerators:
- Unicode:
Characters with ordinal values greater than 127 are kept as-is in the resulting string. Non-printable ASCII characters with ordinal values 127 and below are encoded as t, n (etc.) or unnnn.
- ASCII:
Characters with ordinal values greater than 127 are encoded as universal character names in the resulting string unnnn for BMP characters and Unnnnnnnn for non-BMP characters. Non-printable ASCII characters with ordinal values 127 and below are encoded as t, n (etc.) or unnnn.
- Compat:
Characters with ordinal values greater than 127 are encoded as a sequence of UTF-8 bytes using octal escapes. Characters with ordinal values 127 and below are encoded as t, n (etc.) or an octal escape. Use this mode to generate strings compatible with Ice 3.6 and earlier.
- exception Ice.TwowayOnlyException¶
Bases:
LocalException
The operation can only be invoked with a twoway request. This exception is raised if an attempt is made to invoke an operation with ice_oneway, ice_batchOneway, ice_datagram, or ice_batchDatagram and the operation has a return value, out-parameters, or an exception specification.
- exception Ice.UnknownException(msg: str, replyStatus: int = 7)¶
Bases:
DispatchException
The dispatch failed with an exception that is not a LocalException or a UserException.
- Parameters:
msg (str)
replyStatus (int)
- exception Ice.UnknownLocalException(msg: str)¶
Bases:
UnknownException
The dispatch failed with LocalException that is not one of the special marshal-able local exceptions.
- Parameters:
msg (str)
- class Ice.UnknownSlicedValue¶
Bases:
Value
Unknown sliced value holds an instance of an unknown Slice class type.
- unknownTypeId¶
The type ID of the unknown Slice class type.
- Type:
str
- ice_id()¶
Obtain the type ID corresponding to the most-derived Slice interface supported by the target object.
- Returns:
The type ID.
- Return type:
str
- exception Ice.UnknownUserException(msg: str)¶
Bases:
UnknownException
The dispatch returned a UserException that was not declared in the operation’s exception specification.
- Parameters:
msg (str)
- class Ice.Value¶
Bases:
object
The base class for instances of Slice-defined classes.
- ice_getSlicedData() SlicedData | None ¶
Return the sliced data if the value has a preserved-slice base class and has been sliced during un-marshaling of the value. Return None otherwise.
- Returns:
The sliced data or None.
- Return type:
SlicedData | None
- ice_id() str ¶
Obtain the type ID corresponding to the most-derived Slice interface supported by the target object.
- Returns:
The type ID.
- Return type:
str
- static ice_staticId() str ¶
Obtain the type ID of this Slice class or interface.
- Returns:
The type ID.
- Return type:
str
- Ice.createProperties(args: list[str] | None = None, defaults: Properties | None = None) Properties ¶
Creates a new property set.
This function creates a new Ice property set. You can optionally provide a command-line argument list (such as
sys.argv
) and/or a dictionary of default property values.If an argument list is supplied, this function parses arguments starting with
--
and a known Ice prefix (e.g.,Ice
,IceSSL
), and removes recognized arguments from the list.- Parameters:
args (list[str], optional) – A list of command-line arguments, such as
sys.argv
. Arguments that match Ice runtime options are parsed into properties and removed from the list.defaults (dict[str, str], optional) – A dictionary representing default property values.
- Returns:
A new Ice property set instance.
- Return type:
Examples
# Create a new empty property set. properties = Ice.createProperties() # Create a property set from command-line arguments. properties = Ice.createProperties(sys.argv) # Create a property set using default values. defaults = {"Ice.Trace.Protocol": "1"} properties = Ice.createProperties(defaults) # Combine command-line parsing with default values. defaults = {"Ice.Trace.Protocol": "1"} properties = Ice.createProperties(sys.argv, defaults)
- Ice.currentEncoding() Ice.EncodingVersion ¶
- Ice.currentProtocol() Ice.ProtocolVersion ¶
- Ice.currentProtocolEncoding() Ice.EncodingVersion ¶
- Ice.dispatch(cb: DispatchCallback, method: Callable, args: list[Any])¶
Dispatch a request to the given servant method.
This function is called by IcePy from an Ice server thread pool thread to dispatch a request to a servant method with the given arguments. The method’s result is then sent back to IcePy using the provided callback.
The method parameter can return: - A direct result, which is immediately sent back via the callback. - A coroutine. - A future.
If the result is a coroutine and the Ice communicator has a custom coroutine executor, dispatch uses the executor to execute the coroutine, and uses the resulting future to wait for dispatch completion.
- Parameters:
cb (IcePy.DispatchCallback) – The callback used to return the result or report an exception to IcePy.
method (Callable) – The servant method to invoke. This method is bound to the servant instance and takes the request parameters as arguments.
args (list) – The request parameters.
- Ice.encodingVersionToString(Ice.EncodingVersion) string ¶
- Ice.getSliceDir() str | None ¶
Returns the path to the directory where the Ice Slice files are installed.
This helper function locates the installation directory for the Ice Slice files, typically used to configure include paths for Slice compilers.
- Returns:
The absolute path to the directory containing the Ice Slice files, or
None
if the directory cannot be found.- Return type:
str or None
- Ice.identityToString(identity: Identity, toStringMode: ToStringMode | None = None) str ¶
Convert an object identity to a string.
- Parameters:
identity (Ice.Identity) – The object identity to convert.
toStringMode (Ice.ToStringMode, optional) – Specifies if and how non-printable ASCII characters are escaped in the result.
- Returns:
The string representation of the object identity.
- Return type:
str
- Ice.initialize(args: list[str] | None = None, initData: InitializationData | None = None, configFile: str | None = None, eventLoop: AbstractEventLoop | None = None) Communicator ¶
Creates a new communicator.
- Parameters:
args (list of str, optional) – The command-line arguments. This function parses arguments starting with
--
and one of the reserved prefixes (Ice, IceSSL etc.) as properties for the new communicator. If there is an argument starting with--Ice.Config
, this function loads the specified configuration file. When the same property is set in a configuration file and through a command-line argument, the command-line setting takes precedence.initData (InitializationData, optional) – Options for the new communicator. This argument and the configFile argument are mutually exclusive.
configFile (str, optional) – The path to a configuration file. This argument and the initData argument are mutually exclusive.
eventLoop (asyncio.AbstractEventLoop, optional) – An asyncio event loop used to run coroutines and wrap futures. If provided, a new event loop adapter is created and configured with the communicator. This adapter is responsible for executing coroutines returned by Ice asynchronous dispatch methods and for wrapping Ice futures (from Ice Async APIs) into asyncio futures. This argument and the initData argument are mutually exclusive. If the initData argument is provided, the event loop adapter can be set using the
InitializationData.eventLoopAdapter
attribute.
- Returns:
The new communicator.
- Return type:
Examples
with Ice.initialize(sys.argv, eventLoop=asyncio.get_running_loop()) as communicator: greeter = VisitorCenter.GreeterPrx(communicator, "greeter:tcp -h localhost -p 4061") await greeter.greetAsync()
- Ice.intVersion() int ¶
- Ice.loadSlice(cmd) None ¶
- Ice.protocolVersionToString(Ice.ProtocolVersion) string ¶
- Ice.proxyIdentityAndFacetCompare(lhs: ObjectPrx | None, rhs: ObjectPrx | None) int ¶
Compares the identities and facets of two proxies.
- Parameters:
lhs (ObjectPrx | None)
rhs (ObjectPrx | None)
- Return type:
int
- Ice.proxyIdentityAndFacetEqual(lhs: ObjectPrx | None, rhs: ObjectPrx | None) bool ¶
Determines whether the identities and facets of two proxies are equal.
- Parameters:
lhs (ObjectPrx | None)
rhs (ObjectPrx | None)
- Return type:
bool
- Ice.proxyIdentityCompare(lhs: ObjectPrx | None, rhs: ObjectPrx | None) int ¶
Compares the identities of two proxies.
- Parameters:
lhs (ObjectPrx | None)
rhs (ObjectPrx | None)
- Return type:
int
- Ice.proxyIdentityEqual(lhs: ObjectPrx | None, rhs: ObjectPrx | None) bool ¶
Determines whether the identities of two proxies are equal.
- Parameters:
lhs (ObjectPrx | None)
rhs (ObjectPrx | None)
- Return type:
bool
- Ice.stringToEncodingVersion(str) Ice.EncodingVersion ¶
- Ice.stringToIdentity(str: str) Identity ¶
Convert a string to an object identity.
- Parameters:
str (str) – The string to convert.
- Returns:
The converted object identity.
- Return type:
- Raises:
ParseException – If the string cannot be converted to an object identity.
- Ice.stringToProtocolVersion(str) Ice.ProtocolVersion ¶
- Ice.stringVersion() string ¶
- Ice.wrap_future(future: Future | Future, *, loop: AbstractEventLoop | None = None) Future ¶
Wrap an
Ice.Future
object into anasyncio.Future
.This function converts an Ice.Future into an asyncio.Future to allow integration of Ice’s asynchronous operations with Python’s asyncio framework. If the provided future is already an asyncio.Future, it is returned unchanged.
If the Ice.Future is already completed, the asyncio.Future is immediately resolved. Otherwise, completion callbacks are registered to ensure that the asyncio.Future reflects the state of the Ice.Future, including result propagation, exception handling, and cancellation.
- Parameters:
future (Future | asyncio.Future) – The Ice.Future object to wrap. If an asyncio.Future is passed, it is returned as-is.
loop (asyncio.AbstractEventLoop, optional) – The event loop to associate with the asyncio.Future. If not provided, the current event loop is used.
- Returns:
A future that mirrors the state of the input Ice.Future.
- Return type:
asyncio.Future
- Raises:
AssertionError – If future is not an instance of Ice.Future or asyncio.Future.