Documentation ¶
Index ¶
- Constants
- func GetChaincodePackageBytes(spec *pb.ChaincodeSpec) ([]byte, error)
- func GetVMFromName(name string) string
- func SetupTestConfig()
- func SetupTestLogging()
- func VMCProcess(ctxt context.Context, vmtype string, req VMCReqIntf) (interface{}, error)
- type Config
- type CreateImageReq
- type StartImageReq
- type StopImageReq
- type VM
- type VMCReqIntf
- type VMCResp
- type VMController
Constants ¶
const (
DOCKER = "Docker"
)
constants for supported containers
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
func GetVMFromName ¶
GetVMFromName generates the docker image from peer information given the hashcode. This is needed to keep image name's unique in a single host, multi-peer environment (such as a development environment)
func SetupTestConfig ¶
func SetupTestConfig()
SetupTestConfig setup the config during test execution
func SetupTestLogging ¶
func SetupTestLogging()
SetupTestLogging setup the logging during test execution
func VMCProcess ¶
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 ¶
type CreateImageReq struct { ID string Reader io.Reader AttachStdin bool AttachStdout bool Args []string Env []string }
CreateImageReq - properties for creating an container image
type StartImageReq ¶
type StartImageReq struct { ID string Args []string Env []string AttachStdin bool AttachStdout bool }
StartImageReq - properties for starting a container.
type StopImageReq ¶
type StopImageReq struct { ID string 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 ¶
type VM struct {
Client *docker.Client
}
VM implemenation of VM management functionality.
func (*VM) BuildChaincodeContainer ¶
func (vm *VM) BuildChaincodeContainer(spec *pb.ChaincodeSpec) ([]byte, error)
BuildChaincodeContainer builds the container for the supplied chaincode specification
func (*VM) BuildObccaContainer ¶
BuildObccaContainer builds the image for the obcca to be used in development network
func (*VM) BuildPeerContainer ¶
BuildPeerContainer builds the image for the Peer to be used in development network
func (*VM) GetPeerPackageBytes ¶
GetPeerPackageBytes returns the gzipped tar image used for docker build of Peer
type VMCReqIntf ¶
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 ¶
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 ¶
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)