Documentation ¶
Index ¶
- Constants
- Variables
- func CreateBadgeServerCobraCommand() *cobra.Command
- func RunBadgeServer(cmd *cobra.Command, v *viper.Viper)
- type BadgeStateTracker
- func (st *BadgeStateTracker) RegisterForDowntimeParamsUpdates(ctx context.Context, downtimeParamsUpdatable updaters.DowntimeParamsUpdatable) error
- func (st *BadgeStateTracker) RegisterForEpochUpdates(ctx context.Context, epochUpdatable updaters.EpochUpdatable)
- func (st *BadgeStateTracker) RegisterForSpecUpdates(ctx context.Context, specUpdatable updaters.SpecUpdatable, ...) error
- type GelocationToProjectsConfiguration
- type HealthServer
- type IpData
- type IpService
- type MetricsService
- type ProjectConfiguration
- type Server
- func (s *Server) Active() bool
- func (s *Server) GenerateBadge(ctx context.Context, req *pairingtypes.GenerateBadgeRequest) (*pairingtypes.GenerateBadgeResponse, error)
- func (s *Server) GetEpoch() uint64
- func (s *Server) GetUniqueName() string
- func (s *Server) InitializeStateTracker(tracker *BadgeStateTracker)
- func (s *Server) SetSpec(specUpdate spectypes.Spec)
- func (s *Server) UpdateEpoch(epoch uint64)
- type UserBadgeItem
Constants ¶
View Source
const ( PortFieldName = "port" MetricsPortFieldName = "metrics-port" ProjectDataFieldName = "projects-data" LavaChainIDFieldName = "chain-id" DefaultGeolocationFieldName = "default-geolocation" CountriesFilePathFieldName = "countries-file-path" IpFilePathFieldName = "ip-file-path" )
View Source
const AddBlockDelayForEpochUpdaterBadgeServer = 2
adding 3 blocks delay, to update the epoch. the reason is for the sdk to wait until all providers are synced to the new epoch before SDK gets a new pairing list.
View Source
const DefaultProjectId = "default"
View Source
const RefererHeaderKey = "Referer"
Variables ¶
View Source
var (
// The name of our config file, without the file extension because viper supports many different config file languages.
DefaultConfigFilename = "badgeserver.yml"
)
Functions ¶
Types ¶
type BadgeStateTracker ¶
type BadgeStateTracker struct { *statetracker.StateTracker statetracker.ConsumerEmergencyTrackerInf // contains filtered or unexported fields }
func NewBadgeStateTracker ¶
func NewBadgeStateTracker(ctx context.Context, clientCtx cosmosclient.Context, chainFetcher chaintracker.ChainFetcher, chainId string) (ret *BadgeStateTracker, err error)
func (*BadgeStateTracker) RegisterForDowntimeParamsUpdates ¶
func (st *BadgeStateTracker) RegisterForDowntimeParamsUpdates(ctx context.Context, downtimeParamsUpdatable updaters.DowntimeParamsUpdatable) error
func (*BadgeStateTracker) RegisterForEpochUpdates ¶
func (st *BadgeStateTracker) RegisterForEpochUpdates(ctx context.Context, epochUpdatable updaters.EpochUpdatable)
func (*BadgeStateTracker) RegisterForSpecUpdates ¶
func (st *BadgeStateTracker) RegisterForSpecUpdates(ctx context.Context, specUpdatable updaters.SpecUpdatable, endpoint lavasession.RPCEndpoint) error
type GelocationToProjectsConfiguration ¶
type GelocationToProjectsConfiguration map[string]map[string]*ProjectConfiguration
type HealthServer ¶
type HealthServer struct {
health.UnimplementedHealthServer
}
func (*HealthServer) Check ¶
func (s *HealthServer) Check(ctx context.Context, in *health.HealthCheckRequest) (*health.HealthCheckResponse, error)
func (*HealthServer) Watch ¶
func (s *HealthServer) Watch(in *health.HealthCheckRequest, _ health.Health_WatchServer) error
type IpService ¶
type IpService struct { DefaultGeolocation int CountryCsvFilePath string IpTsvFilePath string IpCountryData *[]*IpData }
func InitIpService ¶
func (*IpService) ReadIpTsvFileData ¶
type MetricsService ¶
type MetricsService struct { TotalRequests prometheus.Counter FailedRequests prometheus.Counter SuccessfulRequests prometheus.Counter }
func InitMetrics ¶
func InitMetrics() *MetricsService
func (*MetricsService) AddRequest ¶
func (service *MetricsService) AddRequest(isSuccessful bool)
type ProjectConfiguration ¶
type ProjectConfiguration struct { EpochsMaxCu int64 `yaml:"epochs-max-cu,omitempty" json:"epochs-max-cu,omitempty" mapstructure:"epochs-max-cu,omitempty"` UpdatedEpoch map[string]uint64 `yaml:"update-epoch,omitempty" json:"update-epoch,omitempty" mapstructure:"update-epoch,omitempty"` PairingList map[string]*types.QueryGetPairingResponse `yaml:"pairing-list,omitempty" json:"pairing-list,omitempty" mapstructure:"pairing-list,omitempty"` }
type Server ¶
type Server struct { pairingtypes.UnimplementedBadgeGeneratorServer ProjectsConfiguration GelocationToProjectsConfiguration // geolocation/project_id/project_data ChainId string IpService *IpService // contains filtered or unexported fields }
func NewServer ¶
func NewServer(ipService *IpService, chainId string, projectsData GelocationToProjectsConfiguration, chainFetcher *chainlib.LavaChainFetcher, clientCtx client.Context, projectPublicKey string, projectPrivateKey *btcSecp256k1.PrivateKey) (*Server, error)
func (*Server) GenerateBadge ¶
func (s *Server) GenerateBadge(ctx context.Context, req *pairingtypes.GenerateBadgeRequest) (*pairingtypes.GenerateBadgeResponse, error)
func (*Server) GetUniqueName ¶
func (*Server) InitializeStateTracker ¶
func (s *Server) InitializeStateTracker(tracker *BadgeStateTracker)
func (*Server) UpdateEpoch ¶
Click to show internal directories.
Click to hide internal directories.