changelog shortlog tags branches changeset file revisions annotate raw help

Mercurial > hg > ventivac / module/venti.m

revision 127: 7f377ffc9ad3
parent 118: bd3834e3d91a
     1.1--- a/module/venti.m	Mon Aug 20 13:08:21 2007 +0200
     1.2+++ b/module/venti.m	Mon Aug 20 13:51:43 2007 +0200
     1.3@@ -69,12 +69,18 @@
     1.4 	Entrydepthshift: con 2;				# shift for pointer depth
     1.5 	Entrydepthmask: con (16r7<<2);		# mask for pointer depth
     1.6 	Entrylocal: con (1<<5);				# used for local storage: should not be set for venti blocks
     1.7+	Entryvarblocks:	con (1<<7);		# variable block size, e.g. for rabin fingerprinting
     1.8 
     1.9 	Maxlumpsize:	con 56 * 1024;
    1.10 	Pointerdepth:	con 7;
    1.11 	Entrysize:		con 40;
    1.12 	Rootsize:		con 300;
    1.13 	Rootversion:	con 2;
    1.14+	Rootversionvar: con 3;
    1.15+
    1.16+	Pointervarmask: con (1<<4);
    1.17+
    1.18+	Dsize:	con 8*1024;
    1.19 
    1.20 	Maxfilesize:	con (big 1 << 48) - big 1;
    1.21 
    1.22@@ -124,7 +130,11 @@
    1.23 		rtype:	string;
    1.24 		score:	Venti->Score;		# to a Dir block
    1.25 		blocksize:	int;				# maximum block size
    1.26-		prev:		Venti->Score;		# last root block
    1.27+		prev:		ref Venti->Score;		# last root block
    1.28+
    1.29+		new:	fn(name, rtype: string, score: Venti->Score, blocksize: int, prev: ref Venti->Score): ref Root;
    1.30+		unpack:	fn(d: array of byte): ref Root;
    1.31+		pack:	fn(r: self ref Root): array of byte;
    1.32 	};
    1.33 
    1.34 	Entry: adt {
    1.35@@ -135,7 +145,12 @@
    1.36 		flags:	int;
    1.37 		size:		big;		# (XXX should be unsigned)
    1.38 		score:	Venti->Score;
    1.39+
    1.40+		new:	fn(psize, dsize, flags: int, size: big, score: Venti->Score): ref Entry;
    1.41+		pack:	fn(e: self ref Entry): array of byte;
    1.42+		unpack:	fn(d: array of byte): ref Entry;
    1.43 	};
    1.44+
    1.45 	Score: adt {
    1.46 		a: array of byte;
    1.47 		eq:		fn(a: self Score, b: Score): int;
    1.48@@ -143,6 +158,7 @@
    1.49 		parse:	fn(s: string): (int, Score);
    1.50 		zero:		fn(): Score;
    1.51 	};
    1.52+
    1.53 	Session: adt {
    1.54 		fd:		ref Sys->FD;
    1.55 		version:	string;
    1.56@@ -153,5 +169,6 @@
    1.57 		sync:	fn(s: self ref Session): int;
    1.58 		rpc:		fn(s: self ref Session, m: ref Vmsg): (ref Vmsg, string);
    1.59 	};
    1.60+
    1.61 	init:	fn();
    1.62 };