Documentation ¶
Index ¶
- type IndexCounts
- func (c *IndexCounts) AddCount(providerID peer.ID, contextID []byte, count uint64)
- func (c *IndexCounts) AddMissingCount(providerID peer.ID, contextID []byte, count uint64)
- func (c *IndexCounts) Provider(providerID peer.ID) (uint64, error)
- func (c *IndexCounts) RemoveCtx(providerID peer.ID, contextID []byte) (uint64, error)
- func (c *IndexCounts) RemoveProvider(providerID peer.ID) uint64
- func (c *IndexCounts) SetTotalAddend(totalAddend uint64)
- func (c *IndexCounts) Total() (uint64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IndexCounts ¶
type IndexCounts struct {
// contains filtered or unexported fields
}
IndexCounts persists multihash counts associated with provider ContextIDs. It is not safe to allow concurrent calls to IndexCounts methods for the same provider. Concurrent calls for different providers are safe.
func NewIndexCounts ¶
func NewIndexCounts(ds datastore.Datastore) *IndexCounts
NewIndexCounts creates a new IndexCounts given a Datastore.
func (*IndexCounts) AddCount ¶
func (c *IndexCounts) AddCount(providerID peer.ID, contextID []byte, count uint64)
AddCount adds the index count to the existing count for the provider's context ID, and updates in-memory totals.
func (*IndexCounts) AddMissingCount ¶
func (c *IndexCounts) AddMissingCount(providerID peer.ID, contextID []byte, count uint64)
AddMissingCount stores the count only if there is no existing count for the provider's context ID, and updates in-memory totals.
func (*IndexCounts) Provider ¶
func (c *IndexCounts) Provider(providerID peer.ID) (uint64, error)
Provider reads all index counts for a provider.
func (*IndexCounts) RemoveProvider ¶
func (c *IndexCounts) RemoveProvider(providerID peer.ID) uint64
RemoveProvider removes all index counts for a provider.
func (*IndexCounts) SetTotalAddend ¶
func (c *IndexCounts) SetTotalAddend(totalAddend uint64)
SetTotalAddent sets a value that is added to the index count returned by Total. Its purpose is to account for uncounted indexes that have existed since before provider index counts were tracked. This only affects Total, and does not affect any individual provider values.
func (*IndexCounts) Total ¶
func (c *IndexCounts) Total() (uint64, error)
Total returns the total of all index counts for all providers.