factory

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HandshakeConfig = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "BASIC_PLUGIN",
	MagicCookieValue: "hello",
}

Functions

func NewEsimFactory added in v0.0.5

func NewEsimFactory(logger logger.Logger) *esimFactory

func NewRpcPluginStructField added in v0.0.5

func NewRpcPluginStructField(writer file_dir.IfaceWriter, logger log2.Logger) *rpcPluginStructField

Types

type InitFieldsReturn

type InitFieldsReturn struct {
	Fields     []string    `json:"fields"`
	SpecFields []pkg.Field `json:"SpecFields"`
}

type Model

type Model interface {
	Sort() string

	InitField() string
}

Model is the interface that we're exposing as a plugin.

type ModelPlugin

type ModelPlugin struct {
	// Impl Injection
	Impl Model
}

This is the implementation of plugin.Plugin so we can serve/consume this

This has two methods: Server must return an RPC server for this plugin type. We construct a ModelRPCServer for this.

Client must return an implementation of our interface that communicates over an RPC client. We return ModelRPC for this.

Ignore MuxBroker. That is used to create more multiplexed streams on our plugin connection and is a more advanced use case.

func (ModelPlugin) Client

func (ModelPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (*ModelPlugin) Server

func (p *ModelPlugin) Server(*plugin.MuxBroker) (interface{}, error)

type ModelRPC

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

Here is an implementation that talks over RPC

func (*ModelRPC) InitField

func (g *ModelRPC) InitField() string

func (*ModelRPC) Sort

func (g *ModelRPC) Sort() string

type ModelRPCServer

type ModelRPCServer struct {
	// This is the real implementation
	Impl Model
}

Here is the RPC server that ModelRPC talks to, conforming to the requirements of net/rpc

func (*ModelRPCServer) InitField

func (s *ModelRPCServer) InitField(args interface{}, resp *string) error

func (*ModelRPCServer) Sort

func (s *ModelRPCServer) Sort(args interface{}, resp *string) error

type Plural added in v0.0.5

type Plural struct {
	PluralName string

	StructName string

	Star string
}

func NewPlural added in v0.0.5

func NewPlural() Plural

func (Plural) NewString added in v0.0.5

func (pl Plural) NewString() string

func (Plural) ReleaseString added in v0.0.5

func (pl Plural) ReleaseString() string

func (Plural) TypeString added in v0.0.5

func (pl Plural) TypeString() string

type PoolTpl added in v0.0.5

type PoolTpl struct {
	VarPoolName string

	StructName string
}

func NewPoolTpl added in v0.0.5

func NewPoolTpl() PoolTpl

func (PoolTpl) String added in v0.0.5

func (pt PoolTpl) String() string

type SortReturn

type SortReturn struct {
	Fields pkg.Fields `json:"fields"`
}

type StructFieldIface added in v0.0.5

type StructFieldIface interface {
	SortField(fields []pkg.Field) *SortReturn

	InitField(fields []pkg.Field) *InitFieldsReturn

	Close()

	SetStructInfo(*structInfo)

	SetStructName(string)

	SetStructDir(string)

	SetStructFileName(string)

	SetFilesName(filesName []string)

	SetPackName(packName string)
}

type Var

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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