meshdb

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2019 License: Apache-2.0 Imports: 8 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MeshDB

type MeshDB struct {
	MiniHeaders *MiniHeadersCollection
	Orders      *OrdersCollection
	// contains filtered or unexported fields
}

MeshDB instantiates the DB connection and creates all the collections used by the application

func NewMeshDB

func NewMeshDB(path string) (*MeshDB, error)

NewMeshDB instantiates a new MeshDB instance

func (*MeshDB) Close

func (m *MeshDB) Close()

Close closes the database connection

func (*MeshDB) FindAllMiniHeadersSortedByNumber

func (m *MeshDB) FindAllMiniHeadersSortedByNumber() ([]*MiniHeader, error)

FindAllMiniHeadersSortedByNumber returns all MiniHeaders sorted by block number

func (*MeshDB) FindLatestMiniHeader

func (m *MeshDB) FindLatestMiniHeader() (*MiniHeader, error)

FindLatestMiniHeader returns the latest MiniHeader (i.e. the one with the largest block number), or nil if there are none in the database.

func (*MeshDB) FindOrdersByMakerAddress

func (m *MeshDB) FindOrdersByMakerAddress(makerAddress common.Address) ([]*Order, error)

FindOrdersByMakerAddress finds all orders belonging to a particular maker address

func (*MeshDB) FindOrdersByMakerAddressAndMaxSalt

func (m *MeshDB) FindOrdersByMakerAddressAndMaxSalt(makerAddress common.Address, salt *big.Int) ([]*Order, error)

FindOrdersByMakerAddressAndMaxSalt finds all orders belonging to a particular maker address that also have a salt value less then or equal to X

func (*MeshDB) FindOrdersByMakerAddressTokenAddressAndTokenID

func (m *MeshDB) FindOrdersByMakerAddressTokenAddressAndTokenID(makerAddress, tokenAddress common.Address, tokenID *big.Int) ([]*Order, error)

FindOrdersByMakerAddressTokenAddressAndTokenID finds all orders belonging to a particular maker address where makerAssetData encodes for a particular token contract and optionally a token ID

func (*MeshDB) FindOrdersLastUpdatedBefore

func (m *MeshDB) FindOrdersLastUpdatedBefore(lastUpdated time.Time) ([]*Order, error)

FindOrdersLastUpdatedBefore finds all orders where the LastUpdated time is less than X

type MiniHeader

type MiniHeader struct {
	Hash   common.Hash
	Parent common.Hash
	Number *big.Int
	Logs   []types.Log
}

MiniHeader is the database representation of a succinct Ethereum block headers

func (*MiniHeader) ID

func (m *MiniHeader) ID() []byte

ID returns the MiniHeader's ID

type MiniHeadersCollection

type MiniHeadersCollection struct {
	*db.Collection
	// contains filtered or unexported fields
}

MiniHeadersCollection represents a DB collection of mini Ethereum block headers

type Order

type Order struct {
	Hash        common.Hash
	SignedOrder *zeroex.SignedOrder
	// When was this order last validated
	LastUpdated time.Time
	// How much of this order can still be filled
	FillableTakerAssetAmount *big.Int
	// Was this order flagged for removal? Due to the possibility of block-reorgs, instead
	// of immediately removing an order when FillableTakerAssetAmount becomes 0, we instead
	// flag it for removal. After this order isn't updated for X time and has IsRemoved = true,
	// the order can be permanently deleted.
	IsRemoved bool
}

Order is the database representation a 0x order along with some relevant metadata

func (Order) ID

func (o Order) ID() []byte

ID returns the Order's ID

type OrdersCollection

type OrdersCollection struct {
	*db.Collection
	MakerAddressAndSaltIndex             *db.Index
	MakerAddressTokenAddressTokenIDIndex *db.Index
	LastUpdatedIndex                     *db.Index
	IsRemovedIndex                       *db.Index
}

OrdersCollection represents a DB collection of 0x orders

Jump to

Keyboard shortcuts

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