class Memo::Namespaces

Overview

Registry of Memo::Service instances keyed by namespace (ns).

Each ns has its own database, embedding service, and USearch index — providing true isolation between projects sharing one memo-arcana process.

Namespaces can be opened explicitly via #open or listed in a config file for preloading at boot. Once opened, services are cached in memory until explicitly closed (or the process exits).

Defined in:

arcana/namespaces.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def close(ns : String) : Bool #

Close and remove a namespace.


[View source]
def close_all #

Close all open services (called on shutdown).


[View source]
def configs : Hash(String, Config) #

[View source]
def get(ns : String) : Memo::Service #

Get the Memo::Service for a namespace, opening it lazily if needed. Raises if the namespace isn't registered.


[View source]
def list : Array(Tuple(String, Bool)) #

List all registered namespaces with their open status.


[View source]
def load_config(path : String) #

Load namespace configs from a YAML-ish config file.

Format (very simple, one block per namespace):

namespaces: - ns: wow db: postgres://wow:wow@localhost/wow_dev service: openai preload: true - ns: notes db: /var/lib/memo/notes.db service: mock


[View source]
def open(config : Config) : Memo::Service #

Register and immediately open a namespace. Returns the Service.


[View source]
def preload_all #

Preload all namespaces marked with preload: true in their config.


[View source]
def register(config : Config) #

Register a namespace config (without opening).


[View source]
def services : Hash(String, Memo::Service) #

[View source]