Documentation ¶
Index ¶
- Constants
- func VMCProcess(ctxt context.Context, vmtype string, req VMCReqIntf) (interface{}, error)
- type BuildRegistry
- type BuildStatus
- type CreateImageReq
- type DestroyImageReq
- type DockerBuilder
- type ExternalBuilder
- type Instance
- type PackageProvider
- type Router
- type StartImageReq
- type StopImageReq
- type UninitializedInstance
- type VMCReqIntf
- type VMCResp
- type VMController
Constants ¶
const ( DOCKER = "Docker" SYSTEM = "System" )
constants for supported containers
Variables ¶
This section is empty.
Functions ¶
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 BuildRegistry ¶
type BuildRegistry struct {
// contains filtered or unexported fields
}
func (*BuildRegistry) BuildStatus ¶
func (br *BuildRegistry) BuildStatus(ccid string) (*BuildStatus, bool)
BuildStatus returns a BuildStatus for the ccid, and whether the caller is waiting in line (true), or this build status is new and their responsibility. If the build status is new, then the caller must call Notify with the error (or nil) upon completion.
type BuildStatus ¶
type BuildStatus struct {
// contains filtered or unexported fields
}
func NewBuildStatus ¶
func NewBuildStatus() *BuildStatus
func (*BuildStatus) Done ¶
func (bs *BuildStatus) Done() <-chan struct{}
func (*BuildStatus) Err ¶
func (bs *BuildStatus) Err() error
func (*BuildStatus) Notify ¶
func (bs *BuildStatus) Notify(err error)
type CreateImageReq ¶
CreateImageReq - properties for creating an container image
type DestroyImageReq ¶
DestroyImageReq - properties for stopping a container.
type DockerBuilder ¶
type DockerBuilder interface {
Build(ccid string, metadata *persistence.ChaincodePackageMetadata, codePackageStream io.Reader) (Instance, error)
}
DockerBuilder is what is exposed by the dockercontroller
type ExternalBuilder ¶
type ExternalBuilder interface {
Build(ccid string, metadata []byte, codePackageStream io.Reader) (Instance, error)
}
ExternalBuilder is what is exposed by the dockercontroller
type Instance ¶
type Instance interface { Start(peerConnection *ccintf.PeerConnection) error ChaincodeServerInfo() (*ccintf.ChaincodeServerInfo, error) Stop() error Wait() (int, error) }
Instance represents a built chaincode instance, because of the docker legacy, calling this a built 'container' would be very misleading, and going forward with the external launcher 'image' also seemed inappropriate. So, the vague 'Instance' is used here.
type PackageProvider ¶
type PackageProvider interface {
GetChaincodePackage(packageID string) (md *persistence.ChaincodePackageMetadata, mdBytes []byte, codeStream io.ReadCloser, err error)
}
PackageProvider gets chaincode packages from the filesystem.
type Router ¶
type Router struct { ExternalBuilder ExternalBuilder DockerBuilder DockerBuilder PackageProvider PackageProvider // contains filtered or unexported fields }
func (*Router) ChaincodeServerInfo ¶
func (r *Router) ChaincodeServerInfo(ccid string) (*ccintf.ChaincodeServerInfo, error)
type StartImageReq ¶
type StartImageReq struct { ccintf.CCID Builder api.BuildSpecFactory Args []string Env []string PrelaunchFunc api.PrelaunchFunc }
StartImageReq - properties for starting a container.
type StopImageReq ¶
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 UninitializedInstance ¶
type UninitializedInstance struct{}
func (UninitializedInstance) ChaincodeServerInfo ¶
func (UninitializedInstance) ChaincodeServerInfo() (*ccintf.ChaincodeServerInfo, error)
func (UninitializedInstance) Start ¶
func (UninitializedInstance) Start(peerConnection *ccintf.PeerConnection) error
func (UninitializedInstance) Stop ¶
func (UninitializedInstance) Stop() error
func (UninitializedInstance) Wait ¶
func (UninitializedInstance) Wait() (int, error)
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)