storage

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: 6 Imported by: 0

Documentation

Overview

Package storage contains FileStorage interface and its mock.

Index

Constants

This section is empty.

Variables

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

ErrNotFound means that file is not found.

Functions

This section is empty.

Types

type FileStorage added in v1.2.0

type FileStorage interface {
	health.Pinger

	Read(ctx context.Context, path string) (io.ReadCloser, error)
	Write(ctx context.Context, data io.Reader, size int64, path string, contentType string, isPublicRead bool) (string, error)

	DeleteData(ctx context.Context, address string) error
}

FileStorage is interface which provides access to user's data.

type IndexStorage added in v1.2.0

type IndexStorage interface {
	InTx(ctx context.Context, f func(s IndexStorage) error) error
	SetHeight(ctx context.Context, height uint64) error
	GetHeight(ctx context.Context) (uint64, error)

	GetProfile(ctx context.Context, addr string) (*Profile, error)
	GetProfiles(ctx context.Context, addr []string) ([]*Profile, error)
	SetProfile(ctx context.Context, p *SetProfileParams) error
	SetProfileBanned(ctx context.Context, addr string) error
	IsProfileBanned(ctx context.Context, addr string) (bool, error)
	DeleteProfile(ctx context.Context, addr string) error

	ListPDV(ctx context.Context, owner string, from uint64, limit uint16) ([]uint64, error)
	DeletePDV(ctx context.Context, owner string) error

	GetPDVMeta(ctx context.Context, address string, id uint64) (*entities.PDVMeta, error)
	SetPDVMeta(ctx context.Context, address string, id uint64, tx string, device string, m *entities.PDVMeta) error

	GetPDVDelta(ctx context.Context, address string) (float64, error)
	GetPDVTotalDelta(ctx context.Context) (float64, error)
	GetPDVDeltaList(ctx context.Context) ([]*PDVDelta, error)

	CreateRewardsQueueItem(ctx context.Context, addr string, reward int64) error
	GetRewardsQueueItemList(ctx context.Context) ([]*RewardsQueueItem, error)
	DeleteRewardsQueueItem(ctx context.Context, addr string) error

	GetPDVRewardsDistributedDate(ctx context.Context) (time.Time, error)
	SetPDVRewardsDistributedDate(ctx context.Context, date time.Time) error
}

IndexStorage provides access to pdv index.

type PDVDelta added in v1.5.5

type PDVDelta struct {
	Address string
	Delta   float64
}

PDVDelta ...

type Profile added in v1.2.0

type Profile struct {
	Address   string
	FirstName string
	LastName  string
	Emails    []string
	Bio       string
	Avatar    string
	Gender    string
	Banned    bool
	Birthday  *time.Time
	UpdatedAt *time.Time
	CreatedAt time.Time
}

Profile ...

type RewardsQueueItem added in v1.5.5

type RewardsQueueItem struct {
	Address string
	Reward  int64
}

RewardsQueueItem ...

type SetProfileParams added in v1.2.0

type SetProfileParams struct {
	Address   string
	FirstName string
	LastName  string
	Emails    []string
	Bio       string
	Avatar    string
	Gender    string
	Birthday  *time.Time
}

SetProfileParams ...

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package postgres is implementation of storage interface.
Package postgres is implementation of storage interface.
Package s3 contains implementation FileStorage interface with any s3-compatible storage.
Package s3 contains implementation FileStorage interface with any s3-compatible storage.

Jump to

Keyboard shortcuts

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