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:
root: .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> root:
The above system has no user accounts, consisting almost entirely of system libraries:
:xyzzy
in MUF
notation.
/
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.
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
root: .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:
root: 0 -> symbols .db["MUF"] foreachHidden key do{ key symbol? if ++ symbols fi } "symbols=" , symbols , "\n" , symbols=1638 root:
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:
root: [ "mydb" | rootMakeDb ]pop ( Create a db 'mydb' ) root: [ "mypkg" .db["mydb"] | ]inPackage ( Create a package inside mydb ) mypkg: 13 1300 makeVector --> myvec ( Create a 1300-slot vector in mypkg ) mypkg: "root" inPackage ( Return to home package ) root: [ .db["mydb"] | rootExportDb ]pop ( Write 'mydb' contents to a host .db file ) root: [ .db["mydb"] | rootRemoveDb ]pop ( Remove 'mydb' db from main server .muq file ) root: [ "mydb" | rootImportDb ]pop ( Read .db hostfile in, recreating 'mydb'. ) root: mypkg::myvec[0] ( Verify 'myvec' exists in 'mypkg' in 'mydb'. ) root: 13
Go to the first, previous, next, last section, table of contents.