Documentation ¶
Index ¶
- Variables
- func GetBlkHeaderSerializedSize(pIntBlk *pb.InternalBlock) (n int64, err error)
- func GetFileContent(file string) string
- func GetIntBlkSerializedSize(pIntBlk *pb.InternalBlock) (n int64, err error)
- func GetTxSerializedSize(pTx *pb.Transaction) (n int64, err error)
- func NormalizedKVError(err error) error
- func UniqSlice(slice []string) []string
- func ValidContractName(contractName string) error
- type BatchChan
- type LRUCache
- type Pair
- type ServerError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrContractExecutionTimeout common error for contract timeout ErrContractExecutionTimeout = errors.New("contract execution timeout") // ErrContractConnectionError connect error ErrContractConnectionError = errors.New("can't connect contract") ErrKVNotFound = errors.New("Key not found") )
Functions ¶
func GetBlkHeaderSerializedSize ¶
func GetBlkHeaderSerializedSize(pIntBlk *pb.InternalBlock) (n int64, err error)
GetBlkHeaderSerializedSize get size(in bytes) of a internal block's header info, which will be written to db
func GetFileContent ¶
GetFileContent read file content and return moved from console/xcmd.go
func GetIntBlkSerializedSize ¶
func GetIntBlkSerializedSize(pIntBlk *pb.InternalBlock) (n int64, err error)
GetIntBlkSerializedSize get size(in bytes) of a internal block after being serialized blockSize = headerSize + sum(txSize)
func GetTxSerializedSize ¶
func GetTxSerializedSize(pTx *pb.Transaction) (n int64, err error)
GetTxSerializedSize get size(in bytes) of a tx after being serialized https://godoc.org/github.com/golang/protobuf/proto#Size
func NormalizedKVError ¶
func ValidContractName ¶
ValidContractName check if contract name is ok
Types ¶
type BatchChan ¶
type BatchChan struct {
// contains filtered or unexported fields
}
BatchChan 将单条的chan包装成batch的chan
func NewBatchChan ¶
func NewBatchChan(window int, waitms int, itemChan chan *pb.Transaction) *BatchChan
NewBatchChan New BatchChan
func (*BatchChan) GetQueue ¶
func (bc *BatchChan) GetQueue() chan []*pb.Transaction
GetQueue 得到当前打包的transaction queue
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
LRUCache cache struct
func (*LRUCache) Add ¶
Add add a key-value pair to LRU cache Params:
- key : cache key
- value: cache value
Return:
- evictOrNot: true if eviction occurs, false if not
func (*LRUCache) Del ¶
func (c *LRUCache) Del(key interface{})
Del delete cached value from cache Params:
- key: cache key
func (*LRUCache) EnlargeCapacity ¶
EnlargeCapacity enlarge the capacity of cache
type ServerError ¶
type ServerError struct {
Errno pb.AChainErrorEnum
}
ServerError AmpChain.proto error