dockercontroller

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Mutual TLS auth client key and cert paths in the chaincode container
	TLSClientKeyPath      string = "/etc/hyperledger/fabric/client.key"
	TLSClientCertPath     string = "/etc/hyperledger/fabric/client.crt"
	TLSClientKeyFile      string = "/etc/hyperledger/fabric/client_pem.key"
	TLSClientCertFile     string = "/etc/hyperledger/fabric/client_pem.crt"
	TLSClientRootCertFile string = "/etc/hyperledger/fabric/peer.crt"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildMetrics

type BuildMetrics struct {
	ChaincodeImageBuildDuration metrics.Histogram
}

func NewBuildMetrics

func NewBuildMetrics(p metrics.Provider) *BuildMetrics

type ContainerInstance

type ContainerInstance struct {
	CCID     string
	Type     string
	DockerVM *DockerVM
}

func (*ContainerInstance) ChaincodeServerInfo

func (ci *ContainerInstance) ChaincodeServerInfo() (*ccintf.ChaincodeServerInfo, error)

func (*ContainerInstance) Start

func (ci *ContainerInstance) Start(peerConnection *ccintf.PeerConnection) error

func (*ContainerInstance) Stop

func (ci *ContainerInstance) Stop() error

func (*ContainerInstance) Wait

func (ci *ContainerInstance) Wait() (int, error)

type DockerVM

type DockerVM struct {
	PeerID          string
	NetworkID       string
	BuildMetrics    *BuildMetrics
	HostConfig      *docker.HostConfig
	Client          dockerClient
	AttachStdOut    bool
	ChaincodePull   bool
	NetworkMode     string
	PlatformBuilder PlatformBuilder
	LoggingEnv      []string
	MSPID           string
}

DockerVM is a vm. It is identified by an image id

func (*DockerVM) Build

func (vm *DockerVM) Build(ccid string, metadata *persistence.ChaincodePackageMetadata, codePackage io.Reader) (container.Instance, error)

Build is responsible for building an image if it does not already exist.

func (*DockerVM) GetArgs

func (vm *DockerVM) GetArgs(ccType string, peerAddress string) ([]string, error)

func (*DockerVM) GetEnv

func (vm *DockerVM) GetEnv(ccid string, tlsConfig *ccintf.TLSConfig) []string

func (*DockerVM) GetVMName

func (vm *DockerVM) GetVMName(ccid string) string

GetVMName generates the VM name from peer information. It accepts a format function parameter to allow different formatting based on the desired use of the name.

func (*DockerVM) GetVMNameForDocker

func (vm *DockerVM) GetVMNameForDocker(ccid string) (string, error)

GetVMNameForDocker formats the docker image from peer information. This is needed to keep image (repository) names unique in a single host, multi-peer environment (such as a development environment). It computes the hash for the supplied image name and then appends it to the lowercase image name to ensure uniqueness.

func (*DockerVM) HealthCheck

func (vm *DockerVM) HealthCheck(ctx context.Context) error

HealthCheck checks if the DockerVM is able to communicate with the Docker daemon.

func (*DockerVM) Start

func (vm *DockerVM) Start(ccid string, ccType string, peerConnection *ccintf.PeerConnection) error

Start starts a container using a previously created docker image

func (*DockerVM) Stop

func (vm *DockerVM) Stop(ccid string) error

Stop stops a running chaincode

func (*DockerVM) Wait

func (vm *DockerVM) Wait(ccid string) (int, error)

Wait blocks until the container stops and returns the exit code of the container.

type PlatformBuilder

type PlatformBuilder interface {
	GenerateDockerBuild(ccType, path string, codePackage io.Reader) (io.Reader, error)
}

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