queue

package
v0.0.0-...-3597e88 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetCode

type AssetCode string
const (
	AssetCodeBTC AssetCode = "BTC"
	AssetCodeETH AssetCode = "ETH"
)

type MockQueue

type MockQueue struct {
	mock.Mock
}

MockQueue is a mockable queue.

func (*MockQueue) QueueAdd

func (m *MockQueue) QueueAdd(tx Transaction) error

func (*MockQueue) QueuePool

func (m *MockQueue) QueuePool() (*Transaction, error)

type Queue

type Queue interface {
	// QueueAdd inserts the element to this queue. If element already exists in a queue, it should
	// return nil.
	QueueAdd(tx Transaction) error
	// QueuePool receives and removes the head of this queue. Returns nil if no elements found.
	QueuePool() (*Transaction, error)
}

Queue implements transactions queue. The queue must not allow duplicates (including history) or must implement deduplication interval so it should not allow duplicate entries for 5 minutes since the first entry with the same ID was added. This is a critical requirement! Otherwise ETH/BTC may be sent twice to Stellar account. If you don't know what to do, use default AWS SQS FIFO queue or DB queue.

type SQSFiFo

type SQSFiFo struct{}

func (*SQSFiFo) Add

func (s *SQSFiFo) Add(tx Transaction) error

func (*SQSFiFo) Pool

func (s *SQSFiFo) Pool() (*Transaction, error)

type Transaction

type Transaction struct {
	TransactionID string
	AssetCode     AssetCode
	// CRITICAL REQUIREMENT: Amount in the base unit of currency.
	// For 10 satoshi this should be equal 0.0000001
	// For 1 BTC      this should be equal 1.0000000
	// For 1 Finney   this should be equal 0.0010000
	// For 1 ETH      this should be equal 1.0000000
	// Currently, the length of Amount string shouldn't be longer than 17 characters.
	Amount           string
	StellarPublicKey string
}

Jump to

Keyboard shortcuts

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