apps_v1

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionGateway

type ActionGateway interface {
	// AllowAppRegistration checks if a user is allowed to register a new application based on their past activity and allowances.
	AllowAppRegistration(tx action_gateway.Store, userAddress string) error
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler manages app registry operations and provides RPC endpoints.

func NewHandler

func NewHandler(store Store, useStoreInTx StoreTxProvider, actionGateway ActionGateway, maxAppMetadataLen int) *Handler

NewHandler creates a new Handler instance with the provided dependencies.

func (*Handler) GetApps

func (h *Handler) GetApps(c *rpc.Context)

GetApps retrieves registered applications with optional filtering.

func (*Handler) SubmitAppVersion

func (h *Handler) SubmitAppVersion(c *rpc.Context)

SubmitAppVersion updates an entry in the app registry.

type MockActionGateway

type MockActionGateway struct {
	Err error
}

func (*MockActionGateway) AllowAppRegistration

func (m *MockActionGateway) AllowAppRegistration(_ action_gateway.Store, _ string) error

type MockStore

type MockStore struct {
	// contains filtered or unexported fields
}

MockStore implements the Store interface for testing.

func (*MockStore) CreateApp

func (m *MockStore) CreateApp(entry app.AppV1) error

func (*MockStore) GetAppCount

func (m *MockStore) GetAppCount(_ string) (uint64, error)

func (*MockStore) GetApps

func (m *MockStore) GetApps(appID *string, ownerWallet *string, pagination *core.PaginationParams) ([]app.AppInfoV1, core.PaginationMetadata, error)

func (*MockStore) GetTotalUserStaked

func (m *MockStore) GetTotalUserStaked(_ string) (decimal.Decimal, error)

func (*MockStore) GetUserActionCount

func (m *MockStore) GetUserActionCount(_ string, _ core.GatedAction, _ time.Duration) (uint64, error)

func (*MockStore) GetUserActionCounts

func (m *MockStore) GetUserActionCounts(_ string, _ time.Duration) (map[core.GatedAction]uint64, error)

func (*MockStore) RecordAction

func (m *MockStore) RecordAction(_ string, _ core.GatedAction) error

type Store

type Store interface {
	// CreateApp registers a new application. Returns an error if the app ID already exists.
	CreateApp(entry app.AppV1) error

	// GetApps retrieves applications with optional filtering.
	GetApps(appID *string, ownerWallet *string, pagination *core.PaginationParams) ([]app.AppInfoV1, core.PaginationMetadata, error)

	action_gateway.Store
}

Store defines the persistence layer interface for user data management. All methods should be implemented to work within database transactions.

type StoreTxHandler

type StoreTxHandler func(Store) error

StoreTxHandler is a function that executes Store operations within a transaction. If the handler returns an error, the transaction is rolled back; otherwise it's committed.

type StoreTxProvider

type StoreTxProvider func(StoreTxHandler) error

StoreTxProvider wraps Store operations in a database transaction. It accepts a StoreTxHandler and manages transaction lifecycle (begin, commit, rollback). Returns an error if the handler fails or the transaction cannot be committed.

Jump to

Keyboard shortcuts

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