container

package
v1.1.0-preview Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DOCKER = "Docker"
	SYSTEM = "System"
)

constants for supported containers

Variables

This section is empty.

Functions

func GetChaincodePackageBytes added in v1.0.0

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

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

func VMCProcess added in v1.0.0

func VMCProcess(ctxt context.Context, vmtype string, req VMCReqIntf) (interface{}, error)

VMCProcess 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

Types

type CreateImageReq added in v1.0.0

type CreateImageReq struct {
	ccintf.CCID
	Reader io.Reader
	Args   []string
	Env    []string
}

CreateImageReq - properties for creating an container image

type DestroyImageReq added in v1.0.0

type DestroyImageReq struct {
	ccintf.CCID
	Timeout uint
	Force   bool
	NoPrune bool
}

DestroyImageReq - properties for stopping a container.

type StartImageReq added in v1.0.0

type StartImageReq struct {
	ccintf.CCID
	Builder       api.BuildSpecFactory
	Args          []string
	Env           []string
	FilesToUpload map[string][]byte
	PrelaunchFunc api.PrelaunchFunc
}

StartImageReq - properties for starting a container.

type StopImageReq added in v1.0.0

type StopImageReq 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
}

StopImageReq - properties for stopping a container.

type VM added in v1.0.0

type VM struct {
	Client *docker.Client
}

VM implementation of VM management functionality.

func NewVM added in v1.0.0

func NewVM() (*VM, error)

NewVM creates a new VM instance.

func (*VM) BuildChaincodeContainer added in v1.0.0

func (vm *VM) BuildChaincodeContainer(spec *pb.ChaincodeSpec) error

BuildChaincodeContainer builds the container for the supplied chaincode specification

func (*VM) ListImages added in v1.0.0

func (vm *VM) ListImages(context context.Context) error

ListImages list the images available

type VMCReqIntf added in v1.0.0

type VMCReqIntf interface {
	// contains filtered or unexported methods
}

VMCReqIntf - 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 VMCResp added in v1.0.0

type VMCResp struct {
	Err  error
	Resp interface{}
}

VMCResp - response from requests. resp field is a anon interface. It can hold any response. err should be tested first

type VMController added in v1.0.0

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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