Documentation ¶
Overview ¶
Package datatype manages datatypes and their relationships. Each asset has a list of datatypes. This allows all assets of datatype "Medical Records," for example, to be shared through a single consent.
Index ¶
- Constants
- func AddDatatypeSymKey(stub cached_stub.CachedStubInterface, caller data_model.User, ...) (data_model.Key, error)
- func GetAllDatatypes(stub cached_stub.CachedStubInterface, caller data_model.User, args []string) ([]byte, error)
- func GetDatatype(stub cached_stub.CachedStubInterface, caller data_model.User, args []string) ([]byte, error)
- func GetDatatypeKeyID(datatypeID string, ownerID string) string
- func GetDatatypeSymKey(stub cached_stub.CachedStubInterface, caller data_model.User, ...) (data_model.Key, error)
- func GetDatatypeWithParams(stub cached_stub.CachedStubInterface, datatypeID string) (datatype_interface.DatatypeInterface, error)
- func GetParentDatatype(stub cached_stub.CachedStubInterface, datatypeID string) (string, error)
- func GetParentDatatypes(stub cached_stub.CachedStubInterface, datatypeID string) ([]string, error)
- func Init(stub cached_stub.CachedStubInterface, logLevel ...shim.LoggingLevel) ([]byte, error)
- func NormalizeDatatypes(stub cached_stub.CachedStubInterface, datatypeIDs []string) ([]string, error)
- func RegisterDatatype(stub cached_stub.CachedStubInterface, caller data_model.User, args []string) ([]byte, error)
- func RegisterDatatypeWithParams(stub cached_stub.CachedStubInterface, datatypeID, description string, ...) (datatype_interface.DatatypeInterface, error)
- func UpdateDatatype(stub cached_stub.CachedStubInterface, caller data_model.User, args []string) ([]byte, error)
Constants ¶
const ROOT_DATATYPE_ID = global.ROOT_DATATYPE_ID
global.ROOT_DATATYPE_ID is id of ROOT datatype. All other datatypes are children of ROOT.
Variables ¶
This section is empty.
Functions ¶
func AddDatatypeSymKey ¶
func AddDatatypeSymKey(stub cached_stub.CachedStubInterface, caller data_model.User, datatypeID, ownerID string, keyPathForOwnerSymkey ...[]string) (data_model.Key, error)
AddDatatypeSymKey adds a sym key for the given datatypeID and ownerID and returns the DatatypeSymKey. It will also make sure that all its parent datatypes will get new sym key for the given owner (if it does not exist already). If the datatype sym key already exists, it will return success.
func GetAllDatatypes ¶
func GetAllDatatypes(stub cached_stub.CachedStubInterface, caller data_model.User, args []string) ([]byte, error)
GetAllDatatypes returns all datatypes, not including the ROOT datatype.
func GetDatatype ¶
func GetDatatype(stub cached_stub.CachedStubInterface, caller data_model.User, args []string) ([]byte, error)
GetDatatype returns a datatype with the given datatypeID. Returns an empty datatype if the passed in datatypeID does not match an existing datatype's ID.
args = [ datatypeID ]
func GetDatatypeKeyID ¶
GetDatatypeKeyID returns the datatype key id associated with a datatype.
func GetDatatypeSymKey ¶
func GetDatatypeSymKey(stub cached_stub.CachedStubInterface, caller data_model.User, datatypeID string, ownerID string, keyPath ...[]string) (data_model.Key, error)
GetDatatypeSymKey composes and returns a sym key for the given datatypeID and OwnerID. Returns an empty key if the datatype is not found or if there is an error.
func GetDatatypeWithParams ¶
func GetDatatypeWithParams(stub cached_stub.CachedStubInterface, datatypeID string) (datatype_interface.DatatypeInterface, error)
GetDatatypeWithParams function gets a datatype from the ledger. Returns an empty datatype if the passed in datatypeID does not match an existing datatype's ID.
func GetParentDatatype ¶
func GetParentDatatype(stub cached_stub.CachedStubInterface, datatypeID string) (string, error)
GetParentDatatype returns the datatypeID of a given datatypeID's direct parent.
func GetParentDatatypes ¶
func GetParentDatatypes(stub cached_stub.CachedStubInterface, datatypeID string) ([]string, error)
GetParentDatatypes returns a list of parents of the given datatypeID, excluding ROOT datatype.
func Init ¶
func Init(stub cached_stub.CachedStubInterface, logLevel ...shim.LoggingLevel) ([]byte, error)
Init sets up the datatype package by building an index table for datatypes.
func NormalizeDatatypes ¶
func NormalizeDatatypes(stub cached_stub.CachedStubInterface, datatypeIDs []string) ([]string, error)
NormalizeDatatypes returns a list of datatype IDs with only the most specific children.
func RegisterDatatype ¶
func RegisterDatatype(stub cached_stub.CachedStubInterface, caller data_model.User, args []string) ([]byte, error)
RegisterDatatype registers a new datatype to the ledger. Maintains datatype tree structure. Assumes a ROOT datatype exists. Every solution must call init_common.Init, which saves the ROOT datatype to the ledger. Creates datatypeSymKey and maintains key relationship with parent datatypes. If parentDatatypeID is not provided or does not exist, the datatype will be added as a child of ROOT.
args = [ datatype, parentDatatypeID ]
func RegisterDatatypeWithParams ¶
func RegisterDatatypeWithParams(stub cached_stub.CachedStubInterface, datatypeID, description string, isActive bool, parentDatatypeID string) (datatype_interface.DatatypeInterface, error)
RegisterDatatypeWithParams saves a new datatype to the ledger and maintains datatype tree structure. Caller must pass in datatype and can optionally pass in parentDatatypeID. If parentDatatypeID is not provided, the datatype will be added as a child of ROOT. If parentDatatypeID does not exist, an error is thrown It returns a new DatatypeInterface instance that has been registered
func UpdateDatatype ¶
func UpdateDatatype(stub cached_stub.CachedStubInterface, caller data_model.User, args []string) ([]byte, error)
UpdateDatatype updates existing datatype's description. Caller's role must be "system".
args = [ datatype ]
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package datatype manages datatypes and their relationships.
|
Package datatype manages datatypes and their relationships. |