Documentation ¶
Index ¶
- Constants
- Variables
- func CreateCacheCobraCommand() *cobra.Command
- func Server(ctx context.Context, listenAddr string, metricsAddr string, ...)
- type CacheMetrics
- type CacheServer
- type CacheValue
- type LastestCacheStore
- type RelayerCacheServer
- func (s *RelayerCacheServer) GetRelay(ctx context.Context, relayCacheGet *pairingtypes.RelayCacheGet) (*pairingtypes.CacheRelayReply, error)
- func (s *RelayerCacheServer) Health(ctx context.Context, req *emptypb.Empty) (*pairingtypes.CacheUsage, error)
- func (s *RelayerCacheServer) PrintCacheStats(ctx context.Context, desc string)
- func (s *RelayerCacheServer) SetRelay(ctx context.Context, relayCacheSet *pairingtypes.RelayCacheSet) (*emptypb.Empty, error)
Constants ¶
View Source
const ( FlagLogLevel = "log_level" FlagMetricsAddress = "metrics_address" )
View Source
const ( DbValueConfirmationAttempts = 5 SEP = ";" )
View Source
const ( ExpirationFlagName = "expiration" ExpirationTimeFinalizedMultiplierFlagName = "expiration-multiplier" ExpirationNonFinalizedFlagName = "expiration-non-finalized" ExpirationTimeNonFinalizedMultiplierFlagName = "expiration-non-finalized-multiplier" ExpirationBlocksHashesToHeightsFlagName = "expiration-blocks-hashes-to-heights" ExpirationNodeErrorsOnFinalizedFlagName = "expiration-finalized-node-errors" FlagCacheSizeName = "max-items" DefaultExpirationForNonFinalized = 500 * time.Millisecond DefaultExpirationTimeFinalizedMultiplier = 1.0 DefaultExpirationTimeNonFinalizedMultiplier = 1.0 DefaultExpirationBlocksHashesToHeights = 48 * time.Hour DefaultExpirationTimeFinalized = time.Hour DefaultExpirationNodeErrors = 250 * time.Millisecond CacheNumCounters = 100000000 // expect 10M items )
View Source
const (
DisabledFlagOption = "disabled"
)
Variables ¶
View Source
var ( NotFoundError = sdkerrors.New("Cache miss", 1, "cache entry for specific block and request wasn't found") // client could'nt connect to any provider. HashMismatchError = sdkerrors.New("Cache hit but hash mismatch", 2, "cache entry for specific block and request had a mismatching hash stored") // client could'nt connect to any provider. EntryTypeError = sdkerrors.New("Cache hit but entry is a different object", 3, "cache entry for specific block and request had a mismatching object stored") // client could'nt connect to any provider. )
Functions ¶
func CreateCacheCobraCommand ¶
Types ¶
type CacheMetrics ¶
type CacheMetrics struct {
// contains filtered or unexported fields
}
func NewCacheMetricsServer ¶
func NewCacheMetricsServer(listenAddress string) *CacheMetrics
func (*CacheMetrics) AddApiSpecific ¶
func (c *CacheMetrics) AddApiSpecific(block int64, chainId string, hit bool)
type CacheServer ¶
type CacheServer struct { ExpirationFinalized time.Duration ExpirationNonFinalized time.Duration ExpirationNodeErrors time.Duration ExpirationBlocksHashesToHeights time.Duration CacheMetrics *CacheMetrics CacheMaxCost int64 // contains filtered or unexported fields }
func (*CacheServer) ExpirationForChain ¶
func (cs *CacheServer) ExpirationForChain(averageBlockTimeForChain time.Duration) time.Duration
func (*CacheServer) InitCache ¶
func (cs *CacheServer) InitCache( ctx context.Context, expiration time.Duration, expirationNonFinalized time.Duration, expirationNodeErrorsOnFinalized time.Duration, expirationBlocksHashesToHeights time.Duration, metricsAddr string, expirationFinalizedMultiplier float64, expirationNonFinalizedMultiplier float64, )
type CacheValue ¶
type CacheValue struct { Response pairingtypes.RelayReply Hash []byte OptionalMetadata []pairingtypes.Metadata SeenBlock int64 }
func (*CacheValue) Cost ¶
func (cv *CacheValue) Cost() int64
func (*CacheValue) ToCacheReply ¶
func (cv *CacheValue) ToCacheReply() *pairingtypes.CacheRelayReply
type LastestCacheStore ¶
type LastestCacheStore struct {
// contains filtered or unexported fields
}
func (*LastestCacheStore) Cost ¶
func (cv *LastestCacheStore) Cost() int64
type RelayerCacheServer ¶
type RelayerCacheServer struct { pairingtypes.UnimplementedRelayerCacheServer CacheServer *CacheServer // contains filtered or unexported fields }
func (*RelayerCacheServer) GetRelay ¶
func (s *RelayerCacheServer) GetRelay(ctx context.Context, relayCacheGet *pairingtypes.RelayCacheGet) (*pairingtypes.CacheRelayReply, error)
func (*RelayerCacheServer) Health ¶
func (s *RelayerCacheServer) Health(ctx context.Context, req *emptypb.Empty) (*pairingtypes.CacheUsage, error)
func (*RelayerCacheServer) PrintCacheStats ¶
func (s *RelayerCacheServer) PrintCacheStats(ctx context.Context, desc string)
func (*RelayerCacheServer) SetRelay ¶
func (s *RelayerCacheServer) SetRelay(ctx context.Context, relayCacheSet *pairingtypes.RelayCacheSet) (*emptypb.Empty, error)
Click to show internal directories.
Click to hide internal directories.