Skip to content

Commit

Permalink
typos (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
HJLebbink committed Jan 26, 2024
1 parent bb8917f commit 2124328
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
26 changes: 22 additions & 4 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This folder contains usage examples of the Reed-Solomon encoder.

Shows basic use of the encoder, and will encode a single file into a number of
data and parity shards. This is meant as an example and is not meant for production use
since there is a number of shotcomings noted below.
since there is a number of shortcomings noted below.

To build an executable use:

Expand All @@ -15,7 +15,7 @@ go build simple-decoder.go
go build simple-encoder.go
```

# Streamin API examples
# Streaming API examples

There are streaming examples of the same functionality, which streams data instead of keeping it in memory.

Expand All @@ -26,8 +26,26 @@ go build stream-decoder.go
go build stream-encoder.go
```

# Example usage

On Windows, the following command will generate six files `README.md.0` to `README.md.5`

```bash
.\simple-encoder.exe .\README.md
```

Rename `README.md` to `README.md.org`, and delete two of the six generated files. The following
command will reconstruct `README.md` from the four generated files.

```bash
.\simple-decoder.exe .\README.md
```

Appreciate that the reconstructed file mau have nul padding as explained in the following shortcomings.


## Shortcomings
* If the file size of the input isn't diviable by the number of data shards
* If the file size of the input isn't dividable by the number of data shards
the output will contain extra zeroes
* If the shard numbers isn't the same for the decoder as in the
encoder, invalid output will be generated.
Expand All @@ -42,4 +60,4 @@ The solution for this is to save a metadata file containing:
* HASH of each shard.
* Order of the shards.

If you save these properties, you should abe able to detect file corruption in a shard and be able to reconstruct your data if you have the needed number of shards left.
If you save these properties, you should abe able to detect file corruption in a shard and be able to reconstruct your data if you have the needed number of shards left.
3 changes: 1 addition & 2 deletions examples/simple-decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ package main
import (
"flag"
"fmt"
"io/ioutil"
"os"

"github.com/klauspost/reedsolomon"
Expand Down Expand Up @@ -77,7 +76,7 @@ func main() {
for i := range shards {
infn := fmt.Sprintf("%s.%d", fname, i)
fmt.Println("Opening", infn)
shards[i], err = ioutil.ReadFile(infn)
shards[i], err = os.ReadFile(infn)
if err != nil {
fmt.Println("Error reading file", err)
shards[i] = nil
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// Simple encoder example
//
// The encoder encodes a simgle file into a number of shards
// The encoder encodes a simple file into a number of shards
// To reverse the process see "simpledecoder.go"
//
// To build an executable use:
Expand Down

0 comments on commit 2124328

Please sign in to comment.