Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is the part of the localstore which keeps track of the chunks that are not part of the reserve but are potentially useful to store for obtaining bandwidth incentives. In order to avoid GC we will only keep track of a fixed no. of chunks as part of the cache and evict a chunk as soon as we go above capacity. In order to achieve this we will use some additional cache state in-mem and stored on disk to create a double-ended queue. The typical operations required here would be a pushBack which adds an item to the end and popFront, which removed the first item. The different operations: 1. New item will be added to the end. 2. Item pushed to end on access. 3. Removal happens from the front.
func New ¶
New creates a new Cache component with the specified capacity. The store is used here only to read the initial state of the cache before shutdown if there was any.
func (*Cache) Getter ¶
Getter returns a Storage.Getter instance which checks if the chunks accessed are part of cache it will update the cache queue. If the operation to update the cache indexes fail, we need to fail the operation as this should signal the user of this getter to rollback the operation.