datastore

package
v0.0.0-...-06c96c1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client() *elastic.Client

func Index

func Index(index string) string

func RegisterMapping

func RegisterMapping(index, fileName string)

func Setup

func Setup(ctx context.Context) error

func StoreBlock

func StoreBlock(ctx context.Context, b BlockData) (*elastic.IndexResponse, error)

func StoreTransaction

func StoreTransaction(ctx context.Context, t *TransactionData) (*elastic.IndexResponse, error)

Types

type BlockData

type BlockData struct {
	Block             *flojson.GetBlockVerboseResult `json:"block"`
	SecSinceLastBlock int64                          `json:"sec_since_last_block"`
	Orphaned          bool                           `json:"orphaned"`
}

func GetBlockFromID

func GetBlockFromID(ctx context.Context, id string) (BlockData, error)

func GetLastBlock

func GetLastBlock(ctx context.Context) (BlockData, error)

type BulkIndexer

type BulkIndexer struct {
	// contains filtered or unexported fields
}
var AutoBulk BulkIndexer

func BeginBulkIndexer

func BeginBulkIndexer() BulkIndexer

func (*BulkIndexer) Add

func (bi *BulkIndexer) Add(bir ...elastic.BulkableRequest)

func (*BulkIndexer) BeginTimedCommits

func (bi *BulkIndexer) BeginTimedCommits(rate time.Duration)

func (*BulkIndexer) CheckSizeStore

func (bi *BulkIndexer) CheckSizeStore(ctx context.Context) (BulkIndexerResponse, error)

func (*BulkIndexer) Commit

func (bi *BulkIndexer) Commit()

func (*BulkIndexer) DeleteBlock

func (bi *BulkIndexer) DeleteBlock(hash string)

func (*BulkIndexer) Do

func (bi *BulkIndexer) Do(ctx context.Context) (*elastic.BulkResponse, error)

func (*BulkIndexer) EndTimedCommit

func (bi *BulkIndexer) EndTimedCommit()

func (*BulkIndexer) EstimateSizeInBytes

func (bi *BulkIndexer) EstimateSizeInBytes() int64

func (*BulkIndexer) NumberOfActions

func (bi *BulkIndexer) NumberOfActions() int

func (*BulkIndexer) OrphanBlock

func (bi *BulkIndexer) OrphanBlock(hash string)

func (*BulkIndexer) StoreBlock

func (bi *BulkIndexer) StoreBlock(bd BlockData)

func (*BulkIndexer) StoreTransaction

func (bi *BulkIndexer) StoreTransaction(td *TransactionData)

type BulkIndexerResponse

type BulkIndexerResponse struct {
	*elastic.BulkResponse
	EstimatedSize int64
	Stored        bool
}

type TransactionData

type TransactionData struct {
	Block       int64                `json:"block"`
	BlockHash   string               `json:"block_hash"`
	Confirmed   bool                 `json:"confirmed"`
	IsCoinbase  bool                 `json:"is_coinbase"`
	Transaction *flojson.TxRawResult `json:"tx"`
	Fee         *float64             `json:"fee,omitempty"`
	FeeSat      *int64               `json:"fee_sat,omitempty"`
}

func GetTransactionFromID

func GetTransactionFromID(ctx context.Context, id string) (TransactionData, error)

Jump to

Keyboard shortcuts

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