tmpop

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2019 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CodeTypeValidation is the ABCI error code for a validation error.
	CodeTypeValidation uint32 = 400

	// CodeTypeInternalError is the ABCI error code for an internal error.
	CodeTypeInternalError uint32 = 500

	// CodeTypeNotImplemented is the ABCI error code for a feature not yet implemented.
	CodeTypeNotImplemented uint32 = 501
)
View Source
const (
	AddEvidence   = "AddEvidence"
	FindSegments  = "FindSegments"
	GetEvidences  = "GetEvidences"
	GetInfo       = "GetInfo"
	GetMapIDs     = "GetMapIDs"
	GetSegment    = "GetSegment"
	PendingEvents = "PendingEvents"
)

Query types.

View Source
const (
	// Name of the Tendermint Application.
	Name = "TMPop"

	// Description of this Tendermint Application.
	Description = "Agent Store in a Blockchain"
)
View Source
const (
	// DefaultMetricsPort is the default port used to expose metrics.
	DefaultMetricsPort = 5090
)

Variables

This section is empty.

Functions

func BuildQueryBinary

func BuildQueryBinary(args interface{}) (argsBytes []byte, err error)

BuildQueryBinary outputs the marshalled Query.

func ComputeAppHash added in v0.2.0

func ComputeAppHash(previous []byte, validator []byte, root []byte) []byte

ComputeAppHash computes the app hash from its required parts.

func Run

func Run(a store.Adapter, kv store.KeyValueStore, config *Config)

Run launches a TMPop Tendermint App

Types

type ABCIError added in v0.2.0

type ABCIError struct {
	Code uint32
	Log  string
}

ABCIError is a structured error used inside TMPoP. The error codes are close to standard http status codes.

func (*ABCIError) Error added in v0.2.0

func (e *ABCIError) Error() string

func (*ABCIError) IsOK added in v0.2.0

func (e *ABCIError) IsOK() bool

IsOK returns true if no error occurred.

type Block added in v0.2.0

type Block struct {
	// The block's header.
	Header *tmtypes.Header
	// A block at height N contains the votes for block N-1.
	Votes []*evidences.TendermintVote
	// A block at height N contains the validator set for block N-1.
	Validators *tmtypes.ValidatorSet
	// The block's transactions.
	Txs []*Tx
}

Block contains the parts of a Tendermint block that TMPoP is interested in.

type Config

type Config struct {
	// A version string that will be set in the store's information.
	Version string

	// A git commit hash that will be set in the store's information.
	Commit string

	// path to the rules definition and validator plugins
	Validation *validation.Config

	// Monitoring configuration
	Monitoring *monitoring.Config
}

Config contains configuration options for the App.

type Info

type Info struct {
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Version     string      `json:"version"`
	Commit      string      `json:"commit"`
	AdapterInfo interface{} `json:"adapterInfo"`
}

Info is the info returned by GetInfo.

type LastBlock added in v0.2.0

type LastBlock struct {
	AppHash    []byte
	Height     int64
	LastHeader *abci.Header
}

LastBlock saves the information of the last block committed for Core/App Handshake on crash/restart.

func ReadLastBlock added in v0.2.0

func ReadLastBlock(ctx context.Context, kv store.KeyValueReader) (*LastBlock, error)

ReadLastBlock returns the last block committed by TMPop

type State

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

State represents the app states, separating the committed state (for queries) from the working state (for CheckTx and DeliverTx).

func NewState

func NewState(ctx context.Context, a store.Adapter, config *Config) (*State, error)

NewState creates a new State.

func (*State) Check

func (s *State) Check(ctx context.Context, link *chainscript.Link) *ABCIError

Check checks if creating this link is a valid operation

func (*State) Commit

func (s *State) Commit(ctx context.Context) ([]byte, []*chainscript.Link, error)

Commit commits the delivered links, resets delivered and checked state, and returns the hash for the commit and the list of committed links.

func (*State) Deliver added in v0.2.0

func (s *State) Deliver(ctx context.Context, link *chainscript.Link) *ABCIError

Deliver adds a link to the list of links to be committed

func (*State) UpdateValidators added in v0.3.0

func (s *State) UpdateValidators(ctx context.Context)

UpdateValidators updates validators if a new version is available.

type TMPop

type TMPop struct {
	abci.BaseApplication
	// contains filtered or unexported fields
}

TMPop is the type of the application that implements github.com/tendermint/abci/types.Application, the tendermint socket protocol (ABCI).

func New

func New(ctx context.Context, a store.Adapter, kv store.KeyValueStore, config *Config) (*TMPop, error)

New creates a new instance of a TMPop.

func (*TMPop) BeginBlock

func (t *TMPop) BeginBlock(req abci.RequestBeginBlock) abci.ResponseBeginBlock

BeginBlock implements github.com/tendermint/abci/types.Application.BeginBlock.

func (*TMPop) CheckTx

func (t *TMPop) CheckTx(tx []byte) abci.ResponseCheckTx

CheckTx implements github.com/tendermint/abci/types.Application.CheckTx.

func (*TMPop) Commit

func (t *TMPop) Commit() abci.ResponseCommit

Commit implements github.com/tendermint/abci/types.Application.Commit. It actually commits the current state in the Store.

func (*TMPop) ConnectTendermint added in v0.2.0

func (t *TMPop) ConnectTendermint(tmClient TendermintClient)

ConnectTendermint connects TMPoP to a Tendermint node

func (*TMPop) DeliverTx

func (t *TMPop) DeliverTx(tx []byte) abci.ResponseDeliverTx

DeliverTx implements github.com/tendermint/abci/types.Application.DeliverTx.

func (*TMPop) GetCurrentHeader added in v0.2.0

func (t *TMPop) GetCurrentHeader() *abci.Header

GetCurrentHeader returns the current block header

func (*TMPop) Info

func (t *TMPop) Info(req abci.RequestInfo) abci.ResponseInfo

Info implements github.com/tendermint/abci/types.Application.Info.

func (*TMPop) Query

func (t *TMPop) Query(reqQuery abci.RequestQuery) (resQuery abci.ResponseQuery)

Query implements github.com/tendermint/abci/types.Application.Query.

func (*TMPop) SetOption

func (t *TMPop) SetOption(req abci.RequestSetOption) abci.ResponseSetOption

SetOption implements github.com/tendermint/abci/types.Application.SetOption.

type TendermintClient added in v0.2.0

type TendermintClient interface {
	Block(ctx context.Context, height int64) (*Block, error)
}

TendermintClient is a light interface to query Tendermint Core.

type TendermintClientWrapper added in v0.2.0

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

TendermintClientWrapper implements TendermintClient.

func NewTendermintClient added in v0.2.0

func NewTendermintClient(tmClient client.Client) *TendermintClientWrapper

NewTendermintClient creates a new TendermintClient.

func (*TendermintClientWrapper) Block added in v0.2.0

func (c *TendermintClientWrapper) Block(ctx context.Context, height int64) (*Block, error)

Block queries for a block at a specific height.

type Tx

type Tx struct {
	TxType   TxType               `json:"type"`
	Link     *chainscript.Link    `json:"link"`
	LinkHash chainscript.LinkHash `json:"linkhash"`
}

Tx represents a TMPoP transaction

type TxType

type TxType byte

TxType represents the type of a Transaction

const (
	// CreateLink characterizes a transaction that creates a new link
	CreateLink TxType = iota
)

Directories

Path Synopsis
Package evidences defines Tendermint proofs.
Package evidences defines Tendermint proofs.

Jump to

Keyboard shortcuts

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