rule_mgr

package
v1.28.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	RulePrefix = "rule"
)

Variables

This section is empty.

Functions

func IsDefault added in v1.20.0

func IsDefault(addr, chainType string) bool

func RuleKey added in v1.20.0

func RuleKey(chainID string) string

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 (r *Rule) GetChainRuleID() string

func (*Rule) IsAvailable added in v1.20.0

func (r *Rule) IsAvailable() bool

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) CountAll

func (rm *RuleManager) CountAll(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

func (*RuleManager) QueryById

func (rm *RuleManager) QueryById(ruleAddress string, chainID []byte) (interface{}, error)

func (*RuleManager) Register added in v1.20.0

func (rm *RuleManager) Register(chainID, ruleAddress, ruleUrl string, createTime int64, isDefault bool)

Register record rule

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

Jump to

Keyboard shortcuts

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