fabric: github.com/hyperledger/fabric/core/chaincode/platforms/util Index | Files

package util

import "github.com/hyperledger/fabric/core/chaincode/platforms/util"

Index

Package Files

utils.go

func ComputeHash Uses

func ComputeHash(contents []byte, hash []byte) []byte

ComputeHash computes contents hash based on previous hash

func DockerBuild Uses

func DockerBuild(opts DockerBuildOptions) error

------------------------------------------------------------------------------------------- DockerBuild ------------------------------------------------------------------------------------------- This function allows a "pass-through" build of chaincode within a docker container as an alternative to using standard "docker build" + Dockerfile mechanisms. The plain docker build is somewhat limiting due to the resulting image that is a superset composition of the build-time and run-time environments. This superset can be problematic on several fronts, such as a bloated image size, and additional security exposure associated with applications that are not needed, etc.

Therefore, this mechanism creates a pipeline consisting of an ephemeral docker container that accepts source code as input, runs some function (e.g. "go build"), and outputs the result. The intention is that this output will be consumed as the basis of a streamlined container by installing the output into a downstream docker-build based on an appropriate minimal image.

The input parameters are fairly simple:

- Image:        (optional) The builder image to use or "chaincode.builder"
- Env:          (optional) environment variables for the build environment.
- Cmd:          The command to execute inside the container.
- InputStream:  A tarball of files that will be expanded into /chaincode/input.
- OutputStream: A tarball of files that will be gathered from /chaincode/output
                after successful execution of Cmd.

-------------------------------------------------------------------------------------------

func HashFilesInDir Uses

func HashFilesInDir(rootDir string, dir string, hash []byte, tw *tar.Writer) ([]byte, error)

HashFilesInDir computes h=hash(h,file bytes) for each file in a directory Directory entries are traversed recursively. In the end a single hash value is returned for the entire directory structure

func IsCodeExist Uses

func IsCodeExist(tmppath string) error

IsCodeExist checks the chaincode if exists

type DockerBuildOptions Uses

type DockerBuildOptions struct {
    Image        string
    Env          []string
    Cmd          string
    InputStream  io.Reader
    OutputStream io.Writer
}

Package util imports 11 packages (graph) and is imported by 19 packages. Updated 2019-04-15. Refresh now. Tools for package owners.