Documentation
¶
Index ¶
- type Cache
- func (c *Cache[T]) DeleteItem(height uint64)
- func (c *Cache[T]) GetDAIncludedHeight(hash string) (uint64, bool)
- func (c *Cache[T]) GetItem(height uint64) *T
- func (c *Cache[T]) IsDAIncluded(hash string) bool
- func (c *Cache[T]) IsSeen(hash string) bool
- func (c *Cache[T]) LoadFromDisk(folderPath string) error
- func (c *Cache[T]) SaveToDisk(folderPath string) error
- func (c *Cache[T]) SetDAIncluded(hash string, height uint64)
- func (c *Cache[T]) SetItem(height uint64, item *T)
- func (c *Cache[T]) SetSeen(hash string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[T any] struct { // contains filtered or unexported fields }
Cache is a generic cache that maintains items that are seen and hard confirmed
func (*Cache[T]) DeleteItem ¶
DeleteItem deletes an item from the cache by height
func (*Cache[T]) GetDAIncludedHeight ¶
func (*Cache[T]) IsDAIncluded ¶
IsDAIncluded returns true if the hash has been DA-included
func (*Cache[T]) LoadFromDisk ¶
LoadFromDisk loads the cache contents from disk from the specified folder. It populates the current cache instance. If files are missing, corresponding parts of the cache will be empty. It's the caller's responsibility to ensure that type T (and any types it contains) are registered with the gob package if necessary (e.g., using gob.Register).
func (*Cache[T]) SaveToDisk ¶
SaveToDisk saves the cache contents to disk in the specified folder. It's the caller's responsibility to ensure that type T (and any types it contains) are registered with the gob package if necessary (e.g., using gob.Register).
func (*Cache[T]) SetDAIncluded ¶
SetDAIncluded sets the hash as DA-included with the given height