VENTI-CLIENT(3)

πŸ“¦ version 0_git20260208, in alpine 3.24, arch rolling, nixos 26.05, nixpkgs unstable

πŸŽ€ NAME πŸŽ€

Welcome to VENTI-CLIENT(3), bestie β€” the Library Functions Manual page for the whole Venti client squad: vtconnect, vthello, vtread, vtwrite, vtreadpacket, vtwritepacket, vtsync, vtping, vtrpc, and ventidoublechecksha1. That's the cast. πŸ‘‘

✨ SYNOPSIS ✨

#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 */

πŸ’– DESCRIPTION πŸ’–

These routines execute the client side of the venti(7) protocol. Periodt. πŸ’…

  • 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 venti-conn(3)) 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. Like, respectfully, don't. πŸ™ˆ

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 venti-conn(3).

πŸ¦‹ SOURCE πŸ¦‹

/src/libventi

🌈 SEE ALSO 🌈

πŸ’… DIAGNOSTICS πŸ’…

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

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


Okay that's the whole iconic page, bestie β€” signing off from VENTI-CLIENT(3), source /src/libventi, and the footer didn't hand us a date, just the title again. Stay slaying those Venti calls! 🫢✨