librsync(3)

πŸ’– librsync β€” the manual page, but make it slay πŸ’–

okay bestie, you found librsync(3), which lives in the Library Functions Manual section, and honestly? she's iconic. let's get into it πŸ’…


✨ NAME ✨

librsync β€” the library for delta compression of streams, periodt πŸ¦‹


🌸 SYNOPSYS 🌸

(not me spelling it SYNOPSYS exactly like the original does β€” we respect the source material here, no cap πŸ™ˆ)

#include <stdio.h>
#include <stdlib.h>
#include <librsync.h>

cc ... -lrsync

like, that's the whole vibe check right there. include the headers, link against it, go off ✨


πŸ‘‘ DESCRIPTION πŸ‘‘

so. the librsync library implements network delta-compression of streams and files. yes, streams and files. both. she does both πŸ’–

the algorithm is similar to the one used in the rsync(1) and xdelta(2) programs, but β€” and this is the part that matters β€” she's specialized for transfer of arbitrary-length octet streams. lowkey a whole different beast.

and here's the thing that makes her actually iconic: unlike most diff programs, librsync does not require access to both of the files on the same machine 😭🫢 instead she only needs:

  • a short β€œsignature” of the old file, and
  • the complete contents of the new file

that's it. that's the whole flex. two machines, one tiny signature, no problem πŸ’…


🧚 The canonical use 🧚

the canonical use of librsync is in the rproxy(8) reference implementation of the rsync proposed extension to HTTP. very main character energy.

but bestie, she's not gatekept β€” she may be useful to other programs which wish to do delta-compression in HTTP, or within their own protocol. do your thing ✨

also, there are HTTP-specific utility functions within librsync, but plot twist: they need not be used. optional. take 'em or leave 'em πŸŽ€

and for the terminal girlies: a number of tools such as rdiff(1) provide command-line and scriptable access to rsync functions πŸ”₯


πŸ’œ SEE ALSO πŸ’œ

iykyk 🌈


πŸ’€ BUGS πŸ’€

okay bestie, real talk, we gotta be honest here 🫢

the rsync protocol is still evolving. there may be bugs in the implementation. the interface may change in the future β€” but it's becoming more stable. growth era, we love to see it ✨

⚠️ also, and this is the spicy part: many routines will panic in case of error rather than returning an error code to the caller. yes fr fr. they just. panic. 😭

patches to fix this are welcome, but at the current state of development, aborting seems as useful as trusting to possibly-incomplete checking in the client. that's not me being mean, that's literally what the page says πŸ’…


πŸŽ€ AUTHOR πŸŽ€

Martin Pool <mbp@sourcefrog.net>, with Andrew Tridgell <tridge@samba.org>.

also, rdiff development has been supported by Linuxcare, Inc and VA Linux Systems β€” shoutout to the sponsors, we stan πŸ«ΆπŸ‘‘


and that's the whole page, bestie! this cutie comes to you from Martin Pool, dated $Date$, and it's the librsync(3) manual page β€” go forth and delta-compress something, you absolute icon πŸ¦‹πŸ’–βœ¨

πŸ“¦ where this page comes from