status

package
v0.1.0-alpha12 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package status provides all components required to serve data ingestion status via an HTTP API. It includes the transport & persistence layers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTP

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

The HTTP type contains HTTP request handlers that return the status of data ingestion.

func NewHTTP

func NewHTTP(statuses Repository) *HTTP

NewHTTP returns a new instance of the HTTP type that will serve status data queried from the Repository implementation.

func (*HTTP) Register

func (h *HTTP) Register(router *mux.Router)

Register the HTTP routes into the given router.

func (*HTTP) Status

func (h *HTTP) Status(w http.ResponseWriter, r *http.Request)

Status handles an inbound HTTP GET request that returns information on the status of data ingestion from the Repository.

type PostgresRepository

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

The PostgresRepository is a Repository implementation that queries status data from a postgres-compatible database.

func NewPostgresRepository

func NewPostgresRepository(db *sql.DB) *PostgresRepository

NewPostgresRepository returns a new instance of the PostgresRepository type that will perform queries against the provided sql.DB instance.

func (*PostgresRepository) Status

func (r *PostgresRepository) Status(ctx context.Context) (Status, error)

Status returns the current status of data within the database.

type Repository

type Repository interface {
	Status(ctx context.Context) (Status, error)
}

The Repository interface describes types that can query the status of the data within the persistent storage.

type Status

type Status struct {
	LastIngestTimestamp time.Time `json:"lastIngestTimestamp"`
}

The Status type contains fields describing the current status of the data within the backend.

Jump to

Keyboard shortcuts

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