Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type OracleServer ¶
type OracleServer struct {
service.UnimplementedOracleServer
// closer to handle graceful closures from multiple go-routines
*sync.Closer
// contains filtered or unexported fields
}
OracleServer is the base implementation of the service.OracleServer interface, this is meant to serve requests from a remote OracleClient
func NewOracleServer ¶
func NewOracleServer(o servicetypes.Oracle, l log.Logger) *OracleServer
NewOracleServer returns a new instance of the OracleServer, given an implementation of the Oracle interface.
func (*OracleServer) Close ¶
func (os *OracleServer) Close() error
Close closes the underlying oracle server, and blocks until all open requests have been satisfied
func (*OracleServer) Done ¶
func (os *OracleServer) Done() <-chan struct{}
Done returns a channel that is closed when the oracle server is closed
func (*OracleServer) Prices ¶
func (os *OracleServer) Prices(ctx context.Context, req *service.QueryPricesRequest) (*service.QueryPricesResponse, error)
Prices calls the underlying oracle's implementation of GetPrices. It defers to the ctx in the request, and errors if the context is cancelled for any reason, or if the oracle errors
func (*OracleServer) StartServer ¶
func (os *OracleServer) StartServer(ctx context.Context, host, port string) error
StartServer starts the oracle gRPC server on the given host and port. The server is killed on any errors from the listener, or if ctx is cancelled. This method returns an error via any failure from the listener. This is a blocking call, i.e until the server is closed or the server errors, this method will block.