retrystore

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 4 Imported by: 2

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastore

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

	ds.Batching
}

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(ctx context.Context) (uint64, error)

DiskUsage implements the PersistentDatastore interface.

func (*Datastore) Get

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

Get retrieves a value given a key.

func (*Datastore) GetSize

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

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

func (*Datastore) Has

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

Has checks if a key is stored.

func (*Datastore) Put

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

Put stores a key/value.

func (*Datastore) Sync added in v0.3.0

func (d *Datastore) Sync(ctx context.Context, prefix ds.Key) error

Sync implements Datastore.Sync

Jump to

Keyboard shortcuts

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