Documentation ¶
Index ¶
- Constants
- type BadgerDB
- func (mdb *BadgerDB) BatchSave(dbEntries []*DBEntry) error
- func (mdb *BadgerDB) Close() error
- func (mdb *BadgerDB) Delete(key string) error
- func (mdb *BadgerDB) DeletePrefix(prefix string) error
- func (mdb *BadgerDB) FindAll() (map[string][]byte, error)
- func (mdb *BadgerDB) FindOne(key string) (one []byte, err error)
- func (mdb *BadgerDB) Key() string
- func (mdb *BadgerDB) Save(dbEntry *DBEntry) error
- type ChainTrackerSpecsInf
- type ConsumerRewards
- type DB
- type DBEntry
- type DisabledRewardServer
- func (rws *DisabledRewardServer) SendNewProof(ctx context.Context, proof *pairingtypes.RelaySession, epoch uint64, ...) (existingCU uint64, updatedWithProof bool)
- func (rws *DisabledRewardServer) SubscribeEnded(consumer string, epoch uint64, subscribeID string)
- func (rws *DisabledRewardServer) SubscribeStarted(consumer string, epoch uint64, subscribeID string)
- type EpochRewards
- type PaymentConfiguration
- type PaymentRequest
- type RelaySessionsToRetryAttempts
- type RewardDB
- func (rs *RewardDB) AddDB(db DB) error
- func (rs *RewardDB) BatchSave(rewardEntities []*RewardEntity) (err error)
- func (rs *RewardDB) Close() error
- func (rs *RewardDB) DBExists(specId string) bool
- func (rs *RewardDB) DeleteClaimedRewards(epoch uint64, consumerAddr string, sessionId uint64, consumerRewardsKey string) (err error)
- func (rs *RewardDB) DeleteEpochRewards(epoch uint64) error
- func (rs *RewardDB) FindAll() (map[uint64]*EpochRewards, error)
- func (rs *RewardDB) FindAllInDB(specId string) (map[uint64]*EpochRewards, error)
- func (rs *RewardDB) FindOne(epoch uint64, consumerAddr string, consumerKey string, sessionId uint64) (*pairingtypes.RelaySession, error)
- func (rs *RewardDB) Save(rewardEntity *RewardEntity) error
- type RewardEntity
- type RewardServer
- func (rws *RewardServer) AddDataBase(specId string, providerPublicAddress string, shardID uint)
- func (rws *RewardServer) AddRewardDelayForUnifiedRewardDistribution(ctx context.Context, epochStart uint64)
- func (rws *RewardServer) CloseAllDataBases() error
- func (rws *RewardServer) Description() string
- func (rws *RewardServer) PaymentHandler(payment *PaymentRequest)
- func (rws *RewardServer) RemoveExpectedPayment(paidCUToFInd uint64, expectedClient sdk.AccAddress, blockHeight int64, ...) bool
- func (rws *RewardServer) SendNewProof(ctx context.Context, proof *pairingtypes.RelaySession, epoch uint64, ...) (existingCU uint64, updatedWithProof bool)
- func (rws *RewardServer) SubscribeEnded(consumer string, epoch uint64, subscribeID string)
- func (rws *RewardServer) SubscribeStarted(consumer string, epoch uint64, subscribeID string)
- func (rws *RewardServer) UpdateEpoch(epoch uint64)
- type RewardsTxSender
Constants ¶
View Source
const ( RewardServerStorageFlagName = "reward-server-storage" DefaultRewardServerStorage = ".storage/rewardserver" RewardTTLFlagName = "reward-ttl" DefaultRewardTTL = 24 * 60 * time.Minute MaxDBSaveRetries = 10 RewardsSnapshotThresholdFlagName = "proofs-snapshot-threshold" DefaultRewardsSnapshotThreshold = 1000 RewardsSnapshotTimeoutSecFlagName = "proofs-snapshot-timeout-sec" DefaultRewardsSnapshotTimeoutSec = 30 MaxPaymentRequestsRetiresForSession = 3 RewardServerMaxRelayRetires = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadgerDB ¶
type BadgerDB struct {
// contains filtered or unexported fields
}
func (*BadgerDB) DeletePrefix ¶
type ChainTrackerSpecsInf ¶
type ConsumerRewards ¶
type ConsumerRewards struct {
// contains filtered or unexported fields
}
func (*ConsumerRewards) PrepareRewardsForClaim ¶
func (csrw *ConsumerRewards) PrepareRewardsForClaim() (retProofs []*pairingtypes.RelaySession, errRet error)
type DB ¶
type DB interface { Key() string Save(dbEntry *DBEntry) error BatchSave(dbEntries []*DBEntry) error FindOne(key string) ([]byte, error) FindAll() (map[string][]byte, error) Delete(key string) error DeletePrefix(prefix string) error Close() error }
func NewMemoryDB ¶
type DisabledRewardServer ¶
type DisabledRewardServer struct{}
used to disable provider rewards claiming
func (*DisabledRewardServer) SendNewProof ¶
func (rws *DisabledRewardServer) SendNewProof(ctx context.Context, proof *pairingtypes.RelaySession, epoch uint64, consumerAddr string, apiInterface string) (existingCU uint64, updatedWithProof bool)
func (*DisabledRewardServer) SubscribeEnded ¶
func (rws *DisabledRewardServer) SubscribeEnded(consumer string, epoch uint64, subscribeID string)
func (*DisabledRewardServer) SubscribeStarted ¶
func (rws *DisabledRewardServer) SubscribeStarted(consumer string, epoch uint64, subscribeID string)
type EpochRewards ¶
type EpochRewards struct {
// contains filtered or unexported fields
}
type PaymentConfiguration ¶
type PaymentConfiguration struct {
// contains filtered or unexported fields
}
type PaymentRequest ¶
type PaymentRequest struct { CU uint64 BlockHeightDeadline int64 PaymentEpoch uint64 Amount sdk.Coin Client sdk.AccAddress UniqueIdentifier uint64 Description string ChainID string ConsumerRewardsKey string ProviderAddress string RelayNumber uint64 }
func BuildPaymentFromRelayPaymentEvent ¶
func BuildPaymentFromRelayPaymentEvent(event terderminttypes.Event, block int64) ([]*PaymentRequest, error)
func (*PaymentRequest) String ¶
func (pr *PaymentRequest) String() string
type RelaySessionsToRetryAttempts ¶
type RelaySessionsToRetryAttempts struct {
// contains filtered or unexported fields
}
type RewardDB ¶
type RewardDB struct {
// contains filtered or unexported fields
}
func NewRewardDB ¶
func NewRewardDB() *RewardDB
func NewRewardDBWithTTL ¶
func (*RewardDB) BatchSave ¶
func (rs *RewardDB) BatchSave(rewardEntities []*RewardEntity) (err error)
func (*RewardDB) DeleteClaimedRewards ¶
func (*RewardDB) DeleteEpochRewards ¶
func (*RewardDB) FindAllInDB ¶
func (rs *RewardDB) FindAllInDB(specId string) (map[uint64]*EpochRewards, error)
TODO: Add tests for this func
func (*RewardDB) FindOne ¶
func (rs *RewardDB) FindOne( epoch uint64, consumerAddr string, consumerKey string, sessionId uint64, ) (*pairingtypes.RelaySession, error)
currently unused
func (*RewardDB) Save ¶
func (rs *RewardDB) Save(rewardEntity *RewardEntity) error
type RewardEntity ¶
type RewardEntity struct { Epoch uint64 ConsumerAddr string ConsumerKey string SessionId uint64 Proof *pairingtypes.RelaySession }
type RewardServer ¶
type RewardServer struct {
// contains filtered or unexported fields
}
func NewRewardServer ¶
func NewRewardServer(rewardsTxSender RewardsTxSender, providerMetrics *metrics.ProviderMetricsManager, rewardDB *RewardDB, rewardStoragePath string, rewardsSnapshotThreshold uint, rewardsSnapshotTimeoutSec uint, chainTrackerSpecsInf ChainTrackerSpecsInf) *RewardServer
func (*RewardServer) AddDataBase ¶
func (rws *RewardServer) AddDataBase(specId string, providerPublicAddress string, shardID uint)
func (*RewardServer) AddRewardDelayForUnifiedRewardDistribution ¶
func (rws *RewardServer) AddRewardDelayForUnifiedRewardDistribution(ctx context.Context, epochStart uint64)
func (*RewardServer) CloseAllDataBases ¶
func (rws *RewardServer) CloseAllDataBases() error
func (*RewardServer) Description ¶
func (rws *RewardServer) Description() string
func (*RewardServer) PaymentHandler ¶
func (rws *RewardServer) PaymentHandler(payment *PaymentRequest)
func (*RewardServer) RemoveExpectedPayment ¶
func (rws *RewardServer) RemoveExpectedPayment(paidCUToFInd uint64, expectedClient sdk.AccAddress, blockHeight int64, uniqueID uint64, chainID string) bool
func (*RewardServer) SendNewProof ¶
func (rws *RewardServer) SendNewProof(ctx context.Context, proof *pairingtypes.RelaySession, epoch uint64, consumerAddr string, apiInterface string) (existingCU uint64, updatedWithProof bool)
func (*RewardServer) SubscribeEnded ¶
func (rws *RewardServer) SubscribeEnded(consumer string, epoch uint64, subscribeID string)
func (*RewardServer) SubscribeStarted ¶
func (rws *RewardServer) SubscribeStarted(consumer string, epoch uint64, subscribeID string)
func (*RewardServer) UpdateEpoch ¶
func (rws *RewardServer) UpdateEpoch(epoch uint64)
type RewardsTxSender ¶
type RewardsTxSender interface { TxRelayPayment(ctx context.Context, relayRequests []*pairingtypes.RelaySession, description string, latestBlocks []*pairingtypes.LatestBlockReport) error GetEpochSizeMultipliedByRecommendedEpochNumToCollectPayment(ctx context.Context) (uint64, error) EarliestBlockInMemory(ctx context.Context) (uint64, error) GetEpochSize(ctx context.Context) (uint64, error) LatestBlock() int64 GetAverageBlockTime() time.Duration }
Click to show internal directories.
Click to hide internal directories.