eyes

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name of the module for registering it
	Name = "eyes"

	// CostSet is the gas needed for the set operation
	CostSet uint64 = 10
	// CostRemove is the gas needed for the remove operation
	CostRemove = 10
)
View Source
const (
	TypeSet    = Name + "/set"
	TypeRemove = Name + "/remove"

	ByteSet    = 0xF4
	ByteRemove = 0xF5
)

nolint

Variables

This section is empty.

Functions

func ErrMissingData

func ErrMissingData() errors.TMError

nolint

func IsMissingDataErr

func IsMissingDataErr(err error) bool

func NewRemoveTx

func NewRemoveTx(key []byte) sdk.Tx

func NewSetTx

func NewSetTx(key, value []byte) sdk.Tx

Types

type Data

type Data struct {
	// SetAt is the block height this was set at
	SetAt uint64 `json:"set_at"`
	// Value is the data that was stored.
	// data.Bytes is like []byte but json encodes as hex not base64
	Value data.Bytes `json:"value"`
}

Data is the struct we use to store in the merkle tree

func NewData

func NewData(value []byte, setAt uint64) Data

NewData creates a new Data item

type Handler

type Handler struct {
	sdk.NopInitState
	sdk.NopInitValidate
}

Handler allows us to set and remove data

func NewHandler

func NewHandler() Handler

NewHandler makes a role handler to modify data

func (Handler) CheckTx

func (h Handler) CheckTx(ctx sdk.Context, store state.SimpleDB, tx sdk.Tx) (res sdk.CheckResult, err error)

CheckTx verifies if the transaction is properly formated

func (Handler) DeliverTx

func (h Handler) DeliverTx(ctx sdk.Context, store state.SimpleDB, tx sdk.Tx) (res sdk.DeliverResult, err error)

DeliverTx tries to create a new role.

Returns an error if the role already exists

func (Handler) Name

func (Handler) Name() string

Name - return name space

type RemoveTx

type RemoveTx struct {
	Key data.Bytes `json:"key"`
}

RemoveTx deletes the value at this key, returns old value

func (RemoveTx) ValidateBasic

func (t RemoveTx) ValidateBasic() error

ValidateBasic makes sure it is valid

func (RemoveTx) Wrap

func (t RemoveTx) Wrap() sdk.Tx

Wrap - fulfills TxInner interface

type SetTx

type SetTx struct {
	Key   data.Bytes `json:"key"`
	Value data.Bytes `json:"value"`
}

SetTx sets a key-value pair

func (SetTx) ValidateBasic

func (t SetTx) ValidateBasic() error

ValidateBasic makes sure it is valid

func (SetTx) Wrap

func (t SetTx) Wrap() sdk.Tx

Wrap - fulfills TxInner interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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