Skip to content

Commit

Permalink
fix: fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
flywukong committed Mar 27, 2023
1 parent c6369a4 commit a113b16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions go/hash/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func ComputeIntegrityHash(reader io.Reader, segmentSize int64, dataShards, parit
n, err := reader.Read(seg)
if err != nil {
if err != io.EOF {
log.Error().Msg("content read failed:" + err.Error())
log.Error().Msg("failed to read content:" + err.Error())
return nil, 0, storageTypes.REDUNDANCY_EC_TYPE, err
}
break
Expand Down Expand Up @@ -84,7 +84,7 @@ func ComputeIntegrityHash(reader io.Reader, segmentSize int64, dataShards, parit
func ComputerHashFromFile(filePath string, segmentSize int64, dataShards, parityShards int) ([][]byte, int64, storageTypes.RedundancyType, error) {
f, err := os.Open(filePath)
if err != nil {
log.Error().Msg("failed open file:" + err.Error())
log.Error().Msg("failed to open file:" + err.Error())
return nil, 0, storageTypes.REDUNDANCY_EC_TYPE, err
}
defer f.Close()
Expand Down
6 changes: 3 additions & 3 deletions go/redundancy/erasure/erasure_coding.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ func (r *RSEncoder) DecodeDataShards(content [][]byte) error {
// The func recreate the missing shards if possible.
func (r *RSEncoder) DecodeShards(data [][]byte) error {
if err := r.encoder().Reconstruct(data); err != nil {
log.Error().Msg("recreate the missing shard fail:" + err.Error())
log.Error().Msg("failed to recreate the missing shard:" + err.Error())
return err
}
ok, err := r.encoder().Verify(data)
if err != nil {
log.Error().Msg("decode verify fail:" + err.Error())
log.Error().Msg("failed to verify:" + err.Error())
return err
}

Expand All @@ -114,7 +114,7 @@ func (r *RSEncoder) ShardSize() int64 {
func (r *RSEncoder) GetOriginalData(shardsData [][]byte, originLength int64) ([]byte, error) {
err := r.DecodeDataShards(shardsData)
if err != nil {
log.Error().Msg("decode shards fail:" + err.Error())
log.Error().Msg("failed to decode shards:" + err.Error())
return []byte(""), err
}

Expand Down

0 comments on commit a113b16

Please sign in to comment.