9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@swtch.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] venti workalike in Python
Date: Tue,  9 Dec 2003 21:31:41 -0500	[thread overview]
Message-ID: <E1ATu8e-000AtJ-Kf@t40.swtch.com> (raw)
In-Reply-To: Your message of "Tue, 09 Dec 2003 18:00:41 PST." <055001c3bec1$6a449170$6739a8c0@hpn5415>

> I'm attempting to decipher the venti and vac code and write a workalike in
> Python.  (packet.c had me bogged down for a while...)  At this point I don't

The discussion of the Vac file system format in /sys/doc/fossil.ps
may be helpful.

> care that much about compatibility, and can't really test it as I don't have
> a running instance of Plan 9.  But as has been noted here before, the venti
> procol is relatively trivial--hello, ping, read, write, goodbye, error,
> although the two auth messages appear to be unused for the moment?--so
> making it compatible at some point shouldn't be too much of a problem.
> Having said that, is there any documentation on the venti protocol apart
> from the source?

Not really, but here's a summary.

Venti uses a simple RPC protocol with only a few messages:

	size[2] RError   tag[1] error[s]

	size[2] QPing    tag[1]
	size[2] RPing    tag[1]

	size[2] QHello   tag[1] version[s] uid[s] strength[1]
	                              ncrypto[1] crypto[ncrypto]
	                              ncodec[1] codec[ncodec]
	size[2] RHello   tag[1] sid[s] crypto[1] codec[1]

	size[2] QGoodbye tag[1]

	size[2] QRead    tag[1] score[20] type[1] 0[1] count[2]
	size[2] RRead    tag[1] data[]

	size[2] QWrite   tag[1] type[1] 0[3] data[]
	size[2] RWrite   score[20]

	size[2] QSync    tag[1]
	size[2] RSync    tag[1]

In the notation, field[s] indicates a string: a two-byte length followed
by that many bytes.

The actual message types are one-byte values:

enum
{
	VtRError = 1,

	VtQPing,
	VtRPing,
	VtQHello,
	VtRHello,
	VtQGoodbye,
	VtRGoodbye,	/* not used */
	VtQAuth0,	/* not used */
	VtRAuth0,	/* not used */
	VtQAuth1,	/* not used */
	VtRAuth1,	/* not used */
	VtQRead,
	VtRRead,
	VtQWrite,
	VtRWrite,
	VtQSync,
	VtRSync,

	VtMaxOp
};

Transactions and tags are like in 9P, except that tags are one byte
and the request messages have names beginning with Q instead of T.
The strength, crypto, and codec stuff was never fleshed out and
is essentially unused.

> I'm not planning on re-implementing venti's arena code but thought that it
> would be quick and easy for testing purposes to implement the back-end
> storage using something like dbm or, mea culpa, a relational database.  (I
> added binary type support to the Python extension for SQLite with this in
> mind.)  Thoughts?

We use Berkeley DB at MIT for another project to store 8kB blocks indexed
by SHA1 hash.  It's adequate.

Russ


  reply	other threads:[~2003-12-10  2:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-10  2:00 John E. Barham
2003-12-10  2:31 ` Russ Cox [this message]
2003-12-10  2:51   ` Geoff Collyer
2003-12-10 22:52 ` William Josephson
2003-12-11  7:20 ` John E. Barham
2003-12-11  9:46 ` John E. Barham
2003-12-11 16:23   ` Russ Cox
2003-12-10 12:11 Geoff Collyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1ATu8e-000AtJ-Kf@t40.swtch.com \
    --to=rsc@swtch.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).