ServiceRemote¶
- class dsviper.ServiceRemote¶
Bases:
objectThe connection to a service, and the root of what it exposes.
The pools and functions are discovered from the definitions the service carries, so no per-service code is needed. Use connect(…), or connect_local(…) for a unix socket.
This is the CLIENT half, and the only half. Nothing here stands a service up: the functions a pool exposes are registered in C++, so the other end is built and run outside this package. Without one listening, connect raises.
Note: Not directly instantiable.
- attachment_function_pool_funcs(pool_id_or_name: ValueUUId | str) ServiceRemoteAttachmentFunctionPoolFunctions | None¶
Return the callable functions of an attachment pool, or None.
The pool is the one pool_id_or_name names; None means the service serves no such pool.
pool_id_or_name is a uuid or a name.
- attachment_function_pools() list[ServiceRemoteAttachmentFunctionPool]¶
Return the list of ServiceRemoteAttachmentFunctionPool.
- attachment_pools ServiceRemoteAttachmentFunctionPools¶
The callable attachment functions, grouped by pool: service.attachment_pools.<pool> is what attachment_function_pool_funcs(<pool>) answers, and service.attachment_pools.<pool>.<name> a ServiceRemoteAttachmentFunction. The pool declarations are attachment_function_pools().
- close() None¶
Close the connection; the service at the other end keeps running.
- static connect(host: str, service: str, definitions: Definitions) ServiceRemote¶
Return a ServiceRemote connected to host on service.
definitions is extended in place with the service’s own, so an empty Definitions() is enough: after the call it holds the types the service’s functions take. service is the port the server listens on, a number or a service name as a string; there is no default, the host that runs the service chooses it.
- static connect_local(socket_path: str, definitions: Definitions) ServiceRemote¶
Return a ServiceRemote connected to socket_path, typed by definitions.
definitions is extended in place with the service’s own, as connect does.
- definitions() DefinitionsConst¶
Return the Definitions the service and this client agree on.
- function_pool_funcs(pool_id_or_name: ValueUUId | str) ServiceRemoteFunctionPoolFunctions | None¶
Return the callable functions of a pool, or None.
The pool is the one pool_id_or_name names; None means the service serves no such pool.
pool_id_or_name is a uuid or a name.
- function_pools() list[ServiceRemoteFunctionPool]¶
Return the list of ServiceRemoteFunctionPool.
- is_closed() bool¶
Return True once the connection is closed.
- peername() str¶
Return the address of the service at the other end.
- pools ServiceRemoteFunctionPools¶
The callable functions, grouped by pool: service.pools.<pool> is the ServiceRemoteFunctionPoolFunctions that function_pool_funcs(<pool>) answers, and service.pools.<pool>.<name> a ServiceRemoteFunction. The pool declarations are function_pools().
- sockname() str¶
Return the address of this end of the connection.
- to_dsm_definitions() DSMDefinitions¶
Return the DSMDefinitions of the service.