rest

package
v0.0.0-...-984cba4 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxHeaderSize max size of content
	MaxHeaderSize = 16 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LevelDBReceiptStoreConf

type LevelDBReceiptStoreConf struct {
	ReceiptStoreConf
	Path string `json:"path"`
}

LevelDBReceiptStoreConf is the configuration for a LevelDB receipt store

type MongoCollection

type MongoCollection interface {
	Insert(...interface{}) error
	Create(info *mgo.CollectionInfo) error
	EnsureIndex(index mgo.Index) error
	Find(query interface{}) MongoQuery
}

MongoCollection is the subset of mgo that we use, allowing stubbing

type MongoDBReceiptStoreConf

type MongoDBReceiptStoreConf struct {
	ReceiptStoreConf
	URL              string `json:"url"`
	Database         string `json:"database"`
	Collection       string `json:"collection"`
	ConnectTimeoutMS int    `json:"connectTimeout"`
}

MongoDBReceiptStoreConf is the configuration for a MongoDB receipt store

type MongoDatabase

type MongoDatabase interface {
	Connect(url string, timeout time.Duration) error
	GetCollection(database string, collection string) MongoCollection
}

MongoDatabase is a subset of mgo that we use, allowing stubbing.

type MongoQuery

type MongoQuery interface {
	Limit(n int) *mgo.Query
	Skip(n int) *mgo.Query
	Sort(fields ...string) *mgo.Query
	All(result interface{}) error
	One(result interface{}) error
}

MongoQuery is the subset of mgo that we use, allowing stubbing

type RESTGateway

type RESTGateway struct {
	// contains filtered or unexported fields
}

RESTGateway as the HTTP gateway interface for ethconnect

func NewRESTGateway

func NewRESTGateway(printYAML *bool) (g *RESTGateway)

NewRESTGateway constructor

func (*RESTGateway) CobraInit

func (g *RESTGateway) CobraInit(cmdName string) (cmd *cobra.Command)

CobraInit retruns a cobra command to configure this KafkaBridge

func (*RESTGateway) Conf

func (g *RESTGateway) Conf() *RESTGatewayConf

Conf gets the config for this bridge

func (*RESTGateway) DispatchMsgAsync

func (g *RESTGateway) DispatchMsgAsync(ctx context.Context, msg map[string]interface{}, ack bool) (*messages.AsyncSentMsg, error)

DispatchMsgAsync is the rest2eth interface method for async dispatching of messages (via our webhook logic)

func (*RESTGateway) SetConf

func (g *RESTGateway) SetConf(conf *RESTGatewayConf)

SetConf sets the config for this bridge

func (*RESTGateway) Start

func (g *RESTGateway) Start() (err error)

Start kicks off the HTTP listener and router

func (*RESTGateway) ValidateConf

func (g *RESTGateway) ValidateConf() (err error)

ValidateConf validates the config

type RESTGatewayConf

type RESTGatewayConf struct {
	Kafka    kafka.KafkaCommonConf                    `json:"kafka"`
	MongoDB  MongoDBReceiptStoreConf                  `json:"mongodb"`
	LevelDB  LevelDBReceiptStoreConf                  `json:"leveldb"`
	MemStore ReceiptStoreConf                         `json:"memstore"`
	OpenAPI  contractgateway.SmartContractGatewayConf `json:"openapi"`
	HTTP     struct {
		LocalAddr string          `json:"localAddr"`
		Port      int             `json:"port"`
		TLS       utils.TLSConfig `json:"tls"`
	} `json:"http"`
	WebhooksDirectConf
}

RESTGatewayConf defines the YAML config structure for a webhooks bridge instance

type ReceiptStoreConf

type ReceiptStoreConf struct {
	MaxDocs             int `json:"maxDocs"`
	QueryLimit          int `json:"queryLimit"`
	RetryInitialDelayMS int `json:"retryInitialDelay"`
	RetryTimeoutMS      int `json:"retryTimeout"`
}

ReceiptStoreConf is the common configuration for all receipt stores

type ReceiptStorePersistence

type ReceiptStorePersistence interface {
	GetReceipts(skip, limit int, ids []string, sinceEpochMS int64, from, to, start string) (*[]map[string]interface{}, error)
	GetReceipt(requestID string) (*map[string]interface{}, error)
	AddReceipt(requestID string, receipt *map[string]interface{}) error
}

ReceiptStorePersistence interface implemented by persistence layers

type WebhooksDirectConf

type WebhooksDirectConf struct {
	MaxInFlight int `json:"maxInFlight"`
	tx.TxnProcessorConf
	eth.RPCConf
}

WebhooksDirectConf defines the YAML structore for a Webhooks direct to RPC bridge

Jump to

Keyboard shortcuts

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