changelog shortlog tags branches changeset files revisions annotate raw help

Mercurial > hg > ventivac / man/2/venti

changeset 118: bd3834e3d91a
parent: 8aa73614be8a
child: 735de23113c5
author: Mechiel Lukkien <mechiel@ueber.net>
date: Fri, 17 Aug 2007 22:16:46 +0200
permissions: -rw-r--r--
description: remove unpackroot and unpackentry, they are in vac.m and appl/lib/vac.b (as Entry.unpack and Root.unpack).
1 .TH VENTI 2
2 .SH NAME
3 Venti \- access to Venti content-addressed filestore.
4 .SH SYNOPSIS
5 .EX
6 include "venti.m";
7 venti := load Venti Venti->PATH;
8 Session: import venti;
9 
10 init: fn();
11 
12 Session: adt {
13  new: fn(fd: ref Sys->FD): ref Session;
14  read: fn(s: self ref Session, score: Venti->Score, etype: int, maxn: int): array of byte;
15  write: fn(s: self ref Session, etype: int, buf: array of byte): (int, Venti->Score);
16  sync: fn(s: self ref Session): int;
17 };
18 
19 Score: adt {
20  a: array of byte;
21  eq: fn(a: self Score, b: Score): int;
22  text: fn(a: self Score): string;
23  parse: fn(s: string): (int, Score);
24  zero: fn(): Score;
25 };
26 
27 .EE
28 .SH DESCRIPTION
29 .I Venti
30 is a block storage server intended for archival applications.
31 The
32 .I Venti
33 module provides low-level access to a Venti server.
34 The module assumes that the physical connection
35 to the server has already been established
36 (for example, by
37 .IR dial (2)).
38 On a Venti server, a block is addressed by the SHA1 hash of
39 the contents of that block, known as a
40 .IR score ,
41 and represented as a
42 .B Score
43 adt.
44 Blocks are additionally tagged with a
45 .IR type ,
46 facilitating recovery in the event of corruption.
47 A
48 .B Session
49 represents an session with a Venti server.
50 .TP
51 .IB s .new(\fIfd\fP)
52 .B New
53 performs the initial handshake with the Venti server,
54 returning established
55 .BR Session .
56 .TP
57 .IB s .read(\fIscore\fP,\ \fIetype\fP,\ \fImaxn\fP)
58 .B Read
59 tries to retrieve the block
60 corresponding to
61 .IR score ,
62 and of type
63 .IR etype .
64 The block must be no longer than
65 .I maxn
66 bytes.
67 .I Etype
68 is conventionally one of the constants
69 .BR Roottype ,
70 .BR Dirtype ,
71 .BR Datatype
72 or
73 .BR Pointertype [0-9],
74 where the different
75 .BR Pointertype s
76 represent different depth levels within a Venti tree.
77 .TP
78 .IB s .write(\fIetype\fP,\ \fIbuf\fP)
79 .B Write
80 writes the data in
81 .I buf
82 to the Venti server.
83 The block will be tagged with type
84 .IR etype .
85 It returns a tuple, say
86 .RI ( ok ,\ score );
87 on error,
88 .I ok
89 is -1, otherwise
90 .I ok
91 is 0 and
92 .I score
93 contains the Venti score for the block that has been written.
94 .TP
95 .IB s .sync()
96 .B Sync
97 tells the Venti server to make sure that all data is committed to
98 active storage.
99 .SH SOURCE
100 .B /appl/lib/venti.b