Skip to main content

Orb

Struct Orb 

Source
pub struct Orb { /* private fields */ }
Expand description

An ORB: the client side, and the server side once the RootPOA is used.

Network I/O runs on a tokio runtime owned by the ORB, or on one the application shares with it (with_runtime); the methods here and on ObjectRef block the calling thread. They must not be called from inside a tokio runtime, the threads of spawn_blocking included (they fail with BAD_INV_ORDER): async code uses ObjectRef::request_async and run_async instead. Servants run on a pool of upcall threads owned by the ORB.

Orb is a cheap handle: clones share the same ORB, which shuts down when the last clone and the last ObjectRef are gone. Servants that hold the ORB keep it alive until shutdown or destroy drops them.

Implementations§

Source§

impl Orb

Source

pub fn init(args: &mut Vec<String>) -> Result<Orb, SystemException>

Initialises an ORB from command line arguments, removing the ORB options (see OrbOptions::parse_args).

Source

pub fn with_options(options: OrbOptions) -> Result<Orb, SystemException>

Initialises an ORB with options. Fails with the exception of an OrbInitializer that failed.

Source

pub fn with_runtime(options: OrbOptions, handle: Handle) -> Orb

Initialises an ORB with options whose network I/O runs on the application’s runtime handle instead of a runtime of its own (OrbOptions::io_threads is not used). The runtime must have I/O and time enabled. A current_thread runtime does I/O only while a thread runs its block_on, so blocking calls (from servants, say) wait until one does; a multi-thread runtime has no such limit.

Shutting the ORB down needs the runtime to run. On a current_thread runtime, a blocking shutdown(true) or destroy outside its block_on waits for it, and inside it blocks the runtime: shut down from inside instead, with shutdown(false) and run_async, and destroy after that.

Destroy the ORB before the runtime shuts down. Destroying it closes its connections and stops its listening tasks; the runtime keeps no task of the ORB. Once the runtime is gone, calls fail with COMM_FAILURE or TRANSIENT.

When an OrbInitializer fails, the ORB is returned shut down (calls fail with BAD_INV_ORDER); use try_with_runtime to get the exception.

Source

pub fn try_with_runtime( options: OrbOptions, handle: Handle, ) -> Result<Orb, SystemException>

with_runtime, failing with the exception of an OrbInitializer that failed.

Source

pub fn pi_current(&self) -> PiCurrent

resolve_initial_references("PICurrent"): the slots of the Portable Interceptors for the calling thread.

Source

pub fn codec_factory(&self) -> CodecFactory

resolve_initial_references("CodecFactory").

Source

pub fn runtime_handle(&self) -> &Handle

The handle of the runtime the ORB’s network I/O runs on: its own, or the one given to with_runtime.

Source

pub fn options(&self) -> &OrbOptions

The options the ORB was created with.

Source

pub fn set_call_timeout(&self, timeout: Option<Duration>)

Sets how long calls through this ORB may take (None: no limit), like omniORB’s setClientCallTimeout(millisecs). The time covers connecting (unless a connect timeout is set), following forwards and waiting for the reply. When it expires the call raises TIMEOUT: completed maybe once the request was sent, and then a CancelRequest goes to the server; completed no before.

A timeout of the calling thread (set_thread_call_timeout) overrides it, one of the object reference (ObjectRef::set_call_timeout) overrides both, and one given for the request (Request::timeout) all of them.

Source

pub fn call_timeout(&self) -> Option<Duration>

Source

pub fn set_connect_timeout(&self, timeout: Option<Duration>)

Sets how long to wait for a new TCP connection, like omniORB’s setClientConnectTimeout: while connecting it replaces the call timeout. None connects until the call timeout expires, or as long as the operating system waits. Expiry raises TIMEOUT, completed no.

Source

pub fn connect_timeout(&self) -> Option<Duration>

Source

pub fn string_to_object( &self, s: &str, ) -> Result<Option<ObjectRef>, SystemException>

Turns a stringified IOR, a corbaloc: or a corbaname: URL into a reference. Returns None for a nil IOR, or a name bound to nil.

corbaloc:rir: goes through resolve_initial_references. corbaname: resolves the name after # in the naming context the rest of the URL denotes (with no name, the context itself is returned). The name must be a valid stringified name (BAD_PARAM, minor BAD_SCHEME_SPECIFIC_PART); a name the naming service cannot resolve raises BAD_PARAM with minor STRING_TO_OBJECT_OTHER, and system exceptions from the naming service are passed on.

Source

pub fn object_to_string( &self, obj: Option<&ObjectRef>, ) -> Result<String, SystemException>

Writes a reference as a stringified IOR; None gives the nil IOR.

Source

pub fn resolve_initial_references( &self, name: &str, ) -> Result<ObjectRef, ResolveError>

Looks up an initial reference: first among those registered, then in init_refs, then under default_init_ref.

Source

pub fn list_initial_services(&self) -> Vec<String>

The names resolve_initial_references knows without the default URL, sorted.

Source

pub fn register_initial_reference( &self, name: &str, obj: Option<&ObjectRef>, ) -> Result<(), ResolveError>

CORBA::ORB::register_initial_reference: makes resolve_initial_references return obj for name. InvalidName if name is empty or already an initial reference (registered or given with -ORBInitRef), BAD_PARAM (minor NIL_INITIAL_REFERENCE) for a nil obj. The names a binding resolves itself, such as RootPOA, are the binding’s to refuse.

Source

pub fn register_local_initial_reference( &self, name: &str, obj: Arc<dyn Any + Send + Sync>, ) -> Result<(), ResolveError>

register_initial_reference for an object of a binding that has no reference, such as a local object: the ORB keeps obj under name until it is destroyed, for resolve_local_initial_reference. resolve_initial_references does not resolve it.

Source

pub fn resolve_local_initial_reference( &self, name: &str, ) -> Option<Arc<dyn Any + Send + Sync>>

An object registered with register_local_initial_reference.

Source

pub fn root_poa(&self) -> Result<Poa, SystemException>

The RootPOA. The first call starts the server side: it opens the endpoints (INITIALIZE if one cannot be opened) and the upcall thread pool.

Source

pub fn register_object_key( &self, key: &str, obj: &ObjectRef, ) -> Result<ObjectRef, SystemException>

Makes obj, an object of this ORB’s POAs, answer to the simple object key key, as in corbaloc::host:port/NameService, and returns a reference with that key. Requests with the key are dispatched to obj as if they had its own key: no LOCATION_FORWARD is involved, so the reference stays valid as long as the key is registered, also across restarts that register it again.

BAD_PARAM if key is empty or obj is not an object of this ORB’s POAs.

Source

pub fn unregister_object_key(&self, key: &str)

Removes a key registered with register_object_key; requests with it then raise OBJECT_NOT_EXIST.

Source

pub fn endpoints(&self) -> Vec<(String, u16)>

The addresses the server side publishes in IORs, as host and port; empty until the RootPOA is used.

Source

pub fn tls_endpoints(&self) -> Vec<(String, u16)>

The TLS endpoints the server side publishes in IORs, as host and port; empty until the RootPOA is used.

Source

pub fn run(&self)

CORBA::ORB::run: blocks until the ORB has shut down, running the requests of MAIN_THREAD_MODEL POAs meanwhile. Other requests are processed on the upcall threads whether or not a thread runs this. Several threads may run it at once.

Source

pub fn run_timeout(&self, timeout: Option<Duration>) -> bool

run for at most timeout (None for no limit). Returns true when the ORB has shut down, false when the time ran out. For a binding that must look at its own events, such as signals, while it runs the ORB.

Source

pub async fn run_async(&self)

run for async code: resolves when the ORB has shut down. It does not run MAIN_THREAD_MODEL requests, which need run or perform_work on a thread. With shutdown(false), the way to shut the ORB down from async code and wait for it.

Source

pub fn work_pending(&self) -> Result<bool, SystemException>

CORBA::ORB::work_pending: whether a MAIN_THREAD_MODEL request waits for perform_work. BAD_INV_ORDER after shutdown.

Source

pub fn perform_work(&self) -> Result<(), SystemException>

CORBA::ORB::perform_work: runs one waiting MAIN_THREAD_MODEL request on the calling thread, if there is one, and returns without waiting otherwise. For an application’s own event loop. BAD_INV_ORDER after shutdown.

Source

pub fn shutdown(&self, wait_for_completion: bool) -> Result<(), SystemException>

CORBA::ORB::shutdown. Refuses new invocations (BAD_INV_ORDER) and new requests, drops the requests the POA managers hold, lets the running ones finish and send their replies, destroys every POA, and then closes every connection, client and server side, with CloseConnection. Invocations still waiting for a reply fail with COMM_FAILURE or TRANSIENT.

With wait_for_completion, returns when all that is done; called from a servant it fails with BAD_INV_ORDER (would deadlock). Without it, the shutdown runs on another thread and the call returns at once, so a servant can call it and still send its reply.

Source

pub fn destroy(&self) -> Result<(), SystemException>

CORBA::ORB::destroy: shutdown(true), and then ends the upcall threads. Fails like shutdown(true) when called from a servant.

Source§

impl Orb

Source

pub fn create_policy( &self, policy_type: PolicyType, value: &Any, ) -> Result<PolicyValue, PolicyError>

CORBA::ORB::create_policy: a POA policy from its enumerator, or a RelativeRoundtripTimeoutPolicy from a TimeBase::TimeT (an unsigned long long, in units of 100 nanoseconds).

PolicyError with BAD_POLICY for a type rustorb does not know, BAD_POLICY_TYPE when the any does not hold the policy’s type, and BAD_POLICY_VALUE for an enumerator out of range.

Source

pub fn set_policy_overrides( &self, policies: &[PolicyValue], set_add: SetOverrideType, ) -> Result<(), SystemException>

PolicyManager::set_policy_overrides of the ORB (the initial reference ORBPolicyManager): a RelativeRoundtripTimeoutPolicy sets call_timeout; without one (after SET_OVERRIDE) calls have no limit. A BidirectionalPolicy of BOTH makes the ORB offer and accept bidirectional GIOP, like -ORBofferBiDirectionalGIOP 1 -ORBacceptBiDirectionalGIOP 1, for the connections opened or accepted from then on (docs/bidir-giop.md). NO_PERMISSION for the other POA policies.

Source

pub fn policy_overrides(&self, types: &[PolicyType]) -> Vec<PolicyValue>

PolicyManager::get_policy_overrides of the ORB.

Trait Implementations§

Source§

impl Clone for Orb

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Orb

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Orb

Source§

impl PartialEq for Orb

Clones of one ORB are equal.

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Orb

§

impl !UnwindSafe for Orb

§

impl Forget for Orb

§

impl Freeze for Orb

§

impl Send for Orb

§

impl Sync for Orb

§

impl Unpin for Orb

§

impl UnsafeUnpin for Orb

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more