burrow: github.com/hyperledger/burrow/vent/service Index | Files

package service

import "github.com/hyperledger/burrow/vent/service"


Package Files

abi_provider.go block_consumer.go constants.go consumer.go decoder.go rowbuilder.go server.go

func NewBlockConsumer Uses

func NewBlockConsumer(projection *sqlsol.Projection, opt sqlsol.SpecOpt, getEventSpec EventSpecGetter,
    eventCh chan<- types.EventData, doneCh chan struct{},
    logger *logging.Logger) func(blockExecution *exec.BlockExecution) error

func UTF8StringFromBytes Uses

func UTF8StringFromBytes(bs []byte) (string, error)

Checks whether the bytes passed are valid utf8 string bytes. If they are not returns a sanitised string version of the bytes with offending sequences replaced by the utf8 replacement/error rune and an error indicating the offending byte sequences and their position. Note: always returns a valid string regardless of error.

type AbiProvider Uses

type AbiProvider struct {
    // contains filtered or unexported fields

AbiProvider provides a method for loading ABIs from disk, and retrieving them from burrow on-demand

func NewAbiProvider Uses

func NewAbiProvider(paths []string, cli rpcquery.QueryClient, logger *logging.Logger) (provider *AbiProvider, err error)

NewAbiProvider loads ABIs from the filesystem. A set of zero or more files or directories can be passed in the path argument. If an event is encountered for which no ABI is known, it is retrieved from burrow

func (*AbiProvider) GetEventAbi Uses

func (p *AbiProvider) GetEventAbi(eventID abi.EventID, address crypto.Address) (*abi.EventSpec, error)

GetEventAbi get the ABI for a particular eventID. If it is not known, it is retrieved from the burrow node via the address for the contract

type Consumer Uses

type Consumer struct {
    Config         *config.VentConfig
    Logger         *logging.Logger
    DB             *sqldb.SQLDB
    GRPCConnection *grpc.ClientConn
    // external events channel used for when vent is leveraged as a library
    EventsChannel chan types.EventData
    Done          chan struct{}

    // contains filtered or unexported fields

Consumer contains basic configuration for consumer to run

func NewConsumer Uses

func NewConsumer(cfg *config.VentConfig, log *logging.Logger, eventChannel chan types.EventData) *Consumer

NewConsumer constructs a new consumer configuration. The event channel will be passed a collection of rows generated from all of the events in a single block It will be closed by the consumer when it is finished

func (*Consumer) Health Uses

func (c *Consumer) Health() error

Health returns the health status for the consumer

func (*Consumer) Run Uses

func (c *Consumer) Run(projection *sqlsol.Projection, stream bool) error

Run connects to a grpc service and subscribes to log events, then gets tables structures, maps them & parse event data. Store data in SQL event tables, it runs forever

func (*Consumer) Shutdown Uses

func (c *Consumer) Shutdown()

Shutdown gracefully shuts down the events consumer

type EventSpecGetter Uses

type EventSpecGetter func(abi.EventID, crypto.Address) (*abi.EventSpec, error)

type Server Uses

type Server struct {
    Config   *config.VentConfig
    Log      *logging.Logger
    Consumer *Consumer
    // contains filtered or unexported fields

Server exposes HTTP endpoints for the service

func NewServer Uses

func NewServer(cfg *config.VentConfig, log *logging.Logger, consumer *Consumer) *Server

NewServer returns a new HTTP server

func (*Server) Run Uses

func (s *Server) Run()

Run starts the HTTP server

func (*Server) ServeHTTP Uses

func (s *Server) ServeHTTP(resp http.ResponseWriter, req *http.Request)

ServeHTTP dispatches the HTTP requests using the Server Mux

func (*Server) Shutdown Uses

func (s *Server) Shutdown()

Shutdown gracefully shuts down the HTTP Server

type Status Uses

type Status struct {
    LastProcessedHeight uint64
    Burrow              *rpc.ResultStatus

Status announcement

Package service imports 29 packages (graph) and is imported by 4 packages. Updated 2020-11-30. Refresh now. Tools for package owners.