Documentation ¶
Overview ¶
Package app is a generated protocol buffer package.
It is generated from these files:
app/results.proto
It has these top-level messages:
ResultSet
Index ¶
- Constants
- Variables
- func ChainInitializers(inits ...weave.Initializer) weave.Initializer
- func ErrNoSuchPath(path string) error
- func IsNoSuchPathErr(err error) bool
- func JoinResults(keys, values *ResultSet) ([]weave.Model, error)
- func UnmarshalOneResult(bz []byte, o weave.Persistent) error
- type BaseApp
- type Decorators
- type ResultSet
- func (*ResultSet) Descriptor() ([]byte, []int)
- func (m *ResultSet) GetResults() [][]byte
- func (m *ResultSet) Marshal() (dAtA []byte, err error)
- func (m *ResultSet) MarshalTo(dAtA []byte) (int, error)
- func (*ResultSet) ProtoMessage()
- func (m *ResultSet) Reset()
- func (m *ResultSet) Size() (n int)
- func (m *ResultSet) String() string
- func (m *ResultSet) Unmarshal(dAtA []byte) error
- type Router
- func (r Router) Check(ctx weave.Context, store weave.KVStore, tx weave.Tx) (weave.CheckResult, error)
- func (r Router) Deliver(ctx weave.Context, store weave.KVStore, tx weave.Tx) (weave.DeliverResult, error)
- func (r Router) Handle(path string, h weave.Handler)
- func (r Router) Handler(path string) weave.Handler
- type StoreApp
- func (s *StoreApp) AddValChange(diffs []abci.ValidatorUpdate)
- func (s *StoreApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeginBlock)
- func (s *StoreApp) BlockContext() weave.Context
- func (s *StoreApp) CheckStore() weave.CacheableKVStore
- func (s *StoreApp) Commit() (res abci.ResponseCommit)
- func (s *StoreApp) DeliverStore() weave.CacheableKVStore
- func (s *StoreApp) EndBlock(_ abci.RequestEndBlock) (res abci.ResponseEndBlock)
- func (s *StoreApp) GetChainID() string
- func (s *StoreApp) Info(req abci.RequestInfo) abci.ResponseInfo
- func (s *StoreApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain)
- func (s *StoreApp) Logger() log.Logger
- func (s *StoreApp) Query(reqQuery abci.RequestQuery) (resQuery abci.ResponseQuery)
- func (s *StoreApp) SetOption(res abci.RequestSetOption) abci.ResponseSetOption
- func (s *StoreApp) WithInit(init weave.Initializer) *StoreApp
- func (s *StoreApp) WithLogger(logger log.Logger) *StoreApp
Constants ¶
const CodeNoSuchPath uint32 = 10
CodeNoSuchPath is an ABCI Response Codes Base SDK reserves 0 ~ 99. App uses 10 ~ 19
const DefaultRouterSize = 10
DefaultRouterSize preallocates this much space to hold routes
Variables ¶
var ( ErrInvalidLengthResults = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowResults = fmt.Errorf("proto: integer overflow") )
Functions ¶
func ChainInitializers ¶
func ChainInitializers(inits ...weave.Initializer) weave.Initializer
ChainInitializers lets you initialize many extensions with one function
func ErrNoSuchPath ¶
ErrNoSuchPath constructs an error when router doesn't know the path
func IsNoSuchPathErr ¶
IsNoSuchPathErr checks if this is an unknown route error
func JoinResults ¶ added in v0.2.0
JoinResults inverts ResultsFromKeys and ResultsFromValues and makes then a consistent whole again
func UnmarshalOneResult ¶ added in v0.2.0
func UnmarshalOneResult(bz []byte, o weave.Persistent) error
UnmarshalOneResult will parse a resultset, and it if is not empty, unmarshal the first result into o
Types ¶
type BaseApp ¶
type BaseApp struct { *StoreApp // contains filtered or unexported fields }
BaseApp adds DeliverTx, CheckTx, and BeginBlock handlers to the storage and query functionality of StoreApp
func NewBaseApp ¶
func NewBaseApp(store *StoreApp, decoder weave.TxDecoder, handler weave.Handler, ticker weave.Ticker, debug bool) BaseApp
NewBaseApp constructs a basic abci application
func (BaseApp) BeginBlock ¶
func (b BaseApp) BeginBlock(req abci.RequestBeginBlock) ( res abci.ResponseBeginBlock)
BeginBlock - ABCI
type Decorators ¶
type Decorators struct {
// contains filtered or unexported fields
}
Decorators holds a chain of decorators, not yet resolved by a Handler
func ChainDecorators ¶
func ChainDecorators(chain ...weave.Decorator) Decorators
ChainDecorators takes a chain of decorators, and upon adding a final Handler (often a Router), returns a Handler that will execute this whole stack.
app.ChainDecorators( util.NewLogging(), util.NewRecovery(), auth.NewDecorator(), coins.NewFeeDecorator(), util.NewSavepoint().OnDeliver(), ).WithHandler( myapp.NewRouter(), )
func (Decorators) Chain ¶
func (d Decorators) Chain(chain ...weave.Decorator) Decorators
Chain allows us to keep adding more Decorators to the chain
func (Decorators) WithHandler ¶
func (d Decorators) WithHandler(h weave.Handler) weave.Handler
WithHandler resolves the stack and returns a concrete Handler that will pass through the chain of decorators before calling the final Handler.
type ResultSet ¶ added in v0.2.0
type ResultSet struct {
Results [][]byte `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"`
}
ResultSet contains a list of keys or values
func ResultsFromKeys ¶ added in v0.2.0
ResultsFromKeys returns a ResultSet of all keys given a set of models
func ResultsFromValues ¶ added in v0.2.0
ResultsFromValues returns a ResultSet of all values given a set of models
func (*ResultSet) Descriptor ¶ added in v0.2.0
func (*ResultSet) GetResults ¶ added in v0.2.0
func (*ResultSet) ProtoMessage ¶ added in v0.2.0
func (*ResultSet) ProtoMessage()
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router allows us to register many handlers with different paths and then direct each message to the proper handler.
Minimal interface modeled after net/http.ServeMux
TODO: look for better trie routers that handle patterns... maybe take code from here? https://github.com/julienschmidt/httprouter https://github.com/julienschmidt/httprouter/blob/master/tree.go
func (Router) Check ¶
func (r Router) Check(ctx weave.Context, store weave.KVStore, tx weave.Tx) (weave.CheckResult, error)
Check dispatches to the proper handler based on path
func (Router) Deliver ¶
func (r Router) Deliver(ctx weave.Context, store weave.KVStore, tx weave.Tx) (weave.DeliverResult, error)
Deliver dispatches to the proper handler based on path
type StoreApp ¶
type StoreApp struct {
// contains filtered or unexported fields
}
StoreApp contains a data store and all info needed to perform queries and handshakes.
It should be embedded in another struct for CheckTx, DeliverTx and initializing state from the genesis. Errors on ABCI steps handled as panics I'm sorry Alex, but there is no other way :( https://github.com/tendermint/tendermint/abci/issues/165#issuecomment-353704015 "Regarding errors in general, for messages that don't take
user input like Flush, Info, InitChain, BeginBlock, EndBlock,
and Commit.... There is no way to handle these errors gracefully, so we might as well panic."
func NewStoreApp ¶
func NewStoreApp(name string, store weave.CommitKVStore, queryRouter weave.QueryRouter, baseContext weave.Context) *StoreApp
NewStoreApp initializes this app into a ready state with some defaults
panics if unable to properly load the state from the given store TODO: is this correct? nothing else to do really....
func (*StoreApp) AddValChange ¶
func (s *StoreApp) AddValChange(diffs []abci.ValidatorUpdate)
AddValChange is meant to be called by apps on DeliverTx results, this is added to the cache for the endblock changeset
func (*StoreApp) BeginBlock ¶
func (s *StoreApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeginBlock)
BeginBlock implements ABCI Sets up blockContext TODO: investigate response tags as of 0.11 abci
func (*StoreApp) BlockContext ¶
BlockContext returns the block context for public use
func (*StoreApp) CheckStore ¶
func (s *StoreApp) CheckStore() weave.CacheableKVStore
CheckStore returns the current CheckTx cache for methods
func (*StoreApp) Commit ¶
func (s *StoreApp) Commit() (res abci.ResponseCommit)
Commit implements abci.Application
func (*StoreApp) DeliverStore ¶
func (s *StoreApp) DeliverStore() weave.CacheableKVStore
DeliverStore returns the current DeliverTx cache for methods
func (*StoreApp) EndBlock ¶
func (s *StoreApp) EndBlock(_ abci.RequestEndBlock) (res abci.ResponseEndBlock)
EndBlock - ABCI Returns a list of all validator changes made in this block TODO: investigate response tags as of 0.11 abci
func (*StoreApp) GetChainID ¶
GetChainID returns the current chainID
func (*StoreApp) Info ¶
func (s *StoreApp) Info(req abci.RequestInfo) abci.ResponseInfo
Info implements abci.Application. It returns the height and hash, as well as the abci name and version.
The height is the block that holds the transactions, not the apphash itself.
func (*StoreApp) InitChain ¶
func (s *StoreApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain)
InitChain implements ABCI TODO: store the original validators somewhere Note: in tendermint 0.17, the genesis file is passed in here, we should use this to trigger reading the genesis now TODO: investigate validators and consensusParams in response
func (*StoreApp) Query ¶
func (s *StoreApp) Query(reqQuery abci.RequestQuery) (resQuery abci.ResponseQuery)
Query gets data from the app store. A query request has the following elements: * Path - the type of query * Data - what to query, interpretted based on Path * Height - the block height to query (if 0 most recent) * Prove - if true, also return a proof
Path may be "/", "/<bucket>", or "/<bucket>/<index>" It may be followed by "?prefix" to make a prefix query. Soon we will support "?range" for powerful range queries
Key and Value in Results are always serialized ResultSet objects, able to support 0 to N values. They must be the same size. This makes things a little more difficult for simple queries, but provides a consistent interface.
func (*StoreApp) SetOption ¶
func (s *StoreApp) SetOption(res abci.RequestSetOption) abci.ResponseSetOption
SetOption - ABCI TODO: not implemented (ABCI spec still unclear....)