chain

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FILE_STATE_ACTIVE  = "active"
	FILE_STATE_PENDING = "pending"
)
View Source
const (
	MINER_STATE_POSITIVE = "positive"
	MINER_STATE_FROZEN   = "frozen"
	MINER_STATE_EXIT     = "exit"
)
View Source
const (
	ERR_Failed = "Failed"
)

Variables

View Source
var (
	ERR_RPC_CONNECTION  = errors.New("rpc connection failed")
	ERR_RPC_TIMEOUT     = errors.New("timeout")
	ERR_RPC_EMPTY_VALUE = errors.New("empty")
)

error type

Functions

This section is empty.

Types

type BlockInfo

type BlockInfo struct {
	MinerId   types.U64
	BlockSize types.U64
	BlockNum  types.U32
	BlockId   FileBlockId
	MinerIp   Ipv4Type
	MinerAcc  types.AccountID
}

file block info

type Cache_MinerInfo

type Cache_MinerInfo struct {
	Peerid uint64 `json:"peerid"`
	Ip     string `json:"ip"`
	Free   uint64 `json:"free"`
}

cache storage miner

type CessEventRecords

type CessEventRecords struct {
	//system
	types.EventRecords
	//SegmentBook
	SegmentBook_PPBNoOnTimeSubmit     []Event_PPBNoOnTimeSubmit
	SegmentBook_PPDNoOnTimeSubmit     []Event_PPDNoOnTimeSubmit
	SegmentBook_ChallengeProof        []Event_ChallengeProof
	SegmentBook_VerifyProof           []Event_VerifyProof
	SegmentBook_OutstandingChallenges []Event_OutstandingChallenges
	//Sminer
	Sminer_Registered          []Event_Registered
	Sminer_TimedTask           []Event_TimedTask
	Sminer_DrawFaucetMoney     []Event_DrawFaucetMoney
	Sminer_FaucetTopUpMoney    []Event_FaucetTopUpMoney
	Sminer_LessThan24Hours     []Event_LessThan24Hours
	Sminer_AlreadyFrozen       []Event_AlreadyFrozen
	Sminer_MinerExit           []Event_MinerExit
	Sminer_MinerClaim          []Event_MinerClaim
	Sminer_IncreaseCollateral  []Event_IncreaseCollateral
	Sminer_Deposit             []Event_Deposit
	Sminer_Redeemed            []Event_Redeemed
	Sminer_Claimed             []Event_Claimed
	Sminer_TimingStorageSpace  []Event_TimingStorageSpace
	Sminer_UpdataBeneficiary   []Event_UpdataBeneficiary
	Sminer_UpdataIp            []Event_UpdataIp
	Sminer_StartOfBufferPeriod []Event_StartOfBufferPeriod
	Sminer_EndOfBufferPeriod   []Event_EndOfBufferPeriod
	//FileBank
	FileBank_DeleteFile           []Event_DeleteFile
	FileBank_BuySpace             []Event_BuySpace
	FileBank_FileUpload           []Event_FileUpload
	FileBank_FileUpdate           []Event_FileUpdate
	FileBank_LeaseExpireIn24Hours []Event_LeaseExpireIn24Hours
	FileBank_FileChangeState      []Event_FileChangeState
	FileBank_BuyFile              []Event_BuyFile
	FileBank_Purchased            []Event_Purchased
	FileBank_InsertFileSlice      []Event_InsertFileSlice
	FileBank_LeaseExpired         []Event_LeaseExpired
	FileBank_FillerUpload         []Event_FillerUpload
	FileBank_ClearInvalidFile     []Event_ClearInvalidFile
	FileBank_RecoverFile          []Event_RecoverFile
	FileBank_ReceiveSpace         []Event_ReceiveSpace
	FileBank_UploadDeclaration    []Event_UploadDeclaration
	FileBank_BuyPackage           []Event_BuyPackage
	FileBank_PackageUpgrade       []Event_PackageUpgrade
	FileBank_PackageRenewal       []Event_PackageRenewal
	//FileMap
	FileMap_RegistrationScheduler []Event_RegistrationScheduler
	FileMap_UpdateScheduler       []Event_UpdateScheduler
	//other system
	ElectionProviderMultiPhase_UnsignedPhaseStarted []Event_UnsignedPhaseStarted
	ElectionProviderMultiPhase_SignedPhaseStarted   []Event_SignedPhaseStarted
	ElectionProviderMultiPhase_SolutionStored       []Event_SolutionStored
	Balances_Withdraw                               []Event_Balances_Withdraw
}

cess events type

type Chainer

type Chainer interface {
	// Getpublickey returns its own public key
	GetPublicKey() []byte
	// GetStashPublicKey returns its stash account public key
	GetStashPublicKey() ([]byte, error)
	// Getpublickey returns its own private key
	GetMnemonicSeed() string
	// NewAccountId returns the account id
	NewAccountId(pubkey []byte) types.AccountID
	// GetSyncStatus returns whether the block is being synchronized
	GetSyncStatus() (bool, error)
	// GetChainStatus returns chain status
	GetChainStatus() bool
	// Getstorageminerinfo is used to get the details of the miner
	GetStorageMinerInfo(pkey []byte) (MinerInfo, error)
	// Getallstorageminer is used to obtain the AccountID of all miners
	GetAllStorageMiner() ([]types.AccountID, error)
	// GetFileMetaInfo is used to get the meta information of the file
	GetFileMetaInfo(fid string) (FileMetaInfo, error)
	// GetAllSchedulerInfo is used to get information about all schedules
	GetAllSchedulerInfo() ([]SchedulerInfo, error)
	// GetProofs is used to get all the proofs to be verified
	GetProofs() ([]Proof, error)
	// GetCessAccount is used to get the account in cess chain format
	GetCessAccount() (string, error)
	// GetAccountInfo is used to get account information
	GetAccountInfo(pkey []byte) (types.AccountInfo, error)
	// GetSpacePackageInfo is used to get the space package information of the account
	GetSpacePackageInfo(pkey []byte) (SpacePackage, error)
	// Register is used by the scheduling service to register
	Register(stash, ip, port string) (string, error)
	// SubmitProofResults is used to submit proof verification results
	SubmitProofResults(data []ProofResult) (string, error)
	// SubmitFillerMeta is used to submit the meta information of the filler
	SubmitFillerMeta(miner_acc types.AccountID, info []FillerMetaInfo) (string, error)
	// SubmitFileMeta is used to submit the meta information of the file
	SubmitFileMeta(fid string, fsize uint64, block []BlockInfo) (string, error)
	// Update is used to update the communication address of the scheduling service
	Update(ip, port string) (string, error)
}

func NewChainClient

func NewChainClient(rpcAddr, secret, stash string, t time.Duration) (Chainer, error)

type ChallengeInfo

type ChallengeInfo struct {
	File_size  types.U64
	File_type  types.U8
	Block_list types.Bytes
	File_id    FileHash
	Shard_id   FileBlockId
	Random     []types.Bytes
}

challenge info

type Event_AlreadyFrozen

type Event_AlreadyFrozen struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type Event_Balances_Withdraw

type Event_Balances_Withdraw struct {
	Phase  types.Phase
	Who    types.AccountID
	Amount types.U128
	Topics []types.Hash
}

type Event_BuyFile

type Event_BuyFile struct {
	Phase  types.Phase
	Acc    types.AccountID
	Money  types.U128
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_BuyPackage

type Event_BuyPackage struct {
	Phase  types.Phase
	Acc    types.AccountID
	Size   types.U128
	Fee    types.U128
	Topics []types.Hash
}

type Event_BuySpace

type Event_BuySpace struct {
	Phase  types.Phase
	Acc    types.AccountID
	Size   types.U128
	Fee    types.U128
	Topics []types.Hash
}

type Event_ChallengeProof

type Event_ChallengeProof struct {
	Phase  types.Phase
	Miner  types.AccountID
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_Claimed

type Event_Claimed struct {
	Phase   types.Phase
	Acc     types.AccountID
	Deposit types.U128
	Topics  []types.Hash
}

type Event_ClearInvalidFile

type Event_ClearInvalidFile struct {
	Phase     types.Phase
	Acc       types.AccountID
	File_hash [64]types.U8
	Topics    []types.Hash
}

type Event_DeleteFile

type Event_DeleteFile struct {
	Phase  types.Phase
	Acc    types.AccountID
	Fileid FileHash
	Topics []types.Hash
}

------------------------FileBank-------------------------------

type Event_Deposit

type Event_Deposit struct {
	Phase   types.Phase
	Balance types.U128
	Topics  []types.Hash
}

type Event_DrawFaucetMoney

type Event_DrawFaucetMoney struct {
	Phase  types.Phase
	Topics []types.Hash
}

type Event_EndOfBufferPeriod

type Event_EndOfBufferPeriod struct {
	Phase  types.Phase
	When   types.U32
	Topics []types.Hash
}

type Event_FaucetTopUpMoney

type Event_FaucetTopUpMoney struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type Event_FileChangeState

type Event_FileChangeState struct {
	Phase  types.Phase
	Acc    types.AccountID
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_FileUpdate

type Event_FileUpdate struct {
	Phase  types.Phase
	Acc    types.AccountID
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_FileUpload

type Event_FileUpload struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type Event_FillerUpload

type Event_FillerUpload struct {
	Phase    types.Phase
	Acc      types.AccountID
	Filesize types.U64
	Topics   []types.Hash
}

type Event_IncreaseCollateral

type Event_IncreaseCollateral struct {
	Phase   types.Phase
	Acc     types.AccountID
	Balance types.U128
	Topics  []types.Hash
}

type Event_InsertFileSlice

type Event_InsertFileSlice struct {
	Phase  types.Phase
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_LeaseExpireIn24Hours

type Event_LeaseExpireIn24Hours struct {
	Phase  types.Phase
	Acc    types.AccountID
	Size   types.U128
	Topics []types.Hash
}

type Event_LeaseExpired

type Event_LeaseExpired struct {
	Phase  types.Phase
	Acc    types.AccountID
	Size   types.U128
	Topics []types.Hash
}

type Event_LessThan24Hours

type Event_LessThan24Hours struct {
	Phase  types.Phase
	Last   types.U32
	Now    types.U32
	Topics []types.Hash
}

type Event_MinerClaim

type Event_MinerClaim struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type Event_MinerExit

type Event_MinerExit struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type Event_OutstandingChallenges

type Event_OutstandingChallenges struct {
	Phase  types.Phase
	Miner  types.AccountID
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_PPBNoOnTimeSubmit

type Event_PPBNoOnTimeSubmit struct {
	Phase     types.Phase
	Acc       types.AccountID
	SegmentId types.U64
	Topics    []types.Hash
}

------------------------SegmentBook----------------------------

type Event_PPDNoOnTimeSubmit

type Event_PPDNoOnTimeSubmit struct {
	Phase     types.Phase
	Acc       types.AccountID
	SegmentId types.U64
	Topics    []types.Hash
}

type Event_PackageRenewal

type Event_PackageRenewal struct {
	Phase        types.Phase
	Acc          types.AccountID
	Package_type types.U8
	Fee          types.U128
	Topics       []types.Hash
}

type Event_PackageUpgrade

type Event_PackageUpgrade struct {
	Phase    types.Phase
	Acc      types.AccountID
	Old_type types.U8
	New_type types.U8
	Fee      types.U128
	Topics   []types.Hash
}

type Event_Purchased

type Event_Purchased struct {
	Phase  types.Phase
	Acc    types.AccountID
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_ReceiveSpace

type Event_ReceiveSpace struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type Event_RecoverFile

type Event_RecoverFile struct {
	Phase     types.Phase
	Acc       types.AccountID
	File_hash [68]types.U8
	Topics    []types.Hash
}

type Event_Redeemed

type Event_Redeemed struct {
	Phase   types.Phase
	Acc     types.AccountID
	Deposit types.U128
	Topics  []types.Hash
}

type Event_Registered

type Event_Registered struct {
	Phase      types.Phase
	Acc        types.AccountID
	StakingVal types.U128
	Topics     []types.Hash
}

------------------------Sminer---------------------------------

type Event_RegistrationScheduler

type Event_RegistrationScheduler struct {
	Phase  types.Phase
	Acc    types.AccountID
	Ip     Ipv4Type_Query
	Topics []types.Hash
}

------------------------FileMap--------------------------------

type Event_SignedPhaseStarted

type Event_SignedPhaseStarted struct {
	Phase  types.Phase
	Round  types.U32
	Topics []types.Hash
}

type Event_SolutionStored

type Event_SolutionStored struct {
	Phase            types.Phase
	Election_compute types.ElectionCompute
	Prev_ejected     types.Bool
	Topics           []types.Hash
}

type Event_StartOfBufferPeriod

type Event_StartOfBufferPeriod struct {
	Phase  types.Phase
	When   types.U32
	Topics []types.Hash
}

type Event_TimedTask

type Event_TimedTask struct {
	Phase  types.Phase
	Topics []types.Hash
}

type Event_TimingStorageSpace

type Event_TimingStorageSpace struct {
	Phase  types.Phase
	Topics []types.Hash
}

type Event_UnsignedPhaseStarted

type Event_UnsignedPhaseStarted struct {
	Phase  types.Phase
	Round  types.U32
	Topics []types.Hash
}

------------------------other system---------------------------

type Event_UpdataBeneficiary

type Event_UpdataBeneficiary struct {
	Phase  types.Phase
	Acc    types.AccountID
	New    types.AccountID
	Topics []types.Hash
}

type Event_UpdataIp

type Event_UpdataIp struct {
	Phase  types.Phase
	Acc    types.AccountID
	Old    Ipv4Type
	New    Ipv4Type
	Topics []types.Hash
}

type Event_UpdateScheduler

type Event_UpdateScheduler struct {
	Phase    types.Phase
	Acc      types.AccountID
	Endpoint Ipv4Type_Query
	Topics   []types.Hash
}

type Event_UploadDeclaration

type Event_UploadDeclaration struct {
	Phase     types.Phase
	Acc       types.AccountID
	File_hash [64]types.U8
	File_name types.Bytes
	Topics    []types.Hash
}

type Event_VerifyProof

type Event_VerifyProof struct {
	Phase  types.Phase
	Miner  types.AccountID
	Fileid types.Bytes
	Topics []types.Hash
}

type FileBlockId

type FileBlockId [68]types.U8

type FileHash

type FileHash [64]types.U8

type FileMetaInfo

type FileMetaInfo struct {
	Size  types.U64
	Index types.U32
	State types.Bytes
	// Users []types.AccountID
	// Names []types.Bytes
	UserBriefs []UserBrief
	BlockInfo  []BlockInfo
}

file meta info

type FillerMetaInfo

type FillerMetaInfo struct {
	Size      types.U64
	Index     types.U32
	BlockNum  types.U32
	BlockSize types.U32
	ScanSize  types.U32
	Acc       types.AccountID
	Hash      FileHash
}

filler meta info

type IpAddress

type IpAddress struct {
	IPv4 Ipv4Type
	IPv6 Ipv6Type
}

type Ipv4Type

type Ipv4Type struct {
	Index types.U8
	Value [4]types.U8
	Port  types.U16
}

type Ipv4Type_Query

type Ipv4Type_Query struct {
	Placeholder types.U8 //
	Index       types.U8
	Value       [4]types.U8
	Port        types.U16
}

type Ipv6Type

type Ipv6Type struct {
	Index types.U8
	Value [8]types.U16
	Port  types.U16
}

type MinerInfo

type MinerInfo struct {
	PeerId      types.U64
	IncomeAcc   types.AccountID
	Ip          Ipv4Type
	Collaterals types.U128
	State       types.Bytes
	Power       types.U128
	Space       types.U128
	RewardInfo  RewardInfo
}

storage miner info

type Proof

type Proof struct {
	FileId         FileHash
	Miner_pubkey   types.AccountID
	Challenge_info ChallengeInfo
	Mu             []types.Bytes
	Sigma          types.Bytes
	Name           types.Bytes
	U              []types.Bytes
}

proof type

type ProofResult

type ProofResult struct {
	PublicKey types.AccountID
	FileId    FileHash
	Shard_id  FileBlockId
	Result    types.Bool
}

proof result

type RewardInfo

type RewardInfo struct {
	Total       types.U128
	Received    types.U128
	NotReceived types.U128
}

type SchedulerInfo

type SchedulerInfo struct {
	Ip             Ipv4Type
	StashUser      types.AccountID
	ControllerUser types.AccountID
}

scheduler info

type SpacePackage

type SpacePackage struct {
	Space           types.U128
	Used_space      types.U128
	Remaining_space types.U128
	Tenancy         types.U32
	Package_type    types.U8
	Start           types.U32
	Deadline        types.U32
	State           types.Bytes
}

user space package Info

type UserBrief added in v0.5.3

type UserBrief struct {
	User        types.AccountID
	File_name   types.Bytes
	Bucket_name types.Bytes
}

Jump to

Keyboard shortcuts

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