crawler

package
v0.4.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewObservableStatus added in v0.2.0

func NewObservableStatus() *observableStatus

Types

type AddressEvent

type AddressEvent struct {
	EventType    EventType
	AccountIndex int
	Address      string
	Utxos        []explorer.Utxo
}

func (AddressEvent) Type

func (a AddressEvent) Type() EventType

type AddressObservable

type AddressObservable struct {
	AccountIndex int
	Address      string
	BlindingKey  []byte
}

type CloseEvent added in v0.2.0

type CloseEvent struct{}

func (CloseEvent) Type added in v0.2.0

func (q CloseEvent) Type() EventType

type Event

type Event interface {
	Type() EventType
}

Event are emitted through a channel during observation.

type EventType

type EventType int
const (
	CloseSignal EventType = iota
	FeeAccountDeposit
	MarketAccountDeposit
	TransactionConfirmed
	TransactionUnConfirmed
)

func (EventType) String

func (et EventType) String() string

type Observable

type Observable interface {
	// contains filtered or unexported methods
}

Observable represent object that can be observe on the blockchain.

type Opts

type Opts struct {
	ExplorerSvc explorer.Service
	//crawler interval in milliseconds
	CrawlerInterval time.Duration
	//number of requests per second
	ExplorerLimit int
	//number of bursts tokens permitted
	ExplorerTokenBurst int
	ErrorHandler       func(err error)
}

Opts defines the parameters needed for creating a crawler service with NewService method

type Service

type Service interface {
	Start()
	Stop()
	AddObservable(observable Observable)
	RemoveObservable(observable Observable)
	IsObservingAddresses(addresses []string) bool
	GetEventChannel() chan Event
}

Service is the interface for Crawler

func NewService

func NewService(opts Opts) Service

NewService returns an utxoCrawelr that is ready for watch for blockchain activites. Use Start and Stop methods to manage it.

type Status added in v0.2.0

type Status string
const (
	New       Status = "NEW"
	Waiting   Status = "WAITING"
	Processed Status = "PROCESSED"
)

type TransactionEvent

type TransactionEvent struct {
	TxID      string
	TxHex     string
	EventType EventType
	BlockHash string
	BlockTime float64
}

func (TransactionEvent) Type

func (t TransactionEvent) Type() EventType

type TransactionObservable

type TransactionObservable struct {
	TxID  string
	TxHex string
}

Jump to

Keyboard shortcuts

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