plugin

package
v0.0.0-...-e0cfe8b Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: BSD-3-Clause Imports: 28 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const Name = "gogoproto"

Name is the name registered for the proto compressor.

Variables

View Source
var (
	EncodingType_JSON      = ptypes.EncodingType_JSON
	EncodingType_PROTOBUF3 = ptypes.EncodingType_PROTOBUF3
)
View Source
var Handshake = extplugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "LOOM_CONTRACT",
	MagicCookieValue: "loomrocks",
}

Handshake is a common handshake that is shared by plugin and host.

Functions

func Serve

func Serve(contract Contract)

Types

type API

type API interface {
	StaticAPI
	VolatileAPI
}

type Code

type Code = ptypes.PluginCode

type Context

type Context interface {
	StaticContext
	VolatileAPI
	Set(key, value []byte)
	Delete(key []byte)
}

Context is the low-level context provided to RequestDispatcher.StaticCall().

type Contract

type Contract interface {
	Meta() (Meta, error)
	Init(ctx Context, req *Request) error
	Call(ctx Context, req *Request) (*Response, error)
	StaticCall(ctx StaticContext, req *Request) (*Response, error)
}

type ContractMethodCall

type ContractMethodCall = ptypes.ContractMethodCall

type ContractRecord

type ContractRecord struct {
	ContractName    string
	ContractAddress loom.Address
	CreatorAddress  loom.Address
}

type EncodingType

type EncodingType = ptypes.EncodingType

type ExternalPlugin

type ExternalPlugin struct {
	extplugin.NetRPCUnsupportedPlugin
	// Concrete implementation, written in Go. This is only used for plugins
	// that are written in Go.
	Impl Contract
}

func (*ExternalPlugin) GRPCClient

func (p *ExternalPlugin) GRPCClient(ctx context.Context, broker *extplugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*ExternalPlugin) GRPCServer

func (p *ExternalPlugin) GRPCServer(broker *extplugin.GRPCBroker, s *grpc.Server) error

type FEvent

type FEvent struct {
	Event  []byte
	Topics []string
}

type FakeContext

type FakeContext struct {
	Events []FEvent
	// contains filtered or unexported fields
}

func CreateFakeContext

func CreateFakeContext(caller, address loom.Address) *FakeContext

func (*FakeContext) Block

func (c *FakeContext) Block() types.BlockHeader

func (*FakeContext) Call

func (c *FakeContext) Call(addr loom.Address, input []byte) ([]byte, error)

func (*FakeContext) CallEVM

func (c *FakeContext) CallEVM(addr loom.Address, input []byte, value *loom.BigUInt) ([]byte, error)

func (*FakeContext) Config

func (c *FakeContext) Config() *cctypes.Config

func (*FakeContext) ContractAddress

func (c *FakeContext) ContractAddress() loom.Address

func (*FakeContext) ContractRecord

func (c *FakeContext) ContractRecord(contractAddr loom.Address) (*ContractRecord, error)

func (*FakeContext) CreateContract

func (c *FakeContext) CreateContract(contract Contract) loom.Address

func (*FakeContext) Delete

func (c *FakeContext) Delete(key []byte)

func (*FakeContext) Emit

func (c *FakeContext) Emit(event []byte)

func (*FakeContext) EmitTopics

func (c *FakeContext) EmitTopics(event []byte, topics ...string)

func (*FakeContext) EnabledFeatures

func (c *FakeContext) EnabledFeatures() []string

func (*FakeContext) FeatureEnabled

func (c *FakeContext) FeatureEnabled(name string, defaultVal bool) bool

func (*FakeContext) Get

func (c *FakeContext) Get(key []byte) []byte

func (*FakeContext) GetEvmTxReceipt

func (c *FakeContext) GetEvmTxReceipt([]byte) (ptypes.EvmTxReceipt, error)

func (*FakeContext) Has

func (c *FakeContext) Has(key []byte) bool

func (*FakeContext) Message

func (c *FakeContext) Message() Message

func (*FakeContext) Now

func (c *FakeContext) Now() time.Time

func (*FakeContext) Range

func (c *FakeContext) Range(prefix []byte) RangeData

func (*FakeContext) RegisterContract

func (c *FakeContext) RegisterContract(contractName string, contractAddr, creatorAddr loom.Address)

func (*FakeContext) Resolve

func (c *FakeContext) Resolve(name string) (loom.Address, error)

func (*FakeContext) Set

func (c *FakeContext) Set(key []byte, value []byte)

func (*FakeContext) SetConfigSetting

func (c *FakeContext) SetConfigSetting(name, value string) error

func (*FakeContext) SetFeature

func (c *FakeContext) SetFeature(name string, val bool)

func (*FakeContext) SetTime

func (c *FakeContext) SetTime(t time.Time)

func (*FakeContext) StaticCall

func (c *FakeContext) StaticCall(addr loom.Address, input []byte) ([]byte, error)

func (*FakeContext) StaticCallEVM

func (c *FakeContext) StaticCallEVM(addr loom.Address, input []byte) ([]byte, error)

func (*FakeContext) Validators

func (c *FakeContext) Validators() []*loom.Validator

func (*FakeContext) WithAddress

func (c *FakeContext) WithAddress(addr loom.Address) *FakeContext

func (*FakeContext) WithBlock

func (c *FakeContext) WithBlock(header loom.BlockHeader) *FakeContext

func (*FakeContext) WithSender

func (c *FakeContext) WithSender(caller loom.Address) *FakeContext

func (*FakeContext) WithValidators

func (c *FakeContext) WithValidators(validators []*types.Validator) *FakeContext

type GRPCAPIClient

type GRPCAPIClient struct {
	// contains filtered or unexported fields
}

func (*GRPCAPIClient) Call

func (c *GRPCAPIClient) Call(addr loom.Address, input []byte) ([]byte, error)

func (*GRPCAPIClient) CallEVM

func (c *GRPCAPIClient) CallEVM(addr loom.Address, input []byte, value *loom.BigUInt) ([]byte, error)

func (*GRPCAPIClient) ContractRecord

func (c *GRPCAPIClient) ContractRecord(contractAddr loom.Address) (*ContractRecord, error)

func (*GRPCAPIClient) Delete

func (c *GRPCAPIClient) Delete(key []byte)

func (*GRPCAPIClient) Get

func (c *GRPCAPIClient) Get(key []byte) []byte

func (*GRPCAPIClient) GetEvmTxReceipt

func (c *GRPCAPIClient) GetEvmTxReceipt(hash []byte) (types.EvmTxReceipt, error)

func (*GRPCAPIClient) Has

func (c *GRPCAPIClient) Has(key []byte) bool

func (*GRPCAPIClient) Range

func (c *GRPCAPIClient) Range(prefix []byte) RangeData

func (*GRPCAPIClient) Resolve

func (c *GRPCAPIClient) Resolve(name string) (loom.Address, error)

func (*GRPCAPIClient) Set

func (c *GRPCAPIClient) Set(key, value []byte)

func (*GRPCAPIClient) StaticCall

func (c *GRPCAPIClient) StaticCall(addr loom.Address, input []byte) ([]byte, error)

func (*GRPCAPIClient) StaticCallEVM

func (c *GRPCAPIClient) StaticCallEVM(addr loom.Address, input []byte) ([]byte, error)

type GRPCContext

type GRPCContext struct {
	*GRPCAPIClient
	// contains filtered or unexported fields
}

func MakeGRPCContext

func MakeGRPCContext(conn *grpc.ClientConn, req *types.ContractCallRequest) *GRPCContext

func (*GRPCContext) Block

func (c *GRPCContext) Block() loom.BlockHeader

func (*GRPCContext) Config

func (c *GRPCContext) Config() *cctypes.Config

func (*GRPCContext) ContractAddress

func (c *GRPCContext) ContractAddress() loom.Address

func (*GRPCContext) Emit

func (c *GRPCContext) Emit(data []byte)

func (*GRPCContext) EmitTopics

func (c *GRPCContext) EmitTopics(data []byte, topics ...string)

func (*GRPCContext) EnabledFeatures

func (c *GRPCContext) EnabledFeatures() []string

func (*GRPCContext) FeatureEnabled

func (c *GRPCContext) FeatureEnabled(name string, defaultVal bool) bool

func (*GRPCContext) Message

func (c *GRPCContext) Message() Message

func (*GRPCContext) Now

func (c *GRPCContext) Now() time.Time

func (*GRPCContext) Validators

func (c *GRPCContext) Validators() []*ltypes.Validator

type GRPCContractServer

type GRPCContractServer struct {
	Impl Contract
	// contains filtered or unexported fields
}

func (*GRPCContractServer) Call

func (*GRPCContractServer) Init

func (*GRPCContractServer) Meta

func (*GRPCContractServer) StaticCall

type Message

type Message struct {
	Sender loom.Address
}

type Meta

type Meta = ptypes.ContractMeta

type RangeData

type RangeData []*RangeEntry

RangeData an array of key value pairs for a range of data

type RangeEntry

type RangeEntry struct {
	Key   []byte
	Value []byte
}

RangeEntry a single entry in a range

type Request

type Request = ptypes.Request

type Response

type Response = ptypes.Response

type StaticAPI

type StaticAPI interface {
	StaticCall(addr loom.Address, input []byte) ([]byte, error)
	StaticCallEVM(addr loom.Address, input []byte) ([]byte, error)
	Resolve(name string) (loom.Address, error)
	EmitTopics(event []byte, topics ...string)
	Emit(event []byte)
}

type StaticContext

type StaticContext interface {
	StaticAPI
	Get(key []byte) []byte
	Has(key []byte) bool
	Range(prefix []byte) RangeData
	Block() loom.BlockHeader
	Now() time.Time
	Message() Message
	GetEvmTxReceipt([]byte) (ptypes.EvmTxReceipt, error)
	ContractAddress() loom.Address
	FeatureEnabled(name string, defaultVal bool) bool
	Config() *cctypes.Config
	EnabledFeatures() []string
	Validators() []*types.Validator
	// ContractRecord retrieves the contract meta data stored in the Registry.
	// NOTE: This method requires Registry v2.
	ContractRecord(contractAddr loom.Address) (*ContractRecord, error)
}

StaticContext is the low-level context provided to RequestDispatcher.Call(). The primary implementation of this interface is plugin.contractContext (loomchain/plugin package). For external GRPC contracts plugin.contractContext is wrapped by GRPCContext (go-loom/plugin package).

type VolatileAPI

type VolatileAPI interface {
	Call(addr loom.Address, input []byte) ([]byte, error)
	CallEVM(addr loom.Address, input []byte, value *loom.BigUInt) ([]byte, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL