Version: v0.0.0-...-ce94876 Latest Latest

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

Go to latest
Published: Jan 1, 2019 License: MIT, MIT Imports: 3 Imported by: 0



Package retrystore provides a datastore wrapper which allows to retry operations.



This section is empty.


This section is empty.


This section is empty.


type Datastore

type Datastore struct {
	TempErrFunc func(error) bool
	Retries     int
	Delay       time.Duration


Datastore wraps a Batching datastore with a user-provided TempErrorFunc -which determines if an error is a temporal error and thus, worth retrying-, an amount of Retries -which specify how many times to retry an operation after a temporal error- and a base Delay, which is multiplied by the current retry and performs a pause before attempting the operation again.

func (*Datastore) DiskUsage

func (d *Datastore) DiskUsage() (uint64, error)

DiskUsage implements the PersistentDatastore interface.

func (*Datastore) Get

func (d *Datastore) Get(k ds.Key) ([]byte, error)

Get retrieves a value given a key.

func (*Datastore) GetSize

func (d *Datastore) GetSize(k ds.Key) (int, error)

GetSize returns the size of the value in the datastore, if present.

func (*Datastore) Has

func (d *Datastore) Has(k ds.Key) (bool, error)

Has checks if a key is stored.

func (*Datastore) Put

func (d *Datastore) Put(k ds.Key, val []byte) error

Put stores a key/value.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL