ontfs

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: LGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPassportExpire = 9 //block count. passport expire for GetFileHashList

	DefaultNodeMinVolume   = 1024 * 1024 //kb. min total volume with fsNode
	DefaultNodePerKbPledge = 1           //fsNode's pledge for participant

	DefaultMinDownLoadFee           = 1 //min download fee for single task*
	DefaultGasPerKbForRead          = 1 //cost for ontfs-sdk read from fsNode*
	DefaultGasPerKbForSaveWithFile  = 1 //cost for ontfs-sdk save from fsNode*
	DefaultGasPerKbForSaveWithSpace = 1 //cost for ontfs-sdk save from fsNode*

	DefaultPdpHeightIV  = 8   //pdp challenge height IV
	DefaultPerBlockSize = 256 //kb.
	DefaultPdpBlockNum  = 32
)
View Source
const (
	FileStorageTypeUseSpace = 0
	FileStorageTypeUseFile  = 1
)
View Source
const (
	FS_SET_GLOBAL_PARAM      = "FsSetGlobalParam"
	FS_GET_GLOBAL_PARAM      = "FsGetGlobalParam"
	FS_NODE_REGISTER         = "FsNodeRegister"
	FS_NODE_QUERY            = "FsNodeQuery"
	FS_NODE_UPDATE           = "FsNodeUpdate"
	FS_NODE_CANCEL           = "FsNodeCancel"
	FS_FILE_PROVE            = "FsFileProve"
	FS_NODE_WITH_DRAW_PROFIT = "FsNodeWithDrawProfit"
	FS_GET_NODE_LIST         = "FsGetNodeList"
	FS_GET_PDP_INFO_LIST     = "FsGetPdpInfoList"
	FS_STORE_FILES           = "FsStoreFiles"
	FS_RENEW_FILES           = "FsRenewFiles"
	FS_DELETE_FILES          = "FsDeleteFiles"
	FS_TRANSFER_FILES        = "FsTransferFiles"
	FS_GET_FILE_INFO         = "FsGetFileInfo"
	FS_GET_FILE_LIST         = "FsGetFileList"
	FS_READ_FILE_PLEDGE      = "FsReadFilePledge"
	FS_READ_FILE_SETTLE      = "FsReadFileSettle"
	FS_GET_READ_PLEDGE       = "FsGetReadPledge"
	FS_CANCEL_FILE_READ      = "FsCancelFileRead"
	FS_SET_WHITE_LIST        = "FsSetWhiteList"
	FS_GET_WHITE_LIST        = "FsGetWhiteList"
	FS_CREATE_SPACE          = "FsCreateSpace"
	FS_DELETE_SPACE          = "FsDeleteSpace"
	FS_UPDATE_SPACE          = "FsUpdateSpace"
	FS_GET_SPACE_INFO        = "FsGetSpaceInfo"
)
View Source
const (
	ONTFS_GLOBAL_PARAM     = "ontFsGlobalParam"
	ONTFS_NODE_INFO        = "ontFsNodeInfo"
	ONTFS_FILE_INFO        = "ontFsFileInfo"
	ONTFS_FILE_PDP         = "ontFsFilePdp"
	ONTFS_FILE_OWNER       = "ontFsFileOwner"
	ONTFS_FILE_WHITE_LIST  = "ontFsFileWhiteList"
	ONTFS_FILE_READ_PLEDGE = "ontFsFileReadPledge"
	ONTFS_FILE_SPACE       = "ontFsFileSpace"
)

Variables

This section is empty.

Functions

func CheckPassport

func CheckPassport(currBlockHeight uint64, passportData []byte) (common.Address, error)

func CheckPdpProve

func CheckPdpProve(nodeAddr common.Address, blockHash []byte, fileBlockCount uint64, pdpParamData []byte,
	proveData []byte) error

func DecodeBool

func DecodeBool(source *common.ZeroCopySource) (bool, error)

func DecodeVarBytes

func DecodeVarBytes(source *common.ZeroCopySource) ([]byte, error)

func EncRet

func EncRet(ret bool, info []byte) []byte

func FsCancelFileRead

func FsCancelFileRead(native *native.NativeService) ([]byte, error)

func FsCreateSpace

func FsCreateSpace(native *native.NativeService) ([]byte, error)

func FsDeleteFiles

func FsDeleteFiles(native *native.NativeService) ([]byte, error)

func FsDeleteSpace

func FsDeleteSpace(native *native.NativeService) ([]byte, error)

func FsFileProve

func FsFileProve(native *native.NativeService) ([]byte, error)

func FsGetFileHashList

func FsGetFileHashList(native *native.NativeService) ([]byte, error)

func FsGetFileInfo

func FsGetFileInfo(native *native.NativeService) ([]byte, error)

func FsGetGlobalParam

func FsGetGlobalParam(native *native.NativeService) ([]byte, error)

func FsGetNodeInfoList

func FsGetNodeInfoList(native *native.NativeService) ([]byte, error)

func FsGetPdpInfoList

func FsGetPdpInfoList(native *native.NativeService) ([]byte, error)

func FsGetReadPledge

func FsGetReadPledge(native *native.NativeService) ([]byte, error)

func FsGetSpaceInfo

func FsGetSpaceInfo(native *native.NativeService) ([]byte, error)

func FsGetWhiteList

func FsGetWhiteList(native *native.NativeService) ([]byte, error)

func FsNodeCancel

func FsNodeCancel(native *native.NativeService) ([]byte, error)

func FsNodeQuery

func FsNodeQuery(native *native.NativeService) ([]byte, error)

func FsNodeRegister

func FsNodeRegister(native *native.NativeService) ([]byte, error)

func FsNodeUpdate

func FsNodeUpdate(native *native.NativeService) ([]byte, error)

func FsNodeWithDrawProfit

func FsNodeWithDrawProfit(native *native.NativeService) ([]byte, error)

func FsReadFilePledge

func FsReadFilePledge(native *native.NativeService) ([]byte, error)

func FsReadFileSettle

func FsReadFileSettle(native *native.NativeService) ([]byte, error)

func FsRenewFiles

func FsRenewFiles(native *native.NativeService) ([]byte, error)

func FsSetGlobalParam

func FsSetGlobalParam(native *native.NativeService) ([]byte, error)

func FsSetWhiteList

func FsSetWhiteList(native *native.NativeService) ([]byte, error)

func FsStoreFiles

func FsStoreFiles(native *native.NativeService) ([]byte, error)

func FsTransferFiles

func FsTransferFiles(native *native.NativeService) ([]byte, error)

func FsUpdateSpace

func FsUpdateSpace(native *native.NativeService) ([]byte, error)

func GenFsFileInfoKey

func GenFsFileInfoKey(contract common.Address, fileOwner common.Address, fileHash []byte) []byte

func GenFsFileInfoPrefix

func GenFsFileInfoPrefix(contract common.Address, fileOwner common.Address) []byte

func GenFsFileOwnerKey

func GenFsFileOwnerKey(contract common.Address, fileHash []byte) []byte

func GenFsNodeInfoKey

func GenFsNodeInfoKey(contract common.Address, nodeAddr common.Address) []byte

func GenFsNodeInfoPrefix

func GenFsNodeInfoPrefix(contract common.Address) []byte

func GenFsPdpRecordKey

func GenFsPdpRecordKey(contract common.Address, fileHash []byte, fileOwner common.Address, nodeAddr common.Address) []byte

func GenFsPdpRecordPrefix

func GenFsPdpRecordPrefix(contract common.Address, fileHash []byte, fileOwner common.Address) []byte

func GenFsReadPledgeKey

func GenFsReadPledgeKey(contract common.Address, downloader common.Address, fileHash []byte) []byte

func GenFsSpaceKey

func GenFsSpaceKey(contract common.Address, spaceOwner common.Address) []byte

func GenFsWhiteListKey

func GenFsWhiteListKey(contract common.Address, fileOwner common.Address, fileHash []byte) []byte

func GenGlobalParamKey

func GenGlobalParamKey(contract common.Address) []byte

func InitFs

func InitFs()

func RegisterFsContract

func RegisterFsContract(native *native.NativeService)

Types

type Errors

type Errors struct {
	ObjectErrors map[string]string
}

func (*Errors) AddErrorsEvent

func (this *Errors) AddErrorsEvent(native *native.NativeService)

func (*Errors) AddObjectError

func (this *Errors) AddObjectError(object string, errorString string)

func (*Errors) FromString

func (this *Errors) FromString(errors string) error

func (*Errors) ToString

func (this *Errors) ToString() string

type FileDel

type FileDel struct {
	FileHash []byte
}

func (*FileDel) Deserialization

func (this *FileDel) Deserialization(source *common.ZeroCopySource) error

func (*FileDel) Serialization

func (this *FileDel) Serialization(sink *common.ZeroCopySink)

type FileDelList

type FileDelList struct {
	FilesDel []FileDel
}

func (*FileDelList) Deserialization

func (this *FileDelList) Deserialization(source *common.ZeroCopySource) error

func (*FileDelList) Serialization

func (this *FileDelList) Serialization(sink *common.ZeroCopySink)

type FileHash

type FileHash struct {
	FHash []byte
}

type FileHashList

type FileHashList struct {
	FilesH []FileHash
}

func (*FileHashList) Deserialization

func (this *FileHashList) Deserialization(source *common.ZeroCopySource) error

func (*FileHashList) Serialization

func (this *FileHashList) Serialization(sink *common.ZeroCopySink)

type FileInfo

type FileInfo struct {
	FileHash       []byte
	FileOwner      common.Address
	FileDesc       []byte
	FileBlockCount uint64
	RealFileSize   uint64
	CopyNumber     uint64
	PayAmount      uint64
	RestAmount     uint64
	FileCost       uint64
	FirstPdp       bool
	PdpInterval    uint64
	TimeStart      uint64
	TimeExpired    uint64
	PdpParam       []byte
	ValidFlag      bool
	StorageType    uint64
}

func (*FileInfo) Deserialization

func (this *FileInfo) Deserialization(source *common.ZeroCopySource) error

func (*FileInfo) Serialization

func (this *FileInfo) Serialization(sink *common.ZeroCopySink)

type FileInfoList

type FileInfoList struct {
	FilesI []FileInfo
}

func (*FileInfoList) Deserialization

func (this *FileInfoList) Deserialization(source *common.ZeroCopySource) error

func (*FileInfoList) Serialization

func (this *FileInfoList) Serialization(sink *common.ZeroCopySink)

type FileReNew

type FileReNew struct {
	FileHash       []byte
	FileOwner      common.Address
	Payer          common.Address
	NewTimeExpired uint64
}

func (*FileReNew) Deserialization

func (this *FileReNew) Deserialization(source *common.ZeroCopySource) error

func (*FileReNew) Serialization

func (this *FileReNew) Serialization(sink *common.ZeroCopySink)

type FileReNewList

type FileReNewList struct {
	FilesReNew []FileReNew
}

func (*FileReNewList) Deserialization

func (this *FileReNewList) Deserialization(source *common.ZeroCopySource) error

func (*FileReNewList) Serialization

func (this *FileReNewList) Serialization(sink *common.ZeroCopySink)

type FileReadSettleSlice

type FileReadSettleSlice struct {
	FileHash     []byte
	PayFrom      common.Address
	PayTo        common.Address
	SliceId      uint64
	PledgeHeight uint64
	Sig          []byte
	PubKey       []byte
}

func (*FileReadSettleSlice) Deserialization

func (this *FileReadSettleSlice) Deserialization(source *common.ZeroCopySource) error

func (*FileReadSettleSlice) Serialization

func (this *FileReadSettleSlice) Serialization(sink *common.ZeroCopySink)

type FileTransfer

type FileTransfer struct {
	FileHash []byte
	OriOwner common.Address
	NewOwner common.Address
}

func (*FileTransfer) Deserialization

func (this *FileTransfer) Deserialization(source *common.ZeroCopySource) error

func (*FileTransfer) Serialization

func (this *FileTransfer) Serialization(sink *common.ZeroCopySink)

type FileTransferList

type FileTransferList struct {
	FilesTransfer []FileTransfer
}

func (*FileTransferList) Deserialization

func (this *FileTransferList) Deserialization(source *common.ZeroCopySource) error

func (*FileTransferList) Serialization

func (this *FileTransferList) Serialization(sink *common.ZeroCopySink)

type FileWhiteList

type FileWhiteList struct {
	FileOwner     common.Address
	FileHash      []byte
	WhiteListInfo WhiteList
}

func (*FileWhiteList) Deserialization

func (this *FileWhiteList) Deserialization(source *common.ZeroCopySource) error

func (*FileWhiteList) Serialization

func (this *FileWhiteList) Serialization(sink *common.ZeroCopySink)

type FsGlobalParam

type FsGlobalParam struct {
	MinDownLoadFee           uint64 //min download fee for single task
	NodeMinVolume            uint64 //min total volume with fsNode
	NodePerKbPledge          uint64 //fsNode's pledge for participant
	GasPerKbForRead          uint64 //cost for ontfs-sdk read from fsNode
	GasPerKbForSaveWithFile  uint64 //cost for ontfs-sdk save from fsNode
	GasPerKbForSaveWithSpace uint64 //cost for ontfs-sdk save from fsNode
}

func (*FsGlobalParam) Deserialization

func (this *FsGlobalParam) Deserialization(source *common.ZeroCopySource) error

func (*FsGlobalParam) Serialization

func (this *FsGlobalParam) Serialization(sink *common.ZeroCopySink)

type FsNodeInfo

type FsNodeInfo struct {
	Pledge         uint64
	Profit         uint64
	Volume         uint64
	RestVol        uint64
	ServiceTime    uint64
	MinPdpInterval uint64
	NodeAddr       common.Address
	NodeNetAddr    []byte
}

func (*FsNodeInfo) Deserialization

func (this *FsNodeInfo) Deserialization(source *common.ZeroCopySource) error

func (*FsNodeInfo) Serialization

func (this *FsNodeInfo) Serialization(sink *common.ZeroCopySink)

type FsNodeInfoList

type FsNodeInfoList struct {
	NodesInfo []FsNodeInfo
}

func (*FsNodeInfoList) Deserialization

func (this *FsNodeInfoList) Deserialization(source *common.ZeroCopySource) error

func (*FsNodeInfoList) Serialization

func (this *FsNodeInfoList) Serialization(sink *common.ZeroCopySink)

type GetReadPledge

type GetReadPledge struct {
	FileHash   []byte
	Downloader common.Address
}

func (*GetReadPledge) Deserialization

func (this *GetReadPledge) Deserialization(source *common.ZeroCopySource) error

func (*GetReadPledge) Serialization

func (this *GetReadPledge) Serialization(sink *common.ZeroCopySink)

type Passport

type Passport struct {
	BlockHeight uint64
	BlockHash   []byte
	WalletAddr  common.Address
	PublicKey   []byte
	Signature   []byte
}

func (*Passport) Deserialization

func (this *Passport) Deserialization(source *common.ZeroCopySource) error

func (*Passport) Serialization

func (this *Passport) Serialization(sink *common.ZeroCopySink)

type PdpData

type PdpData struct {
	NodeAddr        common.Address
	FileHash        []byte
	ProveData       []byte
	ChallengeHeight uint64
}

func (*PdpData) Deserialization

func (this *PdpData) Deserialization(source *common.ZeroCopySource) error

func (*PdpData) Serialization

func (this *PdpData) Serialization(sink *common.ZeroCopySink)

type PdpRecord

type PdpRecord struct {
	NodeAddr    common.Address
	FileHash    []byte
	FileOwner   common.Address
	PdpCount    uint64 // pdp times
	LastPdpTime uint64
	NextHeight  uint64 //pdp next challenge height
	SettleFlag  bool
}

func (*PdpRecord) Deserialization

func (this *PdpRecord) Deserialization(source *common.ZeroCopySource) error

func (*PdpRecord) Serialization

func (this *PdpRecord) Serialization(sink *common.ZeroCopySink)

type PdpRecordKey

type PdpRecordKey struct {
	RecordKey []byte
}

type PdpRecordList

type PdpRecordList struct {
	PdpRecords []PdpRecord
}

func (*PdpRecordList) Deserialization

func (this *PdpRecordList) Deserialization(source *common.ZeroCopySource) error

func (*PdpRecordList) Serialization

func (this *PdpRecordList) Serialization(sink *common.ZeroCopySink)

type ReadPlan

type ReadPlan struct {
	NodeAddr         common.Address
	MaxReadBlockNum  uint64
	HaveReadBlockNum uint64
}

func (*ReadPlan) Deserialization

func (this *ReadPlan) Deserialization(source *common.ZeroCopySource) error

func (*ReadPlan) Serialization

func (this *ReadPlan) Serialization(sink *common.ZeroCopySink)

type ReadPledge

type ReadPledge struct {
	FileHash     []byte
	Downloader   common.Address
	BlockHeight  uint64
	ExpireHeight uint64
	RestMoney    uint64
	ReadPlans    []ReadPlan
}

func (*ReadPledge) Deserialization

func (this *ReadPledge) Deserialization(source *common.ZeroCopySource) error

func (*ReadPledge) Serialization

func (this *ReadPledge) Serialization(sink *common.ZeroCopySink)

type RetInfo

type RetInfo struct {
	Ret  bool
	Info []byte
}

func DecRet

func DecRet(ret []byte) *RetInfo

func (*RetInfo) Deserialization

func (this *RetInfo) Deserialization(source *common.ZeroCopySource) error

func (*RetInfo) Serialization

func (this *RetInfo) Serialization(sink *common.ZeroCopySink)

type SpaceInfo

type SpaceInfo struct {
	SpaceOwner  common.Address
	Volume      uint64
	RestVol     uint64
	CopyNumber  uint64
	PayAmount   uint64
	RestAmount  uint64
	PdpInterval uint64
	TimeStart   uint64
	TimeExpired uint64
	ValidFlag   bool
}

func (*SpaceInfo) Deserialization

func (this *SpaceInfo) Deserialization(source *common.ZeroCopySource) error

func (*SpaceInfo) Serialization

func (this *SpaceInfo) Serialization(sink *common.ZeroCopySink)

type SpaceUpdate

type SpaceUpdate struct {
	SpaceOwner     common.Address
	Payer          common.Address
	NewVolume      uint64
	NewTimeExpired uint64
}

func (*SpaceUpdate) Deserialization

func (this *SpaceUpdate) Deserialization(source *common.ZeroCopySource) error

func (*SpaceUpdate) Serialization

func (this *SpaceUpdate) Serialization(sink *common.ZeroCopySink)

type WhiteList

type WhiteList struct {
	UsersAddr []common.Address
}

func (*WhiteList) Deserialization

func (this *WhiteList) Deserialization(source *common.ZeroCopySource) error

func (*WhiteList) Serialization

func (this *WhiteList) Serialization(sink *common.ZeroCopySink)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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