Documentation ¶
Index ¶
- Variables
- func Serve(model Model)
- type ClientGRPC
- type Level
- type Model
- type ModelGRPCPlugin
- type Plugin
- type Response
- func (res Response) Array() ([]interface{}, error)
- func (res Response) Bind(v interface{}) error
- func (res Response) Interface() (interface{}, error)
- func (res Response) Map() (maps.MapStrAny, error)
- func (res Response) MustArray() []interface{}
- func (res Response) MustBind(v interface{})
- func (res Response) MustInterface() interface{}
- func (res Response) MustMap() maps.MapStrAny
- func (res Response) MustValue() interface{}
- func (res Response) Value() (interface{}, error)
- type ServerGRPC
Constants ¶
This section is empty.
Variables ¶
View Source
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "GOU_MODEL_PLUGIN",
MagicCookieValue: "GOU VER0.6.0",
}
Handshake is a common handshake that is shared by plugin and host.
View Source
var PluginMap = map[string]plugin.Plugin{ "model": &ModelGRPCPlugin{}, }
PluginMap is the map of plugins we can dispense.
Functions ¶
Types ¶
type ClientGRPC ¶
type ClientGRPC struct {
// contains filtered or unexported fields
}
ClientGRPC is an implementation of KV that talks over RPC.
type Level ¶ added in v0.6.1
type Level int32
Level represents a log level.
const ( // NoLevel is a special level used to indicate that no level has been // set and allow for a default to be used. NoLevel Level = 0 // Trace is the most verbose level. Intended to be used for the tracing // of actions in code, such as function enters/exits, etc. Trace Level = 1 // Debug information for programmer lowlevel analysis. Debug Level = 2 // Info information about steady state operations. Info Level = 3 // Warn information about rare but handled events. Warn Level = 4 // Error information about unrecoverable events. Error Level = 5 // Off disables all logging output. Off Level = 6 )
type ModelGRPCPlugin ¶
type ModelGRPCPlugin struct { // GRPCPlugin must still implement the Plugin interface plugin.Plugin // Concrete implementation, written in Go. This is only used for plugins // that are written in Go. Impl Model }
ModelGRPCPlugin This is the implementation of plugin.Plugin so we can serve/consume this.
func (*ModelGRPCPlugin) GRPCClient ¶
func (p *ModelGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
GRPCClient the GRPC client
func (*ModelGRPCPlugin) GRPCServer ¶
func (p *ModelGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
GRPCServer the GRPC Server
type Plugin ¶ added in v0.6.1
type Plugin struct {
Logger hclog.Logger
}
Plugin Here is a real implementation of Pluine that writes to a local file with the key name and the contents are the value of the key.
type Response ¶
Response GRPC Response
func (Response) MustArray ¶ added in v0.6.1
func (res Response) MustArray() []interface{}
MustArray cast to array | slice
func (Response) MustBind ¶ added in v0.6.1
func (res Response) MustBind(v interface{})
MustBind bind struct
func (Response) MustInterface ¶ added in v0.6.1
func (res Response) MustInterface() interface{}
MustInterface bind struct
Click to show internal directories.
Click to hide internal directories.