mirror of https://github.com/minio/minio.git
Adding erasure package to wrap versioned erasure. Ensures we always write latest version.
This commit is contained in:
parent
c081b7c011
commit
00381c887a
|
@ -0,0 +1,37 @@
|
||||||
|
package erasure
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/minio-io/minio/pkg/storage/donut/erasure/erasure1"
|
||||||
|
)
|
||||||
|
|
||||||
|
type EncoderTechnique int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Vandermonde matrix type
|
||||||
|
Vandermonde EncoderTechnique = iota
|
||||||
|
// Cauchy matrix type
|
||||||
|
Cauchy
|
||||||
|
)
|
||||||
|
|
||||||
|
// Write latest donut format
|
||||||
|
func Write(target io.Writer, key string, part uint8, length uint32, k, m uint8, technique EncoderTechnique, data io.Reader) error {
|
||||||
|
var versionedTechnique erasure1.EncoderTechnique
|
||||||
|
switch {
|
||||||
|
case technique == Vandermonde:
|
||||||
|
versionedTechnique = erasure1.Vandermonde
|
||||||
|
case technique == Cauchy:
|
||||||
|
versionedTechnique = erasure1.Cauchy
|
||||||
|
default:
|
||||||
|
errors.New("Unknown encoder technique")
|
||||||
|
}
|
||||||
|
return erasure1.Write(target, key, part, length, k, m, versionedTechnique, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read any donut format
|
||||||
|
func Read(reader io.Reader) (io.Reader, error) {
|
||||||
|
// when version2 is created, create a method in version2 that can transform version1 structure to version2
|
||||||
|
return nil, errors.New("Not Implemented")
|
||||||
|
}
|
Loading…
Reference in New Issue