Documentation
¶
Index ¶
- Constants
- func EncodeTx(tx *Tx) ([]byte, error)
- type BeginBlockHandler
- type Cache
- type CommitInfo
- func (*CommitInfo) Descriptor() ([]byte, []int)
- func (m *CommitInfo) GetHash() []byte
- func (m *CommitInfo) GetVersion() int64
- func (*CommitInfo) ProtoMessage()
- func (m *CommitInfo) Reset()
- func (m *CommitInfo) String() string
- func (m *CommitInfo) XXX_DiscardUnknown()
- func (m *CommitInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CommitInfo) XXX_Merge(src proto.Message)
- func (m *CommitInfo) XXX_Size() int
- func (m *CommitInfo) XXX_Unmarshal(b []byte) error
- type Context
- type EndBlockHandler
- type InitialStartHandler
- type KVStore
- type QueryContext
- type QueryHandler
- type Result
- type Store
- type Tag
- type Tags
- type Tx
- func (*Tx) Descriptor() ([]byte, []int)
- func (m *Tx) GetMsg() []byte
- func (m *Tx) GetNonce() []byte
- func (m *Tx) GetRoute() string
- func (m *Tx) GetSender() []byte
- func (m *Tx) GetSig() []byte
- func (*Tx) ProtoMessage()
- func (m *Tx) Reset()
- func (tx *Tx) Sign(sk crypto.PrivateKeyEd25519) error
- func (m *Tx) String() string
- func (tx *Tx) Verify(pubKey crypto.PublicKeyEd25519) bool
- func (m *Tx) XXX_DiscardUnknown()
- func (m *Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Tx) XXX_Merge(src proto.Message)
- func (m *Tx) XXX_Size() int
- func (m *Tx) XXX_Unmarshal(b []byte) error
- type TxHandler
Constants ¶
const ( // OK - all is bueno with the executed Tx. Any non-zero code is an error OK uint32 = iota // HandlerNotFound - yep...we couldn't find it HandlerNotFound // BadTx - no bueno, couldn't decode it or something like that BadTx // NotFound - catch all NotFound // BadQuery - in store query BadQuery )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BeginBlockHandler ¶
type BeginBlockHandler func(ctx Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
BeginBlockHandler is called before DeliverTx
type Cache ¶
type Cache interface {
KVStore
// Dump the cache to the tree
ApplyToState()
}
Cache extends KVStore adding an additional method to implement on a cache
type CommitInfo ¶
type CommitInfo struct {
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
Version int64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
State commit information
func (*CommitInfo) Descriptor ¶
func (*CommitInfo) Descriptor() ([]byte, []int)
func (*CommitInfo) GetHash ¶
func (m *CommitInfo) GetHash() []byte
func (*CommitInfo) GetVersion ¶
func (m *CommitInfo) GetVersion() int64
func (*CommitInfo) ProtoMessage ¶
func (*CommitInfo) ProtoMessage()
func (*CommitInfo) Reset ¶
func (m *CommitInfo) Reset()
func (*CommitInfo) String ¶
func (m *CommitInfo) String() string
func (*CommitInfo) XXX_DiscardUnknown ¶
func (m *CommitInfo) XXX_DiscardUnknown()
func (*CommitInfo) XXX_Marshal ¶
func (m *CommitInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CommitInfo) XXX_Merge ¶
func (m *CommitInfo) XXX_Merge(src proto.Message)
func (*CommitInfo) XXX_Size ¶
func (m *CommitInfo) XXX_Size() int
func (*CommitInfo) XXX_Unmarshal ¶
func (m *CommitInfo) XXX_Unmarshal(b []byte) error
type Context ¶
Context provides access to the state store and the current decoded Transaction
func NewContext ¶
NewContext creates a new context (hence the name)
type EndBlockHandler ¶
type EndBlockHandler func(ctx Context, req abci.RequestEndBlock) abci.ResponseEndBlock
EndBlockHandler is called after all DeliverTxs have been ran
type InitialStartHandler ¶
type InitialStartHandler func(ctx Context, req abci.RequestInitChain) abci.ResponseInitChain
InitialStartHandler is called once the first time the application is ran. This is the place to load initial state in your application as it is passed the store to commit to tree state
type KVStore ¶
type KVStore interface {
// Get from the cache or tree
Get(key []byte) []byte
// Set to the cache or tree
Set(key, value []byte)
// IterateKeyRange over the tree
IterateKeyRange(start, end []byte, ascending bool, fn func(key []byte, value []byte) bool) bool
}
KVStore is the base interface for all methods related to a store. See the store package
type QueryContext ¶
type QueryContext struct {
// contains filtered or unexported fields
}
QueryContext provides a read-only query context
func NewQueryContext ¶
func NewQueryContext(state KVStore) QueryContext
NewQueryContext creates an instance
type QueryHandler ¶
type QueryHandler func(key []byte, ctx QueryContext) abci.ResponseQuery
QueryHandler for query routes
type Result ¶
Result is it returned from a menta app TxHandler By default 'Code' will be zero which mean 'Ok' to tendermint
func ErrorNoHandler ¶
func ErrorNoHandler() Result
ErrorNoHandler is returned when menta can't find a handler for a given route
func ResultError ¶
ResultError is returned on an error with a non-zero code
type Store ¶
type Store interface {
KVStore
// Commit is called on Abci commit to commit the tree to storage and update the hash
Commit() CommitInfo
// Close the store
Close()
// Refresh the check/deliver caches
RefreshCache() Cache
}
Store extends KVStore
type Tx ¶
type Tx struct {
Route string `protobuf:"bytes,1,opt,name=route,proto3" json:"route,omitempty"`
Msg []byte `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg,omitempty"`
Sender []byte `protobuf:"bytes,4,opt,name=sender,proto3" json:"sender,omitempty"`
Nonce []byte `protobuf:"bytes,5,opt,name=nonce,proto3" json:"nonce,omitempty"`
Sig []byte `protobuf:"bytes,6,opt,name=sig,proto3" json:"sig,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
Transaction model across client and node.
'msg' is a []byte of application specific content, the application is reponsible for encoding/decoding it.
func (*Tx) Descriptor ¶
func (*Tx) ProtoMessage ¶
func (*Tx) ProtoMessage()
func (*Tx) Verify ¶
func (tx *Tx) Verify(pubKey crypto.PublicKeyEd25519) bool
Verify a Tx against a given public key
func (*Tx) XXX_DiscardUnknown ¶
func (m *Tx) XXX_DiscardUnknown()