memory

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const LoggerTag = "DATASTORE"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Signer is an instance of the ethereum.Signer which will be used to
	// verify price signatures.
	Signer ethereum.Signer
	// Transport is a implementation of transport used to fetch prices from
	// feeders.
	Transport transport.Transport
	// Pairs is the list supported pairs by the datastore with their
	// configuration.
	Pairs map[string]*Pair
	// Logger is a current logger interface used by the Datastore.
	// The Logger is required to monitor asynchronous processes.
	Logger log.Logger
}

type Datastore

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

Datastore reads and stores prices from the P2P network.

func NewDatastore

func NewDatastore(cfg Config) (*Datastore, error)

func (*Datastore) Prices

func (c *Datastore) Prices() datastore.PriceStore

Prices implements the datastore.Datastore interface.

func (*Datastore) Start

func (c *Datastore) Start(ctx context.Context) error

Start implements the datastore.Datastore interface.

func (*Datastore) Wait

func (c *Datastore) Wait() chan error

Wait implements the datastore.Datastore interface.

type Pair

type Pair struct {
	// Feeds is the list of Ethereum addresses from which prices will be
	// accepted.
	Feeds []ethereum.Address
}

type PriceStore

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

PriceStore contains a list of messages.Price's.

func NewPriceStore

func NewPriceStore() *PriceStore

NewPriceStore creates a new store instance.

func (*PriceStore) Add

func (p *PriceStore) Add(from ethereum.Address, msg *messages.Price)

Add implements the datastore.PriceStore interface.

func (*PriceStore) All

All implements the datastore.PriceStore interface.

func (*PriceStore) AssetPair

func (p *PriceStore) AssetPair(assetPair string) []*messages.Price

AssetPair implements the datastore.PriceStore interface.

func (*PriceStore) Feeder

func (p *PriceStore) Feeder(assetPair string, feeder ethereum.Address) *messages.Price

Feeder implements the datastore.PriceStore interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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