service

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package service contains business logic of application.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound           = errors.New("not found")
	ErrImageInvalidFormat = errors.New("image invalid format")
	ErrUploadTimeout      = errors.New("upload timeout")
	ErrPDVFraud           = errors.New("PDV fraud detected")
	ErrProfileBanned      = errors.New("profile banned")
)

ErrNotFound means that requested object is not found.

Functions

This section is empty.

Types

type Blacklist added in v1.4.0

type Blacklist struct {
	CookieSource []string `json:"cookieSource"`
}

Blacklist contains attributes of worthless pdv. swagger:model Blacklist

type RewardMap added in v0.2.4

type RewardMap map[schema.Type]sdk.Dec

RewardMap contains dictionary with PDV types and rewards for them.

type Service

type Service interface {
	// SaveImage sends Image to storage.
	SaveImage(ctx context.Context, r io.Reader, owner string) (string, string, error)
	// SavePDV sends PDV to storage.
	SavePDV(ctx context.Context, p schema.PDVWrapper, owner sdk.AccAddress) (uint64, *entities.PDVMeta, error)
	// ListPDV lists PDVs.
	ListPDV(ctx context.Context, owner string, from uint64, limit uint16) ([]uint64, error)
	// ReceivePDV returns slice of bytes of PDV requested by address from storage.
	ReceivePDV(ctx context.Context, owner string, id uint64) ([]byte, error)
	// GetPDVMeta returns PDVs meta.
	GetPDVMeta(ctx context.Context, owner string, id uint64) (*entities.PDVMeta, error)

	// GetProfiles ...
	GetProfiles(ctx context.Context, owner []string) ([]*entities.Profile, error)

	// GetRewardsMap ...
	GetRewardsMap() RewardMap

	// GetBlacklist ...
	GetBlacklist() Blacklist

	// GetPDVDelta ...
	GetPDVDelta(ctx context.Context, owner string) (sdk.Dec, error)

	// GetPDVTotalDelta ...
	GetPDVTotalDelta(ctx context.Context) (sdk.Dec, error)

	// GetPDVRewardsNextDistributionDate ...
	GetPDVRewardsNextDistributionDate(ctx context.Context) (time.Time, error)
}

Service interface provides service's logic's methods.

func New

func New(
	c crypto.Crypto,
	fs storage.FileStorage,
	is storage.IndexStorage,
	p producer.Producer,
	hades hades.Hades,
	rewardMap RewardMap,
	pdvRewardsInterval time.Duration,
) Service

New returns new instance of service.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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