Documentation ¶
Overview ¶
Package sdk is a generated GoMock package.
Index ¶
- Constants
- func Error(msg string) protogo.Response
- func Success(payload []byte) protogo.Response
- type Bool
- type Contract
- type ECKeyType
- type Hash
- type KeyHistoryKvIter
- type KeyHistoryKvIterImpl
- type KeyModification
- type MockContract
- type MockContractMockRecorder
- type MockKeyHistoryKvIter
- func (m *MockKeyHistoryKvIter) Close() (bool, error)
- func (m *MockKeyHistoryKvIter) EXPECT() *MockKeyHistoryKvIterMockRecorder
- func (m *MockKeyHistoryKvIter) HasNext() bool
- func (m *MockKeyHistoryKvIter) Next() (*KeyModification, error)
- func (m *MockKeyHistoryKvIter) NextRow() (*serialize.EasyCodec, error)
- type MockKeyHistoryKvIterMockRecorder
- type MockResultSet
- type MockResultSetKV
- type MockResultSetKVMockRecorder
- type MockResultSetMockRecorder
- type MockSDKInterface
- func (m *MockSDKInterface) CallContract(contractName, method string, args map[string][]byte) protogo.Response
- func (m *MockSDKInterface) Debugf(format string, a ...interface{})
- func (m *MockSDKInterface) DelState(key, field string) error
- func (m *MockSDKInterface) DelStateFromKey(key string) error
- func (m *MockSDKInterface) EXPECT() *MockSDKInterfaceMockRecorder
- func (m *MockSDKInterface) EmitEvent(topic string, data []string)
- func (m *MockSDKInterface) Errorf(format string, a ...interface{})
- func (m *MockSDKInterface) GetArgs() map[string][]byte
- func (m *MockSDKInterface) GetBatchState(batchKeys []*vm.BatchKey) ([]*vm.BatchKey, error)
- func (m *MockSDKInterface) GetBlockHeight() (int, error)
- func (m *MockSDKInterface) GetCreatorOrgId() (string, error)
- func (m *MockSDKInterface) GetCreatorPk() (string, error)
- func (m *MockSDKInterface) GetCreatorRole() (string, error)
- func (m *MockSDKInterface) GetSenderAddr() (string, error)
- func (m *MockSDKInterface) GetSenderOrgId() (string, error)
- func (m *MockSDKInterface) GetSenderPk() (string, error)
- func (m *MockSDKInterface) GetSenderRole() (string, error)
- func (m *MockSDKInterface) GetState(key, field string) (string, error)
- func (m *MockSDKInterface) GetStateByte(key, field string) ([]byte, error)
- func (m *MockSDKInterface) GetStateFromKey(key string) (string, error)
- func (m *MockSDKInterface) GetStateFromKeyByte(key string) ([]byte, error)
- func (m *MockSDKInterface) GetTxId() (string, error)
- func (m *MockSDKInterface) GetTxInfo(txId string) protogo.Response
- func (m *MockSDKInterface) GetTxTimeStamp() (string, error)
- func (m *MockSDKInterface) Infof(format string, a ...interface{})
- func (m *MockSDKInterface) Log(message string)
- func (m *MockSDKInterface) NewHistoryKvIterForKey(key, field string) (KeyHistoryKvIter, error)
- func (m *MockSDKInterface) NewIterator(startKey, limitKey string) (ResultSetKV, error)
- func (m *MockSDKInterface) NewIteratorPrefixWithKey(key string) (ResultSetKV, error)
- func (m *MockSDKInterface) NewIteratorPrefixWithKeyField(key, field string) (ResultSetKV, error)
- func (m *MockSDKInterface) NewIteratorWithField(key, startField, limitField string) (ResultSetKV, error)
- func (m *MockSDKInterface) Origin() (string, error)
- func (m *MockSDKInterface) PutState(key, field, value string) error
- func (m *MockSDKInterface) PutStateByte(key, field string, value []byte) error
- func (m *MockSDKInterface) PutStateFromKey(key, value string) error
- func (m *MockSDKInterface) PutStateFromKeyByte(key string, value []byte) error
- func (m *MockSDKInterface) Sender() (string, error)
- func (m *MockSDKInterface) Warnf(format string, a ...interface{})
- type MockSDKInterfaceMockRecorder
- func (mr *MockSDKInterfaceMockRecorder) CallContract(contractName, method, args interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) Debugf(format interface{}, a ...interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) DelState(key, field interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) DelStateFromKey(key interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) EmitEvent(topic, data interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) Errorf(format interface{}, a ...interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetArgs() *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetBatchState(batchKeys interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetBlockHeight() *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetCreatorOrgId() *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetCreatorPk() *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetCreatorRole() *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetSenderAddr() *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetSenderOrgId() *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetSenderPk() *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetSenderRole() *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetState(key, field interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetStateByte(key, field interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetStateFromKey(key interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetStateFromKeyByte(key interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetTxId() *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetTxInfo(txId interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) GetTxTimeStamp() *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) Infof(format interface{}, a ...interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) Log(message interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) NewHistoryKvIterForKey(key, field interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) NewIterator(startKey, limitKey interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) NewIteratorPrefixWithKey(key interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) NewIteratorPrefixWithKeyField(key, field interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) NewIteratorWithField(key, startField, limitField interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) Origin() *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) PutState(key, field, value interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) PutStateByte(key, field, value interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) PutStateFromKey(key, value interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) PutStateFromKeyByte(key, value interface{}) *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) Sender() *gomock.Call
- func (mr *MockSDKInterfaceMockRecorder) Warnf(format interface{}, a ...interface{}) *gomock.Call
- type Options
- type ResultSet
- type ResultSetKV
- type ResultSetKvImpl
- type SDK
- func (s *SDK) CallContract(contractName, method string, args map[string][]byte) protogo.Response
- func (s *SDK) Debugf(format string, a ...interface{})
- func (s *SDK) DelState(key, field string) error
- func (s *SDK) DelStateFromKey(key string) error
- func (s *SDK) EmitEvent(topic string, data []string)
- func (s *SDK) Errorf(format string, a ...interface{})
- func (s *SDK) GetArgs() map[string][]byte
- func (s *SDK) GetBatchState(batchKeys []*vmPb.BatchKey) ([]*vmPb.BatchKey, error)
- func (s *SDK) GetBlockHeight() (int, error)
- func (s *SDK) GetCreatorOrgId() (string, error)
- func (s *SDK) GetCreatorPk() (string, error)
- func (s *SDK) GetCreatorRole() (string, error)
- func (s *SDK) GetEvents() []*protogo.Event
- func (s *SDK) GetReadMap() map[string][]byte
- func (s *SDK) GetSenderAddr() (string, error)
- func (s *SDK) GetSenderOrgId() (string, error)
- func (s *SDK) GetSenderPk() (string, error)
- func (s *SDK) GetSenderRole() (string, error)
- func (s *SDK) GetState(key, field string) (string, error)
- func (s *SDK) GetStateByte(key, field string) ([]byte, error)
- func (s *SDK) GetStateFromKey(key string) (string, error)
- func (s *SDK) GetStateFromKeyByte(key string) ([]byte, error)
- func (s *SDK) GetTxId() (string, error)
- func (s *SDK) GetTxInfo(txId string) protogo.Response
- func (s *SDK) GetTxTimeStamp() (string, error)
- func (s *SDK) GetWriteMap() map[string][]byte
- func (s *SDK) Infof(format string, a ...interface{})
- func (s *SDK) Log(message string)
- func (s *SDK) NewHistoryKvIterForKey(key, field string) (KeyHistoryKvIter, error)
- func (s *SDK) NewIterator(startKey string, limitKey string) (ResultSetKV, error)
- func (s *SDK) NewIteratorPrefixWithKey(key string) (ResultSetKV, error)
- func (s *SDK) NewIteratorPrefixWithKeyField(startKey string, startField string) (ResultSetKV, error)
- func (s *SDK) NewIteratorWithField(key string, startField string, limitField string) (ResultSetKV, error)
- func (s *SDK) Origin() (string, error)
- func (s *SDK) PutState(key, field string, value string) error
- func (s *SDK) PutStateByte(key, field string, value []byte) error
- func (s *SDK) PutStateFromKey(key string, value string) error
- func (s *SDK) PutStateFromKeyByte(key string, value []byte) error
- func (s *SDK) Sender() (string, error)
- func (s *SDK) Warnf(format string, a ...interface{})
- type SDKInterface
- type StoreMap
- func (c *StoreMap) Del(key []string) (err error)
- func (c *StoreMap) Exist(key []string) (ok bool, err error)
- func (c *StoreMap) Get(key []string) ([]byte, error)
- func (c *StoreMap) NewStoreMapIteratorPrefixWithKey(key []string) (ResultSetKV, error)
- func (c *StoreMap) Set(key []string, value []byte) (err error)
Constants ¶
const ( KeyRegisterProcessName = "KEY_REGISTER_PROCESS_NAME" KeySenderAddr = "KEY_SENDER_ADDR" KeyCallContractResp = "KEY_CALL_CONTRACT_RESPONSE" KeyCallContractReq = "KEY_CALL_CONTRACT_REQUEST" KeyStateKey = "KEY_STATE_KEY" KeyUserKey = "KEY_USER_KEY" KeyUserField = "KEY_USER_FIELD" KeyStateValue = "KEY_STATE_VALUE" KeyKVIterKey = "KEY_KV_ITERATOR_KEY" KeyIterIndex = "KEY_KV_ITERATOR_INDEX" KeyHistoryIterKey = "KEY_HISTORY_ITERATOR_KEY" KeyHistoryIterField = "KEY_HISTORY_ITERATOR_FIELD" //KeyHistoryIterIndex = "KEY_HISTORY_ITERATOR_INDEX" KeyContractName = "KEY_CONTRACT_NAME" KeyIteratorFuncName = "KEY_ITERATOR_FUNC_NAME" KeyIterStartKey = "KEY_ITERATOR_START_KEY" KeyIterStartField = "KEY_ITERATOR_START_FIELD" KeyIterLimitKey = "KEY_ITERATOR_LIMIT_KEY" KeyIterLimitField = "KEY_ITERATOR_LIMIT_FIELD" KeyWriteMap = "KEY_WRITE_MAP" KeyIteratorHasNext = "KEY_ITERATOR_HAS_NEXT" KeyTxId = "KEY_TX_ID" KeyBlockHeight = "KEY_BLOCK_HEIGHT" KeyIsDelete = "KEY_IS_DELETE" KeyTimestamp = "KEY_TIMESTAMP" )
const ( MapSize = 8 // common easyCodec key EC_KEY_TYPE_KEY ECKeyType = "key" EC_KEY_TYPE_FIELD ECKeyType = "field" EC_KEY_TYPE_VALUE ECKeyType = "value" EC_KEY_TYPE_TX_ID ECKeyType = "txId" EC_KEY_TYPE_BLOCK_HEITHT ECKeyType = "blockHeight" EC_KEY_TYPE_IS_DELETE ECKeyType = "isDelete" EC_KEY_TYPE_TIMESTAMP ECKeyType = "timestamp" // stateKvIterator method FuncKvIteratorCreate = "createKvIterator" FuncKvPreIteratorCreate = "createKvPreIterator" FuncKvIteratorHasNext = "kvIteratorHasNext" FuncKvIteratorNext = "kvIteratorNext" FuncKvIteratorClose = "kvIteratorClose" // keyHistoryKvIterator method FuncKeyHistoryIterHasNext = "keyHistoryIterHasNext" FuncKeyHistoryIterNext = "keyHistoryIterNext" FuncKeyHistoryIterClose = "keyHistoryIterClose" // int32 representation of bool BoolTrue Bool = 1 BoolFalse Bool = 0 )
const ( // OK constant - status code less than 400, endorser will endorse it. // OK means init or invoke successfully. OK = 0 // ERROR constant - default error value ERROR = 1 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Contract ¶
type Contract interface { // InitContract used to deploy and upgrade contract InitContract() protogo.Response // UpgradeContract used to upgrade contract UpgradeContract() protogo.Response // InvokeContract used to invoke user contract InvokeContract(method string) protogo.Response }
Contract user contract common
type KeyHistoryKvIter ¶
type KeyHistoryKvIter interface { ResultSet // Next return txId, blockHeight, timestamp, value, isDelete, error Next() (*KeyModification, error) }
type KeyHistoryKvIterImpl ¶
type KeyHistoryKvIterImpl struct {
// contains filtered or unexported fields
}
func (*KeyHistoryKvIterImpl) Close ¶
func (k *KeyHistoryKvIterImpl) Close() (bool, error)
func (*KeyHistoryKvIterImpl) HasNext ¶
func (k *KeyHistoryKvIterImpl) HasNext() bool
func (*KeyHistoryKvIterImpl) Next ¶
func (k *KeyHistoryKvIterImpl) Next() (*KeyModification, error)
type KeyModification ¶
type MockContract ¶
type MockContract struct {
// contains filtered or unexported fields
}
MockContract is a mock of Contract interface.
func NewMockContract ¶
func NewMockContract(ctrl *gomock.Controller) *MockContract
NewMockContract creates a new mock instance.
func (*MockContract) EXPECT ¶
func (m *MockContract) EXPECT() *MockContractMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockContract) InitContract ¶
func (m *MockContract) InitContract() protogo.Response
InitContract mocks base method.
func (*MockContract) InvokeContract ¶
func (m *MockContract) InvokeContract(method string) protogo.Response
InvokeContract mocks base method.
func (*MockContract) UpgradeContract ¶
func (m *MockContract) UpgradeContract() protogo.Response
UpgradeContract mocks base method.
type MockContractMockRecorder ¶
type MockContractMockRecorder struct {
// contains filtered or unexported fields
}
MockContractMockRecorder is the mock recorder for MockContract.
func (*MockContractMockRecorder) InitContract ¶
func (mr *MockContractMockRecorder) InitContract() *gomock.Call
InitContract indicates an expected call of InitContract.
func (*MockContractMockRecorder) InvokeContract ¶
func (mr *MockContractMockRecorder) InvokeContract(method interface{}) *gomock.Call
InvokeContract indicates an expected call of InvokeContract.
func (*MockContractMockRecorder) UpgradeContract ¶
func (mr *MockContractMockRecorder) UpgradeContract() *gomock.Call
UpgradeContract indicates an expected call of UpgradeContract.
type MockKeyHistoryKvIter ¶
type MockKeyHistoryKvIter struct {
// contains filtered or unexported fields
}
MockKeyHistoryKvIter is a mock of KeyHistoryKvIter interface.
func NewMockKeyHistoryKvIter ¶
func NewMockKeyHistoryKvIter(ctrl *gomock.Controller) *MockKeyHistoryKvIter
NewMockKeyHistoryKvIter creates a new mock instance.
func (*MockKeyHistoryKvIter) Close ¶
func (m *MockKeyHistoryKvIter) Close() (bool, error)
Close mocks base method.
func (*MockKeyHistoryKvIter) EXPECT ¶
func (m *MockKeyHistoryKvIter) EXPECT() *MockKeyHistoryKvIterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockKeyHistoryKvIter) HasNext ¶
func (m *MockKeyHistoryKvIter) HasNext() bool
HasNext mocks base method.
func (*MockKeyHistoryKvIter) Next ¶
func (m *MockKeyHistoryKvIter) Next() (*KeyModification, error)
Next mocks base method.
type MockKeyHistoryKvIterMockRecorder ¶
type MockKeyHistoryKvIterMockRecorder struct {
// contains filtered or unexported fields
}
MockKeyHistoryKvIterMockRecorder is the mock recorder for MockKeyHistoryKvIter.
func (*MockKeyHistoryKvIterMockRecorder) Close ¶
func (mr *MockKeyHistoryKvIterMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockKeyHistoryKvIterMockRecorder) HasNext ¶
func (mr *MockKeyHistoryKvIterMockRecorder) HasNext() *gomock.Call
HasNext indicates an expected call of HasNext.
func (*MockKeyHistoryKvIterMockRecorder) Next ¶
func (mr *MockKeyHistoryKvIterMockRecorder) Next() *gomock.Call
Next indicates an expected call of Next.
func (*MockKeyHistoryKvIterMockRecorder) NextRow ¶
func (mr *MockKeyHistoryKvIterMockRecorder) NextRow() *gomock.Call
NextRow indicates an expected call of NextRow.
type MockResultSet ¶
type MockResultSet struct {
// contains filtered or unexported fields
}
MockResultSet is a mock of ResultSet interface.
func NewMockResultSet ¶
func NewMockResultSet(ctrl *gomock.Controller) *MockResultSet
NewMockResultSet creates a new mock instance.
func (*MockResultSet) Close ¶
func (m *MockResultSet) Close() (bool, error)
Close mocks base method.
func (*MockResultSet) EXPECT ¶
func (m *MockResultSet) EXPECT() *MockResultSetMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockResultSetKV ¶
type MockResultSetKV struct {
// contains filtered or unexported fields
}
MockResultSetKV is a mock of ResultSetKV interface.
func NewMockResultSetKV ¶
func NewMockResultSetKV(ctrl *gomock.Controller) *MockResultSetKV
NewMockResultSetKV creates a new mock instance.
func (*MockResultSetKV) Close ¶
func (m *MockResultSetKV) Close() (bool, error)
Close mocks base method.
func (*MockResultSetKV) EXPECT ¶
func (m *MockResultSetKV) EXPECT() *MockResultSetKVMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockResultSetKV) HasNext ¶
func (m *MockResultSetKV) HasNext() bool
HasNext mocks base method.
type MockResultSetKVMockRecorder ¶
type MockResultSetKVMockRecorder struct {
// contains filtered or unexported fields
}
MockResultSetKVMockRecorder is the mock recorder for MockResultSetKV.
func (*MockResultSetKVMockRecorder) Close ¶
func (mr *MockResultSetKVMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockResultSetKVMockRecorder) HasNext ¶
func (mr *MockResultSetKVMockRecorder) HasNext() *gomock.Call
HasNext indicates an expected call of HasNext.
func (*MockResultSetKVMockRecorder) Next ¶
func (mr *MockResultSetKVMockRecorder) Next() *gomock.Call
Next indicates an expected call of Next.
func (*MockResultSetKVMockRecorder) NextRow ¶
func (mr *MockResultSetKVMockRecorder) NextRow() *gomock.Call
NextRow indicates an expected call of NextRow.
type MockResultSetMockRecorder ¶
type MockResultSetMockRecorder struct {
// contains filtered or unexported fields
}
MockResultSetMockRecorder is the mock recorder for MockResultSet.
func (*MockResultSetMockRecorder) Close ¶
func (mr *MockResultSetMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockResultSetMockRecorder) HasNext ¶
func (mr *MockResultSetMockRecorder) HasNext() *gomock.Call
HasNext indicates an expected call of HasNext.
func (*MockResultSetMockRecorder) NextRow ¶
func (mr *MockResultSetMockRecorder) NextRow() *gomock.Call
NextRow indicates an expected call of NextRow.
type MockSDKInterface ¶
type MockSDKInterface struct {
// contains filtered or unexported fields
}
MockSDKInterface is a mock of SDKInterface interface.
func NewMockSDKInterface ¶
func NewMockSDKInterface(ctrl *gomock.Controller) *MockSDKInterface
NewMockSDKInterface creates a new mock instance.
func (*MockSDKInterface) CallContract ¶
func (m *MockSDKInterface) CallContract(contractName, method string, args map[string][]byte) protogo.Response
CallContract mocks base method.
func (*MockSDKInterface) Debugf ¶
func (m *MockSDKInterface) Debugf(format string, a ...interface{})
Debugf mocks base method.
func (*MockSDKInterface) DelState ¶
func (m *MockSDKInterface) DelState(key, field string) error
DelState mocks base method.
func (*MockSDKInterface) DelStateFromKey ¶
func (m *MockSDKInterface) DelStateFromKey(key string) error
DelStateFromKey mocks base method.
func (*MockSDKInterface) EXPECT ¶
func (m *MockSDKInterface) EXPECT() *MockSDKInterfaceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSDKInterface) EmitEvent ¶
func (m *MockSDKInterface) EmitEvent(topic string, data []string)
EmitEvent mocks base method.
func (*MockSDKInterface) Errorf ¶
func (m *MockSDKInterface) Errorf(format string, a ...interface{})
Errorf mocks base method.
func (*MockSDKInterface) GetArgs ¶
func (m *MockSDKInterface) GetArgs() map[string][]byte
GetArgs mocks base method.
func (*MockSDKInterface) GetBatchState ¶
GetBatchState mocks base method.
func (*MockSDKInterface) GetBlockHeight ¶
func (m *MockSDKInterface) GetBlockHeight() (int, error)
GetBlockHeight mocks base method.
func (*MockSDKInterface) GetCreatorOrgId ¶
func (m *MockSDKInterface) GetCreatorOrgId() (string, error)
GetCreatorOrgId mocks base method.
func (*MockSDKInterface) GetCreatorPk ¶
func (m *MockSDKInterface) GetCreatorPk() (string, error)
GetCreatorPk mocks base method.
func (*MockSDKInterface) GetCreatorRole ¶
func (m *MockSDKInterface) GetCreatorRole() (string, error)
GetCreatorRole mocks base method.
func (*MockSDKInterface) GetSenderAddr ¶
func (m *MockSDKInterface) GetSenderAddr() (string, error)
GetSenderAddr mocks base method.
func (*MockSDKInterface) GetSenderOrgId ¶
func (m *MockSDKInterface) GetSenderOrgId() (string, error)
GetSenderOrgId mocks base method.
func (*MockSDKInterface) GetSenderPk ¶
func (m *MockSDKInterface) GetSenderPk() (string, error)
GetSenderPk mocks base method.
func (*MockSDKInterface) GetSenderRole ¶
func (m *MockSDKInterface) GetSenderRole() (string, error)
GetSenderRole mocks base method.
func (*MockSDKInterface) GetState ¶
func (m *MockSDKInterface) GetState(key, field string) (string, error)
GetState mocks base method.
func (*MockSDKInterface) GetStateByte ¶
func (m *MockSDKInterface) GetStateByte(key, field string) ([]byte, error)
GetStateByte mocks base method.
func (*MockSDKInterface) GetStateFromKey ¶
func (m *MockSDKInterface) GetStateFromKey(key string) (string, error)
GetStateFromKey mocks base method.
func (*MockSDKInterface) GetStateFromKeyByte ¶
func (m *MockSDKInterface) GetStateFromKeyByte(key string) ([]byte, error)
GetStateFromKeyByte mocks base method.
func (*MockSDKInterface) GetTxId ¶
func (m *MockSDKInterface) GetTxId() (string, error)
GetTxId mocks base method.
func (*MockSDKInterface) GetTxInfo ¶
func (m *MockSDKInterface) GetTxInfo(txId string) protogo.Response
GetTxInfo mocks base method.
func (*MockSDKInterface) GetTxTimeStamp ¶
func (m *MockSDKInterface) GetTxTimeStamp() (string, error)
GetTxTimeStamp mocks base method.
func (*MockSDKInterface) Infof ¶
func (m *MockSDKInterface) Infof(format string, a ...interface{})
Infof mocks base method.
func (*MockSDKInterface) Log ¶
func (m *MockSDKInterface) Log(message string)
Log mocks base method.
func (*MockSDKInterface) NewHistoryKvIterForKey ¶
func (m *MockSDKInterface) NewHistoryKvIterForKey(key, field string) (KeyHistoryKvIter, error)
NewHistoryKvIterForKey mocks base method.
func (*MockSDKInterface) NewIterator ¶
func (m *MockSDKInterface) NewIterator(startKey, limitKey string) (ResultSetKV, error)
NewIterator mocks base method.
func (*MockSDKInterface) NewIteratorPrefixWithKey ¶
func (m *MockSDKInterface) NewIteratorPrefixWithKey(key string) (ResultSetKV, error)
NewIteratorPrefixWithKey mocks base method.
func (*MockSDKInterface) NewIteratorPrefixWithKeyField ¶
func (m *MockSDKInterface) NewIteratorPrefixWithKeyField(key, field string) (ResultSetKV, error)
NewIteratorPrefixWithKeyField mocks base method.
func (*MockSDKInterface) NewIteratorWithField ¶
func (m *MockSDKInterface) NewIteratorWithField(key, startField, limitField string) (ResultSetKV, error)
NewIteratorWithField mocks base method.
func (*MockSDKInterface) Origin ¶
func (m *MockSDKInterface) Origin() (string, error)
Origin mocks base method.
func (*MockSDKInterface) PutState ¶
func (m *MockSDKInterface) PutState(key, field, value string) error
PutState mocks base method.
func (*MockSDKInterface) PutStateByte ¶
func (m *MockSDKInterface) PutStateByte(key, field string, value []byte) error
PutStateByte mocks base method.
func (*MockSDKInterface) PutStateFromKey ¶
func (m *MockSDKInterface) PutStateFromKey(key, value string) error
PutStateFromKey mocks base method.
func (*MockSDKInterface) PutStateFromKeyByte ¶
func (m *MockSDKInterface) PutStateFromKeyByte(key string, value []byte) error
PutStateFromKeyByte mocks base method.
func (*MockSDKInterface) Sender ¶
func (m *MockSDKInterface) Sender() (string, error)
Sender mocks base method.
func (*MockSDKInterface) Warnf ¶
func (m *MockSDKInterface) Warnf(format string, a ...interface{})
Warnf mocks base method.
type MockSDKInterfaceMockRecorder ¶
type MockSDKInterfaceMockRecorder struct {
// contains filtered or unexported fields
}
MockSDKInterfaceMockRecorder is the mock recorder for MockSDKInterface.
func (*MockSDKInterfaceMockRecorder) CallContract ¶
func (mr *MockSDKInterfaceMockRecorder) CallContract(contractName, method, args interface{}) *gomock.Call
CallContract indicates an expected call of CallContract.
func (*MockSDKInterfaceMockRecorder) Debugf ¶
func (mr *MockSDKInterfaceMockRecorder) Debugf(format interface{}, a ...interface{}) *gomock.Call
Debugf indicates an expected call of Debugf.
func (*MockSDKInterfaceMockRecorder) DelState ¶
func (mr *MockSDKInterfaceMockRecorder) DelState(key, field interface{}) *gomock.Call
DelState indicates an expected call of DelState.
func (*MockSDKInterfaceMockRecorder) DelStateFromKey ¶
func (mr *MockSDKInterfaceMockRecorder) DelStateFromKey(key interface{}) *gomock.Call
DelStateFromKey indicates an expected call of DelStateFromKey.
func (*MockSDKInterfaceMockRecorder) EmitEvent ¶
func (mr *MockSDKInterfaceMockRecorder) EmitEvent(topic, data interface{}) *gomock.Call
EmitEvent indicates an expected call of EmitEvent.
func (*MockSDKInterfaceMockRecorder) Errorf ¶
func (mr *MockSDKInterfaceMockRecorder) Errorf(format interface{}, a ...interface{}) *gomock.Call
Errorf indicates an expected call of Errorf.
func (*MockSDKInterfaceMockRecorder) GetArgs ¶
func (mr *MockSDKInterfaceMockRecorder) GetArgs() *gomock.Call
GetArgs indicates an expected call of GetArgs.
func (*MockSDKInterfaceMockRecorder) GetBatchState ¶
func (mr *MockSDKInterfaceMockRecorder) GetBatchState(batchKeys interface{}) *gomock.Call
GetBatchState indicates an expected call of GetBatchState.
func (*MockSDKInterfaceMockRecorder) GetBlockHeight ¶
func (mr *MockSDKInterfaceMockRecorder) GetBlockHeight() *gomock.Call
GetBlockHeight indicates an expected call of GetBlockHeight.
func (*MockSDKInterfaceMockRecorder) GetCreatorOrgId ¶
func (mr *MockSDKInterfaceMockRecorder) GetCreatorOrgId() *gomock.Call
GetCreatorOrgId indicates an expected call of GetCreatorOrgId.
func (*MockSDKInterfaceMockRecorder) GetCreatorPk ¶
func (mr *MockSDKInterfaceMockRecorder) GetCreatorPk() *gomock.Call
GetCreatorPk indicates an expected call of GetCreatorPk.
func (*MockSDKInterfaceMockRecorder) GetCreatorRole ¶
func (mr *MockSDKInterfaceMockRecorder) GetCreatorRole() *gomock.Call
GetCreatorRole indicates an expected call of GetCreatorRole.
func (*MockSDKInterfaceMockRecorder) GetSenderAddr ¶
func (mr *MockSDKInterfaceMockRecorder) GetSenderAddr() *gomock.Call
GetSenderAddr indicates an expected call of GetSenderAddr.
func (*MockSDKInterfaceMockRecorder) GetSenderOrgId ¶
func (mr *MockSDKInterfaceMockRecorder) GetSenderOrgId() *gomock.Call
GetSenderOrgId indicates an expected call of GetSenderOrgId.
func (*MockSDKInterfaceMockRecorder) GetSenderPk ¶
func (mr *MockSDKInterfaceMockRecorder) GetSenderPk() *gomock.Call
GetSenderPk indicates an expected call of GetSenderPk.
func (*MockSDKInterfaceMockRecorder) GetSenderRole ¶
func (mr *MockSDKInterfaceMockRecorder) GetSenderRole() *gomock.Call
GetSenderRole indicates an expected call of GetSenderRole.
func (*MockSDKInterfaceMockRecorder) GetState ¶
func (mr *MockSDKInterfaceMockRecorder) GetState(key, field interface{}) *gomock.Call
GetState indicates an expected call of GetState.
func (*MockSDKInterfaceMockRecorder) GetStateByte ¶
func (mr *MockSDKInterfaceMockRecorder) GetStateByte(key, field interface{}) *gomock.Call
GetStateByte indicates an expected call of GetStateByte.
func (*MockSDKInterfaceMockRecorder) GetStateFromKey ¶
func (mr *MockSDKInterfaceMockRecorder) GetStateFromKey(key interface{}) *gomock.Call
GetStateFromKey indicates an expected call of GetStateFromKey.
func (*MockSDKInterfaceMockRecorder) GetStateFromKeyByte ¶
func (mr *MockSDKInterfaceMockRecorder) GetStateFromKeyByte(key interface{}) *gomock.Call
GetStateFromKeyByte indicates an expected call of GetStateFromKeyByte.
func (*MockSDKInterfaceMockRecorder) GetTxId ¶
func (mr *MockSDKInterfaceMockRecorder) GetTxId() *gomock.Call
GetTxId indicates an expected call of GetTxId.
func (*MockSDKInterfaceMockRecorder) GetTxInfo ¶
func (mr *MockSDKInterfaceMockRecorder) GetTxInfo(txId interface{}) *gomock.Call
GetTxInfo indicates an expected call of GetTxInfo.
func (*MockSDKInterfaceMockRecorder) GetTxTimeStamp ¶
func (mr *MockSDKInterfaceMockRecorder) GetTxTimeStamp() *gomock.Call
GetTxTimeStamp indicates an expected call of GetTxTimeStamp.
func (*MockSDKInterfaceMockRecorder) Infof ¶
func (mr *MockSDKInterfaceMockRecorder) Infof(format interface{}, a ...interface{}) *gomock.Call
Infof indicates an expected call of Infof.
func (*MockSDKInterfaceMockRecorder) Log ¶
func (mr *MockSDKInterfaceMockRecorder) Log(message interface{}) *gomock.Call
Log indicates an expected call of Log.
func (*MockSDKInterfaceMockRecorder) NewHistoryKvIterForKey ¶
func (mr *MockSDKInterfaceMockRecorder) NewHistoryKvIterForKey(key, field interface{}) *gomock.Call
NewHistoryKvIterForKey indicates an expected call of NewHistoryKvIterForKey.
func (*MockSDKInterfaceMockRecorder) NewIterator ¶
func (mr *MockSDKInterfaceMockRecorder) NewIterator(startKey, limitKey interface{}) *gomock.Call
NewIterator indicates an expected call of NewIterator.
func (*MockSDKInterfaceMockRecorder) NewIteratorPrefixWithKey ¶
func (mr *MockSDKInterfaceMockRecorder) NewIteratorPrefixWithKey(key interface{}) *gomock.Call
NewIteratorPrefixWithKey indicates an expected call of NewIteratorPrefixWithKey.
func (*MockSDKInterfaceMockRecorder) NewIteratorPrefixWithKeyField ¶
func (mr *MockSDKInterfaceMockRecorder) NewIteratorPrefixWithKeyField(key, field interface{}) *gomock.Call
NewIteratorPrefixWithKeyField indicates an expected call of NewIteratorPrefixWithKeyField.
func (*MockSDKInterfaceMockRecorder) NewIteratorWithField ¶
func (mr *MockSDKInterfaceMockRecorder) NewIteratorWithField(key, startField, limitField interface{}) *gomock.Call
NewIteratorWithField indicates an expected call of NewIteratorWithField.
func (*MockSDKInterfaceMockRecorder) Origin ¶
func (mr *MockSDKInterfaceMockRecorder) Origin() *gomock.Call
Origin indicates an expected call of Origin.
func (*MockSDKInterfaceMockRecorder) PutState ¶
func (mr *MockSDKInterfaceMockRecorder) PutState(key, field, value interface{}) *gomock.Call
PutState indicates an expected call of PutState.
func (*MockSDKInterfaceMockRecorder) PutStateByte ¶
func (mr *MockSDKInterfaceMockRecorder) PutStateByte(key, field, value interface{}) *gomock.Call
PutStateByte indicates an expected call of PutStateByte.
func (*MockSDKInterfaceMockRecorder) PutStateFromKey ¶
func (mr *MockSDKInterfaceMockRecorder) PutStateFromKey(key, value interface{}) *gomock.Call
PutStateFromKey indicates an expected call of PutStateFromKey.
func (*MockSDKInterfaceMockRecorder) PutStateFromKeyByte ¶
func (mr *MockSDKInterfaceMockRecorder) PutStateFromKeyByte(key, value interface{}) *gomock.Call
PutStateFromKeyByte indicates an expected call of PutStateFromKeyByte.
func (*MockSDKInterfaceMockRecorder) Sender ¶
func (mr *MockSDKInterfaceMockRecorder) Sender() *gomock.Call
Sender indicates an expected call of Sender.
func (*MockSDKInterfaceMockRecorder) Warnf ¶
func (mr *MockSDKInterfaceMockRecorder) Warnf(format interface{}, a ...interface{}) *gomock.Call
Warnf indicates an expected call of Warnf.
type ResultSet ¶
type ResultSet interface { // NextRow get next row, // sql: column name is EasyCodec key, value is EasyCodec string val. as: val := ec.getString("columnName") // kv iterator: key/value is EasyCodec key for "key"/"value", value type is []byte. as: k, _ := ec.GetString("key") v, _ := ec.GetBytes("value") NextRow() (*serialize.EasyCodec, error) // HasNext return does the next line exist HasNext() bool // Close . Close() (bool, error) }
ResultSet iterator query result
type ResultSetKV ¶
type ResultSetKvImpl ¶
type ResultSetKvImpl struct {
// contains filtered or unexported fields
}
ResultSetKvImpl iterator query result KVdb
func (*ResultSetKvImpl) Close ¶
func (r *ResultSetKvImpl) Close() (bool, error)
func (*ResultSetKvImpl) HasNext ¶
func (r *ResultSetKvImpl) HasNext() bool
type SDK ¶
type SDK struct {
// contains filtered or unexported fields
}
func NewSDK ¶
func NewSDK( crossCtx *protogo.CrossContext, sendFunc func(msg *protogo.DockerVMMessage, responseNotify func(msg *protogo.DockerVMMessage)), txId string, originalTxId string, chainId string, contractName string, contractLogger *zap.SugaredLogger, SandboxLogger *zap.SugaredLogger, args map[string][]byte, ) *SDK
func (*SDK) CallContract ¶
func (*SDK) DelStateFromKey ¶
func (*SDK) GetBatchState ¶
func (*SDK) GetBlockHeight ¶
func (*SDK) GetCreatorOrgId ¶
func (*SDK) GetCreatorPk ¶
func (*SDK) GetCreatorRole ¶
func (*SDK) GetReadMap ¶
func (*SDK) GetSenderAddr ¶
func (*SDK) GetSenderOrgId ¶
func (*SDK) GetSenderPk ¶
func (*SDK) GetSenderRole ¶
func (*SDK) GetTxTimeStamp ¶
func (*SDK) GetWriteMap ¶
func (*SDK) NewHistoryKvIterForKey ¶
func (s *SDK) NewHistoryKvIterForKey(key, field string) (KeyHistoryKvIter, error)
func (*SDK) NewIterator ¶
func (s *SDK) NewIterator(startKey string, limitKey string) (ResultSetKV, error)
func (*SDK) NewIteratorPrefixWithKey ¶
func (s *SDK) NewIteratorPrefixWithKey(key string) (ResultSetKV, error)
func (*SDK) NewIteratorPrefixWithKeyField ¶
func (s *SDK) NewIteratorPrefixWithKeyField(startKey string, startField string) (ResultSetKV, error)
func (*SDK) NewIteratorWithField ¶
type SDKInterface ¶
type SDKInterface interface { // GetArgs get arg from transaction parameters // @return: 参数map GetArgs() map[string][]byte // GetState get [key, field] from chain and db // @param key: 获取的参数名 // @param field: 获取的参数名 // @return1: 获取结果,格式为string // @return2: 获取错误信息 GetState(key, field string) (string, error) // GetBatchState get [BatchKeys] from chain and db // @param batchKey: 获取的参数名 // @return1: 获取结果 // @return2: 获取错误信息 GetBatchState(batchKeys []*vmPb.BatchKey) ([]*vmPb.BatchKey, error) // GetStateByte get [key, field] from chain and db // @param key: 获取的参数名 // @param field: 获取的参数名 // @return1: 获取结果,格式为[]byte // @return2: 获取错误信息 GetStateByte(key, field string) ([]byte, error) // GetStateFromKey get [key] from chain and db // @param key: 获取的参数名 // @return1: 获取结果,格式为string // @return2: 获取错误信息 GetStateFromKey(key string) (string, error) // GetStateFromKeyByte get [key] from chain and db // @param key: 获取的参数名 // @return1: 获取结果,格式为[]byte // @return2: 获取错误信息 GetStateFromKeyByte(key string) ([]byte, error) // PutState put [key, field, value] to chain // @param1 key: 参数名 // @param1 field: 参数名 // @param2 value: 参数值,类型为string // @return1: 上传参数错误信息 PutState(key, field string, value string) error // PutStateByte put [key, field, value] to chain // @param1 key: 参数名 // @param1 field: 参数名 // @param2 value: 参数值,类型为[]byte // @return1: 上传参数错误信息 PutStateByte(key, field string, value []byte) error // PutStateFromKey put [key, value] to chain // @param1 key: 参数名 // @param2 value: 参数值,类型为string // @return1: 上传参数错误信息 PutStateFromKey(key string, value string) error // PutStateFromKeyByte put [key, value] to chain // @param1 key: 参数名 // @param2 value: 参数值,类型为[]byte // @return1: 上传参数错误信息 PutStateFromKeyByte(key string, value []byte) error // DelState delete [key, field] to chain // @param1 key: 删除的参数名 // @param1 field: 删除的参数名 // @return1:删除参数的错误信息 DelState(key, field string) error // DelStateFromKey delete [key] to chain // @param1 key: 删除的参数名 // @return1:删除参数的错误信息 DelStateFromKey(key string) error // GetCreatorOrgId get tx creator org id // @return1: 合约创建者的组织ID // @return2: 获取错误信息 GetCreatorOrgId() (string, error) // GetCreatorRole get tx creator role // @return1: 合约创建者的角色 // @return2: 获取错误信息 GetCreatorRole() (string, error) // GetCreatorPk get tx creator pk // @return1: 合约创建者的公钥 // @return2: 获取错误信息 GetCreatorPk() (string, error) // GetSenderOrgId get tx sender org id // @return1: 交易发起者的组织ID // @return2: 获取错误信息 GetSenderOrgId() (string, error) // GetSenderRole get tx sender role // @return1: 交易发起者的角色 // @return2: 获取错误信息 GetSenderRole() (string, error) // GetSenderPk get tx sender pk // @return1: 交易发起者的公钥 // @return2: 获取错误信息 GetSenderPk() (string, error) // GetBlockHeight get tx block height // @return1: 当前块高度 // @return2: 获取错误信息 GetBlockHeight() (int, error) // GetTxId get current tx id // @return1: 交易ID // @return2: 获取错误信息 GetTxId() (string, error) // GetTxInfo get tx info // @param txId :合约交易ID GetTxInfo(txId string) protogo.Response // GetTxTimeStamp get tx timestamp // @return1: 交易timestamp // @return2: 获取错误信息 GetTxTimeStamp() (string, error) // EmitEvent emit event, you can subscribe to the event using the SDK // @param1 topic: 合约事件的主题 // @param2 data: 合约事件的数据,参数数量不可大于16 EmitEvent(topic string, data []string) // Log record log to chain server // @param message: 事情日志的信息 //Deprecated Log(message string) // Debugf record log to chain server // @param format: 日志格式化模板 // @param a: 模板参数 Debugf(format string, a ...interface{}) // Infof record log to chain server // @param format: 日志格式化模板 // @param a: 模板参数 Infof(format string, a ...interface{}) // Warnf record log to chain server // @param format: 日志格式化模板 // @param a: 模板参数 Warnf(format string, a ...interface{}) // Errorf record log to chain server // @param format: 日志格式化模板 // @param a: 模板参数 Errorf(format string, a ...interface{}) // CallContract invoke another contract and get response // @param1: 合约名称 // @param2: 合约方法 // @param3: 合约合约参数 // @return1: 合约结果 CallContract(contractName, method string, args map[string][]byte) protogo.Response // NewIterator range of [startKey, limitKey), front closed back open // @param1: 范围查询起始key // @param2: 范围查询结束key // @return1: 根据起始key生成的迭代器 // @return2: 获取错误信息 NewIterator(startKey string, limitKey string) (ResultSetKV, error) // NewIteratorWithField range of [key+"#"+startField, key+"#"+limitField), front closed back open // @param1: 分别与param2, param3 构成查询起始和结束的key // @param2: [param1 + "#" + param2] 来获取查询起始的key // @param3: [param1 + "#" + param3] 来获取查询结束的key // @return1: 根据起始位置生成的迭代器 // @return2: 获取错误信息 NewIteratorWithField(key string, startField string, limitField string) (ResultSetKV, error) // NewIteratorPrefixWithKeyField range of [key+"#"+field, key+"#"+field], front closed back closed // @param1: [ param1 + "#" +param2 ] 构成前缀范围查询的key // @param2: [ param1 + "#" +param2 ] 构成前缀范围查询的key // @return1: 根据起始位置生成的迭代器 // @return2: 获取错误信息 NewIteratorPrefixWithKeyField(key string, field string) (ResultSetKV, error) // NewIteratorPrefixWithKey range of [key, key], front closed back closed // @param1: 前缀范围查询起始key // @return1: 根据起始位置生成的迭代器 // @return2: 获取错误信息 NewIteratorPrefixWithKey(key string) (ResultSetKV, error) // NewHistoryKvIterForKey query all historical data of key, field // @param1: 查询历史的key // @param2: 查询历史的field // @return1: 根据key, field 生成的历史迭代器 // @return2: 获取错误信息 NewHistoryKvIterForKey(key, field string) (KeyHistoryKvIter, error) // GetSenderAddr Get the address of the origin caller address, same with Origin() // @return1: origin caller address // @return2: 获取错误信息 //Deprecated GetSenderAddr() (string, error) // Sender Get the address of the sender address, if the contract is called by another contract, the result will be // the caller contract's address // @return1: sender address // @return2: 获取错误信息 Sender() (string, error) // Origin Get the address of the tx origin caller address // @return1: origin caller address // @return2: 获取错误信息 Origin() (string, error) }
var Instance SDKInterface
type StoreMap ¶
type StoreMap struct { // Name store map name Name string `json:"name"` // Depth store map deep Depth int64 `json:"depth"` // HashType HashType crypto.HashType `json:"hash_type"` }
StoreMap is used to store key,value pairs automatically. Every key,value pair in it will be stored(use sdk's PutStateByte) when it was added into StoreMap. StoreMap is a structure like solidity's mapping. This structure is just for convenient, it's performance is worse than using PutStateByte directly because when you create a StoreMap(call NewStoreMap), it will call at least 1 time GetStateByte to find whether the StoreMap exist in store and if the StoreMap is not exist in store, it will call 1 time PutStateByte to store the StoreMap. If you have many key,value pairs to store, you can use it.
func NewStoreMap ¶
NewStoreMap return a StoreMap object. It includes at least 1 time GetStateByte call.
func (*StoreMap) NewStoreMapIteratorPrefixWithKey ¶
func (c *StoreMap) NewStoreMapIteratorPrefixWithKey(key []string) (ResultSetKV, error)
NewStoreMapIteratorPrefixWithKey create a iterator(IteratorPrefixWithKey) of the StoreMap