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

Method syncCheck

ethstorage/storage_manager.go:361–380  ·  view source on GitHub ↗
(kvIdx uint64)

Source from the content-addressed store, hash-verified

359}
360
361func (s *StorageManager) syncCheck(kvIdx uint64) error {
362 meta, success, err := s.shardManager.TryReadMeta(kvIdx)
363 if !success || err != nil {
364 return errors.New("meta reading failed")
365 }
366
367 // There are two cases that we do NOT want to return data: not synced and empty filled
368 h0 := common.Hash{} // means not filled, e.g. haven't been synced yet
369
370 h1 := common.Hash{}
371 h1[HashSizeInContract] = h1[HashSizeInContract] | blobFillingMask // means empty filled
372
373 hash := common.Hash{}
374 copy(hash[:], meta)
375 if hash == h0 || hash == h1 {
376 return errors.New("syncing or just empty blob")
377 }
378
379 return nil
380}
381
382// DownloadAllMetas This function download the blob hashes of all the local storage shards from the smart contract
383func (s *StorageManager) DownloadAllMetas(ctx context.Context, batchSize uint64) error {

Callers 1

TryReadEncodedMethod · 0.95

Calls 1

TryReadMetaMethod · 0.65

Tested by

no test coverage detected