{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package container\n\n## Functions\n\n```go\nfunc GetChaincodePackageBytes(pr *platforms.Registry, spec *pb.ChaincodeSpec) ([]byte, error)\n```\nGetChaincodePackageBytes creates bytes for docker container generation using the supplied chaincode specification\n\n## Types\n\n```go\ntype Builder interface {\n\tBuild() (io.Reader, error)\n}\n```\n\n```go\ntype ExitedFunc func(exitCode int, err error)\n```\nExitedFunc is the prototype for the function called when a container exits.\n\n```go\ntype PlatformBuilder struct {\n\tType             string\n\tPath             string\n\tName             string\n\tVersion          string\n\tCodePackage      []byte\n\tPlatformRegistry *platforms.Registry\n}\n```\nPlatformBuilder implements the Build interface using the platforms package GenerateDockerBuild function. XXX This is a pretty awkward spot for the builder, it should really probably be pushed into the dockercontroller, as it only builds docker images, but, doing so would require contaminating the dockercontroller package with the CDS, which is also undesirable.\n\n```go\nfunc (b *PlatformBuilder) Build() (io.Reader, error)\n```\nBuild a tar stream based on the CDS\n\n```go\ntype StartContainerReq struct {\n\tccintf.CCID\n\tBuilder       Builder\n\tArgs          []string\n\tEnv           []string\n\tFilesToUpload map[string][]byte\n}\n```\nStartContainerReq - properties for starting a container.\n\n```go\nfunc (si StartContainerReq) Do(v VM) error\n```\n\n```go\nfunc (si StartContainerReq) GetCCID() ccintf.CCID\n```\n\n```go\ntype StopContainerReq struct {\n\tccintf.CCID\n\tTimeout uint\n\t//by default we will kill the container after stopping\n\tDontkill bool\n\t//by default we will remove the container after killing\n\tDontremove bool\n}\n```\nStopContainerReq - properties for stopping a container.\n\n```go\nfunc (si StopContainerReq) Do(v VM) error\n```\n\n```go\nfunc (si StopContainerReq) GetCCID() ccintf.CCID\n```\n\n```go\ntype VM interface {\n\tStart(ccid ccintf.CCID, args []string, env []string, filesToUpload map[string][]byte, builder Builder) error\n\tStop(ccid ccintf.CCID, timeout uint, dontkill bool, dontremove bool) error\n\tWait(ccid ccintf.CCID) (int, error)\n\tHealthCheck(context.Context) error\n}\n```\nVM is an abstract virtual image for supporting arbitrary virtual machines\n\n```go\ntype VMCReq interface {\n\tDo(v VM) error\n\tGetCCID() ccintf.CCID\n}\n```\nVMCReq - all requests should implement this interface. The context should be passed and tested at each layer till we stop note that we'd stop on the first method on the stack that does not take context\n\n```go\ntype VMController struct {\n\tsync.RWMutex\n\t// contains filtered or unexported fields\n}\n```\nVMController - manages VMs\n\n\t. abstract construction of different types of VMs (we only care about Docker for now)\n\t. manage lifecycle of VM (start with build, start, stop ...\n\t  eventually probably need fine grained management)\n\n```go\nfunc NewVMController(vmProviders map[string]VMProvider) *VMController\n```\nNewVMController creates a new instance of VMController\n\n```go\nfunc (vmc *VMController) Process(vmtype string, req VMCReq) error\n```\n\n```go\ntype VMProvider interface {\n\tNewVM() VM\n}\n```\n\n```go\ntype WaitContainerReq struct {\n\tCCID   ccintf.CCID\n\tExited ExitedFunc\n}\n```\nWaitContainerReq provides the chaincode ID of the container to wait on and a callback to call upon chaincode termination.\n\n```go\nfunc (w WaitContainerReq) Do(v VM) error\n```\n\n```go\nfunc (w WaitContainerReq) GetCCID() ccintf.CCID\n```\n\n","path":"github.com/eric-erki/https-hyperledger.org/core/container","name":"container","synopsis":"","isRedistributable":true}
