CosNaming_NamingContext(3)

πŸ“¦
version 5.2.2 Β· 2 versions
, in fedora 43, fedora 44

πŸ’– CosNaming_NamingContext πŸ’–

okay bestie, welcome to CosNaming_NamingContext β€” that's the Erlang module definition page, manual section 3, and she is the blueprint for naming contexts. ✨


🌸 NAME 🌸

CosNaming_NamingContext β€” this interface is the one that supports all the different bind and access functions for names in a context. that's it, that's her whole job. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so like. this is the object that defines name scopes, right? and names have to be unique within a naming context. no dupes, periodt. but here's the thing β€” objects can have multiple names, and they can live in multiple naming contexts. and a naming context can itself be named in other contexts, and yes, cycles are permitted. it's giving nested friend groups, honestly. πŸ”₯

the type NameComponent used below is defined as:

-record('CosNaming_NameComponent', {id, kind=""}).

where id and kind are strings. πŸ“

the type Binding used below is defined as:

-record('CosNaming_Binding', {binding_name, binding_type}).

where binding_name is a Name and binding_type is an enum which has the values nobject and ncontext. πŸ‘‘

both of these records live in the file CosNaming.hrl and you include it with:

-include_lib("orber/COSS/CosNaming/CosNaming.hrl").

and now, the ✨exceptions✨ β€” there are a number of them that can be returned from functions in this interface. buckle up:

  • NotFound is defined as
-record('CosNaming_NamingContext_NotFound',
        {rest_of_name, why}).
  • CannotProceed is defined as
-record('CosNaming_NamingContext_CannotProceed',
        {rest_of_name, cxt}).
  • InvalidName is defined as
-record('CosNaming_NamingContext_InvalidName', {}).
  • NotFound is defined as
-record('CosNaming_NamingContext_NotFound', {}).
  • AlreadyBound is defined as
-record('CosNaming_NamingContext_AlreadyBound', {}).
  • NotEmpty is defined as
-record('CosNaming_NamingContext_NotEmpty', {}).
ok so yes, NotFound shows up twice in that list. that's what the original says, so that's what we're saying. no editing the lore. πŸ™ˆ

these exceptions are defined in the file CosNaming_NamingContext.hrl and you include it with:

-include_lib("orber/COSS/CosNaming/CosNaming_NamingContext.hrl").

πŸŽ€ EXPORTS πŸŽ€

bind(NamingContext, Name, Object) -> Return

Types:

NameContext = #objref
Name = [NameComponent]
Object = #objref
Return = ok

creates a binding of a name and an object in the naming context. but listen β€” naming contexts that are bound using bind() do not participate in name resolution. so like, keep that in mind, bestie. πŸ’œ


rebind(NamingContext, Name, Object) -> Return

Types:

NamingContext = #objref
Name = [NameComponent]
Object = #objref
Return = ok

creates a binding of a name and an object in the naming context even if the name is already bound. it just. doesn't care. icon behaviour honestly. and same deal as bind(): naming contexts bound using rebind() do not participate in name resolution. πŸ’…


bind_context(NamingContext1, Name, NamingContex2) -> Return

Types:

NamingContext1 = NamingContext2 =#objref
Name = [NameComponent]
Return = ok

the bind_context function creates a binding of a name and a naming context in the current context. and unlike the previous two?? naming contexts that are bound using bind_context() do participate in name resolution. slay. πŸ”₯


rebind_context(NamingContext1, Name, NamingContex2) -> Return

Types:

NamingContext1 = NamingContext2 =#objref
Name = [NameComponent]
Return = ok

the rebind_context function creates a binding of a name and a naming context in the current context even if the name already is bound. overachiever energy. and yes, naming contexts bound using rebind_context() participate in name resolution too. ✨


resolve(NamingContext, Name) -> Return

Types:

NamingContext = #objref
Name = [NameComponent]
Return = Object
Object = #objref

the resolve function is the way to retrieve an object bound to a name in the naming context. the given name must match the bound name exactly β€” no vibes-based matching, sorry. 😭 and the type of the object is not returned, so clients are responsible for narrowing the object to the correct type. that part's on you, bestie. 🫢


unbind(NamingContext, Name) -> Return

Types:

NamingContext = #objref
Name = [NameComponent]
Return = ok

the unbind operation removes a name binding from the naming context. bye bye binding. πŸ‘‹


new_context(NamingContext) -> Return

Types:

NamingContext = #objref
Return = #objref

the new_context operation creates a new naming context. fresh out the box. 🌈


bind_new_context(NamingContext, Name) -> Return

Types:

NamingContext = #objref
Name = [NameComponent]
Return = #objref

the new_context operation creates a new naming context and binds it to Name in the current context. two birds, one adorable function. πŸ¦‹


destroy(NamingContext) -> Return

Types:

NamingContext = #objref
Return = ok

the destroy operation disposes the NamingContext object and removes it from the name server.

⚠️ the context must be empty β€” like, it must not contain any bindings β€” to be removed. do not try it on a full context, it's not gonna go well. πŸ’€

list(NamingContext, HowMany) -> Return

Types:

NamingContext = #objref
HowMany = int()
Return = {ok, BindingList, BindingIterator}
BindingList = [Binding]
BindingIterator = #objref

the list operation returns a BindingList with a number of bindings up-to HowMany from the context. it also returns a BindinIterator which can be used to step through the list. and if the total number of existing bindings is less than, or equal to, the HowMany parameter, a NIL object reference is returned. πŸ‘

Note: one must destroy the BindingIterator, unless it is a NIL object reference, by using 'BindingIterator':destroy(). otherwise one can get dangling objects. seriously. dangling objects are not the vibe. 😭

and that's the whole page, bestie, you ate it. πŸ’… this icon was brought to you by Ericsson AB, version orber 5.2.2, and this very manual page CosNaming_NamingContext(3) β€” go forth and bind responsibly. πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from