GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
VENTI-CLIENT(3) FreeBSD Library Functions Manual VENTI-CLIENT(3)

vtconnect, vthello, vtread, vtwrite, vtreadpacket, vtwritepacket, vtsync, vtping, vtrpc, ventidoublechecksha1 - Venti client

#include <u.h>
#include <libc.h>
#include <venti.h>

Packet* vtrpc(VtConn *z, Packet *p)

int vthello(VtConn *z)

int vtconnect(VtConn *z)

int vtread(VtConn *z, uchar score[VtScoreSize],
uint type, uchar *buf, int n)

int vtwrite(VtConn *z, uchar score[VtScoreSize],
uint type, uchar *buf, int n)

Packet* vtreadpacket(VtConn *z, uchar score[VtScoreSize],
uint type, int n)

int vtwritepacket(VtConn *z, uchar score[VtScoreSize],
uint type, Packet *p)

int vtsync(VtConn *z)

int vtping(VtConn *z)

extern int ventidoublechecksha1; /* default 1 */

These routines execute the client side of the protocol.

Vtrpc executes a single Venti RPC transaction, sending the request packet p and then waiting for and returning the response packet. Vtrpc will set the tag in the packet. Vtrpc frees p, even on error. Vtrpc is typically called only indirectly, via the functions below.

Vthello executes a hello transaction, setting z->sid to the name used by the server. Vthello is typically called only indirectly, via vtconnect.

Vtconnect calls vtversion (see and vthello, in that order, returning success only if both succeed. This sequence (calling vtversion and then vthello) must be done before the functions below can be called.

Vtread reads the block with the given score and type from the server, stores the returned data in memory at buf, and returns the number of bytes read. If the server's block has size larger than n, vtread does not modify buf and returns an error.

Vtwrite writes the n bytes in buf as a block of the given type, setting score.

Vtreadpacket and vtwritepacket are like vtread and vtwrite but return or accept the block contents in the form of a Packet. They avoid making a copy of the data.

Vtsync causes the server to flush all pending write requests to disk before returning.

Vtping executes a ping transaction with the server.

By default, vtread and vtreadpacket check that the SHA1 hash of the returned data matches the requested score, and vtwrite and vtwritepacket check that the returned score matches the SHA1 hash of the written data. Setting ventidoublechecksha1 to zero disables these extra checks, mainly for benchmarking purposes. Doing so in production code is not recommended.

These functions can be called from multiple threads or procs simultaneously to issue requests in parallel. Programs that issue requests from multiple threads in the same proc should start separate procs running vtsendproc and vtrecvproc as described in

/src/libventi

Vtrpc and vtpacket return nil on error. The other routines return -1 on error.

Vtwrite returns 0 on success: there are no partial writes.


Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.