Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chunk ¶
type Chunk struct { // Offset show from which byte the Chunk is started. Offset uint64 // Data contains all bytes in the chunk. Data []byte // Length is the number of bytes in the chunk. Length uint64 // Signature is the unique signature/hash of the data. // Two chunks with equal Data will have the same Signature. Signature string }
Chunk represent one chunk of the data bytes.
type ChunkConfig ¶
type ChunkConfig struct { // WindowSize is the number of bytes that are included in // the window that going to be rolling/shifted through the data. WindowSize uint64 `yaml:"window_size"` // MinSizeChunk point how much must be the minimum size of a Chunk. MinSizeChunk int `yaml:"min_size_chunk"` // MaxSizeChunk point how much must be the maximum size of a Chunk. MaxSizeChunk int `yaml:"max_size_chunk"` // FingerprintBreakPoint point when boundary of the chunks. When the // hash value of the bytes in window are equal to FingerprintBreakPoint // this means that the Chuncker should create a new chunk FingerprintBreakPoint uint64 `yaml:"fingerprint_break_point"` }
ChunkConfig contains config information of the Chunker.
type Chunker ¶
type Chunker struct {
// contains filtered or unexported fields
}
Chunker split data to chunks. It read data from a channel and split data to chunks based on the information in ChunkConfig. After a chunk is created the Chunker sends it through a channel. It is not responsible for storing and processing created chunks.
func NewChunker ¶
func NewChunker(new func([]byte) rollinghash.Hash, cfg ChunkConfig, b chan byte, ch chan Chunk) *Chunker
NewChunker initialize and return *Chunker.
type Delta ¶
type Delta struct { // NewChunks contains new chunks that are missing in the old data bytes NewChunks []Chunk // OldChunks contains all chunks from the old data // bytes that are removed or updated and are not up-to-date. OldChunks []Chunk }
Delta contains the difference between two data bytes.
type SignerDelta ¶
type SignerDelta interface { Sign(file, signatureFile string) error FindDelta(signatureFile, newFile string) (Delta, error) }
SignerDelta contains methods for sign a file (Sign) anf find difference (FindDelta) between two version of files.
func NewFileSignerDelta ¶
func NewFileSignerDelta(d chan<- byte, ch <-chan Chunk) SignerDelta
NewFileSignerDelta initialize and return a new SignerDelta.
Directories ¶
Path | Synopsis |
---|---|
Package rollinghash implements Rabin hashing (fingerprinting).
|
Package rollinghash implements Rabin hashing (fingerprinting). |
Click to show internal directories.
Click to hide internal directories.