Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyOperations(ops []writeaheadlog.Operation) error
- func ApplyUpdates(wal *writeaheadlog.Wal, updates []FileUpdate) error
- func FilterAPIs(apis []rpc.API, parseAPI *ParsedAPI) error
- type AccountManager
- type ClientBackend
- type ClientSetting
- type ClientSettingAPIDisplay
- type ContractCreateRequest
- type ContractID
- type ContractMetaData
- type ContractParams
- type ContractStatus
- type DeleteUpdate
- type DirectoryInfo
- type DownloadParameters
- type DownloadRequest
- type DownloadRequestSector
- type DownloadResponse
- type DxPath
- type EthBackend
- type FileBriefInfo
- type FileInfo
- type FileUpdate
- type FileUploadParams
- type HostBackend
- type HostExtConfig
- type HostFolder
- type HostHealthInfo
- type HostHealthInfoTable
- type HostInfo
- type HostIntConfig
- type HostIntConfigForDisplay
- type HostInteractionRecord
- type HostPoolScan
- type HostPoolScans
- type HostSpace
- type InsertUpdate
- type MarketPrice
- type ParsedAPI
- type Peer
- type PeriodCost
- type RentPayment
- type RentPaymentAPIDisplay
- type SysPath
- type UploadAction
- type UploadFileInfo
- type UploadMerkleProof
- type UploadRequest
Constants ¶
const ( // Client Handle Message Set HostConfigRespMsg = 0x20 ContractCreateHostSign = 0x21 ContractCreateRevisionSign = 0x22 ContractUploadMerkleProofMsg = 0x23 ContractUploadRevisionSign = 0x24 ContractDownloadDataMsg = 0x25 HostBusyHandleReqMsg = 0x26 HostCommitFailedMsg = 0x27 HostAckMsg = 0x28 HostNegotiateErrorMsg = 0x29 // Host Handle Message Set HostConfigReqMsg = 0x30 ContractCreateReqMsg = 0x31 ContractCreateClientRevisionSign = 0x32 ContractUploadReqMsg = 0x33 ContractUploadClientRevisionSign = 0x34 ContractDownloadReqMsg = 0x35 ClientCommitSuccessMsg = 0x36 ClientCommitFailedMsg = 0x37 ClientAckMsg = 0x38 ClientNegotiateErrorMsg = 0x39 )
Negotiation related messages
const ( // OpInsertFile is the operation name for an InsertUpdate OpInsertFile = "insert_file" // OpDeleteFile is the operation name for an DeleteUpdate OpDeleteFile = "delete_file" )
const ( Override = iota Append Normal )
Defines the download mode
const ( // EnvProd marks the production execution environment EnvProd = "prod" // EnvTest marks the test execution environment EnvTest = "test" // DxFileExt is the extension of DxFile DxFileExt = ".dxfile" // ConfigVersion is the version of host config ConfigVersion = "1.0.1" )
const ( // SectorSize is 4 MB SectorSize = uint64(1 << 22) // HashSize is 32 bits HashSize = 32 // SegmentSize is the segment size is used when taking the Merkle root of a file. SegmentSize = 64 )
const ( // ProofWindowSize is the window for storage host to submit a storage proof ProofWindowSize = 12 * unit.BlocksPerHour )
const ( // RenewWindow is the window for storage contract renew for storage client RenewWindow = 12 * unit.BlocksPerHour )
const (
UploadActionAppend = "Append"
)
Defines upload mode
Variables ¶
var ( // ErrHostBusyHandleReq defines that client sent the contract request too frequently. If this error is occurred // the host's evaluation will not be deducted ErrHostBusyHandleReq = errors.New("client must wait until the host finish its's previous request") // ErrClientNegotiate defines that client occurs error while negotiate ErrClientNegotiate = errors.New("client negotiate error") // ErrClientCommit defines that client occurs error while commit(finalize) ErrClientCommit = errors.New("client commit error") // ErrHostNegotiate defines that client occurs error while negotiate ErrHostNegotiate = errors.New("host negotiate error") // ErrHostCommit defines that host occurs error while commit(finalize) ErrHostCommit = errors.New("host commit error") )
var ( // persistence default value DefaultMaxDuration = unit.BlocksPerDay * 30 // 30 days DefaultMaxDownloadBatchSize = 17 * (1 << 20) // 17 MB DefaultMaxReviseBatchSize = 17 * (1 << 20) // 17 MB // deposit defaults value DefaultDeposit = common.PtrBigInt(math.BigPow(10, 3)) // 173 dx per TB per month DefaultDepositBudget = common.PtrBigInt(math.BigPow(10, 22)) // 10000 DX DefaultMaxDeposit = common.PtrBigInt(math.BigPow(10, 20)) // 100 DX // prices // TODO: remove these two fields when the two prices are removed from negotiation DefaultBaseRPCPrice = common.PtrBigInt(math.BigPow(10, 11)) DefaultSectorAccessPrice = common.PtrBigInt(math.BigPow(10, 13)) DefaultStoragePrice = common.PtrBigInt(math.BigPow(10, 4)).MultInt64(5) DefaultUploadBandwidthPrice = common.PtrBigInt(math.BigPow(10, 8)).MultInt64(5) DefaultDownloadBandwidthPrice = common.PtrBigInt(math.BigPow(10, 9)).MultInt64(5) DefaultContractPrice = common.NewBigInt(1e2) )
Default host settings
var ( // ErrAlreadyRoot is the error happens when calling Parent function on // a root directory ErrAlreadyRoot = errors.New("cannot call the Parent function on the root directory") // ErrEmptyDxPath is the error happens when calling NewDxPath on an empty string ErrEmptyDxPath = errors.New("cannot create an empty DxPath") )
var ( // ENV define the program running environment: test, prod ENV = EnvProd // DefaultMinSectors define the default minimum sectors needed to recovery DefaultMinSectors uint32 = 1 // DefaultNumSectors define the default total sectors needed to recovery DefaultNumSectors uint32 = 2 )
var ( DefaultRentPayment = RentPayment{ Fund: common.PtrBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)).MultInt64(1e4), StorageHosts: 3, Period: 3 * unit.BlocksPerDay, ExpectedStorage: 1e12, ExpectedUpload: uint64(200e9) / unit.BlocksPerMonth, ExpectedDownload: uint64(100e9) / unit.BlocksPerMonth, ExpectedRedundancy: 2.0, } )
Default rentPayment values
var ErrRequestingHostConfig = errors.New("host configuration should only be requested one at a time")
ErrRequestingHostConfig is the error code used when the client asks host for its configuration multiple times before the host finished handling the previous configuration request. Therefore, the host's evaluation should not be deducted.
var (
ResponsibilityLockTimeout = 60 * time.Second
)
The block generation rate for Ethereum is 15s/block. Therefore, 240 blocks can be generated in an hour
Functions ¶
func ApplyOperations ¶
func ApplyOperations(ops []writeaheadlog.Operation) error
ApplyOperations apply the operations
func ApplyUpdates ¶
func ApplyUpdates(wal *writeaheadlog.Wal, updates []FileUpdate) error
ApplyUpdates apply the updates on the wal
Types ¶
type AccountManager ¶
type AccountManager interface {
Find(accounts.Account) (accounts.Wallet, error)
Wallets() []accounts.Wallet
}
AccountManager is the interface for account.Manager to be used in storage host module
type ClientBackend ¶
type ClientBackend interface {
Online() bool
Syncing() bool
GetStorageHostSetting(hostEnodeID enode.ID, hostEnodeURL string, config *HostExtConfig) error
SubscribeChainChangeEvent(ch chan<- core.ChainChangeEvent) event.Subscription
GetTxByBlockHash(blockHash common.Hash) (types.Transactions, error)
SetupConnection(enodeURL string) (Peer, error)
AccountManager() *accounts.Manager
ChainConfig() *params.ChainConfig
CurrentBlock() *types.Block
SendTx(ctx context.Context, signedTx *types.Transaction) error
SuggestPrice(ctx context.Context) (*big.Int, error)
GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error)
SendStorageContractCreateTx(clientAddr common.Address, input []byte) (common.Hash, error)
GetHostAnnouncementWithBlockHash(blockHash common.Hash) (hostAnnouncements []types.HostAnnouncement, number uint64, errGet error)
GetPaymentAddress() (common.Address, error)
TryToRenewOrRevise(hostID enode.ID) bool
RevisionOrRenewingDone(hostID enode.ID)
CheckAndUpdateConnection(peerNode *enode.Node)
SelfEnodeURL() string
}
ClientBackend is an interface that used to provide necessary functions to storage host manager and contract manager
type ClientSetting ¶
type ClientSetting struct {
RentPayment RentPayment `json:"rentPayment"`
EnableIPViolation bool `json:"enableIPViolation"`
MaxUploadSpeed int64 `json:"maxUploadSpeed"`
MaxDownloadSpeed int64 `json:"maxDownloadSpeed"`
}
ClientSetting defines the settings that client used to create contract with other peers, where EnableIPViolation specifies if the host with same network IP addresses will be filtered out or not
type ClientSettingAPIDisplay ¶
type ClientSettingAPIDisplay struct {
RentPayment RentPaymentAPIDisplay `json:"RentPayment Setting"`
EnableIPViolation string `json:"IP Violation Check Status"`
MaxUploadSpeed string `json:"Max Upload Speed"`
MaxDownloadSpeed string `json:"Max Download Speed"`
}
ClientSettingAPIDisplay is used for API Configurations Display
type ContractCreateRequest ¶
type ContractCreateRequest struct {
StorageContract types.StorageContract
Sign []byte
Renew bool
OldContractID common.Hash
}
ContractCreateRequest contains storage contract info and client pk
type ContractID ¶
ContractID is used to define the contract ID data type
func StringToContractID ¶
func StringToContractID(s string) (id ContractID, err error)
StringToContractID convert string to ContractID
func (ContractID) String ¶
func (ci ContractID) String() string
String method is used to convert the contractID into string format
type ContractMetaData ¶
type ContractMetaData struct {
ID ContractID
EnodeID enode.ID
LatestContractRevision types.StorageContractRevision
StartHeight uint64
EndHeight uint64
ContractBalance common.BigInt
UploadCost common.BigInt
DownloadCost common.BigInt
StorageCost common.BigInt
// contract available fund
TotalCost common.BigInt
GasCost common.BigInt
ContractFee common.BigInt
Status ContractStatus
}
ContractMetaData defines read-only detailed contract information
type ContractParams ¶
type ContractParams struct {
RentPayment RentPayment
HostEnodeURL string
Funding common.BigInt
StartHeight uint64
EndHeight uint64
ClientPaymentAddress common.Address
Host HostInfo
}
ContractParams is the drafted contract sent by the storage client.
type ContractStatus ¶
ContractStatus is used to define the contract status data type. There are three status in total: able to upload, able to renew, and if the contract has been canceled
type DeleteUpdate ¶
type DeleteUpdate struct {
FileName string
}
DeleteUpdate defines an update of delete the FileName
func (*DeleteUpdate) Apply ¶
func (du *DeleteUpdate) Apply() (err error)
Apply of DeleteUpdate delete du.FileName
func (*DeleteUpdate) EncodeToWalOp ¶
func (du *DeleteUpdate) EncodeToWalOp() (writeaheadlog.Operation, error)
EncodeToWalOp encode the DeleteUpdate to Operation, named by OpDeleteFile
type DirectoryInfo ¶
type DirectoryInfo struct {
NumFiles uint64 `json:"numFiles"`
TotalSize uint64 `json:"totalSize"`
Health uint32 `json:"health"`
StuckHealth uint32 `json:"stuckHealth"`
MinRedundancy uint32 `json:"minRedundancy"`
TimeLastHealthCheck time.Time `json:"timeLastHealthCheck"`
TimeModify time.Time `json:"timeModify"`
NumStuckSegments uint32 `json:"numStuckSegments"`
DxPath DxPath `json:"dxPath"`
}
DirectoryInfo provides information about a dxdir
type DownloadParameters ¶
DownloadParameters is the parameters to download from outer request
type DownloadRequest ¶
type DownloadRequest struct {
StorageContractID common.Hash
Sector DownloadRequestSector
MerkleProof bool
NewRevisionNumber uint64
NewValidProofValues []*big.Int
NewMissedProofValues []*big.Int
Signature []byte
}
DownloadRequest contains the request parameters for RPCDownload.
type DownloadRequestSector ¶
DownloadRequestSector is a section requested in DownloadRequest.
type DownloadResponse ¶
DownloadResponse contains the response data for RPCDownload.
type DxPath ¶
type DxPath struct {
Path string
}
DxPath is the file Path or directory Path relates to the root directory of the DxFiles. It is used in storage client and storage client's file system WARN: When creating a DxPath, please use NewDxPath method to create a new DxPath.
func NewDxPath ¶
NewDxPath create a DxPath with provided s string. If validation is not passed for s, an error is returned
func RootDxPath ¶
func RootDxPath() DxPath
RootDxPath return the special root DxPath which has Path as empty string
type EthBackend ¶
type EthBackend interface {
APIs() []rpc.API
GetStorageHostSetting(hostEnodeID enode.ID, hostEnodeURL string, config *HostExtConfig) error
SubscribeChainChangeEvent(ch chan<- core.ChainChangeEvent) event.Subscription
GetBlockByHash(blockHash common.Hash) (*types.Block, error)
GetBlockChain() *core.BlockChain
GetBlockByNumber(number uint64) (*types.Block, error)
AccountManager() *accounts.Manager
GetCurrentBlockHeight() uint64
ChainConfig() *params.ChainConfig
CurrentBlock() *types.Block
SendTx(ctx context.Context, signedTx *types.Transaction) error
SuggestPrice(ctx context.Context) (*big.Int, error)
GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error)
SetupConnection(enodeURL string) (Peer, error)
TryToRenewOrRevise(hostID enode.ID) bool
RevisionOrRenewingDone(hostID enode.ID)
SetStatic(node *enode.Node)
CheckAndUpdateConnection(peerNode *enode.Node)
SelfEnodeURL() string
}
EthBackend is an interface used to get methods implemented by Ethereum
type FileBriefInfo ¶
type FileBriefInfo struct {
Path string `json:"dxpath"`
Status string `json:"status"`
UploadProgress float64 `json:"uploadProgress"`
}
FileBriefInfo is the brief info about a DxFile
type FileInfo ¶
type FileInfo struct {
DxPath string `json:"dxpath"`
Status string `json:"status"`
SourcePath string `json:"sourcePath"`
FileSize uint64 `json:"fileSize"`
Redundancy uint32 `json:"redundancy"`
StoredOnDisk bool `json:"storedOnDisk"`
UploadProgress float64 `json:"uploadProgress"`
}
FileInfo is the structure containing file info to be displayed
type FileUpdate ¶
type FileUpdate interface {
Apply() error // Apply the content of the update
EncodeToWalOp() (writeaheadlog.Operation, error) // convert an dxfileUpdate to writeaheadlog.Operation
}
FileUpdate defines the update interface for dxfile and dxdir update. It is the intermediate layer between dxfile/dxdir persist and wal Currently FileUpdate is implemented by InsertUpdate and DeleteUpdate
func OpToUpdate ¶
func OpToUpdate(op writeaheadlog.Operation) (FileUpdate, error)
OpToUpdate decodeFromWalOp will decode the wal.Operation to a specified type of dxfileUpdate based on the op.Name field
type FileUploadParams ¶
type FileUploadParams struct {
Source string
DxPath DxPath
ErasureCode erasurecode.ErasureCoder
Mode int
}
FileUploadParams contains the information used by the Client to upload a file
type HostBackend ¶
type HostBackend interface {
APIs() []rpc.API
SubscribeChainChangeEvent(ch chan<- core.ChainChangeEvent) event.Subscription
GetBlockByHash(blockHash common.Hash) (*types.Block, error)
GetBlockByNumber(number uint64) (*types.Block, error)
GetBlockChain() *core.BlockChain
AccountManager() *accounts.Manager
SetStatic(node *enode.Node)
CheckAndUpdateConnection(peerNode *enode.Node)
}
HostBackend is the interface for Ethereum to be used in storage host module
type HostExtConfig ¶
type HostExtConfig struct {
AcceptingContracts bool `json:"acceptingContracts"`
MaxDownloadBatchSize uint64 `json:"maxDownloadBatchSize"`
MaxDuration uint64 `json:"maxDuration"`
MaxReviseBatchSize uint64 `json:"maxReviseBatchSize"`
PaymentAddress common.Address `json:"paymentAddress"`
RemainingStorage uint64 `json:"remainingStorage"`
SectorSize uint64 `json:"sectorSize"`
TotalStorage uint64 `json:"totalStorage"`
WindowSize uint64 `json:"windowSize"`
Deposit common.BigInt `json:"deposit"`
MaxDeposit common.BigInt `json:"maxDeposit"`
BaseRPCPrice common.BigInt `json:"baseRPCPrice"`
ContractPrice common.BigInt `json:"contractPrice"`
DownloadBandwidthPrice common.BigInt `json:"downloadBandwidthPrice"`
SectorAccessPrice common.BigInt `json:"sectorAccessPrice"`
StoragePrice common.BigInt `json:"storagePrice"`
UploadBandwidthPrice common.BigInt `json:"uploadBandwidthPrice"`
Version string `json:"version"`
}
HostExtConfig make group of host setting to broadcast as object
type HostFolder ¶
type HostFolder struct {
Path string `json:"path"`
TotalSectors uint64 `json:"totalSectors"`
UsedSectors uint64 `json:"usedSectors"`
}
HostFolder is the host folder structure
type HostHealthInfo ¶
HostHealthInfo is the file structure used for DxFile health update. It has two fields, one indicating whether the host if offline or not, One indicating whether the contract with the host is good for renew.
type HostHealthInfoTable ¶
type HostHealthInfoTable map[enode.ID]HostHealthInfo
HostHealthInfoTable is the map the is passed into DxFile health update. It is a map from host id to HostHealthInfo
type HostInfo ¶
type HostInfo struct {
HostExtConfig
FirstSeen uint64 `json:"firstseen"`
// TODO: refactor this into an interface: host interactions
SuccessfulInteractionFactor float64 `json:"successfulInteractionFactor"`
FailedInteractionFactor float64 `json:"FailedInteractionFactor"`
LastInteractionTime uint64 `json:"lastInteractionTime"`
InteractionRecords []HostInteractionRecord `json:"interactionRecords"`
// TODO: refactor this into an interface: host scans
AccumulatedUptime float64 `json:"accumulated_uptime"`
AccumulatedDowntime float64 `json:"accumulated_downtime"`
LastCheckTime uint64 `json:"last_check_time"`
ScanRecords HostPoolScans `json:"scan_records"`
// IP will be decoded from the enode URL
IP string `json:"ip"`
IPNetwork string `json:"ip_network"`
LastIPNetWorkChange time.Time `json:"last_ipnetwork_change"`
EnodeID enode.ID `json:"enodeid"`
EnodeURL string `json:"enodeurl"`
NodePubKey []byte `json:"nodepubkey"`
Filtered bool `json:"filtered"`
}
HostInfo storage storage host information
type HostIntConfig ¶
type HostIntConfig struct {
AcceptingContracts bool `json:"acceptingContracts"`
MaxDownloadBatchSize uint64 `json:"maxDownloadBatchSize"`
MaxDuration uint64 `json:"maxDuration"`
MaxReviseBatchSize uint64 `json:"maxReviseBatchSize"`
WindowSize uint64 `json:"windowSize"`
PaymentAddress common.Address `json:"paymentAddress"`
Deposit common.BigInt `json:"deposit"`
DepositBudget common.BigInt `json:"depositBudget"`
MaxDeposit common.BigInt `json:"maxDeposit"`
BaseRPCPrice common.BigInt `json:"baseRPCPrice"`
ContractPrice common.BigInt `json:"contractPrice"`
DownloadBandwidthPrice common.BigInt `json:"downloadBandwidthPrice"`
SectorAccessPrice common.BigInt `json:"sectorAccessPrice"`
StoragePrice common.BigInt `json:"storagePrice"`
UploadBandwidthPrice common.BigInt `json:"uploadBandwidthPrice"`
}
HostIntConfig make group of host setting as object
type HostIntConfigForDisplay ¶
type HostIntConfigForDisplay struct {
AcceptingContracts string `json:"acceptingContracts"`
MaxDownloadBatchSize string `json:"maxDownloadBatchSize"`
MaxDuration string `json:"maxDuration"`
MaxReviseBatchSize string `json:"maxReviseBatchSize"`
WindowSize string `json:"windowSize"`
PaymentAddress string `json:"paymentAddress"`
Deposit string `json:"deposit"`
DepositBudget string `json:"depositBudget"`
MaxDeposit string `json:"maxDeposit"`
BaseRPCPrice string `json:"baseRPCPrice"`
ContractPrice string `json:"contractPrice"`
DownloadBandwidthPrice string `json:"downloadBandwidthPrice"`
SectorAccessPrice string `json:"sectorAccessPrice"`
StoragePrice string `json:"storagePrice"`
UploadBandwidthPrice string `json:"uploadBandwidthPrice"`
}
HostIntConfigForDisplay is the host internal config for displayed
type HostInteractionRecord ¶
type HostInteractionRecord struct {
Time time.Time `json:"time"`
InteractionType string `json:"interactionType"`
Success bool `json:"success"`
}
HostInteractionRecord is the interaction record for client-host interactions which is used in hostManager
type HostPoolScan ¶
HostPoolScan recorded the scan details, including the time a storage host got scanned and whether the host is online or not
type HostPoolScans ¶
type HostPoolScans []HostPoolScan
HostPoolScans stores a list of host pool scan records
type HostSpace ¶
type HostSpace struct {
TotalSectors uint64 `json:"totalSectors"`
UsedSectors uint64 `json:"usedSectors"`
FreeSectors uint64 `json:"freeSectors"`
}
HostSpace is the
type InsertUpdate ¶
InsertUpdate defines an update of insert Data into FileName at Offset
func (*InsertUpdate) Apply ¶
func (iu *InsertUpdate) Apply() (err error)
Apply execute the InsertUpdate, writing data to the location
func (*InsertUpdate) EncodeToWalOp ¶
func (iu *InsertUpdate) EncodeToWalOp() (writeaheadlog.Operation, error)
EncodeToWalOp encode the InsertUpdate to wal.Operation, named by OpInsertFile
type MarketPrice ¶
type MarketPrice struct {
ContractPrice common.BigInt
StoragePrice common.BigInt
UploadPrice common.BigInt
DownloadPrice common.BigInt
Deposit common.BigInt
MaxDeposit common.BigInt
}
MarketPrice is the market price metrics from HostMarket
type ParsedAPI ¶
type ParsedAPI struct {
NetInfo *ethapi.PublicNetAPI
Account *ethapi.PrivateAccountAPI
EthInfo *ethapi.PublicEthereumAPI
StorageTx *ethapi.PrivateStorageContractTxAPI
}
ParsedAPI will parse the APIs saved in the Ethereum and get the ones needed
type Peer ¶
type Peer interface {
TriggerError(error)
SendStorageHostConfig(config HostExtConfig) error
RequestStorageHostConfig() error
SendUploadMerkleProof(merkleProof UploadMerkleProof) error
RequestContractCreation(req ContractCreateRequest) error
SendContractCreateClientRevisionSign(revisionSign []byte) error
SendContractCreationHostSign(contractSign []byte) error
SendContractCreationHostRevisionSign(revisionSign []byte) error
RequestContractUpload(req UploadRequest) error
SendContractUploadClientRevisionSign(revisionSign []byte) error
SendUploadHostRevisionSign(revisionSign []byte) error
RequestContractDownload(req DownloadRequest) error
SendContractDownloadData(resp DownloadResponse) error
SendHostBusyHandleRequestErr() error
SendClientNegotiateErrorMsg() error
SendClientCommitFailedMsg() error
SendClientCommitSuccessMsg() error
SendHostCommitFailedMsg() error
SendClientAckMsg() error
SendHostAckMsg() error
SendHostNegotiateErrorMsg() error
WaitConfigResp() (p2p.Msg, error)
ClientWaitContractResp() (msg p2p.Msg, err error)
HostWaitContractResp() (msg p2p.Msg, err error)
TryToRenewOrRevise() bool
RevisionOrRenewingDone()
TryRequestHostConfig() error
RequestHostConfigDone()
PeerNode() *enode.Node
IsStaticConn() bool
}
Peer is the interface returned by the SetupConnection. The use of it is to allow eth.peer object to be used in the storage model. All the methods provided in the Peer interface is used for negotiation during the contract create, contract revision, contract renew, and configuration request
type PeriodCost ¶
type PeriodCost struct {
// ContractFees = ContractFee + GasFee
ContractFees common.BigInt `json:"contractFees"`
UploadCost common.BigInt `json:"uploadCost"`
DownloadCost common.BigInt `json:"downloadCost"`
StorageCost common.BigInt `json:"storageCost"`
PrevContractCost common.BigInt `json:"prevContractCost"`
ContractFund common.BigInt `json:"contractFund"`
UnspentFund common.BigInt `json:"unspentFund"`
WithheldFund common.BigInt `json:"withheldFund"`
WithheldFundReleaseBlock uint64 `json:"withheldFundReleaseBlock"`
}
PeriodCost specifies cost storage client needs to pay within one period cycle. It includes cost for all contracts
type RentPayment ¶
type RentPayment struct {
Fund common.BigInt `json:"fund"`
StorageHosts uint64 `json:"storageHosts"`
Period uint64 `json:"period"`
// ExpectedStorage is amount of data expected to be stored
ExpectedStorage uint64 `json:"expectedStorage"`
// ExpectedUpload is expected amount of data upload before redundancy / block
ExpectedUpload uint64 `json:"expectedUpload"`
// ExpectedDownload is expected amount of data downloaded / block
ExpectedDownload uint64 `json:"expectedDownload"`
// ExpectedRedundancy is the average redundancy of files uploaded
ExpectedRedundancy float64 `json:"expectedRedundancy"`
}
RentPayment stores the StorageClient payment settings for renting the storage space from the host
type RentPaymentAPIDisplay ¶
type RentPaymentAPIDisplay struct {
Fund string `json:"Fund"`
StorageHosts string `json:"Number of Storage Hosts"`
Period string `json:"Storage Time"`
// ExpectedStorage is amount of data expected to be stored
ExpectedStorage string `json:"Expected Storage"`
// ExpectedUpload is expected amount of data upload before redundancy / block
ExpectedUpload string `json:"Expected Upload"`
// ExpectedDownload is expected amount of data downloaded / block
ExpectedDownload string `json:"Expected Download"`
// ExpectedRedundancy is the average redundancy of files uploaded
ExpectedRedundancy string `json:"Expected Redundancy"`
}
RentPaymentAPIDisplay is used for API Configurations Display
type UploadAction ¶
UploadAction is a generic Write action. The meaning of each field depends on the Type of the action.
type UploadFileInfo ¶
type UploadFileInfo struct {
AccessTime time.Time `json:"accessTime"`
Available bool `json:"available"`
ChangeTime time.Time `json:"changeTime"`
CipherType string `json:"cipherType"`
CreateTime time.Time `json:"createTime"`
Expiration uint64 `json:"expiration"`
FileSize uint64 `json:"fileSize"`
Health float64 `json:"health"`
LocalPath string `json:"localPath"`
MaxHealth float64 `json:"maxHealth"`
MaxHealthPercent float64 `json:"maxHealthPercent"`
ModTime time.Time `json:"modTime"`
NumStuckChunks uint64 `json:"numStuckChunks"`
OnDisk bool `json:"onDisk"`
Recoverable bool `json:"recoverable"`
Redundancy float64 `json:"redundancy"`
Renewing bool `json:"renewing"`
DxPath string `json:"dxpath"`
Stuck bool `json:"stuck"`
StuckHealth float64 `json:"stuckHealth"`
UploadedBytes uint64 `json:"uploadedBytes"`
UploadProgress float64 `json:"uploadProgress"`
}
UploadFileInfo provides information about a file
type UploadMerkleProof ¶
type UploadMerkleProof struct {
OldSubtreeHashes []common.Hash
OldLeafHashes []common.Hash
NewMerkleRoot common.Hash
}
UploadMerkleProof contains the optional Merkle proof for response data for RPCUpload.
type UploadRequest ¶
type UploadRequest struct {
StorageContractID common.Hash
Actions []UploadAction
NewRevisionNumber uint64
NewValidProofValues []*big.Int
NewMissedProofValues []*big.Int
}
UploadRequest contains the request parameters for RPCUpload.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
memorymanager
Package memorymanager implements the storage client memory management methods
|
Package memorymanager implements the storage client memory management methods |