types

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxAcceptableUpdateDelay = 5 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileHandler

type FileHandler interface {
	RemoveAll(path string) error
}

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

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

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.

func (*RequestHandlerImpl) Get

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