backupsrv

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupDataMsg

type BackupDataMsg struct {
	IdAddrHex     string                     `json:"idAddrHex" binding:"required"`
	Data          string                     `json:"data" binding:"required"`
	DataSignature string                     `json:"dataSignature" binding:"required"`
	Type          string                     `json:"type" binding:"required"`
	KSignPk       *utils.PublicKey           `json:"ksignpk" binding:"required"`
	ProofKSignHex claimsrv.ProofClaimUserHex `json:"proofKSignHex" binding:"required"`
	RelayAddr     string                     `json:"relayAddr" binding:"required"`
	Version       uint64                     `json:"version" binding:"required"`
	Nonce         uint                       `json:"nonce" binding:"required"`
}

func (BackupDataMsg) IncrementNonce

func (bd BackupDataMsg) IncrementNonce() utils.PoWData

IncrementNonce implements the method for the PoWData interface

type BackupPacket

type BackupPacket struct {
	Username string `json:"username" binding:"required"`
	Backup   string `json:"backup" binding:"required"`
}

type Service

type Service interface {
	// BACKUP SERVICE
	Register(user User) error
	BackupUpload(user User, backupPacket BackupPacket) error
	BackupDownload(user User) (BackupPacket, error)

	// SYNCHRONIZATION SERVICE
	GetPoWDifficulty() int
	GetLastVersion(id core.ID) (uint64, error)
	//Save(idaddr common.Address, saveBackupMsg BackupDataMsg) (uint64, error)
	RecoverAll(id core.ID) ([]BackupDataMsg, error)
	RecoverSinceVersion(id core.ID, version uint64) ([]BackupDataMsg, error)
	RecoverByType(id core.ID, dataType string) ([]BackupDataMsg, error)
	RecoverSinceVersionByType(id core.ID, version uint64, dataType string) ([]BackupDataMsg, error)
}

type ServiceImpl

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

func New

func New(mongoservice mongosrv.Service, powDiff int) *ServiceImpl

func (*ServiceImpl) BackupDownload

func (bs *ServiceImpl) BackupDownload(user User) (BackupPacket, error)

func (*ServiceImpl) BackupUpload

func (bs *ServiceImpl) BackupUpload(user User, backupPacket BackupPacket) error

func (*ServiceImpl) GetLastVersion

func (bs *ServiceImpl) GetLastVersion(id core.ID) (uint64, error)

func (*ServiceImpl) GetPoWDifficulty

func (bs *ServiceImpl) GetPoWDifficulty() int

GetPoWDifficulty returns the configured Proof-of-Work difficulty, setted in the config file of the backupserver

func (*ServiceImpl) RecoverAll

func (bs *ServiceImpl) RecoverAll(id core.ID) ([]BackupDataMsg, error)

RecoverAll returns all the data packets stored by an idaddr

func (*ServiceImpl) RecoverByType

func (bs *ServiceImpl) RecoverByType(id core.ID, dataType string) ([]BackupDataMsg, error)

RecoverByType returns all the data packets stored by an id with the requested type

func (*ServiceImpl) RecoverSinceVersion

func (bs *ServiceImpl) RecoverSinceVersion(id core.ID, version uint64) ([]BackupDataMsg, error)

RecoverSinceVersion returns all the data packets stored by an id since after the version specified in the parameter

func (*ServiceImpl) RecoverSinceVersionByType

func (bs *ServiceImpl) RecoverSinceVersionByType(id core.ID, version uint64, dataType string) ([]BackupDataMsg, error)

RecoverSinceVersionByType returns all the data packets stored by an id with the requested type since after the version specified in the parameter

func (*ServiceImpl) Register

func (bs *ServiceImpl) Register(user User) error

Register adds a new user into the db if it already not exists

type User

type User struct {
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

Jump to

Keyboard shortcuts

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