LoadFileData loads the file data into memory.
()
| 53 | |
| 54 | // LoadFileData loads the file data into memory. |
| 55 | func (e *Encoder) LoadFileData() error { |
| 56 | shardByteCount := 0 |
| 57 | fileData := make([][]byte, len(e.filePaths)) |
| 58 | for i, path := range e.filePaths { |
| 59 | var err error |
| 60 | fileData[i], err = e.fileIO.ReadFile(path) |
| 61 | e.delegate.OnDataFileLoad(i+1, len(e.filePaths), path, len(fileData[i]), err) |
| 62 | if err != nil { |
| 63 | return err |
| 64 | } |
| 65 | |
| 66 | if len(fileData[i]) > shardByteCount { |
| 67 | shardByteCount = len(fileData[i]) |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | e.shardByteCount = shardByteCount |
| 72 | e.fileData = fileData |
| 73 | return nil |
| 74 | } |
| 75 | |
| 76 | func (e *Encoder) buildShards() [][]byte { |
| 77 | shards := make([][]byte, len(e.fileData)+e.volumeCount) |
nothing calls this directly
no test coverage detected