Documentation ¶
Index ¶
- Variables
- type Args
- type Aux
- type Block
- type BlockInfo
- type Blockchain
- type BlockcodeMsg
- type BuildContext
- type BuildResponse
- type Container
- type ContainerManager
- type ContainerTransaction
- type ExecRequest
- type Image
- type ImageBuilder
- type LangBuilder
- type Result
- type SampleBlockchain
- type Tx
- type VM
Constants ¶
This section is empty.
Variables ¶
var MountDir = "mountdir"
MountDir where block codes are stored
Functions ¶
This section is empty.
Types ¶
type Args ¶
type Args struct { Func string `json:"func"` Payload map[string][]byte `json:"payload"` Tx *Tx `json:"tx"` BlockInfo *BlockInfo `json:"blockInfo"` }
Args defines the structure of arguments sent to a blockcode
type Aux ¶
type Aux struct {
Image Image `json:"aux"`
}
Aux represents the aux structure in a docker image build response
type Block ¶
type Block interface {
GetTransactions() []*core.Transaction
}
Block defines an interface for a block
type BlockInfo ¶
type BlockInfo struct {
BlockNumber uint64
}
BlockInfo represents information about the current block
type Blockchain ¶
Blockchain interface defines a structure for accessing the blockchain and all its primitives.
type BlockcodeMsg ¶
type BlockcodeMsg struct { Type int `json:"type"` Tx *core.Transaction `json:"tx"` }
BlockcodeMsg defines the message expected from a blockcode
type BuildContext ¶
type BuildContext struct {
Dir string
}
BuildContext for building a docker image
type BuildResponse ¶
type BuildResponse struct {
Stream string `json:"stream"`
}
BuildResponse that respresents a stream from docker build progression
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container defines the container that runs a block code.
type ContainerManager ¶
type ContainerManager struct {
// contains filtered or unexported fields
}
ContainerManager defines the module that manages containerization of Block codes and their execution
func NewContainerManager ¶
func NewContainerManager(dockerClient *docker.Client, img *Image, log logger.Logger) *ContainerManager
NewContainerManager creates an instance of ContainerManager
type ContainerTransaction ¶
type ContainerTransaction struct { Tx *core.Transaction `json:"tx"` Function string `json:"function"` Data []byte `json:"data"` }
ContainerTransaction defines the structure of the blockcode transaction
type ExecRequest ¶
type ExecRequest struct { Function string `json:"Function"` Data interface{} `json:"Data"` }
ExecRequest defines the execution request to the blockcode stub
type Image ¶
type Image struct {
ID string `json:"ID"`
}
Image defines the structure of the final output of the image build
type ImageBuilder ¶
type ImageBuilder struct {
// contains filtered or unexported fields
}
ImageBuilder builds a struct
func NewImageBuilder ¶
func NewImageBuilder(log logger.Logger, dockerClient *docker.Client, dockerFileURL string) *ImageBuilder
NewImageBuilder creates an instance of ImageBuilder
func (*ImageBuilder) Build ¶
func (ib *ImageBuilder) Build() (*Image, error)
Build builds an image from a docker file gotten from the getDockerFile func - Checks if image already exists, else - Gets the docker file - Create an in-memory tar object and add the docker file to it - Create the build options - Build image in a separate go routine - Read the output - When build completes, check if image was created
type LangBuilder ¶
LangBuilder provides information about how to build and run a blockcode of a specific language
type Result ¶
type Result struct { Error bool `json:"error"` Body interface{} `json:"body"` }
Result represents the output of a function call
type SampleBlockchain ¶
type SampleBlockchain struct {
// contains filtered or unexported fields
}
SampleBlockchain defines a structure of a blockchain. This is for test only. Blockchains are more complex than this.
func NewSampleBlockchain ¶
func NewSampleBlockchain() *SampleBlockchain
NewSampleBlockchain creates a SampleBlockchain
func (*SampleBlockchain) GetBlockCode ¶
func (b *SampleBlockchain) GetBlockCode(address string) (*blockcode.Blockcode, error)
GetBlockCode returns a blockcode