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

Method WriteMeta

ethstorage/data_file.go:217–228  ·  view source on GitHub ↗

Write the metadata of the kv

(kvIdx uint64, b []byte)

Source from the content-addressed store, hash-verified

215
216// Write the metadata of the kv
217func (df *DataFile) WriteMeta(kvIdx uint64, b []byte) error {
218 if !df.ContainsKv(kvIdx) {
219 return fmt.Errorf("kv not found")
220 }
221
222 if len(b) > int(df.metaSize) {
223 return fmt.Errorf("write meta too large")
224 }
225
226 _, err := df.file.WriteAt(b, int64(HEADER_SIZE+df.chunkIdxLen*df.chunkSize+(kvIdx-df.KvIdxStart())*df.metaSize))
227 return err
228}
229
230func (df *DataFile) writeHeader() error {
231 header := DataFileHeader{

Callers

nothing calls this directly

Calls 2

ContainsKvMethod · 0.95
KvIdxStartMethod · 0.95

Tested by

no test coverage detected