Exemple #1
0
func DecodeTuple(block1, block2 []byte, bck bucket.Bucket, tuple [][]byte) (e error) {
	ts := len(tuple)
	e = bck.ELoad(tuple[0], block1)
	if e != nil {
		return
	}
	for i := 1; i < ts; i++ {
		e = bck.ELoad(tuple[i], block2)
		if e != nil {
			return
		}
		blockutil.XorBlock(block1, block2)
	}
	return
}
Exemple #2
0
func TestDecodeTuple(block1, block2 []byte, bck bucket.Bucket, tuple [][]byte, hashes chan []byte) (ok bool) {
	ts := len(tuple)
	ok = true
	e := bck.ELoad(tuple[0], block1)
	if e != nil {
		hashes <- tuple[0]
		ok = false
	}
	for i := 1; i < ts; i++ {
		e2 := bck.ELoad(tuple[i], block2)
		if e2 != nil {
			hashes <- tuple[i]
			ok = false
		}
		blockutil.XorBlock(block1, block2)
	}
	return
}
Exemple #3
0
func MeterDecodeTuple(block1, block2 []byte, bck bucket.Bucket, tuple [][]byte, hashes chan []byte, metrik *Metrik) (ok bool) {
	ts := len(tuple)
	ok = true
	e := bck.ELoad(tuple[0], block1)
	metrik.Max++
	if e != nil {
		hashes <- tuple[0]
		ok = false
	} else {
		metrik.Count++
	}
	for i := 1; i < ts; i++ {
		e2 := bck.ELoad(tuple[i], block2)
		metrik.Max++
		if e2 != nil {
			hashes <- tuple[i]
			ok = false
		} else {
			metrik.Count++
		}
		blockutil.XorBlock(block1, block2)
	}
	return
}