// Init handles chaincode initialization. Only the 'parms' function is // recognized here. func (c *counters) Init(stub *shim.ChaincodeStub, function string, args []string) (val []byte, err error) { defer busy.Catch(&err) switch function { case "parms": return c.initParms(stub, args) default: c.errorf("Init : Function '%s' is not recognized for INIT", function) } return }
// Query handles the `query` methods. func (c *counters) Query(stub *shim.ChaincodeStub, function string, args []string) (val []byte, err error) { defer busy.Catch(&err) switch function { case "parms": return c.queryParms(stub, args) case "status": return c.status(stub, args) default: c.errorf("Query : Function '%s' is not recognized for QUERY", function) } return }
// Invoke handles the `invoke` methods. func (c *counters) Invoke(stub *shim.ChaincodeStub, function string, args []string) (val []byte, err error) { defer busy.Catch(&err) switch function { case "create": return c.create(stub, args) case "decrement": return c.incDec(stub, args, -1) case "increment": return c.incDec(stub, args, 1) default: c.errorf("Invoke : Function '%s' is not recognized for INVOKE", function) } return }