Documentation
¶
Index ¶
- Variables
- type GRPCClient
- func (m *GRPCClient) BuyConditions(asset string) bool
- func (m *GRPCClient) GetProperty() map[string]interface{}
- func (m *GRPCClient) Info() proto.Information
- func (m *GRPCClient) Init()
- func (m *GRPCClient) RankFilter(asset string) bool
- func (m *GRPCClient) SellConditions(asset string) bool
- func (m *GRPCClient) SetProperty(property map[string]interface{})
- type GRPCServer
- func (m *GRPCServer) BuyConditions(ctx context.Context, asset *proto.Asset) (*proto.Bool, error)
- func (m *GRPCServer) GetProperty(context.Context, *proto.Empty) (*proto.Dictionary, error)
- func (m *GRPCServer) Info(context.Context, *proto.Empty) (*proto.Information, error)
- func (m *GRPCServer) Init(context.Context, *proto.Empty) (*proto.Empty, error)
- func (m *GRPCServer) RankFilter(ctx context.Context, asset *proto.Asset) (*proto.Bool, error)
- func (m *GRPCServer) SellConditions(ctx context.Context, asset *proto.Asset) (*proto.Bool, error)
- func (m *GRPCServer) SetProperty(context context.Context, property *proto.Dictionary) (*proto.Empty, error)
- type Strategy
- type StrategyPlugin
Constants ¶
This section is empty.
Variables ¶
View Source
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "BASIC_PLUGIN",
MagicCookieValue: "hello",
}
Handshake is a common handshake that is shared by plugin and host.
View Source
var PluginMap = map[string]plugin.Plugin{ "strategy": &StrategyPlugin{}, }
PluginMap is the map of plugins we can dispense.
Functions ¶
This section is empty.
Types ¶
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
GRPCClient is an implementation of Strategy that talks over RPC.
func (*GRPCClient) BuyConditions ¶
func (m *GRPCClient) BuyConditions(asset string) bool
func (*GRPCClient) GetProperty ¶
func (m *GRPCClient) GetProperty() map[string]interface{}
func (*GRPCClient) Info ¶
func (m *GRPCClient) Info() proto.Information
func (*GRPCClient) Init ¶
func (m *GRPCClient) Init()
func (*GRPCClient) RankFilter ¶
func (m *GRPCClient) RankFilter(asset string) bool
func (*GRPCClient) SellConditions ¶
func (m *GRPCClient) SellConditions(asset string) bool
func (*GRPCClient) SetProperty ¶
func (m *GRPCClient) SetProperty(property map[string]interface{})
type GRPCServer ¶
type GRPCServer struct { // This is the real implementation Impl Strategy }
Here is the gRPC server that GRPCClient talks to.
func (*GRPCServer) BuyConditions ¶
func (*GRPCServer) GetProperty ¶
func (m *GRPCServer) GetProperty(context.Context, *proto.Empty) (*proto.Dictionary, error)
func (*GRPCServer) Info ¶
func (m *GRPCServer) Info(context.Context, *proto.Empty) (*proto.Information, error)
func (*GRPCServer) RankFilter ¶
func (*GRPCServer) SellConditions ¶
func (*GRPCServer) SetProperty ¶
func (m *GRPCServer) SetProperty(context context.Context, property *proto.Dictionary) (*proto.Empty, error)
type Strategy ¶
type Strategy interface { Init() Info() proto.Information GetProperty() map[string]interface{} SetProperty(map[string]interface{}) SellConditions(string) bool BuyConditions(string) bool RankFilter(string) bool }
KV is the interface that we're exposing as a plugin.
type StrategyPlugin ¶
type StrategyPlugin struct { // Concrete implementation, written in Go. This is only used for plugins // that are written in Go. Impl Strategy }
This is the implementation of plugin.Plugin so we can serve/consume this. We also implement GRPCPlugin so that this plugin can be served over gRPC.
func (*StrategyPlugin) Client ¶
func (*StrategyPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)
func (*StrategyPlugin) GRPCClient ¶
func (p *StrategyPlugin) GRPCClient(c *grpc.ClientConn) (interface{}, error)
func (*StrategyPlugin) GRPCServer ¶
func (p *StrategyPlugin) GRPCServer(s *grpc.Server) error
func (*StrategyPlugin) Server ¶
func (p *StrategyPlugin) Server(*plugin.MuxBroker) (interface{}, error)
Click to show internal directories.
Click to hide internal directories.