MCPcopy Create free account
hub / github.com/akalin/gopar / LoadFileData

Method LoadFileData

par1/encoder.go:55–74  ·  view source on GitHub ↗

LoadFileData loads the file data into memory.

()

Source from the content-addressed store, hash-verified

53
54// LoadFileData loads the file data into memory.
55func (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
76func (e *Encoder) buildShards() [][]byte {
77 shards := make([][]byte, len(e.fileData)+e.volumeCount)

Callers

nothing calls this directly

Calls 2

ReadFileMethod · 0.65
OnDataFileLoadMethod · 0.65

Tested by

no test coverage detected