init_common

package
v0.0.0-...-aeb4a1d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

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

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

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL