Documentation ¶
Index ¶
- Variables
- type AppService
- type Service
- func (e *Service) CountSmesherRewards(ctx context.Context, smesherID string) (total, count int64, err error)
- func (e *Service) GetAccount(ctx context.Context, accountID string) (*model.Account, error)
- func (e *Service) GetAccountRewards(ctx context.Context, accountID string, page, perPage int64) ([]*model.Reward, int64, error)
- func (e *Service) GetAccountTransactions(ctx context.Context, accountID string, page, perPage int64) ([]*model.Transaction, int64, error)
- func (e *Service) GetAccounts(ctx context.Context, page, perPage int64) ([]*model.Account, int64, error)
- func (e *Service) GetActivation(ctx context.Context, activationID string) (*model.Activation, error)
- func (e *Service) GetActivations(ctx context.Context, page, perPage int64) (atxs []*model.Activation, total int64, err error)
- func (e *Service) GetApp(ctx context.Context, appID string) (*model.App, error)
- func (e *Service) GetApps(ctx context.Context, page, pageSize int64) (apps []*model.App, total int64, err error)
- func (e *Service) GetBlock(ctx context.Context, blockID string) (*model.Block, error)
- func (e *Service) GetCurrentEpoch(ctx context.Context) (*model.Epoch, error)
- func (e *Service) GetCurrentLayer(ctx context.Context) (*model.Layer, error)
- func (e *Service) GetEpoch(ctx context.Context, epochNum int) (*model.Epoch, error)
- func (e *Service) GetEpochActivations(ctx context.Context, epochNum int, page, perPage int64) (atxs []*model.Activation, total int64, err error)
- func (e *Service) GetEpochLayers(ctx context.Context, epochNum int, page, perPage int64) (layers []*model.Layer, total int64, err error)
- func (e *Service) GetEpochRewards(ctx context.Context, epochNum int, page, perPage int64) (rewards []*model.Reward, total int64, err error)
- func (e *Service) GetEpochSmeshers(ctx context.Context, epochNum int, page, perPage int64) (smeshers []*model.Smesher, total int64, err error)
- func (e *Service) GetEpochTransactions(ctx context.Context, epochNum int, page, perPage int64) (txs []*model.Transaction, total int64, err error)
- func (e *Service) GetEpochs(ctx context.Context, page, perPage int64) ([]*model.Epoch, int64, error)
- func (e *Service) GetLayer(ctx context.Context, layerNum int) (*model.Layer, error)
- func (e *Service) GetLayerActivations(ctx context.Context, layerNum int, page, perPage int64) (atxs []*model.Activation, total int64, err error)
- func (e *Service) GetLayerBlocks(ctx context.Context, layerNum int, page, perPage int64) (blocks []*model.Block, total int64, err error)
- func (e *Service) GetLayerRewards(ctx context.Context, layerNum int, page, perPage int64) (rewards []*model.Reward, total int64, err error)
- func (e *Service) GetLayerSmeshers(ctx context.Context, layerNum int, page, perPage int64) (smeshers []*model.Smesher, total int64, err error)
- func (e *Service) GetLayerTransactions(ctx context.Context, layerNum int, page, perPage int64) (txs []*model.Transaction, total int64, err error)
- func (e *Service) GetLayers(ctx context.Context, page, perPage int64) (layers []*model.Layer, total int64, err error)
- func (e *Service) GetNetworkInfo(ctx context.Context) (net *model.NetworkInfo, err error)
- func (e *Service) GetReward(ctx context.Context, rewardID string) (*model.Reward, error)
- func (e *Service) GetRewards(ctx context.Context, page, perPage int64) ([]*model.Reward, int64, error)
- func (e *Service) GetSmesher(ctx context.Context, smesherID string) (*model.Smesher, error)
- func (e *Service) GetSmesherActivations(ctx context.Context, smesherID string, page, perPage int64) (atxs []*model.Activation, total int64, err error)
- func (e *Service) GetSmesherRewards(ctx context.Context, smesherID string, page, perPage int64) (rewards []*model.Reward, total int64, err error)
- func (e *Service) GetSmeshers(ctx context.Context, page, perPage int64) (smeshers []*model.Smesher, total int64, err error)
- func (e *Service) GetState(ctx context.Context) (*model.NetworkInfo, *model.Epoch, *model.Layer, error)
- func (e *Service) GetTransaction(ctx context.Context, txID string) (*model.Transaction, error)
- func (e *Service) GetTransactions(ctx context.Context, page, perPage int64) (txs []*model.Transaction, total int64, err error)
- func (e *Service) Ping(ctx context.Context) error
- func (e *Service) Search(ctx context.Context, search string) (string, error)
Constants ¶
This section is empty.
Variables ¶
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 ¶
type AppService interface { GetState(ctx context.Context) (*model.NetworkInfo, *model.Epoch, *model.Layer, error) GetNetworkInfo(ctx context.Context) (*model.NetworkInfo, error) Search(ctx context.Context, search string) (string, error) Ping(ctx context.Context) error model.EpochService model.LayerService model.SmesherService model.AccountService model.RewardService model.TransactionService model.ActivationService model.AppService model.BlockService }
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 ¶
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) 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) GetCurrentEpoch ¶
GetCurrentEpoch returns current epoch.
func (*Service) GetCurrentLayer ¶
GetCurrentLayer returns current layer.
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) 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 ¶
GetNetworkInfo returns actual network info. Caches data for some time (see networkInfoTTL).
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 ¶
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) GetTransaction ¶
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.