forsyth20121205-174063a80cc13 years agoHistory
103 lines · 2.2 KB · Text
RawDownload
.TH VENTI 2.SH NAMEVenti \- access to Venti content-addressed filestore..SH SYNOPSIS.EXinclude "venti.m";venti := load Venti Venti->PATH;Session: import venti; init:			fn(); Session: adt {	new:		fn(fd: ref Sys->FD): ref Session;	read:		fn(s: self ref Session, score: Venti->Score, etype: int, maxn: int): array of byte;	write:	fn(s: self ref Session, etype: int, buf: array of byte): (int, Venti->Score);	sync:	fn(s: self ref Session): int;}; Score: adt {	a: array of byte;	eq:		fn(a: self Score, b: Score): int;	text:		fn(a: self Score): string;	parse:	fn(s: string): (int, Score);	zero:		fn(): Score;}; .EE.SH DESCRIPTION.I Ventiis a block storage server intended for archival applications.The.I Ventimodule provides low-level access to a Venti server.The module assumes that the physical connectionto the server has already been established(for example, by.IR dial (2)).On a Venti server, a block is addressed by the SHA1 hash ofthe contents of that block, known as a.IR score ,and represented as a.B Scoreadt.Blocks are additionally tagged with a.IR type ,facilitating recovery in the event of corruption.A.B Sessionrepresents a session with a Venti server..TP.IB s .new(\fIfd\fP).B Newperforms the initial handshake with the Venti server,returning established.BR Session ..TP.IB s .read(\fIscore\fP,\ \fIetype\fP,\ \fImaxn\fP).B Readtries to retrieve the blockcorresponding to.IR score ,and of type.IR etype .The block must be no longer than.I maxnbytes..I Etypeis conventionally one of the constants.BR Roottype ,.BR Dirtype ,.BR Datatypeor.BR Pointertype [0-9],where the different.BR Pointertype srepresent different depth levels within a Venti tree..TP.IB s .write(\fIetype\fP,\ \fIbuf\fP).B Writewrites the data in.I bufto the Venti server.The block will be tagged with type.IR etype .It returns a tuple, say.RI ( ok ,\  score );on error,.I okis -1, otherwise.I okis 0 and.I scorecontains the Venti score for the block that has been written..TP.IB s .sync().B Synctells the Venti server to make sure that all data is committed toactive storage..SH SOURCE.B /module/venti.m.br.B /appl/lib/venti.b.SH BUGS