From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Mon, 26 Apr 1999 08:40:02 -0500 From: G. David Butler gdb@dbSystems.com Subject: [9fans] rsynth, yes enjoyed much Topicbox-Message-UUID: 957f2798-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19990426134002.a-a1tJ5j-2u_eFFM06znuqdVzmSgHIiLroR_3R9CZzI@z> >>perhaps you could >>convert libgdbm to use libc directly. > >Yes, however, I'm now begin to doubt it's worth for Plan 9. >Plan 9 has not any dbm utility other than ndb related, which >suggets it doesn't important to the system, doesn't it? Remember that the file servers are accessed by many terminals and cpu servers and you *must* support multiple users in any access method. With dbm type routines the system will need file locking, etc. Looking at a 9P data store, there is no reason why you can't store data using names as keys. The key access looks like a hash mechanism (an open/read of a directory has no particular order). /* create the data store */ Tcreate tag topdirfid name_table CHDIR|0777 0 Rcreate tag fid qid Tclunk tag fid Rclunk tag fid Twalk tag topdirfid name_table Rwalk tag dirfid qid /* for each name */ Tcreate tag dirfid name 0666 1 Rcreate tag fid qid Twrite tag fid offset length pad data Rwrite tag fid length Tclunk tag fid Rclunk tag fid ... /* done */ Tclunk tag dirfid Rclunk tag dirfid To access the data for a key: Twalk tag topdirfid name_table Rwalk tag dirfid qid /*for each name*/ Twalk tag dirfid name Rwalk tag fid qid Topen tag fid 0 Ropen tag fid qid Tread tag fid offset length Rread tag fid length pad data Tclunk tag fid Rclunk tag fid ... /* done */ Tclunk tag dirfid Rclunk tag dirfid Since 9P is native in the entire system, it seems the most natural way of handling data. Performance requirements, of course, are handled in the implementation. David Butler gdb@dbSystems.com