changelog shortlog tags branches changeset file revisions annotate raw help

Mercurial > hg > ventivac / module/vac.m

revision 127: 7f377ffc9ad3
parent 126: 07b5d02499fd
child 134: d600dd4ae0a1
     1.1--- a/module/vac.m	Mon Aug 20 13:08:21 2007 +0200
     1.2+++ b/module/vac.m	Mon Aug 20 13:51:43 2007 +0200
     1.3@@ -24,23 +24,9 @@
     1.4 	Modedev,
     1.5 	Modenamedpipe: con 1<<(9+iota);
     1.6 
     1.7-	Entrysize:	con 40;
     1.8-	Rootsize:	con 300;
     1.9 	Metablocksize:	con 12;
    1.10 	Metaentrysize:	con 4;
    1.11 
    1.12-	Rootversionvar:	con 3;	# xxx move to venti.m
    1.13-	Pointervarmask:	con (1<<4);	# xxx move to venti.m
    1.14-
    1.15-	Dsize:	con 8*1024;
    1.16-
    1.17-	Entryactive:	con (1<<0);	# entry is in use
    1.18-	Entrydir:	con (1<<1);	# a directory
    1.19-	Entrydepthshift:	con 2;	# shift for pointer depth
    1.20-	Entrydepthmask:	con (16r7<<2);	# mask for pointer depth
    1.21-	Entrylocal:	con (1<<5);	# used for local storage: should not be set for venti blocks
    1.22-	Entryvarblocks:	con (1<<7);	# variable block size, e.g. for rabin fingerprinting
    1.23-
    1.24 	Direntrymagic:	con 16r1c4d9072;
    1.25 	Metablockmagic:	con 16r5656fc79;
    1.26 
    1.27@@ -51,33 +37,6 @@
    1.28 	Rabinblockmin:	con 1024;
    1.29 	Rabinblockmax:	con 32*1024;
    1.30 
    1.31-	Root: adt {
    1.32-		version:	int;
    1.33-		name:	string;
    1.34-		rtype:	string;
    1.35-		score:	Venti->Score;		# to a Dir block
    1.36-		blocksize:	int;				# maximum block size
    1.37-		prev:		ref Venti->Score;		# last root block
    1.38-
    1.39-		new:	fn(name, rtype: string, score: Venti->Score, blocksize: int, prev: ref Venti->Score): ref Root;
    1.40-		unpack:	fn(d: array of byte): ref Root;
    1.41-		pack:	fn(r: self ref Root): array of byte;
    1.42-	};
    1.43-
    1.44-	Entry: adt {
    1.45-		gen:		int;		# generation number (XXX should be unsigned)
    1.46-		psize:	int;		# pointer block size
    1.47-		dsize:	int;		# data block size
    1.48-		depth:	int;		# unpacked from flags
    1.49-		flags:	int;
    1.50-		size:		big;		# (XXX should be unsigned)
    1.51-		score:	Venti->Score;
    1.52-
    1.53-		new:	fn(psize, dsize, flags: int, size: big, score: Venti->Score): ref Entry;
    1.54-		pack:	fn(e: self ref Entry): array of byte;
    1.55-		unpack:	fn(d: array of byte): ref Entry;
    1.56-	};
    1.57-
    1.58 	Direntry: adt {
    1.59 		version:	int;
    1.60 		elem:	string;
    1.61@@ -133,8 +92,8 @@
    1.62 
    1.63 		new:	fn(s: ref Venti->Session, dtype, dsize, varblocks: int): ref File;
    1.64 		write:	fn(f: self ref File, d: array of byte): int;
    1.65-		finish:	fn(f: self ref File): ref Entry;
    1.66-		mkstate:	fn(session: ref Venti->Session, e: ref Entry, varblocks: int): ref File;
    1.67+		finish:	fn(f: self ref File): ref Venti->Entry;
    1.68+		mkstate:	fn(session: ref Venti->Session, e: ref Venti->Entry, varblocks: int): ref File;
    1.69 	};
    1.70 
    1.71 	# for writing venti directories (entries)
    1.72@@ -144,8 +103,8 @@
    1.73 		nd, ne:	int;
    1.74 
    1.75 		new:	fn(s: ref Venti->Session, dsize: int): ref Sink;
    1.76-		add:	fn(m: self ref Sink, e: ref Entry): int;
    1.77-		finish:	fn(m: self ref Sink): ref Entry;
    1.78+		add:	fn(m: self ref Sink, e: ref Venti->Entry): int;
    1.79+		finish:	fn(m: self ref Sink): ref Venti->Entry;
    1.80 	};
    1.81 
    1.82 	Mentry: adt {
    1.83@@ -164,15 +123,15 @@
    1.84 
    1.85 		new:	fn(s: ref Venti->Session, dsize: int): ref MSink;
    1.86 		add:	fn(m: self ref MSink, de: ref Direntry): int;
    1.87-		finish:	fn(m: self ref MSink): ref Entry;
    1.88+		finish:	fn(m: self ref MSink): ref Venti->Entry;
    1.89 	};
    1.90 
    1.91 	# for reading pages from a hash tree referenced by an entry
    1.92 	Source: adt {
    1.93 		session:	ref Venti->Session;
    1.94-		e:	ref Entry;
    1.95+		e:	ref Venti->Entry;
    1.96 
    1.97-		new:	fn(s: ref Venti->Session, e: ref Entry): ref Source;
    1.98+		new:	fn(s: ref Venti->Session, e: ref Venti->Entry): ref Source;
    1.99 		get:	fn(s: self ref Source, i: big, d: array of byte): int;
   1.100 		oget:	fn(s: self ref Source, offset: big): array of byte;
   1.101 	};
   1.102@@ -183,7 +142,7 @@
   1.103 		o:	big;
   1.104 
   1.105 		mk:	fn(s: ref Source): ref Vacfile;
   1.106-		new:	fn(session: ref Venti->Session, e: ref Entry): ref Vacfile;
   1.107+		new:	fn(session: ref Venti->Session, e: ref Venti->Entry): ref Vacfile;
   1.108 		read:	fn(v: self ref Vacfile, d: array of byte, n: int): int;
   1.109 		seek:	fn(v: self ref Vacfile, offset: big): big;
   1.110 		pread:	fn(v: self ref Vacfile, d: array of byte, n: int, offset: big): int;
   1.111@@ -197,9 +156,9 @@
   1.112 		i:	int;
   1.113 
   1.114 		mk:	fn(vf: ref Vacfile, ms: ref Source): ref Vacdir;
   1.115-		new:	fn(session: ref Venti->Session, e, me: ref Entry): ref Vacdir;
   1.116+		new:	fn(session: ref Venti->Session, e, me: ref Venti->Entry): ref Vacdir;
   1.117 		walk:	fn(v: self ref Vacdir, elem: string): ref Direntry;
   1.118-		open:	fn(v: self ref Vacdir, de: ref Direntry): (ref Entry, ref Entry);
   1.119+		open:	fn(v: self ref Vacdir, de: ref Direntry): (ref Venti->Entry, ref Venti->Entry);
   1.120 		readdir:	fn(v: self ref Vacdir): (int, ref Direntry);
   1.121 		rewind:		fn(v: self ref Vacdir);
   1.122 	};