Documentation ¶
Index ¶
- Constants
- func IsDefault(addr, chainType string) bool
- func RuleKey(chainID string) string
- type Rule
- type RuleManager
- func (rm *RuleManager) All(chainID []byte) (interface{}, error)
- func (rm *RuleManager) AllRules() ([]*Rule, error)
- func (rm *RuleManager) ChangeStatus(ruleAddress, trigger, lastStatus string, chainID []byte) (bool, []byte)
- func (rm *RuleManager) CountAll(chainID []byte) (bool, []byte)
- func (rm *RuleManager) CountAvailable(chainID []byte) (bool, []byte)
- func (rm *RuleManager) GetMaster(chainID string) (*Rule, error)
- func (rm *RuleManager) GovernancePre(ruleAddress string, event governance.EventType, chainID []byte) (interface{}, *boltvm.BxhError)
- func (rm *RuleManager) HasMaster(chainID string) bool
- func (rm *RuleManager) IsAvailable(chainID, ruleAddress string) bool
- func (rm *RuleManager) QueryById(ruleAddress string, chainID []byte) (interface{}, error)
- func (rm *RuleManager) Register(chainID, ruleAddress, ruleUrl string, createTime int64, isDefault bool)
- type RuleMgr
Constants ¶
View Source
const (
RulePrefix = "rule"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Rule ¶
type Rule struct { Address string `json:"address"` RuleUrl string `json:"rule_url"` ChainID string `json:"chain_id"` Master bool `json:"master"` Default bool `json:"builtIn"` CreateTime int64 `json:"create_time"` Status governance.GovernanceStatus `json:"status"` FSM *fsm.FSM `json:"fsm"` }
func (*Rule) GetChainRuleID ¶ added in v1.20.0
func (*Rule) IsAvailable ¶ added in v1.20.0
type RuleManager ¶
type RuleManager struct {
governance.Persister
}
func (*RuleManager) All ¶
func (rm *RuleManager) All(chainID []byte) (interface{}, error)
Appchains returns all appchains
func (*RuleManager) AllRules ¶ added in v1.20.0
func (rm *RuleManager) AllRules() ([]*Rule, error)
func (*RuleManager) ChangeStatus ¶
func (rm *RuleManager) ChangeStatus(ruleAddress, trigger, lastStatus string, chainID []byte) (bool, []byte)
func (*RuleManager) CountAvailable ¶
func (rm *RuleManager) CountAvailable(chainID []byte) (bool, []byte)
CountAvailable counts all rules of one appchain including available
func (*RuleManager) GetMaster ¶ added in v1.20.0
func (rm *RuleManager) GetMaster(chainID string) (*Rule, error)
func (*RuleManager) GovernancePre ¶ added in v1.20.0
func (rm *RuleManager) GovernancePre(ruleAddress string, event governance.EventType, chainID []byte) (interface{}, *boltvm.BxhError)
GovernancePre checks if the rule address can do event with appchain id and record rule. (only check, not modify infomation)
func (*RuleManager) HasMaster ¶ added in v1.20.0
func (rm *RuleManager) HasMaster(chainID string) bool
func (*RuleManager) IsAvailable ¶
func (rm *RuleManager) IsAvailable(chainID, ruleAddress string) bool
type RuleMgr ¶
type RuleMgr interface { governance.Governance Register(chainID, ruleAddress, ruleUrl string, createTime int64, isDefault bool) GetMaster(chainId string) (*Rule, error) HasMaster(chainId string) bool IsAvailable(chainId, ruleId string) bool AllRules() ([]*Rule, error) }
func New ¶
func New(persister governance.Persister) RuleMgr
Click to show internal directories.
Click to hide internal directories.