Skip to Content
Namespaces

Namespaces

Namespaces let you run multiple independent configurations and completely separated keyspaces within a single Diom cluster.

For example, you can have two cache namespaces one with 4GB capacity that’s backed by disk, and another with 1GB capacity and backed by RAM; without needing separate clusters.

Creating namespaces

A namespace has to be created before used, and each component has its own namespace API

diom.cache.namespace.configure diom.kv.namespace.configure ...

The create API is an upsert it creates the namespace if it doesn’t exist, or updates it if it does. Some properties are immutable after creation; attempting to change them returns an error.

All configuration values are optional and fall back to the default namespace’s values if unset.

Namespaces are scoped per component type. A cache namespace named payments is independent from a kv namespace named payments. Using a namespace that doesn’t exist returns an error.

Namespace identifiers starting with _ are reserved for internal use.

Using namespaces

You can set the namespace by passing the namespace property to supporting APIs. If a namespace is not passed, the default namespace is used.

Example of how to use a namespace:

diom.kv.set(key, value, { namespace: "my-namespace" })

Configuration

Each component’s namespace has component specific configuration options. For the full set of configurations, please refer to each component’s namespace.configure function.

Bootstrapping namespaces

Diom supports configuring namespaces as part of the bootstrap functionality.

For example, to configure the default cache namespace you can add the following bootstrap command:

cache namespace.configure default {...}
Namespaces are not automatically removed if you remove them from the bootstrap script; delete them explicitly if needed.

Default namespace

Every component type has a default namespace with sensible defaults. You can either create them yourself, with your own configurations, or let Diom create them for you.

Last updated on