Documentation ¶
Index ¶
- Constants
- Variables
- func CopyDir(logger *flogging.FabricLogger, srcroot, destroot string) error
- func SanitizeCCIDPath(ccid string) string
- func Untar(buffer io.Reader, dst string) error
- func ValidPath(uncleanPath string) bool
- type BuildContext
- type BuildInfo
- type Builder
- func (b *Builder) Build(buildContext *BuildContext) error
- func (b *Builder) Detect(buildContext *BuildContext) bool
- func (b *Builder) NewCommand(name string, args ...string) *exec.Cmd
- func (b *Builder) Release(buildContext *BuildContext) error
- func (b *Builder) Run(ccid, bldDir string, peerConnection *ccintf.PeerConnection) (*Session, error)
- type ChaincodeServerUserData
- type Detector
- type Duration
- type ExitFunc
- type Instance
- type MetadataProvider
- type Session
Constants ¶
const ( DialTimeout = 3 * time.Second CCServerReleaseDir = "chaincode/server" )
Variables ¶
var ( // DefaultPropagateEnvironment enumerates the list of environment variables that are // implicitly propagated to external builder and launcher commands. DefaultPropagateEnvironment = []string{"LD_LIBRARY_PATH", "LIBPATH", "PATH", "TMPDIR"} )
Functions ¶
func CopyDir ¶
func CopyDir(logger *flogging.FabricLogger, srcroot, destroot string) error
CopyDir creates a copy of a dir
func SanitizeCCIDPath ¶
SanitizeCCIDPath is used to ensure that special characters are removed from file names.
Types ¶
type BuildContext ¶
type BuildContext struct { CCID string ScratchDir string SourceDir string ReleaseDir string MetadataDir string BldDir string }
BuildContext holds references to the various assets locations necessary to execute the detect, build, release, and run programs for external builders
func NewBuildContext ¶
func NewBuildContext(ccid string, mdBytes []byte, codePackage io.Reader) (bc *BuildContext, err error)
NewBuildContext creates the directories required to runt he external build process and extracts the chaincode package assets.
Users of the BuildContext must call Cleanup when the build process is complete to remove the transient file system assets.
func (*BuildContext) Cleanup ¶
func (bc *BuildContext) Cleanup()
Cleanup removes the build context artifacts.
type BuildInfo ¶
type BuildInfo struct { // BuilderName is the user provided name of the external builder. BuilderName string `json:"builder_name"` }
BuildInfo contains metadata is that is saved to the local file system with the assets generated by an external builder. This is used to associate build output with the builder that generated it.
type Builder ¶
type Builder struct { PropagateEnvironment []string Location string Logger *flogging.FabricLogger Name string MSPID string }
A Builder is used to interact with an external chaincode builder and launcher.
func CreateBuilders ¶
func CreateBuilders(builderConfs []peer.ExternalBuilder, mspid string) []*Builder
CreateBuilders will construct builders from the peer configuration.
func (*Builder) Build ¶
func (b *Builder) Build(buildContext *BuildContext) error
Build runs the `build` script.
func (*Builder) Detect ¶
func (b *Builder) Detect(buildContext *BuildContext) bool
Detect runs the `detect` script.
func (*Builder) NewCommand ¶
NewCommand creates an exec.Cmd that is configured to prune the calling environment down to the environment variables specified in the external builder's PropagateEnvironment and the DefaultPropagateEnvironment.
func (*Builder) Release ¶
func (b *Builder) Release(buildContext *BuildContext) error
Release runs the `release` script.
type ChaincodeServerUserData ¶
type ChaincodeServerUserData struct { Address string `json:"address"` Domain string `json:"domain"` DialTimeout Duration `json:"dial_timeout"` TLSRequired bool `json:"tls_required"` ClientAuthRequired bool `json:"client_auth_required"` ClientKey string `json:"client_key"` // PEM encoded client key ClientCert string `json:"client_cert"` // PEM encoded client certificate RootCert string `json:"root_cert"` // PEM encoded peer chaincode certificate }
ChaincodeServerUserData holds "connection.json" information
func (*ChaincodeServerUserData) ChaincodeServerInfo ¶
func (c *ChaincodeServerUserData) ChaincodeServerInfo(cryptoDir string) (*ccintf.ChaincodeServerInfo, error)
type Detector ¶
type Detector struct { // DurablePath is the file system location where chaincode assets are persisted. DurablePath string // Builders are the builders that detect and build processing will use. Builders []*Builder }
A Detector is responsible for orchestrating the external builder detection and build process.
func (*Detector) Build ¶
Build executes the external builder detect and build process.
Before running the detect and build process, the detector first checks the durable path for the results of a previous build for the provided package. If found, the detect and build process is skipped and the existing instance is returned.
type Duration ¶
Duration used for the DialTimeout property
func (Duration) MarshalJSON ¶
func (*Duration) UnmarshalJSON ¶
type Instance ¶
type Instance struct { PackageID string BldDir string ReleaseDir string Builder *Builder Session *Session TermTimeout time.Duration }
func (*Instance) ChaincodeServerInfo ¶
func (i *Instance) ChaincodeServerInfo() (*ccintf.ChaincodeServerInfo, error)
func (*Instance) ChaincodeServerReleaseDir ¶
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 Session ¶
type Session struct {
// contains filtered or unexported fields
}
func Start ¶
Start will start the provided command and return a Session that can be used to await completion or signal the process.
The provided logger is used log stderr from the running process.