git.gammaspectra.live/P2Pool/consensus/v3@v3.8.0/p2pool/cache/cache.go (about) 1 package cache 2 3 import ( 4 "git.gammaspectra.live/P2Pool/consensus/v3/p2pool/sidechain" 5 "git.gammaspectra.live/P2Pool/consensus/v3/types" 6 ) 7 8 type Cache interface { 9 Store(block *sidechain.PoolBlock) 10 Close() 11 } 12 13 type Loadee interface { 14 sidechain.ConsensusProvider 15 AddCachedBlock(block *sidechain.PoolBlock) 16 } 17 18 type HeapCache interface { 19 Cache 20 LoadAll(l Loadee) 21 } 22 23 type AddressableCache interface { 24 Cache 25 26 RemoveByMainId(id types.Hash) 27 RemoveByTemplateId(id types.Hash) 28 29 LoadByMainId(id types.Hash) *sidechain.PoolBlock 30 // LoadByTemplateId returns a slice of loaded blocks. If more than one, these might have colliding nonce / extra nonce values 31 LoadByTemplateId(id types.Hash) sidechain.UniquePoolBlockSlice 32 LoadBySideChainHeight(height uint64) sidechain.UniquePoolBlockSlice 33 LoadByMainChainHeight(height uint64) sidechain.UniquePoolBlockSlice 34 35 // ProcessBlock blocks returned on other Load methods may return pruned/compact blocks. Use this to process them 36 ProcessBlock(block *sidechain.PoolBlock) error 37 } 38 39 type IndexedCache interface { 40 AddressableCache 41 }