move code around for better readability

This commit is contained in:
vyzo 2021-06-27 17:04:26 +03:00
parent 31497f4bd3
commit 4a71c68e06

View File

@ -263,19 +263,6 @@ func (s *SplitStore) Get(cid cid.Cid) (blocks.Block, error) {
}
}
// internal version used by walk so that we don't blow the txn
func (s *SplitStore) get(cid cid.Cid) (blocks.Block, error) {
blk, err := s.hot.Get(cid)
switch err {
case bstore.ErrNotFound:
return s.cold.Get(cid)
default:
return blk, err
}
}
func (s *SplitStore) GetSize(cid cid.Cid) (int, error) {
s.txnLk.RLock()
defer s.txnLk.RUnlock()
@ -1087,6 +1074,19 @@ func (s *SplitStore) walkLinks(c cid.Cid, walked *cid.Set, f func(cid.Cid) error
return rerr
}
// internal version used by walk so that we don't blow the txn
func (s *SplitStore) get(cid cid.Cid) (blocks.Block, error) {
blk, err := s.hot.Get(cid)
switch err {
case bstore.ErrNotFound:
return s.cold.Get(cid)
default:
return blk, err
}
}
func (s *SplitStore) moveColdBlocks(cold []cid.Cid) error {
batch := make([]blocks.Block, 0, batchSize)