api

package
v9.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: MIT Imports: 34 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VERSION = "8.0.0"

VERSION identifies podium's current version

Functions

This section is empty.

Types

type App

type App struct {
	Debug bool

	// HTTP endpoint for HTTP requests. Built after calling Start. Format: 127.0.0.1:8080
	HTTPEndpoint string

	// GRPC endpoint for GRPC requests. Built after calling Start. Format: 127.0.0.1:8081
	GRPCEndpoint string

	ConfigPath string
	Errors     metrics.EWMA

	Config       *viper.Viper
	Logger       zap.Logger
	Leaderboards *leaderboard.Client
	NewRelic     newrelic.Application
	DDStatsD     *extnethttpmiddleware.DogStatsD
	// contains filtered or unexported fields
}

App is a struct that represents a podium Application

func New

func New(host string, httpPort, grpcPort int, configPath string, debug bool, logger zap.Logger) (*App, error)

New returns a new podium Application. If httpPort is sent as zero, a random port will be selected (the same will happen for grpcPort)

func (*App) AddError

func (app *App) AddError()

AddError rate statistics

func (*App) BulkUpsertScores

func (app *App) BulkUpsertScores(ctx context.Context, req *api.BulkUpsertScoresRequest) (*api.BulkUpsertScoresResponse, error)

BulkUpsertScores is the handler responsible for creating or updating members score.

func (*App) GetAroundMember

func (app *App) GetAroundMember(ctx context.Context, req *api.GetAroundMemberRequest) (*api.GetAroundMemberResponse, error)

GetAroundMember retrieves a list of member score and rank centered req the given member.

func (*App) GetAroundScore

func (app *App) GetAroundScore(ctx context.Context, req *api.GetAroundScoreRequest) (*api.GetAroundScoreResponse, error)

GetAroundScore retrieves a list of member scores and ranks centered req a given score.

func (*App) GetMember

func (app *App) GetMember(ctx context.Context, req *api.GetMemberRequest) (*api.GetMemberResponse, error)

GetMember is the handler responsible for retrieving a member score and rank.

func (*App) GetMembers

func (app *App) GetMembers(ctx context.Context, req *api.GetMembersRequest) (*api.GetMembersResponse, error)

GetMembers retrieves several members at once.

func (*App) GetRank

func (app *App) GetRank(ctx context.Context, req *api.GetRankRequest) (*api.GetRankResponse, error)

GetRank is the handler responsible for retrieving a member rank.

func (*App) GetRankMultiLeaderboards

func (app *App) GetRankMultiLeaderboards(ctx context.Context, req *api.GetRankMultiLeaderboardsRequest) (*api.GetRankMultiLeaderboardsResponse, error)

GetRankMultiLeaderboards returns the member rank req several leaderboards at once.

func (*App) GetTopMembers

func (app *App) GetTopMembers(ctx context.Context, req *api.GetTopMembersRequest) (*api.GetTopMembersResponse, error)

GetTopMembers retrieves onePage of member score and rank.

func (*App) GetTopPercentage

func (app *App) GetTopPercentage(ctx context.Context, req *api.GetTopPercentageRequest) (*api.GetTopPercentageResponse, error)

GetTopPercentage retrieves top x % members req the leaderboard.

func (*App) GracefullStop

func (app *App) GracefullStop()

GracefulStop attempts to stop the server.

func (*App) HealthCheck

func (app *App) HealthCheck(ctx context.Context, req *api.HealthCheckRequest) (*api.HealthCheckResponse, error)

func (*App) IncrementScore

func (app *App) IncrementScore(ctx context.Context, req *api.IncrementScoreRequest) (*api.IncrementScoreResponse, error)

IncrementScore is the handler responsible for incrementing the member score.

func (*App) OnErrorHandler

func (app *App) OnErrorHandler(err error, stack []byte)

OnErrorHandler handles panics

func (*App) RemoveLeaderboard

func (app *App) RemoveLeaderboard(ctx context.Context, req *api.RemoveLeaderboardRequest) (*api.RemoveLeaderboardResponse, error)

RemoveLeaderboard is the handler responsible for removing a leaderboard.

func (*App) RemoveMember

func (app *App) RemoveMember(ctx context.Context, req *api.RemoveMemberRequest) (*api.RemoveMemberResponse, error)

TODO: Make this function use RemoveMembers RemoveMember removes a member from a leaderboard.

func (*App) RemoveMembers

func (app *App) RemoveMembers(ctx context.Context, req *api.RemoveMembersRequest) (*api.RemoveMembersResponse, error)

RemoveMembers removes several members from a leaderboard.

func (*App) Start

func (app *App) Start(ctx context.Context) error

Start starts listening for web requests at specified host and port

func (*App) Status

func (app *App) Status(ctx context.Context, req *empty.Empty) (*api.StatusResponse, error)

func (*App) TotalMembers

func (app *App) TotalMembers(ctx context.Context, req *api.TotalMembersRequest) (*api.TotalMembersResponse, error)

TotalMembers is the handler responsible for returning the total number of members req a leaderboard.

func (*App) UpsertScore

func (app *App) UpsertScore(ctx context.Context, req *api.UpsertScoreRequest) (*api.UpsertScoreResponse, error)

UpsertScore is the handler responsible for creating or updating the member score.

func (*App) UpsertScoreMultiLeaderboards

UpsertScoreMultiLeaderboards sets the member score for all leaderboards.

func (*App) WaitForReady

func (app *App) WaitForReady(d time.Duration) error

WaitForReady blocks until App is ready to serve requests or the timeout is reached. An error is returned on timeout.

type EasyJSONMarshaler

type EasyJSONMarshaler interface {
	MarshalEasyJSON(w *jwriter.Writer)
}

EasyJSONMarshaler describes a struct able to marshal json

type EasyJSONUnmarshaler

type EasyJSONUnmarshaler interface {
	UnmarshalEasyJSON(l *jlexer.Lexer)
}

EasyJSONUnmarshaler describes a struct able to unmarshal json

type JSON

type JSON map[string]interface{}

JSON type

Jump to

Keyboard shortcuts

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