Documentation ¶
Overview ¶
Package oracle defines a simple system for http middleware built around functions with the following signature:
func Wrap(h http.Handler) http.Handler
The middleware are chained together using the middlewareChain type which can wrap the grpc-gateway to augment how it serves the API.
Package oracle is a framework that provides a REST/JSON API defined using a GRPC spec, that communicates with the phylum.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // ListenAddress is an address the oracle HTTP listens on. ListenAddress string `yaml:"listen-address"` // PhylumPath is the the path for the business logic. PhylumPath string `yaml:"phylum-path"` // GatewayEndpoint is an address to the shiroclient gateway. GatewayEndpoint string `yaml:"gateway-endpoint"` // PhylumServiceName is the app-specific name of the conneted phylum. PhylumServiceName string `yaml:"phylum-service-name"` // ServiceName is the app-specific name of the Oracle. ServiceName string `yaml:"service-name"` // RequestIDHeader is the HTTP header encoding the request ID. RequestIDHeader string `yaml:"request-id-header"` // Version is the oracle version. Version string `yaml:"version"` // TraceOpts are tracing options. TraceOpts []opttrace.Option // Verbose increases logging. Verbose bool `yaml:"verbose"` // EmulateCC emulates chaincode in memory (for testing). EmulateCC bool `yaml:"emulate-cc"` // contains filtered or unexported fields }
Config configures an oracle.
func (*Config) SetOTLPEndpoint ¶
SetOTLPEndpoint is a helper to set the OTLP trace endpoint.
func (*Config) SetSwaggerHandler ¶
SetSwaggerHandler configures an endpoint to serve the swagger API.
type GrpcGatewayConfig ¶
type GrpcGatewayConfig interface { // RegisterServiceServer is required to be overidden by the implementation. RegisterServiceServer(grpcServer *grpc.Server) // RegisterServiceClient is required to be overidden by the implementation. RegisterServiceClient(ctx context.Context, grpcCon *grpc.ClientConn, mux *runtime.ServeMux) error }
GrpcGatewayConfig configures the grpc gateway used by the oracle.
type Oracle ¶
type Oracle struct {
// contains filtered or unexported fields
}
Oracle provides services.
func NewTestOracle ¶
NewTestOracle is used to create an oracle for testing.
func (*Oracle) GetHealthCheck ¶
func (orc *Oracle) GetHealthCheck(ctx context.Context, req *healthcheck.GetHealthCheckRequest) (*healthcheck.GetHealthCheckResponse, error)
GetHealthCheck checks this service and all dependent services to construct a health report. Returns a grpc error code if a service is down.
func (*Oracle) StartGateway ¶
func (orc *Oracle) StartGateway(ctx context.Context, grpcConfig GrpcGatewayConfig) error