diff options
author | n-peugnet <n.peugnet@free.fr> | 2021-09-01 19:07:49 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2021-09-01 19:07:49 +0200 |
commit | 1dec2cdc84a6497c893d84485c6f94589f997215 (patch) | |
tree | 690a3a1601c54ea77878a9fae8429beac46c5919 /delta.go | |
parent | db40818ef79ccb3f5f9232623f57ad284a4af7d0 (diff) | |
download | dna-backup-1dec2cdc84a6497c893d84485c6f94589f997215.tar.gz dna-backup-1dec2cdc84a6497c893d84485c6f94589f997215.zip |
Prepare for delta encoding
Diffstat (limited to 'delta.go')
-rw-r--r-- | delta.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/delta.go b/delta.go new file mode 100644 index 0000000..423fb07 --- /dev/null +++ b/delta.go @@ -0,0 +1,32 @@ +package main + +import ( + "io" + + "github.com/gabstv/go-bsdiff/pkg/bsdiff" + "github.com/gabstv/go-bsdiff/pkg/bspatch" +) + +type DeltaCodec interface { + Differ + Patcher +} + +type Differ interface { + Diff(source io.Reader, target io.Reader, patch io.Writer) error +} + +type Patcher interface { + Patch(source io.Reader, target io.Writer, patch io.Reader) error +} + +// TODO: maybe move this in it own file ? +type Bsdiff struct{} + +func (*Bsdiff) Diff(source io.Reader, target io.Reader, patch io.Writer) error { + return bsdiff.Reader(source, target, patch) +} + +func (*Bsdiff) Patch(source io.Reader, target io.Writer, patch io.Reader) error { + return bspatch.Reader(source, target, patch) +} |