package
0.0.0-20190726131402-fc9645e03f95
Repository: https://github.com/ibm-watson-iot/blockchain-samples.git
Documentation: pkg.go.dev

# README

PingPong Contract

Updated for Hyperledger 0.6

This is a simple contract that has been derived from the IoT Sample contract. Please read the introductory articles in the docs folder if you are not familiar with how these contracts function.

This contract adds the ability to send outgoing events from an advanced IoT contract. Three events are registered, as clipped from the code:

// EVTINVOKEERR is sent out whenever there is an error in the chaincode
const EVTINVOKEERR = "EVTINVOKEERR"

// EVTPONG is sent out whenever a PING assetID is received
const EVTPONG = "EVTPONG"

// EVTPING is sent out whenever a PONG assetID is received
const EVTPING = "EVTPING"

See the event listener application README and code to understand how the client registers interest in specific events and then catches them in a gRPB stream (modeled in Go as channels).

# Packages

No description provided by the author

# Functions

GETContractStateFromLedger retrieves state from ledger and returns to caller.
GETRecentStatesFromLedger returns the unmarshaled recent states.
NewContractLogger creates a logger for the contract to use.
PUTContractStateToLedger writes a contract state into the ledger.
PUTcreateOnUpdate marshals the new setting and writes it to the ledger.
PUTRecentStatesToLedger marshals and writes the recent states.

# Constants

AlertsERROR the over temperature alert.
AlertsSIZE is to be maintained always as 1 greater than the last alert, giving a size.
ASSETID is the JSON tag for the assetID.
CONTRACTSTATEKEY is used to store contract state, including version, nickname and activeAssets.
CRITICAL means cannot function.
DEBUG allows for a peek into the guts of the app for debugging.
DEFAULTLOGGINGLEVEL is normally INFO in test and WARNING in production.
DEFAULTNICKNAME is used when a contract is initialized without giving it a nickname.
ERROR means something is wrong.
EVTERROR is sent out whenever an ERROR assetID is received.
EVTINVOKEERR is sent out whenever there is an error in the chaincode.
EVTPONG is sent out whenever a PING assetID is received.
INFO means this happened and might be of interest.
MaxRecentStates is an arbitrary limit on how many asset states we track across the entire contract.
MYVERSION Update for every change, use VX.X.X (Major, Minor, Fix).
NOTICE means take note, this should be investigated.
RECENTSTATESKEY is used as key for recent states bucket.
TIMESTAMP is the JSON tag for timestamps, devices must use this tag to be compatible!.
TXNTIMESTAMP is the JSON tag for transaction timestamps, which map directly onto the transaction in the blockchain.
TXNUUID is the JSON tag for transaction UUIDs, which map directly onto the transaction in the blockchain.
WARNING means something might be wrong.

# Variables

AlertsName is a map of ID to name.
AlertsValue is a map of name to ID.
CASESENSITIVEMODE defines whether property names in the EVENT have to strictly follow JSON RPC conventions of case matching.
NOALERTSACTIVE is the zero value of an external alerts array (string names).
NOALERTSACTIVEINTERNAL is the zero value of an internal alerts array (bools).

# Structs

No description provided by the author
AlertStatusInternal contains the three possible statuses for alerts.
AssetIDT is assetID as type, used for simple unmarshaling.
ContractLogger is our version of goLogger.
ContractState struct defines contract state.
CreateOnUpdate is a shared parameter structure for the use of the createonupdate feature.
RecentStates is JSON encoded string slice.
SimpleChaincode is the receiver for all shim API.

# Interfaces

ILogger the goLogger interface to which we are 100% compatible.

# Type aliases

AlertArrayInternal is used to store the list of active, raised or cleared alerts for internal processing.
AlertNameArray is used for external alerts in JSON.
Alerts exists so that strict type checking can be applied.
ArgsMap is a generic map[string]interface{} to be used as a receiver.
No description provided by the author