MCPcopy Create free account
hub / github.com/ethstorage/es-node / Write

Method Write

ethstorage/data_file.go:192–203  ·  view source on GitHub ↗

Write the chunk bytes to the file.

(chunkIdx uint64, b []byte)

Source from the content-addressed store, hash-verified

190
191// Write the chunk bytes to the file.
192func (df *DataFile) Write(chunkIdx uint64, b []byte) error {
193 if !df.Contains(chunkIdx) {
194 return fmt.Errorf("chunk not found")
195 }
196
197 if len(b) > int(df.chunkSize) {
198 return fmt.Errorf("write data too large")
199 }
200
201 _, err := df.file.WriteAt(b, HEADER_SIZE+int64(chunkIdx-df.chunkIdxStart)*int64(df.chunkSize))
202 return err
203}
204
205// Read the metadata of the kv
206func (df *DataFile) ReadMeta(kvIdx uint64) ([]byte, error) {

Callers 15

runChunkWriteFunction · 0.95
writeHeaderMethod · 0.45
TryWriteMethod · 0.45
BuildMsgIdFnFunction · 0.45
WriteMsgFunction · 0.45
makeHasherFunction · 0.45
healthzHandlerFunction · 0.45
HelloHandlerMethod · 0.45
ReportStateHandlerMethod · 0.45
runChunkReadFunction · 0.45
runShardReadFunction · 0.45
runKVReadFunction · 0.45

Calls 1

ContainsMethod · 0.95

Tested by

no test coverage detected