Skip to main content

Crate rustorb_naming

Crate rustorb_naming 

Source
Expand description

CosNaming (Naming Service): NamingContext, NamingContextExt and BindingIterator, with persistence behind a storage trait.

The client side: NamingContext, NamingContextExt and BindingIterator are stubs for the interfaces of the CosNaming IDL (Naming Service 1.3), over the ones rustorb-idl -brust generates in idl::cos_naming, with the names of rustorb_core::name. The user exceptions of the operations are the variants of NamingError. Code generated from IDL that uses CosNaming refers to idl::cos_naming (-Wbextern=CosNaming=rustorb_naming::idl::cos_naming).

The server side: NamingService serves the naming contexts on an ORB, with the root context at corbaloc::host:port/NameService like omniNames, and keeps the bindings in a Store: LogStore (an append-only log and checkpoints) by default, or MemoryStore. The rustorb-names binary is the daemon.

use rustorb_core::Orb;
use rustorb_naming::{NamingContextExt, to_name};

let mut args = vec![
    "-ORBInitRef".to_owned(),
    "NameService=corbaloc::localhost:2809/NameService".to_owned(),
];
let orb = Orb::init(&mut args)?;
let obj = orb.resolve_initial_references("NameService")?;
let root = NamingContextExt::narrow(obj)?.ok_or("not a NamingContextExt")?;
root.bind_new_context(&to_name("app")?)?;
let echo = root.resolve_str("app/Echo")?;

Names and their string form (Name, to_name, to_string) come from rustorb_core::name, which corbaname: URLs use too: Orb::string_to_object("corbaname::host:2809#app/Echo") resolves the name without this crate.

Re-exports§

pub use store::LogStore;
pub use store::MemoryStore;
pub use store::Store;

Modules§

idl
The code rustorb-idl -brust generates from the CosNaming IDL (crates/rustorb-codegen/generate-rust.sh writes src/idl/).
repository_id
Repository ids of the CosNaming interfaces and exceptions.
store
Where the naming service keeps its bindings: the Store trait, the in-memory MemoryStore and the default LogStore (an append-only log and checkpoints).

Structs§

Binding
CosNaming::Binding: one entry of a context, from list or a BindingIterator.
BindingIterator
A stub for CosNaming::BindingIterator, from NamingContext::list.
InvalidName
A stringified name is malformed, or a name has no components (CosNaming::NamingContext::InvalidName when the conversion is local).
NameComponent
CosNaming::NameComponent: one step of a Name.
NamingContext
A stub for CosNaming::NamingContext, over the one rustorb-idl -brust generates (crate::idl::cos_naming::NamingContext) with the names of rustorb_core::name and the errors of NamingError.
NamingContextExt
A stub for CosNaming::NamingContextExt: a NamingContext (which it dereferences to) that also works with stringified names and corbaname: URLs.
NamingService
A CosNaming naming service served by an ORB: the root context and the contexts created from it, with their bindings in a Store.

Enums§

BindingType
CosNaming::BindingType: what a name is bound to.
NamingError
How a naming operation failed: one of the CosNaming user exceptions, or a system exception.
NotFoundReason
CosNaming::NamingContext::NotFoundReason: why a name was not found.
StartError
Why a NamingService could not start.

Constants§

ROOT_KEY
The object key of the root context, as in corbaloc::host:2809/NameService, and its id in the store.

Functions§

to_name
Parses a stringified name, as NamingContextExt::to_name does: components are separated by /, the id and kind of a component by ., and \ escapes the next character. a.b/c\/d/.e is the name [("a", "b"), ("c/d", ""), ("", "e")]; . alone is a component with an empty id and kind.
to_string
Writes a name in the string form to_name reads, as NamingContextExt::to_string does. An empty name is invalid.
to_url
Makes a corbaname: URL from a corbaloc address list (such as :host:2809 or iiop:1.2@host) and a stringified name, escaping the name as a URL, like NamingContextExt::to_url: to_url(":host:2809", "a/b c") is corbaname::host:2809#a/b%20c.

Type Aliases§

Name
CosNaming::Name: a sequence of components, from the outermost context.