38 "Namespace name exceeds the length limit"
50 auto namespaces = atomic_load_explicit(&engine->namespaces, memory_order_acquire);
51 auto ns_ptr = srn_context_find_namespace(parent_ctx, (
const char *)name->
buffer);
53 if (ns_ptr !=
nullptr) {
65 namespaces = atomic_load_explicit(&engine->namespaces, memory_order_relaxed);
66 ns = hmap_lookup(namespaces, &k, nullptr);
69 ns = ALLOC_OR_PANIC(parent_ctx, srn_namespace_t);
70 ns->name = srn_string_copy(parent_ctx, name);
71 ns->id = srn_allocate_object_id(engine);
72 ns->root_context = srn_context_make(engine);
79 hmap_t *sym_table = ALLOC_OR_PANIC(ns->root_context, hmap_t);
80 *sym_table = hmap_empty(ns->root_context);
81 atomic_init(&ns->sym_table, sym_table);
85 ns->sym_table_lock = ALLOC_OR_PANIC(ns->root_context, srn_fiber_mutex_t);
86 srn_fiber_mutex_init(ns->sym_table_lock);
91 hmap_t *next = ALLOC_OR_PANIC(parent_ctx, hmap_t);
92 *next = hmap_insert(namespaces, &k, ns);
94 atomic_store_explicit(&engine->namespaces, next, memory_order_release);
srn_namespace_t * srn_namespace_load(srn_namespace_t *ns)
Load the namespace's source from the filesystem into src_buffer, parse it, and populate the symbol ta...
srn_namespace_t * srn_namespace_get_or_create(srn_engine_t *engine, srn_string_t *name, srn_error_t **err)
Create a new and empty namespace if it is not already created in the engine, if it exists,...