aboutsummaryrefslogtreecommitdiff
path: root/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'repo.go')
-rw-r--r--repo.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/repo.go b/repo.go
index 6f177c2..32666f4 100644
--- a/repo.go
+++ b/repo.go
@@ -48,6 +48,8 @@ type Repo struct {
sketchWSize int
sketchSfCount int
sketchFCount int
+ differ Differ
+ patcher Patcher
}
type File struct {
@@ -63,9 +65,19 @@ func NewRepo(path string) *Repo {
sketchWSize: 32,
sketchSfCount: 3,
sketchFCount: 4,
+ differ: &Bsdiff{},
+ patcher: &Bsdiff{},
}
}
+func (r *Repo) Differ() Differ {
+ return r.differ
+}
+
+func (r *Repo) Patcher() Patcher {
+ return r.patcher
+}
+
func (r *Repo) Commit(source string) {
versions := r.loadVersions()
newVersion := len(versions)
@@ -275,6 +287,12 @@ func (r *Repo) findSimilarChunk(chunk Chunk, sketches SketchMap) (*ChunkId, bool
return similarChunk, similarChunk != nil
}
+// TODO: encode stream
+func (r *Repo) encodeStream(stream io.Reader, fingerprints FingerprintMap, sketches SketchMap) []Chunk {
+ chunks := r.matchStream(stream, fingerprints)
+ return chunks
+}
+
func (r *Repo) matchStream(stream io.Reader, fingerprints FingerprintMap) []Chunk {
var b byte
var chunks []Chunk