container

package
v1.2.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetChaincodePackageBytes

func GetChaincodePackageBytes(spec *pb.ChaincodeSpec) ([]byte, error)

GetChaincodePackageBytes creates bytes for docker container generation using the supplied chaincode specification

Types

type Builder added in v1.3.0

type Builder interface {
	Build() (io.Reader, error)
}

type PlatformBuilder added in v1.3.0

type PlatformBuilder struct {
	DeploymentSpec *pb.ChaincodeDeploymentSpec
}

PlatformBuilder 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.

func (*PlatformBuilder) Build added in v1.3.0

func (b *PlatformBuilder) Build() (io.Reader, error)

Build a tar stream based on the CDS

type StartContainerReq added in v1.3.0

type StartContainerReq struct {
	ccintf.CCID
	Builder       Builder
	Args          []string
	Env           []string
	FilesToUpload map[string][]byte
}

StartContainerReq - properties for starting a container.

func (StartContainerReq) Do added in v1.3.0

func (si StartContainerReq) Do(ctxt context.Context, v VM) error

func (StartContainerReq) GetCCID added in v1.3.0

func (si StartContainerReq) GetCCID() ccintf.CCID

type StopContainerReq added in v1.3.0

type StopContainerReq struct {
	ccintf.CCID
	Timeout uint
	//by default we will kill the container after stopping
	Dontkill bool
	//by default we will remove the container after killing
	Dontremove bool
}

StopContainerReq - properties for stopping a container.

func (StopContainerReq) Do added in v1.3.0

func (si StopContainerReq) Do(ctxt context.Context, v VM) error

func (StopContainerReq) GetCCID added in v1.3.0

func (si StopContainerReq) GetCCID() ccintf.CCID

type VM

type VM interface {
	Start(ctxt context.Context, ccid ccintf.CCID, args []string, env []string, filesToUpload map[string][]byte, builder Builder) error
	Stop(ctxt context.Context, ccid ccintf.CCID, timeout uint, dontkill bool, dontremove bool) error
}

VM is an abstract virtual image for supporting arbitrary virual machines

type VMCReq added in v1.3.0

type VMCReq interface {
	Do(ctxt context.Context, v VM) error
	GetCCID() ccintf.CCID
}

VMCReq - 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

type VMController

type VMController struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

VMController - manages VMs

. abstract construction of different types of VMs (we only care about Docker for now)
. manage lifecycle of VM (start with build, start, stop ...
  eventually probably need fine grained management)

func NewVMController added in v1.3.0

func NewVMController(vmProviders map[string]VMProvider) *VMController

NewVMController creates a new instance of VMController

func (*VMController) Process added in v1.3.0

func (vmc *VMController) Process(ctxt context.Context, vmtype string, req VMCReq) error

Process should be used as follows

. construct a context
. construct req of the right type (e.g., CreateImageReq)
. call it in a go routine
. process response in the go routing

context can be cancelled. VMCProcess will try to cancel calling functions if it can For instance docker clients api's such as BuildImage are not cancelable. In all cases VMCProcess will wait for the called go routine to return

type VMProvider added in v1.3.0

type VMProvider interface {
	NewVM() VM
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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