Go to the first, previous, next, last section, table of contents.

db pragmatics

Each db is named internally by a 21-bit number: Internally within server, every 64-bit logical pointer references an object includes this number.

For human consumption, these numbers are usually encoded as four-letter names, such as "joe" or "LISP". By a convention supported by the Muq server, uppercase names are used for standard system libraries, and lowercase names are used for local users and libraries: By respecting this convention on your system, you minimize chances of incompatibilities between your local server state and future standard libraries which may become available.

The set of databases installed in a given server may be listed out from the MUF commandline:

.db ls
"ANSI"	#<Db ANSI 3b6580000001c15>
"DBUG"	#<Db DBUG 9dbe00000001c15>
"DICT"	#<Db DICT a6c900000001c15>
"DIFI"	#<Db DIFI a6ec00000001c15>
"GEST"	#<Db GEST 1154380000001c15>
"KEYW"	#<Db KEYW 1af5c00000001c15>
"LISP"	#<Db LISP 1db2b00000001c15>
"LNED"	#<Db LNED 1e18680000001c15>
"MUC"	#<Db MUC 211d280000001c15>
"MUF"	#<Db MUF 211fb00000001c15>
"MUFV"	#<Db MUFV 2120600000001c15>
"OMSH"	#<Db OMSH 2542d80000001c15>
"OMUD"	#<Db OMUD 2544680000001c15>
"PUB"	#<Db PUB 2851980000001c15>
"QNET"	#<Db QNET 2a1c600000001c15>
"QNETA"	#<Db QNETA 6afbe80000001c15>
"RMUD"	#<Db RMUD 2c79b00000001c15>
"ROOTDB"	#<Db ROOTDB 3d15>
"TASK"	#<Db TASK 3035080000001c15>
"TLNT"	#<Db TLNT 312bb00000001c15>
"muqn"	#<Db muqn a129680000001c15>

The above system has no user accounts, consisting almost entirely of system libraries:

  1. ANSI A small experimental library of ansi-terminal cursor positioning (&tc) functions.
  2. DBUG The Muq debugger.
  3. DICT Lists of words 1024 long, used by Muq password routines.
  4. DIFI Constants and functions for the Diffie-Hellman public key support code.
  5. GEST Db used to hold known users on other systems -- "guests".
  6. KEYW Db used to hold system keywords -- :xyzzy in MUF notation.
  7. LISP Db used to hold the lisp compiler and runtimes.
  8. LNED Db used to hold a small experimental line editor.
  9. MUC Db used to hold the Multi-User C compiler, shell and runtimes.
  10. MUF Db used to hold the Multi-User Forth compilers, shells and runtimes -- this holds the bulk of the core Muq support softcode.
  11. MUFV Db intended to hold all the variables needed by the MUF db, so that the MUF can be read-only. There are probably still variables in the MUF db.
  12. OMSH Db holding the Micronesia "oldmud" user shell code.
  13. OMUD Db holding the Micronesia "oldmud" worldkit code.
  14. PUB I forget!
  15. QNET Db holding the Muqnet transparent networking support code.
  16. QNETA Db intended to hold the mutable data for the Muqnet db, so as to allow QNET to eventually be read-only.
  17. RMUD Db parts of the "oldmud" worldkit which need to be root privileged. In principle, the other oldmud libraries should be installable owned by an unprivileged account, although this is not yet done and probably not yet possible in practice.
  18. ROOTDB This is the root db for the server, corresponding to the root partition / on a unix filesystem: It is deliberately given a six-letter name (otherwise impossible) to emphasize its specialness. (The actual decimal db number is zero.) Since it is risky to modify this db, and impossible to dismount it, it should be kept simple, stable and small.
  19. TASK This db contains the "task" support logic used by the Micronesia worldkit to handle Muqnet callback archiving and invocation.
  20. TLNT This db contains the TELNET protocol support code and data, used to support user telnet logins.

Here is an occasionally useful facility: The 'private' propdir on db objects lists all existing objects in that db. This means that you may do

.db["MUF"] lsh

to list absolutely everything in the MUF db -- every string, every object, every vector, every bignum, every b-tree block, everything.

This is usually not a good idea!

But writing loops similar to that used by lsh can be a useful way of gathering statistics on space consumption:

0 -> symbols   .db["MUF"] foreachHidden key do{ key symbol? if ++ symbols fi }   "symbols=" , symbols , "\n" ,

Here is a simple example of creating a new db, creating a package inside it, creating a value in that package, exporting the db as a Muq .db file, removing the db from the server, and then importing the .db file back into the server to recreate the db and its contents:

[ "mydb" | rootMakeDb ]pop            ( Create a db 'mydb' )
[ "mypkg" .db["mydb"] | ]inPackage    ( Create a package inside mydb )
13 1300 makeVector --> myvec          ( Create a 1300-slot vector in mypkg )
"root" inPackage                      ( Return to home package )
[ .db["mydb"] | rootExportDb ]pop     ( Write 'mydb' contents to a host .db file )
[ .db["mydb"] | rootRemoveDb ]pop     ( Remove 'mydb' db from main server .muq file )
[ "mydb"      | rootImportDb ]pop     ( Read .db hostfile in, recreating 'mydb'. )
mypkg::myvec[0]                       ( Verify 'myvec' exists in 'mypkg' in 'mydb'. )
root: 13

Go to the first, previous, next, last section, table of contents.