Documentation ¶
Index ¶
- type AddressAssociation
- type Chain
- type Database
- type MockDatabase
- func (m *MockDatabase) AddProcessedTransaction(chain Chain, transactionID, receivingAddress string) (alreadyProcessing bool, err error)
- func (m *MockDatabase) AddRecoveryTransaction(sourceAccount string, txEnvelope string) error
- func (m *MockDatabase) CreateAddressAssociation(chain Chain, stellarAddress, address string, addressIndex uint32) error
- func (m *MockDatabase) GetAssociationByChainAddress(chain Chain, address string) (*AddressAssociation, error)
- func (m *MockDatabase) GetAssociationByStellarPublicKey(stellarPublicKey string) (*AddressAssociation, error)
- func (m *MockDatabase) IncrementAddressIndex(chain Chain) (uint32, error)
- func (m *MockDatabase) ResetBlockCounters() error
- type PostgresDatabase
- func (d *PostgresDatabase) AddEvent(event sse.Event) error
- func (d *PostgresDatabase) AddProcessedTransaction(chain Chain, transactionID, receivingAddress string) (bool, error)
- func (d *PostgresDatabase) AddRecoveryTransaction(sourceAccount string, txEnvelope string) error
- func (d *PostgresDatabase) CreateAddressAssociation(chain Chain, stellarAddress, address string, addressIndex uint32) error
- func (d *PostgresDatabase) GetAssociationByChainAddress(chain Chain, address string) (*AddressAssociation, error)
- func (d *PostgresDatabase) GetAssociationByStellarPublicKey(stellarPublicKey string) (*AddressAssociation, error)
- func (d *PostgresDatabase) GetBitcoinBlockToProcess() (uint64, error)
- func (d *PostgresDatabase) GetEthereumBlockToProcess() (uint64, error)
- func (d *PostgresDatabase) GetEventsSinceID(id int64) (int64, []sse.Event, error)
- func (d *PostgresDatabase) IncrementAddressIndex(chain Chain) (uint32, error)
- func (d *PostgresDatabase) Open(dsn string) error
- func (d *PostgresDatabase) QueueAdd(tx queue.Transaction) error
- func (d *PostgresDatabase) QueuePool() (*queue.Transaction, error)
- func (d *PostgresDatabase) ResetBlockCounters() error
- func (d *PostgresDatabase) SaveLastProcessedBitcoinBlock(block uint64) error
- func (d *PostgresDatabase) SaveLastProcessedEthereumBlock(block uint64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressAssociation ¶
type Database ¶
type Database interface { // CreateAddressAssociation creates Bitcoin/Ethereum-Stellar association. `addressIndex` // is the chain (Bitcoin/Ethereum) address derivation index (BIP-32). CreateAddressAssociation(chain Chain, stellarAddress, address string, addressIndex uint32) error // GetAssociationByChainAddress searches for previously saved Bitcoin/Ethereum-Stellar association. // Should return nil if not found. GetAssociationByChainAddress(chain Chain, address string) (*AddressAssociation, error) // GetAssociationByStellarPublicKey searches for previously saved Bitcoin/Ethereum-Stellar association. // Should return nil if not found. GetAssociationByStellarPublicKey(stellarPublicKey string) (*AddressAssociation, error) // AddProcessedTransaction adds a transaction to database as processed. This // should return `true` and no error if transaction processing has already started/finished. AddProcessedTransaction(chain Chain, transactionID, receivingAddress string) (alreadyProcessing bool, err error) // IncrementAddressIndex returns the current value of index used for `chain` key // derivation and then increments it. This operation must be atomic so this function // should never return the same value more than once. IncrementAddressIndex(chain Chain) (uint32, error) // ResetBlockCounters changes last processed bitcoin and ethereum block to default value. // Used in stress tests. ResetBlockCounters() error // AddRecoveryTransaction inserts recovery account ID and transaction envelope AddRecoveryTransaction(sourceAccount string, txEnvelope string) error }
type MockDatabase ¶
MockDatabase is a mockable database.
func (*MockDatabase) AddProcessedTransaction ¶
func (m *MockDatabase) AddProcessedTransaction(chain Chain, transactionID, receivingAddress string) (alreadyProcessing bool, err error)
func (*MockDatabase) AddRecoveryTransaction ¶
func (m *MockDatabase) AddRecoveryTransaction(sourceAccount string, txEnvelope string) error
func (*MockDatabase) CreateAddressAssociation ¶
func (m *MockDatabase) CreateAddressAssociation(chain Chain, stellarAddress, address string, addressIndex uint32) error
func (*MockDatabase) GetAssociationByChainAddress ¶
func (m *MockDatabase) GetAssociationByChainAddress(chain Chain, address string) (*AddressAssociation, error)
func (*MockDatabase) GetAssociationByStellarPublicKey ¶
func (m *MockDatabase) GetAssociationByStellarPublicKey(stellarPublicKey string) (*AddressAssociation, error)
func (*MockDatabase) IncrementAddressIndex ¶
func (m *MockDatabase) IncrementAddressIndex(chain Chain) (uint32, error)
func (*MockDatabase) ResetBlockCounters ¶
func (m *MockDatabase) ResetBlockCounters() error
type PostgresDatabase ¶
type PostgresDatabase struct {
// contains filtered or unexported fields
}
func (*PostgresDatabase) AddEvent ¶
func (d *PostgresDatabase) AddEvent(event sse.Event) error
AddEvent adds a new server-sent event to the storage.
func (*PostgresDatabase) AddProcessedTransaction ¶
func (d *PostgresDatabase) AddProcessedTransaction(chain Chain, transactionID, receivingAddress string) (bool, error)
func (*PostgresDatabase) AddRecoveryTransaction ¶
func (d *PostgresDatabase) AddRecoveryTransaction(sourceAccount string, txEnvelope string) error
func (*PostgresDatabase) CreateAddressAssociation ¶
func (d *PostgresDatabase) CreateAddressAssociation(chain Chain, stellarAddress, address string, addressIndex uint32) error
func (*PostgresDatabase) GetAssociationByChainAddress ¶
func (d *PostgresDatabase) GetAssociationByChainAddress(chain Chain, address string) (*AddressAssociation, error)
func (*PostgresDatabase) GetAssociationByStellarPublicKey ¶
func (d *PostgresDatabase) GetAssociationByStellarPublicKey(stellarPublicKey string) (*AddressAssociation, error)
func (*PostgresDatabase) GetBitcoinBlockToProcess ¶
func (d *PostgresDatabase) GetBitcoinBlockToProcess() (uint64, error)
func (*PostgresDatabase) GetEthereumBlockToProcess ¶
func (d *PostgresDatabase) GetEthereumBlockToProcess() (uint64, error)
func (*PostgresDatabase) GetEventsSinceID ¶
GetEventsSinceID returns all events since `id`. Used to load and publish all broadcasted events. It returns the last event ID, list of events or error. If `id` is equal `-1`:
- it should return the last event ID and empty list if at least one event has been broadcasted.
- it should return `0` if no events have been broadcasted.
func (*PostgresDatabase) IncrementAddressIndex ¶
func (d *PostgresDatabase) IncrementAddressIndex(chain Chain) (uint32, error)
func (*PostgresDatabase) Open ¶
func (d *PostgresDatabase) Open(dsn string) error
func (*PostgresDatabase) QueueAdd ¶
func (d *PostgresDatabase) QueueAdd(tx queue.Transaction) error
QueueAdd implements queue.Queue interface. If element already exists in a queue, it should return nil.
func (*PostgresDatabase) QueuePool ¶
func (d *PostgresDatabase) QueuePool() (*queue.Transaction, error)
QueuePool receives and removes the head of this queue. Returns nil if no elements found. QueuePool implements queue.Queue interface.
func (*PostgresDatabase) ResetBlockCounters ¶
func (d *PostgresDatabase) ResetBlockCounters() error
func (*PostgresDatabase) SaveLastProcessedBitcoinBlock ¶
func (d *PostgresDatabase) SaveLastProcessedBitcoinBlock(block uint64) error
func (*PostgresDatabase) SaveLastProcessedEthereumBlock ¶
func (d *PostgresDatabase) SaveLastProcessedEthereumBlock(block uint64) error
Click to show internal directories.
Click to hide internal directories.