types

package
v0.4.1-dev1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "daemons"

Variables

View Source
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 added in v0.4.0

type FileHandler interface {
	RemoveAll(path string) error
}

FileHandler is an interface that encapsulates the os function `RemoveAll`.

type FileHandlerImpl added in v0.4.0

type FileHandlerImpl struct{}

FileHandlerImpl is the struct that implements the `FileHandler` interface.

func (*FileHandlerImpl) RemoveAll added in v0.4.0

func (r *FileHandlerImpl) RemoveAll(path string) error

RemoveAll wraps `os.RemoveAll` which removes everything at a given path.

type GrpcClient added in v0.4.0

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 added in v0.4.0

type GrpcClientImpl struct{}

GrpcClientImpl is the struct that implements the `GrpcClient` interface.

func (*GrpcClientImpl) CloseConnection added in v0.4.0

func (g *GrpcClientImpl) CloseConnection(grpcConn *grpc.ClientConn) error

CloseConnection calls `grpc.ClientConn.Close()` to close a grpc connection.

func (*GrpcClientImpl) NewGrpcConnection added in v0.4.0

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 added in v0.4.0

func (g *GrpcClientImpl) NewTcpConnection(
	ctx context.Context,
	endpoint string,
) (*grpc.ClientConn, error)

NewTcpConnection calls `grpc.Dial` to create an insecure tcp connection.

type GrpcServer added in v0.4.0

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 RequestHandler added in v0.4.0

type RequestHandler interface {
	Get(ctx context.Context, url string) (*http.Response, error)
}

RequestHandler is an interface that handles making HTTP requests.

type RequestHandlerImpl added in v0.4.0

type RequestHandlerImpl struct {
	// contains filtered or unexported fields
}

RequestHandlerImpl is the struct that implements the `RequestHandler` interface.

func NewRequestHandlerImpl added in v0.4.0

func NewRequestHandlerImpl(client *http.Client) *RequestHandlerImpl

NewRequestHandlerImpl creates a new RequestHandlerImpl. It manages making HTTP requests.

func (*RequestHandlerImpl) Get added in v0.4.0

Get wraps `http.Get` which makes an HTTP GET request to a URL and returns a response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL