database

package
v0.0.0-...-477c745 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AnchorDataStr []byte = []byte("AnchorData")
View Source
var CHAIN_HEAD = []byte("ChainHead")
View Source
var ProgramStateStr []byte = []byte("ProgramState")

Functions

func UintToHash

func UintToHash(i uint32) interfaces.IHash

Types

type AnchorData

type AnchorData struct {
	AnchorDataBase
}

func (*AnchorData) DatabasePrimaryIndex

func (e *AnchorData) DatabasePrimaryIndex() interfaces.IHash

func (*AnchorData) DatabaseSecondaryIndex

func (e *AnchorData) DatabaseSecondaryIndex() interfaces.IHash

func (*AnchorData) GetChainID

func (e *AnchorData) GetChainID() interfaces.IHash

func (*AnchorData) GetDatabaseHeight

func (e *AnchorData) GetDatabaseHeight() uint32

func (*AnchorData) IsComplete

func (c *AnchorData) IsComplete() bool

IsComplete returns whether or not a given anchor has been recorded back into Factom

func (*AnchorData) IsSubmitted

func (c *AnchorData) IsSubmitted() bool

IsSubmitted returns whether or not an Ethereum transaction has been submitted for this anchor

func (*AnchorData) JSONBuffer

func (e *AnchorData) JSONBuffer(b *bytes.Buffer) error

func (*AnchorData) JSONByte

func (e *AnchorData) JSONByte() ([]byte, error)

func (*AnchorData) JSONString

func (e *AnchorData) JSONString() (string, error)

func (*AnchorData) MarshalBinary

func (e *AnchorData) MarshalBinary() ([]byte, error)

func (*AnchorData) New

func (*AnchorData) String

func (e *AnchorData) String() string

func (*AnchorData) UnmarshalBinary

func (e *AnchorData) UnmarshalBinary(data []byte) (err error)

func (*AnchorData) UnmarshalBinaryData

func (e *AnchorData) UnmarshalBinaryData(data []byte) (newData []byte, err error)

type AnchorDataBase

type AnchorDataBase struct {
	MerkleRoot   string // Merkle Root of a 1000 block window of Directory Blocks
	DBlockHeight uint32 // Maximum height that is in the 1000 block window

	EthereumRecordHeight    uint32 // Directory Block height for this Ethereum anchor's record within Factom
	EthereumRecordEntryHash string // Entry Hash for this Ethereum anchor's record within Factom

	Ethereum struct {
		ContractAddress string // Contract Address that the anchor was put into
		TxID            string //0x50ea0effc383542811a58704a6d6842ed6d76439a2d942d941896ad097c06a78
		BlockHeight     int64  //293003
		BlockHash       string //0x3b504616495fc9cf7be9b5b776692a9abbfb95491fa62abf62dcdf4d53ff5979
		TxIndex         int64  // Transaction index within its block
	}
}

type AnchorDatabaseOverlay

type AnchorDatabaseOverlay struct {
	databaseOverlay.Overlay
}

func NewBoltDB

func NewBoltDB(boltPath string) (*AnchorDatabaseOverlay, error)

func NewLevelDB

func NewLevelDB(ldbpath string) (*AnchorDatabaseOverlay, error)

func NewMapDB

func NewMapDB() *AnchorDatabaseOverlay

func (*AnchorDatabaseOverlay) FetchAnchorData

func (db *AnchorDatabaseOverlay) FetchAnchorData(dbHeight uint32) (*AnchorData, error)

func (*AnchorDatabaseOverlay) FetchAnchorDataHead

func (db *AnchorDatabaseOverlay) FetchAnchorDataHead() (*AnchorData, error)

func (*AnchorDatabaseOverlay) FetchNextHighestAnchorDataSubmitted

func (db *AnchorDatabaseOverlay) FetchNextHighestAnchorDataSubmitted(height uint32) (*AnchorData, error)

func (*AnchorDatabaseOverlay) FetchProgramState

func (db *AnchorDatabaseOverlay) FetchProgramState() (*ProgramState, error)

func (*AnchorDatabaseOverlay) InsertAnchorData

func (db *AnchorDatabaseOverlay) InsertAnchorData(data *AnchorData, isHead bool) error

func (*AnchorDatabaseOverlay) InsertProgramState

func (db *AnchorDatabaseOverlay) InsertProgramState(data *ProgramState) error

func (*AnchorDatabaseOverlay) UpdateAnchorDataHead

func (db *AnchorDatabaseOverlay) UpdateAnchorDataHead() error

type PendingTxInfo

type PendingTxInfo struct {
	Nonce          uint64
	IsMandatory    bool   // whether or not this transaction needs to go through for this Directory Block height
	EthTxID        string // the transactionid as it can be found in the eth blockchain
	EthTxGasPrice  int64  // the eth/gas that this transaction is offering
	FactomDBheight uint32 // the factom directory block height that this transaction updates
	FactomDBkeyMR  string // the factom directory block key merkle root that this transaction sets
	TxTime         int64  // the unix time that this transaction was created and broadcast into the eth p2p network
}

type ProgramState

type ProgramState struct {
	ProgramStateBase
	ProgramStateMutex sync.Mutex
}

func (*ProgramState) JSONBuffer

func (e *ProgramState) JSONBuffer(b *bytes.Buffer) error

func (*ProgramState) JSONByte

func (e *ProgramState) JSONByte() ([]byte, error)

func (*ProgramState) JSONString

func (e *ProgramState) JSONString() (string, error)

func (*ProgramState) MarshalBinary

func (e *ProgramState) MarshalBinary() ([]byte, error)

func (*ProgramState) String

func (e *ProgramState) String() string

func (*ProgramState) UnmarshalBinary

func (e *ProgramState) UnmarshalBinary(data []byte) (err error)

func (*ProgramState) UnmarshalBinaryData

func (e *ProgramState) UnmarshalBinaryData(data []byte) (newData []byte, err error)

type ProgramStateBase

type ProgramStateBase struct {
	LastEthereumBlockChecked        int64
	LastFactomDBlockHeightChecked   uint32
	LastConfirmedAnchorDBlockHeight uint32
	PendingTx                       *PendingTxInfo
}

Jump to

Keyboard shortcuts

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