区块链大学区块链研习社IPFS/filecoin技术架构分析

filecoin技术架构分析之十二:filecoin源码分析之内

2019-03-07  本文已影响24人  杨尉

本文作者:先河系统杨尉;原创作品,转载请注明出处

[上一篇链接] filecoin技术架构分析之十一:filecoin源码分析之内部接口层api包分析

[下一篇链接] filecoin技术架构分析之十三:filecoin源码分析之服务层actor及vm

目录

12.1 说明

12.2 plumbing&porcelain模式简述

12.3 plumbing底层接口

▼ package
    plumbing

▶ imports

▼+API : struct
    [fields]
   -chain : chain.ReadStore
   -config : *cfg.Config
   -logger : logging.EventLogger
   -msgPool : *core.MessagePool
   -msgPreviewer : *msg.Previewer
   -msgQueryer : *msg.Queryer
   -msgSender : *msg.Sender
   -msgWaiter : *msg.Waiter
   -network : *ntwk.Network
   -sigGetter : *mthdsig.Getter
   -wallet : *wallet.Wallet
    [methods]
   +ActorGet(ctx context.Context, addr address.Address) : *actor.Actor, error
   +ActorGetSignature(ctx context.Context, actorAddr address.Address, method string) : *exec.FunctionSignature, error
   +BlockGet(ctx context.Context, id cid.Cid) : *types.Block, error
   +ChainHead(ctx context.Context) : types.TipSet
   +ChainLs(ctx context.Context) : chan interface{}
   +ConfigGet(dottedPath string) : interface{}, error
   +ConfigSet(dottedPath string, paramJSON string) : error
   +MessagePoolGet(cid cid.Cid) : *types.SignedMessage, bool
   +MessagePoolPending() : []*types.SignedMessage
   +MessagePoolRemove(cid cid.Cid)
   +MessagePreview(ctx context.Context, from, to address.Address, method string, params ...interface{}) : types.GasUnits, error
   +MessageQuery(ctx context.Context, optFrom, to address.Address, method string, params ...interface{}) : [][]byte, *exec.FunctionSignature, error
   +MessageSend(ctx context.Context, from, to address.Address, value *types.AttoFIL, gasPrice types.AttoFIL, gasLimit types.GasUnits, method string, params ...interface{}) : cid.Cid, error
   +MessageWait(ctx context.Context, msgCid cid.Cid, cb func(*types.Block, *types.SignedMessage, *types.MessageReceipt) error) : error
   +NetworkFindProvidersAsync(ctx context.Context, key cid.Cid, count int) : chan pstore.PeerInfo
   +NetworkGetPeerID() : peer.ID
   +PubSubPublish(topic string, data []byte) : error
   +PubSubSubscribe(topic string) : pubsub.Subscription, error
   +SignBytes(data []byte, addr address.Address) : types.Signature, error
   +WalletAddresses() : []address.Address
   +WalletFind(address address.Address) : wallet.Backend, error
   +WalletNewAddress() : address.Address, error
    [functions]
   +New(deps *APIDeps) : *API

12.4 porcelain高层接口

▼ package
    porcelain

▶ imports

▼+API : struct
    [embedded]
   +*plumbing.API : *plumbing.API
    [methods]
   +ChainBlockHeight(ctx context.Context) : *types.BlockHeight, error
   +CreatePayments(ctx context.Context, config CreatePaymentsParams) : *CreatePaymentsReturn, error
   +GetAndMaybeSetDefaultSenderAddress() : address.Address, error
   +MessagePoolWait(ctx context.Context, messageCount uint) : []*types.SignedMessage, error
   +MessageSendWithDefaultAddress(ctx context.Context, from, to address.Address, value *types.AttoFIL, gasPrice types.AttoFIL, gasLimit types.GasUnits, method string, params ...interface{}) : cid.Cid, error
   +MinerGetAsk(ctx context.Context, minerAddr address.Address, askID uint64) : minerActor.Ask, error
   +MinerGetOwnerAddress(ctx context.Context, minerAddr address.Address) : address.Address, error
   +MinerGetPeerID(ctx context.Context, minerAddr address.Address) : peer.ID, error
   +MinerPreviewCreate(ctx context.Context, fromAddr address.Address, pledge uint64, pid peer.ID, collateral *types.AttoFIL) : types.GasUnits, error
   +MinerPreviewSetPrice(ctx context.Context, from address.Address, miner address.Address, price *types.AttoFIL, expiry *big.Int) : types.GasUnits, error
   +MinerSetPrice(ctx context.Context, from address.Address, miner address.Address, gasPrice types.AttoFIL, gasLimit types.GasUnits, price *types.AttoFIL, expiry *big.Int) : MinerSetPriceResponse, error
   +PaymentChannelLs(ctx context.Context, fromAddr address.Address, payerAddr address.Address) : map[string]*paymentbroker.PaymentChannel, error
   +PaymentChannelVoucher(ctx context.Context, fromAddr address.Address, channel *types.ChannelID, amount *types.AttoFIL, validAt *types.BlockHeight) : *paymentbroker.PaymentVoucher, error
   +WalletBalance(ctx context.Context, address address.Address) : *types.AttoFIL, error
    [functions]
   +New(plumbing *plumbing.API) : *API

[上一篇链接] filecoin技术架构分析之十一:filecoin源码分析之内部接口层api包分析

[下一篇链接] filecoin技术架构分析之十三:filecoin源码分析之服务层actor及vm

上一篇下一篇

猜你喜欢

热点阅读