mirror of
https://github.com/minio/minio.git
synced 2024-12-26 07:05:55 -05:00
Specifying more exact types for data
This commit is contained in:
parent
ed4bca240f
commit
0b08312ddd
@ -28,7 +28,7 @@ type Metadata map[string]string
|
|||||||
|
|
||||||
type DataHeader struct {
|
type DataHeader struct {
|
||||||
Key string
|
Key string
|
||||||
Part int
|
Part uint8
|
||||||
Metadata Metadata
|
Metadata Metadata
|
||||||
EncoderParams EncoderParams
|
EncoderParams EncoderParams
|
||||||
}
|
}
|
||||||
@ -41,13 +41,13 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type EncoderParams struct {
|
type EncoderParams struct {
|
||||||
Length int
|
Length uint32
|
||||||
K uint8
|
K uint8
|
||||||
M uint8
|
M uint8
|
||||||
Technique EncoderTechnique
|
Technique EncoderTechnique
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHeader(key string, part int, metadata Metadata, encoderParams EncoderParams) DataHeader {
|
func NewHeader(key string, part uint8, metadata Metadata, encoderParams EncoderParams) DataHeader {
|
||||||
header := DataHeader{}
|
header := DataHeader{}
|
||||||
header.Key = key
|
header.Key = key
|
||||||
header.Part = part
|
header.Part = part
|
||||||
|
@ -32,9 +32,8 @@ var _ = Suite(&MySuite{})
|
|||||||
func (s *MySuite) TestSingleWrite(c *C) {
|
func (s *MySuite) TestSingleWrite(c *C) {
|
||||||
var testBuffer bytes.Buffer
|
var testBuffer bytes.Buffer
|
||||||
testData := "Hello, World"
|
testData := "Hello, World"
|
||||||
testLength := len(testData)
|
|
||||||
encoderParams := EncoderParams{
|
encoderParams := EncoderParams{
|
||||||
Length: testLength,
|
Length: uint32(len(testData)),
|
||||||
K: 8,
|
K: 8,
|
||||||
M: 8,
|
M: 8,
|
||||||
Technique: CAUCHY,
|
Technique: CAUCHY,
|
||||||
@ -43,7 +42,7 @@ func (s *MySuite) TestSingleWrite(c *C) {
|
|||||||
metadata["Content-Type"] = "application/octet-stream"
|
metadata["Content-Type"] = "application/octet-stream"
|
||||||
metadata["Content-MD5"] = "testing"
|
metadata["Content-MD5"] = "testing"
|
||||||
|
|
||||||
header := NewHeader("testobj", 0, metadata, encoderParams)
|
header := NewHeader("testobj", 1, metadata, encoderParams)
|
||||||
|
|
||||||
err := WriteData(&testBuffer, header, bytes.NewBufferString(testData))
|
err := WriteData(&testBuffer, header, bytes.NewBufferString(testData))
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
Loading…
Reference in New Issue
Block a user