Documentation
¶
Index ¶
- type ApiKeyRepository
- type ControlFlagsRepository
- type DatabaseStorage
- type FeeRepository
- type PluginOwnerRepository
- type PluginPolicySyncRepository
- type PluginRepository
- type PolicyRepository
- type PoolProvider
- type PricingRepository
- type RatingRepository
- type RedisStorage
- func (r *RedisStorage) CheckNonceExists(ctx context.Context, nonce string, publicKey string) (bool, error)
- func (r *RedisStorage) Close() error
- func (r *RedisStorage) Delete(ctx context.Context, key string) error
- func (r *RedisStorage) Exists(ctx context.Context, key string) (bool, error)
- func (r *RedisStorage) Expire(ctx context.Context, key string, expiry time.Duration) error
- func (r *RedisStorage) Get(ctx context.Context, key string) (string, error)
- func (r *RedisStorage) Set(ctx context.Context, key string, value string, expiry time.Duration) error
- func (r *RedisStorage) StoreNonce(ctx context.Context, nonce string, publicKey string, expiryTime time.Time) error
- type ReportRepository
- type ReviewRepository
- type TagRepository
- type Transactor
- type VaultTokenRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiKeyRepository ¶
type ControlFlagsRepository ¶ added in v0.1.16
type DatabaseStorage ¶
type DatabaseStorage interface {
Transactor
PolicyRepository
PluginPolicySyncRepository
VaultTokenRepository
PricingRepository
PluginRepository
PluginOwnerRepository
FeeRepository
TagRepository
ReviewRepository
RatingRepository
ApiKeyRepository
ReportRepository
ControlFlagsRepository
Close() error
}
type FeeRepository ¶
type FeeRepository interface {
GetFeeById(ctx context.Context, id uint64) (*types.Fee, error)
GetFeesByPublicKey(ctx context.Context, publicKey string) ([]*types.Fee, error)
GetFeesByPluginID(ctx context.Context, pluginID types.PluginID, publicKey string, skip, take uint32) ([]itypes.FeeWithStatus, uint32, error)
GetPluginBillingSummary(ctx context.Context, publicKey string) ([]itypes.PluginBillingSummaryRow, error)
GetPricingsByPluginIDs(ctx context.Context, pluginIDs []string) (map[string][]itypes.PricingInfo, error)
InsertFee(ctx context.Context, dbTx pgx.Tx, fee *types.Fee) (uint64, error)
InsertPluginInstallation(ctx context.Context, dbTx pgx.Tx, pluginID types.PluginID, publicKey string) error
MarkFeesCollected(ctx context.Context, dbTx pgx.Tx, feeIDs []uint64, txHash string, totalAmount uint64) error
GetUserFees(ctx context.Context, publicKey string) (*types.UserFeeStatus, error)
UpdateBatchStatus(ctx context.Context, dbTx pgx.Tx, txHash string, status *rpc.TxOnChainStatus) error
IsTrialActive(ctx context.Context, dbTx pgx.Tx, pubKey string) (bool, time.Duration, error)
}
type PluginOwnerRepository ¶ added in v0.1.16
type PluginOwnerRepository interface {
IsOwner(ctx context.Context, pluginID types.PluginID, publicKey string) (bool, error)
GetPluginsByOwner(ctx context.Context, publicKey string) ([]types.PluginID, error)
AddOwner(ctx context.Context, pluginID types.PluginID, publicKey string, addedVia itypes.PluginOwnerAddedVia, addedBy string) error
DeactivateOwner(ctx context.Context, pluginID types.PluginID, publicKey string) error
}
type PluginPolicySyncRepository ¶
type PluginPolicySyncRepository interface {
AddPluginPolicySync(ctx context.Context, dbTx pgx.Tx, policy itypes.PluginPolicySync) error
GetPluginPolicySync(ctx context.Context, id uuid.UUID) (*itypes.PluginPolicySync, error)
DeletePluginPolicySync(ctx context.Context, id uuid.UUID) error
GetUnFinishedPluginPolicySyncs(ctx context.Context) ([]itypes.PluginPolicySync, error)
UpdatePluginPolicySync(ctx context.Context, dbTx pgx.Tx, policy itypes.PluginPolicySync) error
}
type PluginRepository ¶
type PluginRepository interface {
FindPlugins(ctx context.Context, filters itypes.PluginFilters, take int, skip int, sort string) (*itypes.PluginsPaginatedList, error)
FindPluginById(ctx context.Context, dbTx pgx.Tx, id types.PluginID) (*itypes.Plugin, error)
GetPluginTitlesByIDs(ctx context.Context, ids []string) (map[string]string, error)
Pool() *pgxpool.Pool
}
type PolicyRepository ¶
type PolicyRepository interface {
GetPluginPolicy(ctx context.Context, id uuid.UUID) (*types.PluginPolicy, error)
GetPluginPolicies(ctx context.Context, publicKey string, pluginIds []types.PluginID, includeInactive bool) ([]types.PluginPolicy, error)
GetPluginInstallationsCount(ctx context.Context, pluginID types.PluginID) (itypes.PluginTotalCount, error)
GetAllPluginPolicies(ctx context.Context, publicKey string, pluginID types.PluginID, take int, skip int, activeFilter *bool) (*itypes.PluginPolicyPaginatedList, error)
DeletePluginPolicyTx(ctx context.Context, dbTx pgx.Tx, id uuid.UUID) error
InsertPluginPolicyTx(ctx context.Context, dbTx pgx.Tx, policy types.PluginPolicy) (*types.PluginPolicy, error)
UpdatePluginPolicyTx(ctx context.Context, dbTx pgx.Tx, policy types.PluginPolicy) (*types.PluginPolicy, error)
DeleteAllPolicies(ctx context.Context, dbTx pgx.Tx, pluginID types.PluginID, publicKey string) error
}
type PoolProvider ¶
type PricingRepository ¶
type PricingRepository interface {
GetPricingByPluginId(ctx context.Context, pluginId types.PluginID) ([]types.Pricing, error)
FindPricingById(ctx context.Context, id uuid.UUID) (*types.Pricing, error)
CreatePricing(ctx context.Context, pricingDto types.PricingCreateDto) (*types.Pricing, error)
DeletePricingById(ctx context.Context, id uuid.UUID) error
}
type RatingRepository ¶
type RatingRepository interface {
FindRatingByPluginId(ctx context.Context, dbTx pgx.Tx, pluginId string) ([]itypes.PluginRatingDto, error)
FindAvgRatingByPluginID(ctx context.Context, pluginID string) (itypes.PluginAvgRatingDto, error)
CreateRatingForPlugin(ctx context.Context, dbTx pgx.Tx, pluginId string) error
UpdateRatingForPlugin(ctx context.Context, dbTx pgx.Tx, pluginId string, reviewRating int) error
}
type RedisStorage ¶
type RedisStorage struct {
// contains filtered or unexported fields
}
func NewRedisStorage ¶
func NewRedisStorage(cfg config.Redis) (*RedisStorage, error)
func (*RedisStorage) CheckNonceExists ¶
func (r *RedisStorage) CheckNonceExists(ctx context.Context, nonce string, publicKey string) (bool, error)
CheckNonceExists checks if a nonce has been used by the same public key
func (*RedisStorage) Close ¶
func (r *RedisStorage) Close() error
func (*RedisStorage) StoreNonce ¶
func (r *RedisStorage) StoreNonce(ctx context.Context, nonce string, publicKey string, expiryTime time.Time) error
StoreNonce stores a nonce in Redis with automatic expiration
type ReportRepository ¶ added in v0.1.16
type ReportRepository interface {
UpsertReport(ctx context.Context, pluginID types.PluginID, publicKey, reason string, cooldown time.Duration) error
GetReport(ctx context.Context, pluginID types.PluginID, publicKey string) (*itypes.PluginReport, error)
CountReportsInWindow(ctx context.Context, pluginID types.PluginID, window time.Duration) (int, error)
HasInstallation(ctx context.Context, pluginID types.PluginID, publicKey string) (bool, error)
CountInstallations(ctx context.Context, pluginID types.PluginID) (int, error)
IsPluginPaused(ctx context.Context, pluginID types.PluginID) (bool, error)
PausePlugin(ctx context.Context, pluginID types.PluginID, record itypes.PauseHistoryRecord) error
}
type ReviewRepository ¶
type ReviewRepository interface {
CreateReview(ctx context.Context, dbTx pgx.Tx, reviewDto itypes.ReviewCreateDto, pluginId string) (string, error)
FindReviews(ctx context.Context, pluginId string, take int, skip int, sort string) (itypes.ReviewsDto, error)
FindReviewById(ctx context.Context, db pgx.Tx, id string) (*itypes.ReviewDto, error)
}
type TagRepository ¶
type Transactor ¶
type VaultTokenRepository ¶
type VaultTokenRepository interface {
CreateVaultToken(ctx context.Context, token itypes.VaultTokenCreate) (*itypes.VaultToken, error)
GetVaultToken(ctx context.Context, tokenID string) (*itypes.VaultToken, error)
RevokeVaultToken(ctx context.Context, tokenID string) error
RevokeAllVaultTokens(ctx context.Context, publicKey string) error
UpdateVaultTokenLastUsed(ctx context.Context, tokenID string) error
GetActiveVaultTokens(ctx context.Context, publicKey string) ([]itypes.VaultToken, error)
}
Click to show internal directories.
Click to hide internal directories.