Update comments across the codebase

This commit is contained in:
Harshavardhana
2015-03-03 02:36:12 -08:00
parent 137584d658
commit 3a3c8645fc
24 changed files with 198 additions and 346 deletions

View File

@@ -47,6 +47,7 @@ type EncoderParams struct {
Technique EncoderTechnique
}
// populate new header
func NewHeader(key string, part uint8, metadata Metadata, encoderParams EncoderParams) DataHeader {
header := DataHeader{}
header.Key = key
@@ -61,6 +62,7 @@ func NewHeader(key string, part uint8, metadata Metadata, encoderParams EncoderP
return header
}
// validate populated header
func ValidateHeader(header DataHeader) bool {
if header.Key == "" || header.Part < 0 || len(header.Metadata) < 2 {
return false
@@ -73,6 +75,7 @@ func ValidateHeader(header DataHeader) bool {
return true
}
// Write data, returns error upon any failure
func WriteData(target io.Writer, header DataHeader, data io.Reader) error {
if !ValidateHeader(header) {
return fmt.Errorf("Invalid header")

View File

@@ -73,6 +73,7 @@ type DonutFrameFooter struct {
type Data bytes.Buffer
// Write Donut format to input io.Writer, returns error upon any failure
func WriteFrame(target io.Writer, reader io.Reader, length uint64) error {
// write header
header := DonutFrameHeader{