externalbuilders

package
v2.0.0-alpha.0...-0c0dd42 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const MetadataFile = "metadata.json"

Variables

View Source
var (
	DefaultEnvWhitelist = []string{"LD_LIBRARY_PATH", "LIBPATH", "PATH", "TMPDIR"}
)

Functions

func NewCommand

func NewCommand(name string, envWhiteList []string, args ...string) *exec.Cmd

NewCommand creates an exec.Cmd that is configured to prune the calling environment down to the environment variables specified in the external builder's EnvironmentWhitelist and the DefaultEnvWhitelist defined above.

func RunCommand

func RunCommand(logger *flogging.FabricLogger, cmd *exec.Cmd) error

func SanitizeCCIDPath

func SanitizeCCIDPath(ccid string) string

func Untar

func Untar(buffer io.Reader, dst string) error

Untar takes a gzip-ed tar archive, and extracts it to dst. It returns an error if the tar contains any files which would escape to a parent of dst, or if the archive contains any files whose type is not a regular file or directory.

func ValidPath

func ValidPath(uncleanPath string) bool

ValidPath checks to see if the path is absolute, or if it is a relative path higher in the tree. In these cases it returns false.

Types

type BuildContext

type BuildContext struct {
	CCID        string
	Metadata    *persistence.ChaincodePackageMetadata
	ScratchDir  string
	SourceDir   string
	ReleaseDir  string
	MetadataDir string
	BldDir      string
}

func NewBuildContext

func NewBuildContext(ccid string, md *persistence.ChaincodePackageMetadata, codePackage io.Reader) (bc *BuildContext, err error)

func (*BuildContext) Cleanup

func (bc *BuildContext) Cleanup()

type BuildInfo

type BuildInfo struct {
	BuilderName string `json:"builder_name"`
}

type Builder

type Builder struct {
	EnvWhitelist []string
	Location     string
	Logger       *flogging.FabricLogger
	Name         string
}

func CreateBuilders

func CreateBuilders(builderConfs []peer.ExternalBuilder) []*Builder

func (*Builder) Build

func (b *Builder) Build(buildContext *BuildContext) error

func (*Builder) Detect

func (b *Builder) Detect(buildContext *BuildContext) bool

func (*Builder) Release

func (b *Builder) Release(buildContext *BuildContext) error

func (*Builder) Run

func (b *Builder) Run(ccid, bldDir string, peerConnection *ccintf.PeerConnection) (*RunStatus, error)

type Detector

type Detector struct {
	DurablePath string
	Builders    []*Builder
}

func (*Detector) Build

func (d *Detector) Build(ccid string, md *persistence.ChaincodePackageMetadata, codeStream io.Reader) (*Instance, error)

func (*Detector) CachedBuild

func (d *Detector) CachedBuild(ccid string) (*Instance, error)

CachedBuild returns a build instance that was already built, or nil, or when an unexpected error is encountered, an error.

func (*Detector) Detect

func (d *Detector) Detect(buildContext *BuildContext) *Builder

type Instance

type Instance struct {
	PackageID string
	BldDir    string
	Builder   *Builder
	RunStatus *RunStatus
}

func (*Instance) Start

func (i *Instance) Start(peerConnection *ccintf.PeerConnection) error

func (*Instance) Stop

func (i *Instance) Stop() error

func (*Instance) Wait

func (i *Instance) Wait() (int, error)

type MetadataProvider

type MetadataProvider struct {
	DurablePath string
}

func (*MetadataProvider) PackageMetadata

func (mp *MetadataProvider) PackageMetadata(ccid string) ([]byte, error)

PackageMetadata returns a set of bytes encoded as a tar file, containing the release metadata as provided by the external builder. If no directory with build output from the external builder is found, the tar bytes will be nil. If the build output is found, but there is no metadata, the bytes will be an empty tar. An error is returned only if the build output is found but some other error occurs.

type RunConfig

type RunConfig struct {
	CCID        string `json:"chaincode_id"`
	PeerAddress string `json:"peer_address"`
	ClientCert  []byte `json:"client_cert"`
	ClientKey   []byte `json:"client_key"`
	RootCert    []byte `json:"root_cert"`
}

RunConfig is serialized to disk when launching

type RunStatus

type RunStatus struct {
	// contains filtered or unexported fields
}

func NewRunStatus

func NewRunStatus() *RunStatus

func (*RunStatus) Done

func (rs *RunStatus) Done() <-chan struct{}

func (*RunStatus) Err

func (rs *RunStatus) Err() error

func (*RunStatus) Notify

func (rs *RunStatus) Notify(err error)

Jump to

Keyboard shortcuts

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