Documentation ¶
Index ¶
- type BackupDataMsg
- type BackupPacket
- type Service
- type ServiceImpl
- func (bs *ServiceImpl) BackupDownload(user User) (BackupPacket, error)
- func (bs *ServiceImpl) BackupUpload(user User, backupPacket BackupPacket) error
- func (bs *ServiceImpl) GetLastVersion(id core.ID) (uint64, error)
- func (bs *ServiceImpl) GetPoWDifficulty() int
- func (bs *ServiceImpl) RecoverAll(id core.ID) ([]BackupDataMsg, error)
- func (bs *ServiceImpl) RecoverByType(id core.ID, dataType string) ([]BackupDataMsg, error)
- func (bs *ServiceImpl) RecoverSinceVersion(id core.ID, version uint64) ([]BackupDataMsg, error)
- func (bs *ServiceImpl) RecoverSinceVersionByType(id core.ID, version uint64, dataType string) ([]BackupDataMsg, error)
- func (bs *ServiceImpl) Register(user User) error
- type User
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 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 (*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