Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
/ rsync-go Public

This is a pure go implementation of the rsync algorithm with highwayhash signature

License

Notifications You must be signed in to change notification settings

minio/rsync-go

Open more actions menu

Repository files navigation

rsync-go

MIT licensed GoDoc

This is a pure go implementation of the rsync algorithm.

This repo in particular is a fork of Amos Wenger implementation (see the section for details)

Usage

Here is a sample example (without error checking):

import (
	"os"
	"bytes"

	"github.com/minio/rsync-go"
)

func main() {
	srcReader, _ := os.Open("content-v2.bin")
	defer srcReader.Close()

	rs := &rsync.RSync{}

	// here we store the whole signature in a byte slice,
	// but it could just as well be sent over a network connection for example
	sig := make([]rsync.BlockHash, 0, 10)
	writeSignature := func(bl rsync.BlockHash) error {
		sig = append(sig, bl)
		return nil
	}

	rs.CreateSignature(srcReader, writeSignature)

	targetReader, _ := os.Open("content-v1.bin")

	opsOut := make(chan rsync.Operation)
	writeOperation := func(op rsync.Operation) error {
		opsOut <- op
		return nil
	}

	go func() {
		defer close(opsOut)
		rs.CreateDelta(targetReader, writeOperation)
	}()

	srcWriter, _ := os.OpenFile("content-v2-reconstructed.bin")
	srcReader.Seek(0, os.SEEK_SET)

	rs.ApplyDelta(srcWriter, srcReader, opsOut)
}

Links

About

This is a pure go implementation of the rsync algorithm with highwayhash signature

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.