Documentation ¶
Overview ¶
Package init_common contains a single function Init which initializes the indices for all packages in common. Init should be called on startup by all solutions.
Index ¶
- func Init(stub cached_stub.CachedStubInterface, logLevel ...shim.LoggingLevel) ([]byte, error)
- func InitByInvoke(stub cached_stub.CachedStubInterface, args []string) error
- func InitDatastore(stub cached_stub.CachedStubInterface, args ...string) ([]byte, error)
- func InitSetup(stub cached_stub.CachedStubInterface) (shim.LoggingLevel, error)
- func InvokeSetup(stub cached_stub.CachedStubInterface) (data_model.User, string, []string, bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(stub cached_stub.CachedStubInterface, logLevel ...shim.LoggingLevel) ([]byte, error)
Init initializes all solutions. It constructs and saves index tables for asset, user, consent, and history. It also registers the ROOT datatype and sets up default ledger datastore connection. All solutions must call init_common.Init during solution set up time.
func InitByInvoke ¶
func InitByInvoke(stub cached_stub.CachedStubInterface, args []string) error
InitByInvoke checks the caller and creates the App Admin User
func InitDatastore ¶
func InitDatastore(stub cached_stub.CachedStubInterface, args ...string) ([]byte, error)
InitDatastore is to be called on startup by solutions that will use the default Cloudant datastore It must be called after init_common.Init(). It initializes the default datastore. args = [userID, password, database, host] example ["0d993c4d-efd0-49f4-a653-a33c2492f405-bluemix",
"2844a1f42798f0e8282f2a77424d779632f08088475068f6013b7f9b17234999", "testdatabase", "https://0d993c4d-efd0-49f4-a653-a33c2492f405-bluemix.cloudantnosqldb.appdomain.cloud"]
func InitSetup ¶
func InitSetup(stub cached_stub.CachedStubInterface) (shim.LoggingLevel, error)
InitSetup does the following three things: 1. Run a very simple self test by writing to the ledger and printing out on any errors. It could be useful to read the return result and verify network is healthy. 2. Initialize common packages by calling init_common.Init() with logLevel. 3. Initialize default Cloudant datastore if the fist args is "_cloudant".
optional args = ["_loglevel" loglevel, "_cloudant", username, password, database, host, (drop_table) ]
username, password, database, host will be set by the Network Operator in a production environment. Set username, password, database, host values in solution.yaml for your local test. drop_table [true|false] is an optional param - default value is false. If it's set to true, database will be dropped and re-created during initialization.
loglevel = "DEBUG" | "INFO" | "NOTICE" | "WARNING" |"ERROR" | "CRITICAL" Refer to Shim's LoggingLevel for more information.
func InvokeSetup ¶
func InvokeSetup(stub cached_stub.CachedStubInterface) (data_model.User, string, []string, bool, error)
InvokeSetup performs following: - checks caller's identity and caller's keys are retrieved - performs chaincode login - args are decrupted if args are encrypted - phi_args are retrieved and parsed - run InitByInvoke to create
Returns caller, function, args, toReturn, error When toReturn is set to true, the caller should return the shim.result (nil)
Types ¶
This section is empty.