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

Method ReadMeta

ethstorage/data_file.go:206–214  ·  view source on GitHub ↗

Read the metadata of the kv

(kvIdx uint64)

Source from the content-addressed store, hash-verified

204
205// Read the metadata of the kv
206func (df *DataFile) ReadMeta(kvIdx uint64) ([]byte, error) {
207 if !df.ContainsKv(kvIdx) {
208 return nil, fmt.Errorf("kv not found")
209 }
210
211 b := make([]byte, df.metaSize)
212 _, err := df.file.ReadAt(b, int64(HEADER_SIZE+df.chunkIdxLen*df.chunkSize+(kvIdx-df.KvIdxStart())*df.metaSize))
213 return b, err
214}
215
216// Write the metadata of the kv
217func (df *DataFile) WriteMeta(kvIdx uint64, b []byte) error {

Callers 2

TryReadMetaMethod · 0.45
runMetaReadFunction · 0.45

Calls 2

ContainsKvMethod · 0.95
KvIdxStartMethod · 0.95

Tested by

no test coverage detected