Documentation ¶
Index ¶
Constants ¶
const (
MaxAcceptableUpdateDelay = 5 * time.Minute
)
const Name = "daemons"
Variables ¶
var ( // Generic daemon server errors. ErrServerNotInitializedCorrectly = errorsmod.Register(Name, 1, "Daemon server not initialized correctly") // PriceFeed daemon service errors will have code 1xxx. ErrPriceFeedInvalidPrice = errorsmod.Register( Name, 1000, fmt.Sprintf("Price is set to %d which is not a valid price", constants.DefaultPrice), ) ErrPriceFeedLastUpdateTimeNotSet = errorsmod.Register(Name, 1001, "LastUpdateTime is not set") ErrPriceFeedMarketPriceUpdateEmpty = errorsmod.Register(Name, 1002, "Market price update has length of 0") )
daemon errors
Functions ¶
This section is empty.
Types ¶
type FileHandler ¶
FileHandler is an interface that encapsulates the os function `RemoveAll`.
type FileHandlerImpl ¶
type FileHandlerImpl struct{}
FileHandlerImpl is the struct that implements the `FileHandler` interface.
func (*FileHandlerImpl) RemoveAll ¶
func (r *FileHandlerImpl) RemoveAll(path string) error
RemoveAll wraps `os.RemoveAll` which removes everything at a given path.
type GrpcClient ¶
type GrpcClient interface { NewGrpcConnection(ctx context.Context, socketAddress string) (*grpc.ClientConn, error) NewTcpConnection(ctx context.Context, endpoint string) (*grpc.ClientConn, error) CloseConnection(grpcConn *grpc.ClientConn) error }
GrpcClient is an interface that encapsulates the `NewGrpcConnection` function and `CloseConnection`.
type GrpcClientImpl ¶
type GrpcClientImpl struct{}
GrpcClientImpl is the struct that implements the `GrpcClient` interface.
func (*GrpcClientImpl) CloseConnection ¶
func (g *GrpcClientImpl) CloseConnection(grpcConn *grpc.ClientConn) error
CloseConnection calls `grpc.ClientConn.Close()` to close a grpc connection.
func (*GrpcClientImpl) NewGrpcConnection ¶
func (g *GrpcClientImpl) NewGrpcConnection( ctx context.Context, socketAddress string, ) (*grpc.ClientConn, error)
NewGrpcConnection calls `grpc.Dial` with custom parameters to create a secure connection with context that blocks until the underlying connection is up.
func (*GrpcClientImpl) NewTcpConnection ¶
func (g *GrpcClientImpl) NewTcpConnection( ctx context.Context, endpoint string, ) (*grpc.ClientConn, error)
NewTcpConnection calls `grpc.Dial` to create an insecure tcp connection.
type GrpcServer ¶
type GrpcServer interface { Serve(lis net.Listener) error Stop() RegisterService(sd *grpc.ServiceDesc, ss interface{}) }
GrpcServer is an interface that encapsulates a `Grpc.Server` object.
type HealthCheckable ¶
type HealthCheckable interface { // HealthCheck returns an error if a service is unhealthy. If the service is healthy, this method returns nil. HealthCheck() (err error) // ReportFailure records a failed update. ReportFailure(err error) // ReportSuccess records a successful update. ReportSuccess() // ServiceName returns the name of the service being monitored. This name is expected to be unique. ServiceName() string }
HealthCheckable is a common interface for services that can be health checked.
Instances of this type are thread-safe.
func NewTimeBoundedHealthCheckable ¶
func NewTimeBoundedHealthCheckable( serviceName string, timeProvider libtime.TimeProvider, logger log.Logger, ) HealthCheckable
NewTimeBoundedHealthCheckable creates a new HealthCheckable instance.
type RequestHandler ¶
RequestHandler is an interface that handles making HTTP requests.
type RequestHandlerImpl ¶
type RequestHandlerImpl struct {
// contains filtered or unexported fields
}
RequestHandlerImpl is the struct that implements the `RequestHandler` interface.
func NewRequestHandlerImpl ¶
func NewRequestHandlerImpl(client *http.Client) *RequestHandlerImpl
NewRequestHandlerImpl creates a new RequestHandlerImpl. It manages making HTTP requests.