repo

package
v0.0.0-...-bec4141 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2022 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferedChunk

type BufferedChunk interface {
	Chunk
	Bytes() []byte
}

type Chunk

type Chunk interface {
	Reader() io.ReadSeeker
	Len() int
}

type ChunkId

type ChunkId struct {
	Ver int
	Idx uint64
}

func (*ChunkId) Path

func (i *ChunkId) Path(repo string) string

type DeltaChunk

type DeltaChunk struct {
	Source *ChunkId
	Patch  []byte
	Size   int
	// contains filtered or unexported fields
}

func (*DeltaChunk) Len

func (c *DeltaChunk) Len() int

TODO: Maybe return the size of the patch instead ?

func (*DeltaChunk) Reader

func (c *DeltaChunk) Reader() io.ReadSeeker

func (*DeltaChunk) SetRepo

func (c *DeltaChunk) SetRepo(r *Repo)

type File

type File struct {
	Path string
	Size int64
	Link string
}

type FingerprintMap

type FingerprintMap map[uint64]*ChunkId

type IdentifiedChunk

type IdentifiedChunk interface {
	Chunk
	GetId() *ChunkId
}

type Repo

type Repo struct {
	// contains filtered or unexported fields
}

func NewRepo

func NewRepo(path string, chunkSize int) *Repo

func (*Repo) Commit

func (r *Repo) Commit(source string)

func (*Repo) Differ

func (r *Repo) Differ() delta.Differ

func (*Repo) Export

func (r *Repo) Export(exporter export.Exporter)

func (*Repo) Init

func (r *Repo) Init()

func (*Repo) LoadChunkContent

func (r *Repo) LoadChunkContent(id *ChunkId) *bytes.Reader

LoadChunkContent loads a chunk from the repo directory. If the chunk is in cache, get it from cache, else read it from drive.

func (*Repo) Patcher

func (r *Repo) Patcher() delta.Patcher

func (*Repo) Restore

func (r *Repo) Restore(destination string)

func (*Repo) StoreChunkContent

func (r *Repo) StoreChunkContent(id *ChunkId, reader io.Reader)

type RepoChunk

type RepoChunk interface {
	Chunk
	SetRepo(r *Repo)
}

type SketchMap

type SketchMap map[uint64][]*ChunkId

func (SketchMap) Set

func (m SketchMap) Set(key []uint64, value *ChunkId)

type StoredChunk

type StoredChunk struct {
	Id *ChunkId
	// contains filtered or unexported fields
}

func NewStoredChunk

func NewStoredChunk(repo *Repo, id *ChunkId) *StoredChunk

func (*StoredChunk) GetId

func (c *StoredChunk) GetId() *ChunkId

func (*StoredChunk) Len

func (c *StoredChunk) Len() int

func (*StoredChunk) Reader

func (c *StoredChunk) Reader() io.ReadSeeker

func (*StoredChunk) SetRepo

func (c *StoredChunk) SetRepo(r *Repo)

type TempChunk

type TempChunk struct {
	Value []byte
}

func NewTempChunk

func NewTempChunk(value []byte) *TempChunk

func (*TempChunk) AppendFrom

func (c *TempChunk) AppendFrom(r io.Reader)

func (*TempChunk) Bytes

func (c *TempChunk) Bytes() []byte

func (*TempChunk) Len

func (c *TempChunk) Len() int

func (*TempChunk) Reader

func (c *TempChunk) Reader() io.ReadSeeker

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL