Beispiel #1
0
// NewErasure creates an encoder object with a given set of parameters.
func NewErasure(ep *ErasureParams) *Erasure {
	var k = C.int(ep.K)
	var m = C.int(ep.M)

	var encodeMatrix *C.uchar
	var encodeTbls *C.uchar

	C.minio_init_encoder(C.int(ep.Technique), k, m, &encodeMatrix,
		&encodeTbls)

	return &Erasure{
		params:       ep,
		encodeMatrix: encodeMatrix,
		encodeTbls:   encodeTbls,
		decodeMatrix: nil,
		decodeTbls:   nil,
		decodeIndex:  nil,
	}
}
Beispiel #2
0
// NewErasure creates an encoder object with a given set of parameters.
func NewErasure(ep *Params) *Erasure {
	var k = C.int(ep.K)
	var m = C.int(ep.M)

	var encodeMatrix *C.uchar
	var encodeTbls *C.uchar

	C.minio_init_encoder(k, m, &encodeMatrix, &encodeTbls)

	return &Erasure{
		params:       ep,
		encodeMatrix: encodeMatrix,
		encodeTbls:   encodeTbls,
		decodeMatrix: nil,
		decodeTbls:   nil,
		decodeIndex:  nil,
		mutex:        new(sync.Mutex),
	}
}