xchain

package
v0.0.0-...-ebe581b Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type XChain

type XChain struct {
	ContractName    string              // ContractName is name of contract
	ContractAccount string              // ContractAccount is a contract account
	ChainName       string              // ChainName is name of blockchain
	Account         *account.Account    // Account is the local account, and is also the client account to request blockchain
	XchainClient    *xchain.XuperClient // XchainClient is the util used to connect and request blockchain
}

func New

func New(conf *config.XchainConf) (*XChain, error)

New creates a XChain client which is used for connecting and requesting blockchain

func (*XChain) AddFileNs

func (x *XChain) AddFileNs(opt *blockchain.AddNsOptions) error

AddFileNs adds file namespace

func (*XChain) AddNode

func (x *XChain) AddNode(opt *blockchain.AddNodeOptions) error

AddNode adds a storage node to xchain

func (*XChain) ChallengeAnswer

func (x *XChain) ChallengeAnswer(opt *blockchain.ChallengeAnswerOptions) ([]byte, error)

ChallengeAnswer sets a storage node's challenge answer on chain

func (*XChain) ChallengeRequest

func (x *XChain) ChallengeRequest(opt *blockchain.ChallengeRequestOptions) error

ChallengeRequest sets a dataowner's challenge request on chain

func (*XChain) ConfirmFileAuthApplication

func (x *XChain) ConfirmFileAuthApplication(opt *blockchain.ConfirmFileAuthOptions) error

ConfirmFileAuthApplication dataOwner node confirms the applier's file authorization application

func (*XChain) GetAuthApplicationByID

func (x *XChain) GetAuthApplicationByID(authID string) (blockchain.FileAuthApplication, error)

GetAuthApplicationByID query authorization application detail by authID

func (*XChain) GetChallengeByID

func (x *XChain) GetChallengeByID(id string) (blockchain.Challenge, error)

GetChallengeByID gets a challenge by challengeID

func (*XChain) GetChallengeNum

func (x *XChain) GetChallengeNum(opt *blockchain.GetChallengeNumOptions) (uint64, error)

GetChallengeNum gets challenge number given filter condition filter condition may include storageNode, challenge status, time period

func (*XChain) GetFileByID

func (x *XChain) GetFileByID(id string) (blockchain.File, error)

GetFileByID gets file by id from xchain

func (*XChain) GetFileByName

func (x *XChain) GetFileByName(owner []byte, ns, name string) (blockchain.File, error)

GetFileByName gets file by name from xchain

func (*XChain) GetHeartbeatNum

func (x *XChain) GetHeartbeatNum(id []byte, timestamp int64) (int, error)

GetHeartbeatNum gets storage heartbeat number by time

func (*XChain) GetNode

func (x *XChain) GetNode(id []byte) (node blockchain.Node, err error)

GetNode gets storage node by id

func (*XChain) GetNodeHealth

func (x *XChain) GetNodeHealth(id []byte) (string, error)

GetNodeHealth gets storage node health status

func (*XChain) GetNsByName

func (x *XChain) GetNsByName(owner []byte, name string) (blockchain.Namespace, error)

GetNsByName gets namespace by nsName from xchain

func (*XChain) GetRootAndLatestBlockIdInChain

func (x *XChain) GetRootAndLatestBlockIdInChain() ([]byte, int64, error)

GetRootAndLatestBlockIdInChain gets latest block height

func (*XChain) GetSliceMigrateRecords

func (x *XChain) GetSliceMigrateRecords(opt *blockchain.NodeSliceMigrateOptions) (string, error)

GetSliceMigrateRecords get storage node slice migration records

func (*XChain) Heartbeat

func (x *XChain) Heartbeat(opt *blockchain.NodeHeartBeatOptions) error

Heartbeat updates heartbeat of storage node

func (*XChain) InvokeContract

func (x *XChain) InvokeContract(args map[string]string, mName string) ([]byte, error)

InvokeContract invokes the contract

func (*XChain) ListChallengeRequests

func (x *XChain) ListChallengeRequests(opt *blockchain.ListChallengeOptions) ([]blockchain.Challenge, error)

ListChallengeRequests lists challenge requests on blockchain filter condition may include fileOwner, storageNode, fileID, challenge status, time period and items number limit

func (*XChain) ListExpiredFiles

func (x *XChain) ListExpiredFiles(opt *blockchain.ListFileOptions) ([]blockchain.File, error)

ListExpiredFiles lists expired but valid files filter condition may include fileOwner, namespace, time period and items numb limit

func (*XChain) ListFileAuthApplications

func (x *XChain) ListFileAuthApplications(opt *blockchain.ListFileAuthOptions) (blockchain.FileAuthApplications, error)

ListFileAuthApplications query the list of authorization applications Support query by time range and fileID

func (*XChain) ListFileNs

func (x *XChain) ListFileNs(opt *blockchain.ListNsOptions) ([]blockchain.Namespace, error)

ListFileNs lists file namespaces by owner

func (*XChain) ListFiles

func (x *XChain) ListFiles(opt *blockchain.ListFileOptions) ([]blockchain.File, error)

ListFiles lists files from xchain filter condition may include fileOwner, namespace, time period and items numb limit

func (*XChain) ListNodes

func (x *XChain) ListNodes() (blockchain.Nodes, error)

ListNodes gets all storage nodes from xchain

func (*XChain) ListNodesExpireSlice

func (x *XChain) ListNodesExpireSlice(opt *blockchain.ListNodeSliceOptions) ([][2]string, error)

ListNodesExpireSlice lists expired slices from xchain returns a list of sliceID(first value of [2]string) and its StorageIndex(second value of [2]string)

func (*XChain) NodeOffline

func (x *XChain) NodeOffline(opt *blockchain.NodeOperateOptions) error

NodeOffline set node status on chain to offline

func (*XChain) NodeOnline

func (x *XChain) NodeOnline(opt *blockchain.NodeOperateOptions) error

NodeOnline set node status on chain to online

func (*XChain) PublishFile

func (x *XChain) PublishFile(opt *blockchain.PublishFileOptions) error

PublishFile publishes file on xchain

func (*XChain) PublishFileAuthApplication

func (x *XChain) PublishFileAuthApplication(opt *blockchain.PublishFileAuthOptions) error

PublishFileAuthApplication used for appliers to publish file authorization application

func (*XChain) QueryContract

func (x *XChain) QueryContract(args map[string]string, mName string) ([]byte, error)

QueryContract queries the contract

func (*XChain) RejectFileAuthApplication

func (x *XChain) RejectFileAuthApplication(opt *blockchain.ConfirmFileAuthOptions) error

RejectFileAuthApplication dataOwner node rejects the applier's file authorization application and gives the reason for the rejection

func (*XChain) SliceMigrateRecord

func (x *XChain) SliceMigrateRecord(opt *blockchain.SliceMigrateOptions) error

SliceMigrateRecord is used by node to slice migration record

func (*XChain) UpdateFileExpireTime

func (x *XChain) UpdateFileExpireTime(opt *blockchain.UpdateExptimeOptions) (blockchain.File, error)

UpdateFileExpireTime updates file expiration time

func (*XChain) UpdateFilePublicSliceMeta

func (x *XChain) UpdateFilePublicSliceMeta(opt *blockchain.UpdateFilePSMOptions) error

UpdateFilePublicSliceMeta is used to update file public slice metas

func (*XChain) UpdateNsReplica

func (x *XChain) UpdateNsReplica(opt *blockchain.UpdateNsReplicaOptions) error

UpdateNsReplica updates file namespace replica

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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