Skip to content

Commit

Permalink
Merge pull request #303 from filecoin-project/feat/support_actor_cfg
Browse files Browse the repository at this point in the history
Feat/support method type fee cfg / 支持消息类型级别的费用配置
  • Loading branch information
simlecode authored Jan 6, 2023
2 parents 0632f03 + e9421f6 commit a32bc4a
Show file tree
Hide file tree
Showing 46 changed files with 2,084 additions and 390 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
*.txt
tipset.json
test_sqlite_db
./cmds/cfg_example/cfg_example
cmds/cfg_example/cfg_example
cmds/client_example/client_example
venus-messager
*.log
./venus-messager-tools
Expand Down
112 changes: 64 additions & 48 deletions api/messager_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,190 +46,206 @@ type MessageImp struct {
Net pubsub.INet
}

func (m MessageImp) HasMessageByUid(ctx context.Context, id string) (bool, error) {
var _ messager.IMessager = (*MessageImp)(nil)

func (m *MessageImp) HasMessageByUid(ctx context.Context, id string) (bool, error) {
return m.MessageSrv.HasMessageByUid(ctx, id)
}

func (m MessageImp) WaitMessage(ctx context.Context, id string, confidence uint64) (*types.Message, error) {
func (m *MessageImp) WaitMessage(ctx context.Context, id string, confidence uint64) (*types.Message, error) {
return m.MessageSrv.WaitMessage(ctx, id, confidence)
}

func (m MessageImp) PushMessage(ctx context.Context, msg *venusTypes.Message, meta *types.SendSpec) (string, error) {
func (m *MessageImp) PushMessage(ctx context.Context, msg *venusTypes.Message, meta *types.SendSpec) (string, error) {
return m.MessageSrv.PushMessage(ctx, msg, meta)
}

func (m MessageImp) PushMessageWithId(ctx context.Context, id string, msg *venusTypes.Message, meta *types.SendSpec) (string, error) {
func (m *MessageImp) PushMessageWithId(ctx context.Context, id string, msg *venusTypes.Message, meta *types.SendSpec) (string, error) {
return m.MessageSrv.PushMessageWithId(ctx, id, msg, meta)
}

func (m MessageImp) GetMessageByUid(ctx context.Context, id string) (*types.Message, error) {
func (m *MessageImp) GetMessageByUid(ctx context.Context, id string) (*types.Message, error) {
return m.MessageSrv.GetMessageByUid(ctx, id)
}

func (m MessageImp) GetMessageBySignedCid(ctx context.Context, cid cid.Cid) (*types.Message, error) {
func (m *MessageImp) GetMessageBySignedCid(ctx context.Context, cid cid.Cid) (*types.Message, error) {
return m.MessageSrv.GetMessageBySignedCid(ctx, cid)
}

func (m MessageImp) GetMessageByUnsignedCid(ctx context.Context, cid cid.Cid) (*types.Message, error) {
func (m *MessageImp) GetMessageByUnsignedCid(ctx context.Context, cid cid.Cid) (*types.Message, error) {
return m.MessageSrv.GetMessageByUnsignedCid(ctx, cid)
}

func (m MessageImp) GetMessageByFromAndNonce(ctx context.Context, from address.Address, nonce uint64) (*types.Message, error) {
func (m *MessageImp) GetMessageByFromAndNonce(ctx context.Context, from address.Address, nonce uint64) (*types.Message, error) {
return m.MessageSrv.GetMessageByFromAndNonce(ctx, from, nonce)
}

func (m MessageImp) ListMessage(ctx context.Context) ([]*types.Message, error) {
func (m *MessageImp) ListMessage(ctx context.Context) ([]*types.Message, error) {
return m.MessageSrv.ListMessage(ctx)
}

func (m MessageImp) ListMessageByFromState(ctx context.Context, from address.Address, state types.MessageState, isAsc bool, pageIndex, pageSize int) ([]*types.Message, error) {
func (m *MessageImp) ListMessageByFromState(ctx context.Context, from address.Address, state types.MessageState, isAsc bool, pageIndex, pageSize int) ([]*types.Message, error) {
return m.MessageSrv.ListMessageByFromState(ctx, from, state, isAsc, pageIndex, pageSize)
}

func (m MessageImp) ListMessageByAddress(ctx context.Context, addr address.Address) ([]*types.Message, error) {
func (m *MessageImp) ListMessageByAddress(ctx context.Context, addr address.Address) ([]*types.Message, error) {
return m.MessageSrv.ListMessageByAddress(ctx, addr)
}

func (m MessageImp) ListFailedMessage(ctx context.Context) ([]*types.Message, error) {
func (m *MessageImp) ListFailedMessage(ctx context.Context) ([]*types.Message, error) {
return m.MessageSrv.ListFailedMessage(ctx)
}

func (m MessageImp) ListBlockedMessage(ctx context.Context, addr address.Address, d time.Duration) ([]*types.Message, error) {
func (m *MessageImp) ListBlockedMessage(ctx context.Context, addr address.Address, d time.Duration) ([]*types.Message, error) {
return m.MessageSrv.ListBlockedMessage(ctx, addr, d)
}

func (m MessageImp) UpdateMessageStateByID(ctx context.Context, id string, state types.MessageState) error {
func (m *MessageImp) UpdateMessageStateByID(ctx context.Context, id string, state types.MessageState) error {
return m.MessageSrv.UpdateMessageStateByID(ctx, id, state)
}

func (m MessageImp) UpdateAllFilledMessage(ctx context.Context) (int, error) {
func (m *MessageImp) UpdateAllFilledMessage(ctx context.Context) (int, error) {
return m.MessageSrv.UpdateAllFilledMessage(ctx)
}

func (m MessageImp) UpdateFilledMessageByID(ctx context.Context, id string) (string, error) {
func (m *MessageImp) UpdateFilledMessageByID(ctx context.Context, id string) (string, error) {
return m.MessageSrv.UpdateFilledMessageByID(ctx, id)
}

func (m MessageImp) ReplaceMessage(ctx context.Context, params *types.ReplacMessageParams) (cid.Cid, error) {
func (m *MessageImp) ReplaceMessage(ctx context.Context, params *types.ReplacMessageParams) (cid.Cid, error) {
return m.MessageSrv.ReplaceMessage(ctx, params)
}

func (m MessageImp) RepublishMessage(ctx context.Context, id string) error {
func (m *MessageImp) RepublishMessage(ctx context.Context, id string) error {
return m.MessageSrv.RepublishMessage(ctx, id)
}

func (m MessageImp) MarkBadMessage(ctx context.Context, id string) error {
func (m *MessageImp) MarkBadMessage(ctx context.Context, id string) error {
return m.MessageSrv.MarkBadMessage(ctx, id)
}

func (m MessageImp) RecoverFailedMsg(ctx context.Context, addr address.Address) ([]string, error) {
func (m *MessageImp) RecoverFailedMsg(ctx context.Context, addr address.Address) ([]string, error) {
return m.MessageSrv.RecoverFailedMsg(ctx, addr)
}

func (m MessageImp) GetAddress(ctx context.Context, addr address.Address) (*types.Address, error) {
func (m *MessageImp) GetAddress(ctx context.Context, addr address.Address) (*types.Address, error) {
return m.AddressSrv.GetAddress(ctx, addr)
}

func (m MessageImp) HasAddress(ctx context.Context, addr address.Address) (bool, error) {
func (m *MessageImp) HasAddress(ctx context.Context, addr address.Address) (bool, error) {
return m.AddressSrv.HasAddress(ctx, addr)
}

func (m MessageImp) WalletHas(ctx context.Context, addr address.Address) (bool, error) {
func (m *MessageImp) WalletHas(ctx context.Context, addr address.Address) (bool, error) {
return m.AddressSrv.WalletHas(ctx, addr)
}

func (m MessageImp) ListAddress(ctx context.Context) ([]*types.Address, error) {
func (m *MessageImp) ListAddress(ctx context.Context) ([]*types.Address, error) {
return m.AddressSrv.ListAddress(ctx)
}

func (m MessageImp) UpdateNonce(ctx context.Context, addr address.Address, nonce uint64) error {
func (m *MessageImp) UpdateNonce(ctx context.Context, addr address.Address, nonce uint64) error {
return m.AddressSrv.UpdateNonce(ctx, addr, nonce)
}

func (m MessageImp) DeleteAddress(ctx context.Context, addr address.Address) error {
func (m *MessageImp) DeleteAddress(ctx context.Context, addr address.Address) error {
return m.AddressSrv.DeleteAddress(ctx, addr)
}

func (m MessageImp) ForbiddenAddress(ctx context.Context, addr address.Address) error {
func (m *MessageImp) ForbiddenAddress(ctx context.Context, addr address.Address) error {
return m.AddressSrv.ForbiddenAddress(ctx, addr)
}

func (m MessageImp) ActiveAddress(ctx context.Context, addr address.Address) error {
func (m *MessageImp) ActiveAddress(ctx context.Context, addr address.Address) error {
return m.AddressSrv.ActiveAddress(ctx, addr)
}

func (m MessageImp) SetSelectMsgNum(ctx context.Context, addr address.Address, num uint64) error {
func (m *MessageImp) SetSelectMsgNum(ctx context.Context, addr address.Address, num uint64) error {
return m.AddressSrv.SetSelectMsgNum(ctx, addr, num)
}

func (m MessageImp) SetFeeParams(ctx context.Context, params *types.AddressSpec) error {
func (m *MessageImp) SetFeeParams(ctx context.Context, params *types.AddressSpec) error {
return m.AddressSrv.SetFeeParams(ctx, params)
}

func (m MessageImp) ClearUnFillMessage(ctx context.Context, addr address.Address) (int, error) {
func (m *MessageImp) ClearUnFillMessage(ctx context.Context, addr address.Address) (int, error) {
return m.MessageSrv.ClearUnFillMessage(ctx, addr)
}

func (m MessageImp) GetSharedParams(ctx context.Context) (*types.SharedSpec, error) {
func (m *MessageImp) GetSharedParams(ctx context.Context) (*types.SharedSpec, error) {
return m.ParamsSrv.GetSharedParams(ctx)
}

func (m MessageImp) SetSharedParams(ctx context.Context, params *types.SharedSpec) error {
func (m *MessageImp) SetSharedParams(ctx context.Context, params *types.SharedSpec) error {
return m.ParamsSrv.SetSharedParams(ctx, params)
}

func (m MessageImp) SaveNode(ctx context.Context, node *types.Node) error {
func (m *MessageImp) SaveNode(ctx context.Context, node *types.Node) error {
return m.NodeSrv.SaveNode(ctx, node)
}

func (m MessageImp) GetNode(ctx context.Context, name string) (*types.Node, error) {
func (m *MessageImp) GetNode(ctx context.Context, name string) (*types.Node, error) {
return m.NodeSrv.GetNode(ctx, name)
}

func (m MessageImp) HasNode(ctx context.Context, name string) (bool, error) {
func (m *MessageImp) HasNode(ctx context.Context, name string) (bool, error) {
return m.NodeSrv.HasNode(ctx, name)
}

func (m MessageImp) ListNode(ctx context.Context) ([]*types.Node, error) {
func (m *MessageImp) ListNode(ctx context.Context) ([]*types.Node, error) {
return m.NodeSrv.ListNode(ctx)
}

func (m MessageImp) DeleteNode(ctx context.Context, name string) error {
func (m *MessageImp) DeleteNode(ctx context.Context, name string) error {
return m.NodeSrv.DeleteNode(ctx, name)
}

func (m MessageImp) Send(ctx context.Context, params types.QuickSendParams) (string, error) {
func (m *MessageImp) Send(ctx context.Context, params types.QuickSendParams) (string, error) {
return m.MessageSrv.Send(ctx, params)
}

func (m MessageImp) NetFindPeer(ctx context.Context, peerID peer.ID) (peer.AddrInfo, error) {
func (m *MessageImp) NetFindPeer(ctx context.Context, peerID peer.ID) (peer.AddrInfo, error) {
return m.Net.FindPeer(ctx, peerID)
}

func (m MessageImp) NetConnect(ctx context.Context, pi peer.AddrInfo) error {
func (m *MessageImp) NetConnect(ctx context.Context, pi peer.AddrInfo) error {
return m.Net.Connect(ctx, pi)
}

func (m MessageImp) NetPeers(ctx context.Context) ([]peer.AddrInfo, error) {
func (m *MessageImp) NetPeers(ctx context.Context) ([]peer.AddrInfo, error) {
return m.Net.Peers(ctx)
}

func (m MessageImp) NetAddrsListen(ctx context.Context) (peer.AddrInfo, error) {
func (m *MessageImp) NetAddrsListen(ctx context.Context) (peer.AddrInfo, error) {
return m.Net.AddrListen(ctx)
}

var _ messager.IMessager = (*MessageImp)(nil)

func (m MessageImp) Version(_ context.Context) (venusTypes.Version, error) {
func (m *MessageImp) Version(_ context.Context) (venusTypes.Version, error) {
return venusTypes.Version{
Version: version.Version,
}, nil
}

func (m MessageImp) SetLogLevel(ctx context.Context, subSystem, level string) error {
func (m *MessageImp) SetLogLevel(ctx context.Context, subSystem, level string) error {
return logging.SetLogLevel(subSystem, level)
}

func (m MessageImp) LogList(ctx context.Context) ([]string, error) {
func (m *MessageImp) LogList(ctx context.Context) ([]string, error) {
return logging.GetSubsystems(), nil
}

func (m *MessageImp) SaveActorCfg(ctx context.Context, actorCfg *types.ActorCfg) error {
return m.MessageSrv.SaveActorCfg(ctx, actorCfg)
}

func (m *MessageImp) UpdateActorCfg(ctx context.Context, id venusTypes.UUID, changeSpecParams *types.ChangeGasSpecParams) error {
return m.MessageSrv.UpdateActorCfg(ctx, id, changeSpecParams)
}

func (m *MessageImp) ListActorCfg(ctx context.Context) ([]*types.ActorCfg, error) {
return m.MessageSrv.ListActorCfg(ctx)
}

func (m *MessageImp) GetActorCfgByID(ctx context.Context, id venusTypes.UUID) (*types.ActorCfg, error) {
return m.MessageSrv.GetActorCfgByID(ctx, id)
}
Loading

0 comments on commit a32bc4a

Please sign in to comment.