Documentation ¶
Overview ¶
candy contract is a fork of fabric chaincode.
Index ¶
- Constants
- Variables
- func ContractFileName(packageID string) string
- func RegisterContractMessage(cdc *amino.Codec)
- type CodeDescriptor
- type ContainerInstance
- type ContractInterface
- type ContractManager
- func (manager *ContractManager) AddContract(peerID p2p.ID, contract *types.Contract, contractSize int)
- func (manager *ContractManager) BuildAndStart(cId string) (string, string, error)
- func (manager *ContractManager) CallContract(cId string, args [][]byte) (*pb.ContractOutput, error)
- func (manager *ContractManager) GetContract(cId contractId) *types.Contract
- func (manager *ContractManager) GetStatus() (contracts []contractId, numPending int32, lenRequesters int)
- func (manager *ContractManager) LostContracts() (ids []contractId)
- func (manager *ContractManager) OnStart() error
- func (manager *ContractManager) OnStop()
- func (manager *ContractManager) PeekContract() *types.Contract
- func (manager *ContractManager) PopRequest(id contractId)
- func (manager *ContractManager) QueryContractList() []string
- func (manager *ContractManager) RedoRequest(id contractId) p2p.ID
- func (manager *ContractManager) RemovePeer(peerID p2p.ID)
- func (manager *ContractManager) SaveContract(contract *types.Contract) error
- func (manager *ContractManager) SetLogger(l log.Logger)
- func (manager *ContractManager) SetPeer(peerID p2p.ID, ids []contractId)
- type ContractMessage
- type ContractPacakgeStreamer
- func (cps *ContractPacakgeStreamer) Code() (*TarFileStream, error)
- func (cps *ContractPacakgeStreamer) Exists() bool
- func (cps *ContractPacakgeStreamer) File(name string) (tarFileStream *TarFileStream, err error)
- func (cps *ContractPacakgeStreamer) Metadata() (*ContractPackageMetadata, error)
- func (cps *ContractPacakgeStreamer) MetadataBytes() ([]byte, error)
- type ContractPackageLocator
- type ContractPackageMetadata
- type ContractRequest
- type DockerBuildOption
- type DockerVM
- func (vm *DockerVM) Build(cId string, metadata *ContractPackageMetadata, codePackage io.Reader) (Instance, error)
- func (vm *DockerVM) GetVMName(cID string) string
- func (vm *DockerVM) GetVMNameForDocker(cId string) (string, error)
- func (vm *DockerVM) HealthCheck(ctx context.Context) error
- func (vm *DockerVM) SetLogger(log log.Logger)
- func (vm *DockerVM) Start(cID, cType string, address string) (string, string, error)
- func (vm *DockerVM) Stop(cID string) error
- func (vm *DockerVM) Wait(cID string) (int, error)
- type FallbackPackageLocator
- type GolangPlatform
- type Instance
- type ModuleInfo
- type PackageInfo
- type PackageWriter
- type PackageWriterWrapper
- type PlatformBuilder
- type PlatformRegistry
- type Reactor
- func (cR *Reactor) AddPeer(peer p2p.Peer)
- func (cR *Reactor) BroadcastStatusRequest() error
- func (cR *Reactor) GetChannels() []*p2p.ChannelDescriptor
- func (cR *Reactor) GetManager() *ContractManager
- func (cR *Reactor) OnStart() error
- func (cR *Reactor) OnStop()
- func (cR *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte)
- func (cR *Reactor) RemovePeer(peer p2p.Peer, reason interface{})
- func (cR *Reactor) SetLogger(l log.Logger)
- type SourceDescriptor
- type SourceMap
- type Sources
- type TarFileStream
Constants ¶
View Source
const ( MetadataFile = "metadata.json" CodePackageFile = "code.tar.gz" )
View Source
const ( // ContractChannel is a channel for contracts update ContractChannel = byte(0x50) )
Variables ¶
View Source
var BaseDockerLabel = "candy"
View Source
var CommitSHA = "development build"
View Source
var Version = "latest"
Functions ¶
func ContractFileName ¶
func RegisterContractMessage ¶
func RegisterContractMessage(cdc *amino.Codec)
Types ¶
type CodeDescriptor ¶
type CodeDescriptor struct { Source string // absolute path of the source to package MetadataRoot string // absolute path META-INF Path string // import path of the package Module bool // does this represent a go module }
CodeDescriptor describes the code we're packaging.
func DescribeCode ¶
func DescribeCode(path string) (*CodeDescriptor, error)
DescribeCode returns GOPATH and package information.
type ContainerInstance ¶
func (*ContainerInstance) ContractServerInfo ¶
func (ci *ContainerInstance) ContractServerInfo()
func (*ContainerInstance) Start ¶
func (ci *ContainerInstance) Start(nodeAddress string) (string, string, error)
func (*ContainerInstance) Stop ¶
func (ci *ContainerInstance) Stop() error
func (*ContainerInstance) Wait ¶
func (ci *ContainerInstance) Wait() (int, error)
type ContractInterface ¶
type ContractInterface interface { // BuildAndStart builds a docker image and start it BuildAndStart(cid string) (string, string, error) // SaveContract saves the contract to the contract store. SaveContract(contract *types.Contract) error // GetContract gets contract from disk GetContract(cId contractId) *types.Contract // QueryContractList gets all installed contacts QueryContractList() []string }
type ContractManager ¶
type ContractManager struct { service.BaseService Contracts []contractId // contains filtered or unexported fields }
func NewContractManager ¶
func NewContractManager(nodeAddress string, vm *DockerVM, support *cs.ContractSupport, server *cs.GRPCServer, requestsCh chan<- ContractRequest, errorCh chan<- peerError) *ContractManager
func (*ContractManager) AddContract ¶
func (*ContractManager) BuildAndStart ¶
func (manager *ContractManager) BuildAndStart(cId string) (string, string, error)
func (*ContractManager) CallContract ¶
func (manager *ContractManager) CallContract(cId string, args [][]byte) (*pb.ContractOutput, error)
func (*ContractManager) GetContract ¶
func (manager *ContractManager) GetContract(cId contractId) *types.Contract
func (*ContractManager) GetStatus ¶
func (manager *ContractManager) GetStatus() (contracts []contractId, numPending int32, lenRequesters int)
func (*ContractManager) LostContracts ¶
func (manager *ContractManager) LostContracts() (ids []contractId)
func (*ContractManager) OnStart ¶
func (manager *ContractManager) OnStart() error
func (*ContractManager) OnStop ¶
func (manager *ContractManager) OnStop()
func (*ContractManager) PeekContract ¶
func (manager *ContractManager) PeekContract() *types.Contract
func (*ContractManager) PopRequest ¶
func (manager *ContractManager) PopRequest(id contractId)
func (*ContractManager) QueryContractList ¶
func (manager *ContractManager) QueryContractList() []string
func (*ContractManager) RedoRequest ¶
func (manager *ContractManager) RedoRequest(id contractId) p2p.ID
func (*ContractManager) RemovePeer ¶
func (manager *ContractManager) RemovePeer(peerID p2p.ID)
func (*ContractManager) SaveContract ¶
func (manager *ContractManager) SaveContract(contract *types.Contract) error
func (*ContractManager) SetLogger ¶
func (manager *ContractManager) SetLogger(l log.Logger)
func (*ContractManager) SetPeer ¶
func (manager *ContractManager) SetPeer(peerID p2p.ID, ids []contractId)
type ContractMessage ¶
type ContractMessage interface {
ValidateBasic() error
}
type ContractPacakgeStreamer ¶
type ContractPacakgeStreamer struct {
PackagePath string
}
func (*ContractPacakgeStreamer) Code ¶
func (cps *ContractPacakgeStreamer) Code() (*TarFileStream, error)
func (*ContractPacakgeStreamer) Exists ¶
func (cps *ContractPacakgeStreamer) Exists() bool
func (*ContractPacakgeStreamer) File ¶
func (cps *ContractPacakgeStreamer) File(name string) (tarFileStream *TarFileStream, err error)
func (*ContractPacakgeStreamer) Metadata ¶
func (cps *ContractPacakgeStreamer) Metadata() (*ContractPackageMetadata, error)
func (*ContractPacakgeStreamer) MetadataBytes ¶
func (cps *ContractPacakgeStreamer) MetadataBytes() ([]byte, error)
type ContractPackageLocator ¶
type ContractPackageLocator struct {
ContractDir string
}
func (*ContractPackageLocator) ContractPackageStreamer ¶
func (cpl *ContractPackageLocator) ContractPackageStreamer(packageID string) *ContractPacakgeStreamer
type ContractPackageMetadata ¶
type ContractRequest ¶
type DockerBuildOption ¶
type DockerVM ¶
type DockerVM struct { // config service.BaseService // contains filtered or unexported fields }
func NewDockerVM ¶
func NewDockerVM(config *cfg.VMConfig, nodeId string, hostConfig *docker.HostConfig) (*DockerVM, error)
NewDockerVM returns a new docker client
func (*DockerVM) GetVMNameForDocker ¶
type FallbackPackageLocator ¶
type FallbackPackageLocator struct {
ContractPackageLocator *ContractPackageLocator
}
func (*FallbackPackageLocator) GetChaincodePackage ¶
func (fpl *FallbackPackageLocator) GetChaincodePackage(packageID string) (*ContractPackageMetadata, []byte, io.ReadCloser, error)
type GolangPlatform ¶
type GolangPlatform struct { }
func (*GolangPlatform) GenerateDockerBuild ¶
func (p *GolangPlatform) GenerateDockerBuild(cType, path string, codePackage io.Reader, client *docker.Client) (io.Reader, error)
----------------------------------------------------------------- generate dockerfile TODO use config's baseos and runtime
func (*GolangPlatform) GetDeploymentPayload ¶
func (p *GolangPlatform) GetDeploymentPayload(codePath string) ([]byte, error)
func (*GolangPlatform) NormalizePath ¶
func (p *GolangPlatform) NormalizePath(cType, path string) (string, error)
type ModuleInfo ¶
type PackageInfo ¶
type PackageInfo struct { ImportPath string Dir string GoFiles []string Goroot bool CFiles []string CgoFiles []string HFiles []string SFiles []string IgnoredGoFiles []string Incomplete bool }
PackageInfo is the subset of data from `go list -deps -json` that's necessary to calculate chaincode package dependencies.
func (PackageInfo) Files ¶
func (p PackageInfo) Files() []string
type PackageWriter ¶
type PackageWriterWrapper ¶
type PlatformBuilder ¶
type PlatformRegistry ¶
type Reactor ¶
type Reactor struct { p2p.BaseReactor // contains filtered or unexported fields }
func NewContractReactor ¶
func NewContractReactor(nodeAddress string, vm *DockerVM, support *cs.ContractSupport, server *cs.GRPCServer) *Reactor
NewContractReactor returns new reactor instance.
func (*Reactor) BroadcastStatusRequest ¶
func (*Reactor) GetChannels ¶
func (cR *Reactor) GetChannels() []*p2p.ChannelDescriptor
func (*Reactor) GetManager ¶
func (cR *Reactor) GetManager() *ContractManager
func (*Reactor) RemovePeer ¶
type SourceDescriptor ¶
type Sources ¶
type Sources []SourceDescriptor
Source Files ¶
Click to show internal directories.
Click to hide internal directories.