1998Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] Persistant storage.... My current idea. -->
<!--X-From-R13: Pra Uerrne <terrneNploreuvtujnl.arg> -->
<!--X-Date: Fri, 03 Apr 1998 09:11:37 +0000 -->
<!--X-Message-Id: Pine.LNX.3.96.980402214938.282A&#45;100000#shamen,cyberhighway.net -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 199804012258.OAA103164#under,engr.sgi.com -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev] Persistant storage.... My current idea.</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:greear#cyberhighway,net">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00008.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00010.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00007.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00010.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00009">Author</A>
&nbsp;|&nbsp;<A HREF="#00009">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00009">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] Persistant storage.... My current idea.</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A></LI>
<LI><em>Subject</em>: Re: [MUD-Dev] Persistant storage.... My current idea. </LI>
<LI><em>From</em>: Ben Greear &lt;<A HREF="mailto:greear#cyberhighway,net">greear#cyberhighway,net</A>&gt;</LI>
<LI><em>Date</em>: Thu, 2 Apr 1998 22:01:56 -0700 (MST)</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
On Wed, 1 Apr 1998, J C Lawrence wrote:

&gt; A very simple cheat which performs very nicely is to do something as
&gt; follows:
&gt; 
&gt;   Every record in the DB is identified by a unique record # of a
&gt; signed integer type.
&gt; 
&gt;   The DB consists of two files, the database itself, and an index.
&gt; 
&gt;   The index file is an array of the following structures:
&gt; 
&gt;     struct {
&gt;       off_t record_pos;   // Offset of the record in the DB
&gt;       size_t record_len;  // Length of the record in the DB
&gt;     }

I still see no reason to store the index on disk.  It just means another
write everytime I modify the DB significantly.  My hash table will be
exactly that however, just stored in RAM instead of disk.

&gt; 
&gt;   The N'th structure in the index file, located by seeking to an
&gt; offset of (N *sizeof (struct)) and then reading sizeof (struct) bytes, 
&gt; holds the data for the record in the DB with a record number of N.

The object id numbers will not be synchronus, indeed, they will vary
wildly as the high bits will be the server id, and the low bits will be
the object id on that server.  I'll probably use longs or two integers,
eight bytes at any rate.

&gt; 
&gt;   Seeking to offset record_pos in the DB file and reading record_len
&gt; bytes will get you the wrapped contents of that record.
&gt; 
&gt;   The DB file is an amorphous binary blob of no particular pattern.
&gt; It contains records of variable length which follow a particular
&gt; pattern:

I'm using java, I think my "JstoreHeader" will be something like this:


long prev_obj_seek_posn;
long next_obj_seek_posn;
String cur_obj_class_name; //ie, get this class, it will know how to
                           //read itself.
int max_length; //of this object's allocated file space
int cur_length; // how much it's using now...although this might not
                // be too useful.
Not sure whether or not I'll try to wrap the contents in the header, at
least explicitly.  Don't think so because at boot time, I'll just read
all headers to make the hash table, skip (seek) right over the data
portions.

&gt;   There is reason behind the signatures and the like.  Look at tdbm
&gt; and YOODA for working models.  The base reason here is so that the
&gt; index file can be reconstructed from the DB file, and so that gross
&gt; format corruption can be detected.

Yes, this is highly desireable and I will definately have it.

&gt; 
&gt;   New records are added into either the first free space in the DB
&gt; file that is large enough to hold them, or some "best fit" equivalent.
&gt; As old records are deleted this opens "spaces" that new records (with
&gt; potentially very different record numbers) will be inserted into.
&gt; Order has no importance in the DB file -- that is what the index file
&gt; is for.  

I'm just going to put them on the end.  I'd wrather waste disk space
than take the time to be clever.  Besides, as the objects' images on
the disk will change, I'll need some room to grow and shrink w/out
affecting the neighbors.

&gt; I now have a dedicated 'net connection at home.  In celebration I'm
&gt; moving the list to Petidomo (see www.petidomo.com), and adding
&gt; searchable web archives of past list traffic (yes, email addresses
&gt; will be munged), and a backing FTP site.  This transfer was supposed
&gt; to be happening today.  It didn't and it won't, not today.  Sorry.
&gt; RSN.

Damn, I'm jeleous...gotta give Cox and US west a swift kick in the
arse..saw 2 MBS connection (wireless T1) for $360 a month..but it would
have to make money to be attractive to me....  Just wait for DSL or
the cable modems..whichever get here first :)

Ben Greear (greear#cyberhighway,net)  <A  HREF="http://www.primenet.com/~greear">http://www.primenet.com/~greear</A> 
Author of ScryMUD:  mud.primenet.com 4444
<A  HREF="http://www.primenet.com/~greear/ScryMUD/scry.html">http://www.primenet.com/~greear/ScryMUD/scry.html</A>




</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="00010" HREF="msg00010.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></strong>
<ul compact><li><em>From:</em> J C Lawrence &lt;claw#under,engr.sgi.com&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00007" HREF="msg00007.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></STRONG>
<UL><LI><EM>From:</EM> J C Lawrence &lt;claw#under,engr.sgi.com&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00008.html">Monthly FAQ Posting</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00010.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00007.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00010.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00009"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00009"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>[MUD-Dev] Re: MUD Development Digest</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<ul compact>
<LI><strong><A NAME="00360" HREF="msg00360.html">[MUD-Dev] Re: MUD Development Digest</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Thu 23 Apr 1998, 05:58 GMT
</LI>
</ul>
</ul>
</ul>
</LI>
<LI><strong><A NAME="00014" HREF="msg00014.html">OT: This is a test of a system config change.</A></strong>, 
coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Sat 04 Apr 1998, 05:40 GMT
<LI><strong><A NAME="00008" HREF="msg00008.html">Monthly FAQ Posting</A></strong>, 
Ling <a href="mailto:K.L.Lo-94#student,lboro.ac.uk">K.L.Lo-94#student,lboro.ac.uk</a>, Thu 02 Apr 1998, 14:27 GMT
<LI><strong><A NAME="00007" HREF="msg00007.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Wed 01 Apr 1998, 22:58 GMT
<UL>
<LI><strong><A NAME="00009" HREF="msg00009.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Fri 03 Apr 1998, 09:11 GMT
<UL>
<LI><strong><A NAME="00010" HREF="msg00010.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Fri 03 Apr 1998, 17:57 GMT
<UL>
<LI><strong><A NAME="00013" HREF="msg00013.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Sat 04 Apr 1998, 01:32 GMT
<UL>
<LI><strong><A NAME="00049" HREF="msg00049.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Tue 07 Apr 1998, 16:56 GMT
<UL>
<LI><strong><A NAME="00063" HREF="msg00063.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Wed 08 Apr 1998, 00:50 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>