service

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when a resource is not found. Router will serve 404 error if this is returned.

Functions

This section is empty.

Types

type AppService

AppService is an interface for interacting with the app collection.

type Service

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

Service main app service which working with database.

func NewService

func NewService(reader storagereader.StorageReader, cacheTTL time.Duration) *Service

NewService creates new service instance.

func (*Service) CountSmesherRewards

func (e *Service) CountSmesherRewards(ctx context.Context, smesherID string) (total, count int64, err error)

CountSmesherRewards returns smesher rewards count by filter.

func (*Service) GetAccount

func (e *Service) GetAccount(ctx context.Context, accountID string) (*model.Account, error)

GetAccount returns account by id.

func (*Service) GetAccountRewards

func (e *Service) GetAccountRewards(ctx context.Context, accountID string, page, perPage int64) ([]*model.Reward, int64, error)

GetAccountRewards returns rewards by account id.

func (*Service) GetAccountTransactions

func (e *Service) GetAccountTransactions(ctx context.Context, accountID string, page, perPage int64) ([]*model.Transaction, int64, error)

GetAccountTransactions returns transactions by account id.

func (*Service) GetAccounts

func (e *Service) GetAccounts(ctx context.Context, page, perPage int64) ([]*model.Account, int64, error)

GetAccounts returns accounts by filter.

func (*Service) GetActivation

func (e *Service) GetActivation(ctx context.Context, activationID string) (*model.Activation, error)

GetActivation returns atx by id.

func (*Service) GetActivations

func (e *Service) GetActivations(ctx context.Context, page, perPage int64) (atxs []*model.Activation, total int64, err error)

GetActivations returns atxs by filter.

func (*Service) GetApp

func (e *Service) GetApp(ctx context.Context, appID string) (*model.App, error)

GetApp returns app by address.

func (*Service) GetApps

func (e *Service) GetApps(ctx context.Context, page, pageSize int64) (apps []*model.App, total int64, err error)

GetApps returns apps by filter.

func (*Service) GetBlock

func (e *Service) GetBlock(ctx context.Context, blockID string) (*model.Block, error)

GetBlock returns block by id.

func (*Service) GetCurrentEpoch

func (e *Service) GetCurrentEpoch(ctx context.Context) (*model.Epoch, error)

GetCurrentEpoch returns current epoch.

func (*Service) GetCurrentLayer

func (e *Service) GetCurrentLayer(ctx context.Context) (*model.Layer, error)

GetCurrentLayer returns current layer.

func (*Service) GetEpoch

func (e *Service) GetEpoch(ctx context.Context, epochNum int) (*model.Epoch, error)

GetEpoch get epoch by number.

func (*Service) GetEpochActivations

func (e *Service) GetEpochActivations(ctx context.Context, epochNum int, page, perPage int64) (atxs []*model.Activation, total int64, err error)

GetEpochActivations returns activations for the given epoch.

func (*Service) GetEpochLayers

func (e *Service) GetEpochLayers(ctx context.Context, epochNum int, page, perPage int64) (layers []*model.Layer, total int64, err error)

GetEpochLayers returns layers for the given epoch.

func (*Service) GetEpochRewards

func (e *Service) GetEpochRewards(ctx context.Context, epochNum int, page, perPage int64) (rewards []*model.Reward, total int64, err error)

GetEpochRewards returns rewards for the given epoch.

func (*Service) GetEpochSmeshers

func (e *Service) GetEpochSmeshers(ctx context.Context, epochNum int, page, perPage int64) (smeshers []*model.Smesher, total int64, err error)

GetEpochSmeshers returns smeshers for the given epoch.

func (*Service) GetEpochTransactions

func (e *Service) GetEpochTransactions(ctx context.Context, epochNum int, page, perPage int64) (txs []*model.Transaction, total int64, err error)

GetEpochTransactions returns transactions for the given epoch.

func (*Service) GetEpochs

func (e *Service) GetEpochs(ctx context.Context, page, perPage int64) ([]*model.Epoch, int64, error)

GetEpochs returns list of epochs.

func (*Service) GetLayer

func (e *Service) GetLayer(ctx context.Context, layerNum int) (*model.Layer, error)

GetLayer returns layer by number.

func (*Service) GetLayerActivations

func (e *Service) GetLayerActivations(ctx context.Context, layerNum int, page, perPage int64) (atxs []*model.Activation, total int64, err error)

GetLayerActivations returns activations for layer.

func (*Service) GetLayerBlocks

func (e *Service) GetLayerBlocks(ctx context.Context, layerNum int, page, perPage int64) (blocks []*model.Block, total int64, err error)

GetLayerBlocks returns blocks for layer.

func (*Service) GetLayerRewards

func (e *Service) GetLayerRewards(ctx context.Context, layerNum int, page, perPage int64) (rewards []*model.Reward, total int64, err error)

GetLayerRewards returns rewards for layer.

func (*Service) GetLayerSmeshers

func (e *Service) GetLayerSmeshers(ctx context.Context, layerNum int, page, perPage int64) (smeshers []*model.Smesher, total int64, err error)

GetLayerSmeshers returns smeshers for layer.

func (*Service) GetLayerTransactions

func (e *Service) GetLayerTransactions(ctx context.Context, layerNum int, page, perPage int64) (txs []*model.Transaction, total int64, err error)

GetLayerTransactions returns transactions for layer.

func (*Service) GetLayers

func (e *Service) GetLayers(ctx context.Context, page, perPage int64) (layers []*model.Layer, total int64, err error)

GetLayers returns layers.

func (*Service) GetNetworkInfo

func (e *Service) GetNetworkInfo(ctx context.Context) (net *model.NetworkInfo, err error)

GetNetworkInfo returns actual network info. Caches data for some time (see networkInfoTTL).

func (*Service) GetReward

func (e *Service) GetReward(ctx context.Context, rewardID string) (*model.Reward, error)

GetReward returns reward by id.

func (*Service) GetRewards

func (e *Service) GetRewards(ctx context.Context, page, perPage int64) ([]*model.Reward, int64, error)

GetRewards returns rewards by filter.

func (*Service) GetSmesher

func (e *Service) GetSmesher(ctx context.Context, smesherID string) (*model.Smesher, error)

GetSmesher returns smesher by id.

func (*Service) GetSmesherActivations

func (e *Service) GetSmesherActivations(ctx context.Context, smesherID string, page, perPage int64) (atxs []*model.Activation, total int64, err error)

GetSmesherActivations returns smesher activations by filter.

func (*Service) GetSmesherRewards

func (e *Service) GetSmesherRewards(ctx context.Context, smesherID string, page, perPage int64) (rewards []*model.Reward, total int64, err error)

GetSmesherRewards returns smesher rewards by filter.

func (*Service) GetSmeshers

func (e *Service) GetSmeshers(ctx context.Context, page, perPage int64) (smeshers []*model.Smesher, total int64, err error)

GetSmeshers returns smeshers by filter.

func (*Service) GetState

func (e *Service) GetState(ctx context.Context) (*model.NetworkInfo, *model.Epoch, *model.Layer, error)

GetState returns state of the network, current layer and epoch.

func (*Service) GetTotalRewards added in v1.2.0

func (e *Service) GetTotalRewards(ctx context.Context, filter *bson.D) (int64, int64, error)

func (*Service) GetTransaction

func (e *Service) GetTransaction(ctx context.Context, txID string) (*model.Transaction, error)

GetTransaction returns tx by id.

func (*Service) GetTransactions

func (e *Service) GetTransactions(ctx context.Context, page, perPage int64) (txs []*model.Transaction, total int64, err error)

GetTransactions returns txs by filter.

func (*Service) Ping

func (e *Service) Ping(ctx context.Context) error

Ping checks if the database is reachable.

func (*Service) Search

func (e *Service) Search(ctx context.Context, search string) (string, error)

Search try guess entity to search and find related one.

Jump to

Keyboard shortcuts

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