cache

package
v0.10.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FullAvailabilityWithLocalRandSquare added in v0.6.2

func FullAvailabilityWithLocalRandSquare(t *testing.T, n int) (share.Availability, *share.Root)

FullAvailabilityWithLocalRandSquare wraps full.GetterWithRandSquare with cache availability

func LightAvailabilityWithLocalRandSquare added in v0.6.2

func LightAvailabilityWithLocalRandSquare(t *testing.T, n int) (share.Availability, *share.Root)

LightAvailabilityWithLocalRandSquare wraps light.GetterWithRandSquare with cache availability

Types

type ShareAvailability

type ShareAvailability struct {
	// contains filtered or unexported fields
}

ShareAvailability wraps a given share.Availability (whether it's light or full) and stores the results of a successful sampling routine over a given Root's hash to disk.

func NewShareAvailability

func NewShareAvailability(
	avail share.Availability,
	ds datastore.Batching,
) *ShareAvailability

NewShareAvailability wraps the given share.Availability with an additional datastore for sampling result caching.

func (*ShareAvailability) Close

func (ca *ShareAvailability) Close(ctx context.Context) error

Close flushes all queued writes to disk.

func (*ShareAvailability) ProbabilityOfAvailability

func (ca *ShareAvailability) ProbabilityOfAvailability(ctx context.Context) float64

func (*ShareAvailability) SharesAvailable

func (ca *ShareAvailability) SharesAvailable(ctx context.Context, root *share.Root) error

SharesAvailable will store, upon success, the hash of the given Root to disk.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL