profefe

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoResults = StatusError(http.StatusNoContent, "no results", nil)
	ErrNotFound  = StatusError(http.StatusNotFound, "nothing found", nil)
)

Functions

func HandleErrorHTTP

func HandleErrorHTTP(logger *log.Logger, err error, w http.ResponseWriter, r *http.Request)

func ReplyError

func ReplyError(w http.ResponseWriter, err error)

func ReplyJSON

func ReplyJSON(w http.ResponseWriter, v interface{})

func SetupRoutes

func SetupRoutes(
	mux *http.ServeMux,
	logger *log.Logger,
	registry prometheus.Registerer,
	collector *Collector,
	querier *Querier,
)

func StatusError

func StatusError(code int, msg string, cause error) *statusError

func VersionHandler

func VersionHandler(w http.ResponseWriter, _ *http.Request)

Types

type Collector

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

func NewCollector

func NewCollector(logger *log.Logger, sw storage.Writer) *Collector

func (*Collector) WriteProfile

func (c *Collector) WriteProfile(ctx context.Context, params *storage.WriteProfileParams, r io.Reader) (Profile, error)

type Profile

type Profile struct {
	ProfileID  profile.ID     `json:"id"`
	ExternalID profile.ID     `json:"external_id,omitempty"`
	Type       string         `json:"type"`
	Service    string         `json:"service"`
	Labels     profile.Labels `json:"labels,omitempty"`
	CreatedAt  time.Time      `json:"created_at,omitempty"`
}

Profile is the JSON representation of a profile returned with API response.

func ProfileFromProfileMeta

func ProfileFromProfileMeta(meta profile.Meta) Profile

type ProfilesHandler

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

func NewProfilesHandler

func NewProfilesHandler(logger *log.Logger, collector *Collector, querier *Querier) *ProfilesHandler

func (*ProfilesHandler) HandleCreateProfile

func (h *ProfilesHandler) HandleCreateProfile(w http.ResponseWriter, r *http.Request) error

func (*ProfilesHandler) HandleFindProfiles

func (h *ProfilesHandler) HandleFindProfiles(w http.ResponseWriter, r *http.Request) error

func (*ProfilesHandler) HandleGetProfile

func (h *ProfilesHandler) HandleGetProfile(w http.ResponseWriter, r *http.Request) error

func (*ProfilesHandler) HandleMergeProfiles

func (h *ProfilesHandler) HandleMergeProfiles(w http.ResponseWriter, r *http.Request) error

func (*ProfilesHandler) ServeHTTP

func (h *ProfilesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Querier

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

func NewQuerier

func NewQuerier(logger *log.Logger, sr storage.Reader) *Querier

func (*Querier) FindMergeProfileTo

func (q *Querier) FindMergeProfileTo(ctx context.Context, dst io.Writer, params *storage.FindProfilesParams) error

func (*Querier) FindProfiles

func (q *Querier) FindProfiles(ctx context.Context, params *storage.FindProfilesParams) ([]Profile, error)

func (*Querier) GetProfilesTo

func (q *Querier) GetProfilesTo(ctx context.Context, dst io.Writer, pids []profile.ID) error

func (*Querier) ListServices

func (q *Querier) ListServices(ctx context.Context) ([]string, error)

type ServicesHandler

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

func NewServicesHandler

func NewServicesHandler(logger *log.Logger, querier *Querier) *ServicesHandler

func (*ServicesHandler) ServeHTTP

func (h *ServicesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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