HGRC Quarry Fossil Service
Simple tools for lasting software

Infrastructure as a Service / Nemoptera

A solid foundation to fork, tweak, and enhance.

Public | Owner: Infrastructure as a Service | Default branch: trunk | Last update: 2026-11-08 15:56

Artifact ab07723fc36ac25c1c6e30ae0fb2ec3ceab23451d813eec6c0ddac288bd9dde1:


(defmodule nemoptera_registry
  (behaviour gen_server)
  (export all))

(defun table () 'nemoptera_registry_table)

(defun start_link ()
  (gen_server:start_link #(local nemoptera_registry) 'nemoptera_registry 'none '()))

(defun init (_)
  (case (ets:info (table))
    ('undefined (ets:new (table) '(named_table public set)))
    (_ 'ok))
  `#(ok ok))

(defun put (org-name slug port)
  (ets:insert (table) (tuple (key org-name slug) port)))

(defun lookup (org-name slug)
  (case (ets:info (table))
    ('undefined 'undefined)
    (_
     (case (ets:lookup (table) (key org-name slug))
       (`(#(,_ ,port)) `#(ok ,port))
       (_ 'undefined)))))

(defun delete (org-name slug)
  (case (ets:info (table))
    ('undefined 'ok)
    (_ (ets:delete (table) (key org-name slug)))))

(defun key (org-name slug)
  (tuple (norm-org org-name) (nemoptera_text:to-str slug)))

(defun norm-org (org-name)
  (cond
    ((or (=:= org-name 'none) (=:= org-name 'undefined) (=:= org-name 'null)) 'none)
    ('true
     (let ((text (nemoptera_text:to-str org-name)))
       (if (=:= "" text) 'none text)))))

(defun handle_call (_message _from state) `#(reply ok ,state))
(defun handle_cast (_message state) `#(noreply ,state))
(defun handle_info (_message state) `#(noreply ,state))
(defun terminate (_reason _state) 'ok)
(defun code_change (_old state _extra) `#(ok ,state))

Clone

You can clone this repository with the following command:

fossil clone https://hgrc.dev/IaaS/Nemoptera Nemoptera.fossil

Contribute

The best way to contribute is through e-mail. See the project documentation for more details.