Versions in this module Expand all Collapse all v1 v1.0.1 Mar 1, 2020 Changes in this version + const Append + const ClientAckMsg + const ClientCommitFailedMsg + const ClientCommitSuccessMsg + const ClientNegotiateErrorMsg + const ConfigVersion + const ContractCreateClientRevisionSign + const ContractCreateHostSign + const ContractCreateReqMsg + const ContractCreateRevisionSign + const ContractDownloadDataMsg + const ContractDownloadReqMsg + const ContractUploadClientRevisionSign + const ContractUploadMerkleProofMsg + const ContractUploadReqMsg + const ContractUploadRevisionSign + const DxFileExt + const EnvProd + const EnvTest + const HashSize + const HostAckMsg + const HostBusyHandleReqMsg + const HostCommitFailedMsg + const HostConfigReqMsg + const HostConfigRespMsg + const HostNegotiateErrorMsg + const Normal + const OpDeleteFile + const OpInsertFile + const Override + const ProofWindowSize + const RenewWindow + const SectorSize + const SegmentSize + const UploadActionAppend + var DefaultBaseRPCPrice = common.PtrBigInt(math.BigPow(10, 11)) + var DefaultContractPrice = common.NewBigInt(1e2) + var DefaultDeposit = common.PtrBigInt(math.BigPow(10, 3)) + var DefaultDepositBudget = common.PtrBigInt(math.BigPow(10, 22)) + var DefaultDownloadBandwidthPrice = common.PtrBigInt(math.BigPow(10, 9)).MultInt64(5) + var DefaultMaxDeposit = common.PtrBigInt(math.BigPow(10, 20)) + var DefaultMaxDownloadBatchSize = 17 * (1 << 20) + var DefaultMaxDuration = unit.BlocksPerDay * 30 + var DefaultMaxReviseBatchSize = 17 * (1 << 20) + var DefaultMinSectors uint32 = 1 + var DefaultNumSectors uint32 = 2 + var DefaultRentPayment = RentPayment + var DefaultSectorAccessPrice = common.PtrBigInt(math.BigPow(10, 13)) + var DefaultStoragePrice = common.PtrBigInt(math.BigPow(10, 4)).MultInt64(5) + var DefaultUploadBandwidthPrice = common.PtrBigInt(math.BigPow(10, 8)).MultInt64(5) + var ENV = EnvProd + var ErrAlreadyRoot = errors.New("cannot call the Parent function on the root directory") + var ErrClientCommit = errors.New("client commit error") + var ErrClientNegotiate = errors.New("client negotiate error") + var ErrEmptyDxPath = errors.New("cannot create an empty DxPath") + var ErrHostBusyHandleReq = errors.New("client must wait until the host finish its's previous request") + var ErrHostCommit = errors.New("host commit error") + var ErrHostNegotiate = errors.New("host negotiate error") + var ErrRequestingHostConfig = errors.New("host configuration should only be requested one at a time") + var ResponsibilityLockTimeout = 60 * time.Second + func ApplyOperations(ops []writeaheadlog.Operation) error + func ApplyUpdates(wal *writeaheadlog.Wal, updates []FileUpdate) error + func FilterAPIs(apis []rpc.API, parseAPI *ParsedAPI) error + type AccountManager interface + Find func(accounts.Account) (accounts.Wallet, error) + Wallets func() []accounts.Wallet + type ClientBackend interface + AccountManager func() *accounts.Manager + ChainConfig func() *params.ChainConfig + CheckAndUpdateConnection func(peerNode *enode.Node) + CurrentBlock func() *types.Block + GetHostAnnouncementWithBlockHash func(blockHash common.Hash) (hostAnnouncements []types.HostAnnouncement, number uint64, errGet error) + GetPaymentAddress func() (common.Address, error) + GetPoolNonce func(ctx context.Context, addr common.Address) (uint64, error) + GetStorageHostSetting func(hostEnodeID enode.ID, hostEnodeURL string, config *HostExtConfig) error + GetTxByBlockHash func(blockHash common.Hash) (types.Transactions, error) + Online func() bool + RevisionOrRenewingDone func(hostID enode.ID) + SelfEnodeURL func() string + SendStorageContractCreateTx func(clientAddr common.Address, input []byte) (common.Hash, error) + SendTx func(ctx context.Context, signedTx *types.Transaction) error + SetupConnection func(enodeURL string) (Peer, error) + SubscribeChainChangeEvent func(ch chan<- core.ChainChangeEvent) event.Subscription + SuggestPrice func(ctx context.Context) (*big.Int, error) + Syncing func() bool + TryToRenewOrRevise func(hostID enode.ID) bool + type ClientSetting struct + EnableIPViolation bool + MaxDownloadSpeed int64 + MaxUploadSpeed int64 + RentPayment RentPayment + type ClientSettingAPIDisplay struct + EnableIPViolation string + MaxDownloadSpeed string + MaxUploadSpeed string + RentPayment RentPaymentAPIDisplay + type ContractCreateRequest struct + OldContractID common.Hash + Renew bool + Sign []byte + StorageContract types.StorageContract + type ContractID common.Hash + func StringToContractID(s string) (id ContractID, err error) + func (ci ContractID) String() string + type ContractMetaData struct + ContractBalance common.BigInt + ContractFee common.BigInt + DownloadCost common.BigInt + EndHeight uint64 + EnodeID enode.ID + GasCost common.BigInt + ID ContractID + LatestContractRevision types.StorageContractRevision + StartHeight uint64 + Status ContractStatus + StorageCost common.BigInt + TotalCost common.BigInt + UploadCost common.BigInt + type ContractParams struct + ClientPaymentAddress common.Address + EndHeight uint64 + Funding common.BigInt + Host HostInfo + HostEnodeURL string + RentPayment RentPayment + StartHeight uint64 + type ContractStatus struct + Canceled bool + RenewAbility bool + UploadAbility bool + type DeleteUpdate struct + FileName string + func (du *DeleteUpdate) Apply() (err error) + func (du *DeleteUpdate) EncodeToWalOp() (writeaheadlog.Operation, error) + type DirectoryInfo struct + DxPath DxPath + Health uint32 + MinRedundancy uint32 + NumFiles uint64 + NumStuckSegments uint32 + StuckHealth uint32 + TimeLastHealthCheck time.Time + TimeModify time.Time + TotalSize uint64 + type DownloadParameters struct + RemoteFilePath string + WriteToLocalPath string + type DownloadRequest struct + MerkleProof bool + NewMissedProofValues []*big.Int + NewRevisionNumber uint64 + NewValidProofValues []*big.Int + Sector DownloadRequestSector + Signature []byte + StorageContractID common.Hash + type DownloadRequestSector struct + Length uint32 + MerkleRoot [32]byte + Offset uint32 + type DownloadResponse struct + Data []byte + MerkleProof []common.Hash + Signature []byte + type DxPath struct + Path string + func NewDxPath(s string) (DxPath, error) + func RootDxPath() DxPath + func (dp DxPath) Equals(dp2 DxPath) bool + func (dp DxPath) IsRoot() bool + func (dp DxPath) Join(s string) (DxPath, error) + func (dp DxPath) Parent() (DxPath, error) + func (dp DxPath) SysPath(rootDir SysPath) SysPath + type EthBackend interface + APIs func() []rpc.API + AccountManager func() *accounts.Manager + ChainConfig func() *params.ChainConfig + CheckAndUpdateConnection func(peerNode *enode.Node) + CurrentBlock func() *types.Block + GetBlockByHash func(blockHash common.Hash) (*types.Block, error) + GetBlockByNumber func(number uint64) (*types.Block, error) + GetBlockChain func() *core.BlockChain + GetCurrentBlockHeight func() uint64 + GetPoolNonce func(ctx context.Context, addr common.Address) (uint64, error) + GetStorageHostSetting func(hostEnodeID enode.ID, hostEnodeURL string, config *HostExtConfig) error + RevisionOrRenewingDone func(hostID enode.ID) + SelfEnodeURL func() string + SendTx func(ctx context.Context, signedTx *types.Transaction) error + SetStatic func(node *enode.Node) + SetupConnection func(enodeURL string) (Peer, error) + SubscribeChainChangeEvent func(ch chan<- core.ChainChangeEvent) event.Subscription + SuggestPrice func(ctx context.Context) (*big.Int, error) + TryToRenewOrRevise func(hostID enode.ID) bool + type FileBriefInfo struct + Path string + Status string + UploadProgress float64 + type FileInfo struct + DxPath string + FileSize uint64 + Redundancy uint32 + SourcePath string + Status string + StoredOnDisk bool + UploadProgress float64 + type FileUpdate interface + Apply func() error + EncodeToWalOp func() (writeaheadlog.Operation, error) + func OpToUpdate(op writeaheadlog.Operation) (FileUpdate, error) + type FileUploadParams struct + DxPath DxPath + ErasureCode erasurecode.ErasureCoder + Mode int + Source string + type HostBackend interface + APIs func() []rpc.API + AccountManager func() *accounts.Manager + CheckAndUpdateConnection func(peerNode *enode.Node) + GetBlockByHash func(blockHash common.Hash) (*types.Block, error) + GetBlockByNumber func(number uint64) (*types.Block, error) + GetBlockChain func() *core.BlockChain + SetStatic func(node *enode.Node) + SubscribeChainChangeEvent func(ch chan<- core.ChainChangeEvent) event.Subscription + type HostExtConfig struct + AcceptingContracts bool + BaseRPCPrice common.BigInt + ContractPrice common.BigInt + Deposit common.BigInt + DownloadBandwidthPrice common.BigInt + MaxDeposit common.BigInt + MaxDownloadBatchSize uint64 + MaxDuration uint64 + MaxReviseBatchSize uint64 + PaymentAddress common.Address + RemainingStorage uint64 + SectorAccessPrice common.BigInt + SectorSize uint64 + StoragePrice common.BigInt + TotalStorage uint64 + UploadBandwidthPrice common.BigInt + Version string + WindowSize uint64 + type HostFolder struct + Path string + TotalSectors uint64 + UsedSectors uint64 + type HostHealthInfo struct + GoodForRenew bool + Offline bool + type HostHealthInfoTable map[enode.ID]HostHealthInfo + type HostInfo struct + AccumulatedDowntime float64 + AccumulatedUptime float64 + EnodeID enode.ID + EnodeURL string + FailedInteractionFactor float64 + Filtered bool + FirstSeen uint64 + IP string + IPNetwork string + InteractionRecords []HostInteractionRecord + LastCheckTime uint64 + LastIPNetWorkChange time.Time + LastInteractionTime uint64 + NodePubKey []byte + ScanRecords HostPoolScans + SuccessfulInteractionFactor float64 + type HostIntConfig struct + AcceptingContracts bool + BaseRPCPrice common.BigInt + ContractPrice common.BigInt + Deposit common.BigInt + DepositBudget common.BigInt + DownloadBandwidthPrice common.BigInt + MaxDeposit common.BigInt + MaxDownloadBatchSize uint64 + MaxDuration uint64 + MaxReviseBatchSize uint64 + PaymentAddress common.Address + SectorAccessPrice common.BigInt + StoragePrice common.BigInt + UploadBandwidthPrice common.BigInt + WindowSize uint64 + type HostIntConfigForDisplay struct + AcceptingContracts string + BaseRPCPrice string + ContractPrice string + Deposit string + DepositBudget string + DownloadBandwidthPrice string + MaxDeposit string + MaxDownloadBatchSize string + MaxDuration string + MaxReviseBatchSize string + PaymentAddress string + SectorAccessPrice string + StoragePrice string + UploadBandwidthPrice string + WindowSize string + type HostInteractionRecord struct + InteractionType string + Success bool + Time time.Time + type HostPoolScan struct + Success bool + Timestamp time.Time + type HostPoolScans []HostPoolScan + type HostSpace struct + FreeSectors uint64 + TotalSectors uint64 + UsedSectors uint64 + type InsertUpdate struct + Data []byte + FileName string + Offset uint64 + func (iu *InsertUpdate) Apply() (err error) + func (iu *InsertUpdate) EncodeToWalOp() (writeaheadlog.Operation, error) + type MarketPrice struct + ContractPrice common.BigInt + Deposit common.BigInt + DownloadPrice common.BigInt + MaxDeposit common.BigInt + StoragePrice common.BigInt + UploadPrice common.BigInt + type ParsedAPI struct + Account *ethapi.PrivateAccountAPI + EthInfo *ethapi.PublicEthereumAPI + NetInfo *ethapi.PublicNetAPI + StorageTx *ethapi.PrivateStorageContractTxAPI + type Peer interface + ClientWaitContractResp func() (msg p2p.Msg, err error) + HostWaitContractResp func() (msg p2p.Msg, err error) + IsStaticConn func() bool + PeerNode func() *enode.Node + RequestContractCreation func(req ContractCreateRequest) error + RequestContractDownload func(req DownloadRequest) error + RequestContractUpload func(req UploadRequest) error + RequestHostConfigDone func() + RequestStorageHostConfig func() error + RevisionOrRenewingDone func() + SendClientAckMsg func() error + SendClientCommitFailedMsg func() error + SendClientCommitSuccessMsg func() error + SendClientNegotiateErrorMsg func() error + SendContractCreateClientRevisionSign func(revisionSign []byte) error + SendContractCreationHostRevisionSign func(revisionSign []byte) error + SendContractCreationHostSign func(contractSign []byte) error + SendContractDownloadData func(resp DownloadResponse) error + SendContractUploadClientRevisionSign func(revisionSign []byte) error + SendHostAckMsg func() error + SendHostBusyHandleRequestErr func() error + SendHostCommitFailedMsg func() error + SendHostNegotiateErrorMsg func() error + SendStorageHostConfig func(config HostExtConfig) error + SendUploadHostRevisionSign func(revisionSign []byte) error + SendUploadMerkleProof func(merkleProof UploadMerkleProof) error + TriggerError func(error) + TryRequestHostConfig func() error + TryToRenewOrRevise func() bool + WaitConfigResp func() (p2p.Msg, error) + type PeriodCost struct + ContractFees common.BigInt + ContractFund common.BigInt + DownloadCost common.BigInt + PrevContractCost common.BigInt + StorageCost common.BigInt + UnspentFund common.BigInt + UploadCost common.BigInt + WithheldFund common.BigInt + WithheldFundReleaseBlock uint64 + type RentPayment struct + ExpectedDownload uint64 + ExpectedRedundancy float64 + ExpectedStorage uint64 + ExpectedUpload uint64 + Fund common.BigInt + Period uint64 + StorageHosts uint64 + type RentPaymentAPIDisplay struct + ExpectedDownload string + ExpectedRedundancy string + ExpectedStorage string + ExpectedUpload string + Fund string + Period string + StorageHosts string + type SysPath string + func (sp SysPath) Join(dp DxPath, extra ...string) SysPath + type UploadAction struct + A uint64 + B uint64 + Data []byte + Type string + type UploadFileInfo struct + AccessTime time.Time + Available bool + ChangeTime time.Time + CipherType string + CreateTime time.Time + DxPath string + Expiration uint64 + FileSize uint64 + Health float64 + LocalPath string + MaxHealth float64 + MaxHealthPercent float64 + ModTime time.Time + NumStuckChunks uint64 + OnDisk bool + Recoverable bool + Redundancy float64 + Renewing bool + Stuck bool + StuckHealth float64 + UploadProgress float64 + UploadedBytes uint64 + type UploadMerkleProof struct + NewMerkleRoot common.Hash + OldLeafHashes []common.Hash + OldSubtreeHashes []common.Hash + type UploadRequest struct + Actions []UploadAction + NewMissedProofValues []*big.Int + NewRevisionNumber uint64 + NewValidProofValues []*big.Int + StorageContractID common.Hash