isaacoperation

package
v3.0.0-alpha.0...-b63f777 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: GPL-3.0 Imports: 21 Imported by: 1

Documentation

Overview

Package isaacoperation provides the base operations.

Index

Constants

This section is empty.

Variables

View Source
var (
	GenesisNetworkPolicyFactHint = hint.MustNewHint("currency-genesis-network-policy-fact-v0.0.1")
	GenesisNetworkPolicyHint     = hint.MustNewHint("currency-genesis-network-policy-v0.0.1")
	NetworkPolicyFactHint        = hint.MustNewHint("currency-network-policy-fact-v0.0.1")
	NetworkPolicyHint            = hint.MustNewHint("currency-network-policy-operation-v0.0.1")
)
View Source
var (
	SuffrageCandidateFactHint = hint.MustNewHint("currency-suffrage-candidate-fact-v0.0.1")
	SuffrageCandidateHint     = hint.MustNewHint("currency-suffrage-candidate-operation-v0.0.1")
)
View Source
var (
	SuffrageDisjoinFactHint = hint.MustNewHint("currency-suffrage-disjoin-fact-v0.0.1")
	SuffrageDisjoinHint     = hint.MustNewHint("currency-suffrage-disjoin-operation-v0.0.1")
)
View Source
var (
	SuffrageJoinFactHint        = hint.MustNewHint("currency-suffrage-join-fact-v0.0.1")
	SuffrageJoinHint            = hint.MustNewHint("currency-suffrage-join-operation-v0.0.1")
	SuffrageGenesisJoinFactHint = hint.MustNewHint("currency-suffrage-genesis-join-fact-v0.0.1")
	SuffrageGenesisJoinHint     = hint.MustNewHint("currency-suffrage-genesis-join-operation-v0.0.1")
)
View Source
var (
	FixedSuffrageCandidateLimiterRuleHint    = hint.MustNewHint("currency-fixed-suffrage-candidate-limiter-rule-v0.0.1")
	MajoritySuffrageCandidateLimiterRuleHint = hint.MustNewHint("currency-majority-suffrage-candidate-limiter-rule-v0.0.1")
)
View Source
var ExpelPreProcessedContextKey = util.ContextKey("expel-preprocessed")

Functions

func NewCandidatesOfMajoritySuffrageCandidateLimiterRule

func NewCandidatesOfMajoritySuffrageCandidateLimiterRule(
	ratio float64,
	getSuffrage func() (uint64, error),
) (uint64, error)

NewCandidatesOfMajoritySuffrageCandidateLimiterRule find the number of new candidates to prevent the current suffrage majority.

func NewMajoritySuffrageCandidateLimiter

func NewMajoritySuffrageCandidateLimiter(
	rule MajoritySuffrageCandidateLimiterRule,
	getSuffrage func() (uint64, error),
) base.SuffrageCandidateLimiter

Types

type FixedSuffrageCandidateLimiterRule

type FixedSuffrageCandidateLimiterRule struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func NewFixedSuffrageCandidateLimiterRule

func NewFixedSuffrageCandidateLimiterRule(limit uint64) FixedSuffrageCandidateLimiterRule

func (*FixedSuffrageCandidateLimiterRule) DecodeBSON

func (l *FixedSuffrageCandidateLimiterRule) DecodeBSON(b []byte, enc *bsonenc.Encoder) error

func (FixedSuffrageCandidateLimiterRule) HashBytes

func (l FixedSuffrageCandidateLimiterRule) HashBytes() []byte

func (FixedSuffrageCandidateLimiterRule) IsValid

func (FixedSuffrageCandidateLimiterRule) Limit

func (FixedSuffrageCandidateLimiterRule) MarshalBSON

func (l FixedSuffrageCandidateLimiterRule) MarshalBSON() ([]byte, error)

func (FixedSuffrageCandidateLimiterRule) MarshalJSON

func (l FixedSuffrageCandidateLimiterRule) MarshalJSON() ([]byte, error)

func (*FixedSuffrageCandidateLimiterRule) UnmarshalJSON

func (l *FixedSuffrageCandidateLimiterRule) UnmarshalJSON(b []byte) error

type FixedSuffrageCandidateLimiterRuleBSONUnMarshaler

type FixedSuffrageCandidateLimiterRuleBSONUnMarshaler struct {
	Hint  string `bson:"_hint"`
	Limit uint64 `bson:"limit"`
}

type GenesisNetworkPolicy

type GenesisNetworkPolicy struct {
	common.BaseOperation
}

GenesisNetworkPolicy is only for used for genesis block

func (GenesisNetworkPolicy) IsValid

func (op GenesisNetworkPolicy) IsValid(networkID []byte) error

func (GenesisNetworkPolicy) PreProcess

type GenesisNetworkPolicyFact

type GenesisNetworkPolicyFact struct {
	base.BaseFact
	// contains filtered or unexported fields
}

func NewGenesisNetworkPolicyFact

func NewGenesisNetworkPolicyFact(policy base.NetworkPolicy) GenesisNetworkPolicyFact

func (*GenesisNetworkPolicyFact) DecodeBSON

func (fact *GenesisNetworkPolicyFact) DecodeBSON(b []byte, enc *bsonenc.Encoder) error

func (*GenesisNetworkPolicyFact) DecodeJSON

func (fact *GenesisNetworkPolicyFact) DecodeJSON(b []byte, enc encoder.Encoder) error

func (GenesisNetworkPolicyFact) IsValid

func (fact GenesisNetworkPolicyFact) IsValid([]byte) error

func (GenesisNetworkPolicyFact) MarshalBSON

func (fact GenesisNetworkPolicyFact) MarshalBSON() ([]byte, error)

func (GenesisNetworkPolicyFact) MarshalJSON

func (fact GenesisNetworkPolicyFact) MarshalJSON() ([]byte, error)

func (GenesisNetworkPolicyFact) Policy

type GenesisNetworkPolicyFactBSONUnMarshaler

type GenesisNetworkPolicyFactBSONUnMarshaler struct {
	Hint   string   `bson:"_hint"`
	Policy bson.Raw `bson:"policy"`
}

type GenesisNetworkPolicyFactJSONMarshaler

type GenesisNetworkPolicyFactJSONMarshaler struct {
	Policy base.NetworkPolicy `json:"policy"`
	base.BaseFactJSONMarshaler
}

type GenesisNetworkPolicyFactJSONUnmarshaler

type GenesisNetworkPolicyFactJSONUnmarshaler struct {
	base.BaseFactJSONUnmarshaler
	Policy json.RawMessage `json:"policy"`
}

type MajoritySuffrageCandidateLimiterRule

type MajoritySuffrageCandidateLimiterRule struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func NewMajoritySuffrageCandidateLimiterRule

func NewMajoritySuffrageCandidateLimiterRule(ratio float64, min, max uint64) MajoritySuffrageCandidateLimiterRule

func (*MajoritySuffrageCandidateLimiterRule) DecodeBSON

func (MajoritySuffrageCandidateLimiterRule) HashBytes

func (MajoritySuffrageCandidateLimiterRule) IsValid

func (MajoritySuffrageCandidateLimiterRule) MarshalBSON

func (l MajoritySuffrageCandidateLimiterRule) MarshalBSON() ([]byte, error)

func (MajoritySuffrageCandidateLimiterRule) MarshalJSON

func (l MajoritySuffrageCandidateLimiterRule) MarshalJSON() ([]byte, error)

func (MajoritySuffrageCandidateLimiterRule) Max

func (MajoritySuffrageCandidateLimiterRule) Min

func (MajoritySuffrageCandidateLimiterRule) Ratio

func (*MajoritySuffrageCandidateLimiterRule) UnmarshalJSON

func (l *MajoritySuffrageCandidateLimiterRule) UnmarshalJSON(b []byte) error

type MajoritySuffrageCandidateLimiterRuleBSONUnMarshaler

type MajoritySuffrageCandidateLimiterRuleBSONUnMarshaler struct {
	Hint  string  `bson:"_hint"`
	Ratio float64 `bson:"ratio"`
	Max   uint64  `bson:"max"`
	Min   uint64  `bson:"min"`
}

type NetworkPolicy

type NetworkPolicy struct {
	common.BaseNodeOperation
}

func NewNetworkPolicy

func NewNetworkPolicy(fact NetworkPolicyFact) NetworkPolicy

func (NetworkPolicy) IsValid

func (op NetworkPolicy) IsValid(networkID []byte) error

func (*NetworkPolicy) SetToken

func (op *NetworkPolicy) SetToken(t base.Token) error

type NetworkPolicyFact

type NetworkPolicyFact struct {
	base.BaseFact
	// contains filtered or unexported fields
}

func NewNetworkPolicyFact

func NewNetworkPolicyFact(token base.Token, policy base.NetworkPolicy) NetworkPolicyFact

func (*NetworkPolicyFact) DecodeBSON

func (fact *NetworkPolicyFact) DecodeBSON(b []byte, enc *bsonenc.Encoder) error

func (*NetworkPolicyFact) DecodeJSON

func (fact *NetworkPolicyFact) DecodeJSON(b []byte, enc encoder.Encoder) error

func (NetworkPolicyFact) IsValid

func (fact NetworkPolicyFact) IsValid([]byte) error

func (NetworkPolicyFact) MarshalBSON

func (fact NetworkPolicyFact) MarshalBSON() ([]byte, error)

func (NetworkPolicyFact) MarshalJSON

func (fact NetworkPolicyFact) MarshalJSON() ([]byte, error)

func (NetworkPolicyFact) Policy

func (fact NetworkPolicyFact) Policy() base.NetworkPolicy

type NetworkPolicyFactBSONUnMarshaler

type NetworkPolicyFactBSONUnMarshaler struct {
	Hint   string   `bson:"_hint"`
	Policy bson.Raw `bson:"policy"`
}

type NetworkPolicyFactJSONMarshaler

type NetworkPolicyFactJSONMarshaler struct {
	Policy base.NetworkPolicy `json:"policy"`
	base.BaseFactJSONMarshaler
}

type NetworkPolicyFactJSONUnmarshaler

type NetworkPolicyFactJSONUnmarshaler struct {
	base.BaseFactJSONUnmarshaler
	Policy json.RawMessage `json:"policy"`
}

type NetworkPolicyProcessor

type NetworkPolicyProcessor struct {
	*base.BaseOperationProcessor
	// contains filtered or unexported fields
}

func NewNetworkPolicyProcessor

func NewNetworkPolicyProcessor(
	height base.Height,
	threshold base.Threshold,
	getStateFunc base.GetStateFunc,
	newPreProcessConstraintFunc base.NewOperationProcessorProcessFunc,
	newProcessConstraintFunc base.NewOperationProcessorProcessFunc,
) (*NetworkPolicyProcessor, error)

func (*NetworkPolicyProcessor) Close

func (p *NetworkPolicyProcessor) Close() error

func (*NetworkPolicyProcessor) PreProcess

func (*NetworkPolicyProcessor) Process

type SuffrageCandidate

type SuffrageCandidate struct {
	common.BaseNodeOperation
}

func NewSuffrageCandidate

func NewSuffrageCandidate(fact SuffrageCandidateFact) SuffrageCandidate

func (*SuffrageCandidate) DecodeBSON

func (op *SuffrageCandidate) DecodeBSON(b []byte, enc *bsonenc.Encoder) error

func (SuffrageCandidate) IsValid

func (op SuffrageCandidate) IsValid(networkID []byte) error

func (SuffrageCandidate) MarshalBSON

func (op SuffrageCandidate) MarshalBSON() ([]byte, error)

func (*SuffrageCandidate) SetToken

func (op *SuffrageCandidate) SetToken(t base.Token) error

type SuffrageCandidateFact

type SuffrageCandidateFact struct {
	base.BaseFact
	// contains filtered or unexported fields
}

func NewSuffrageCandidateFact

func NewSuffrageCandidateFact(
	token base.Token,
	address base.Address,
	publickey base.Publickey,
) SuffrageCandidateFact

func (SuffrageCandidateFact) Address

func (fact SuffrageCandidateFact) Address() base.Address

func (*SuffrageCandidateFact) DecodeBSON

func (fact *SuffrageCandidateFact) DecodeBSON(b []byte, enc *bsonenc.Encoder) error

func (*SuffrageCandidateFact) DecodeJSON

func (fact *SuffrageCandidateFact) DecodeJSON(b []byte, enc encoder.Encoder) error

func (SuffrageCandidateFact) IsValid

func (fact SuffrageCandidateFact) IsValid([]byte) error

func (SuffrageCandidateFact) MarshalBSON

func (fact SuffrageCandidateFact) MarshalBSON() ([]byte, error)

func (SuffrageCandidateFact) MarshalJSON

func (fact SuffrageCandidateFact) MarshalJSON() ([]byte, error)

func (SuffrageCandidateFact) Publickey

func (fact SuffrageCandidateFact) Publickey() base.Publickey

type SuffrageCandidateFactBSONUnMarshaler

type SuffrageCandidateFactBSONUnMarshaler struct {
	Hint      string `bson:"_hint"`
	Address   string `bson:"address"`
	Publickey string `bson:"publickey"`
}

type SuffrageCandidateProcessor

type SuffrageCandidateProcessor struct {
	*base.BaseOperationProcessor
	// contains filtered or unexported fields
}

func NewSuffrageCandidateProcessor

func NewSuffrageCandidateProcessor(
	height base.Height,
	getStateFunc base.GetStateFunc,
	newPreProcessConstraintFunc base.NewOperationProcessorProcessFunc,
	newProcessConstraintFunc base.NewOperationProcessorProcessFunc,
	lifespan base.Height,
) (*SuffrageCandidateProcessor, error)

func (*SuffrageCandidateProcessor) Close

func (p *SuffrageCandidateProcessor) Close() error

func (*SuffrageCandidateProcessor) PreProcess

func (*SuffrageCandidateProcessor) Process

type SuffrageCandidatesStateValueMerger

type SuffrageCandidatesStateValueMerger struct {
	*common.BaseStateValueMerger

	sync.Mutex
	// contains filtered or unexported fields
}

func NewSuffrageCandidatesStateValueMerger

func NewSuffrageCandidatesStateValueMerger(height base.Height, st base.State) *SuffrageCandidatesStateValueMerger

func (*SuffrageCandidatesStateValueMerger) CloseValue

func (*SuffrageCandidatesStateValueMerger) Merge

type SuffrageDisjoin

type SuffrageDisjoin struct {
	common.BaseNodeOperation
}

func NewSuffrageDisjoin

func NewSuffrageDisjoin(fact SuffrageDisjoinFact) SuffrageDisjoin

func (*SuffrageDisjoin) DecodeBSON

func (op *SuffrageDisjoin) DecodeBSON(b []byte, enc *bsonenc.Encoder) error

func (SuffrageDisjoin) IsValid

func (op SuffrageDisjoin) IsValid(networkID []byte) error

func (*SuffrageDisjoin) SetToken

func (op *SuffrageDisjoin) SetToken(t base.Token) error

type SuffrageDisjoinFact

type SuffrageDisjoinFact struct {
	base.BaseFact
	// contains filtered or unexported fields
}

func NewSuffrageDisjoinFact

func NewSuffrageDisjoinFact(
	token base.Token,
	node base.Address,
	start base.Height,
) SuffrageDisjoinFact

func (*SuffrageDisjoinFact) DecodeBSON

func (fact *SuffrageDisjoinFact) DecodeBSON(b []byte, enc *bsonenc.Encoder) error

func (*SuffrageDisjoinFact) DecodeJSON

func (fact *SuffrageDisjoinFact) DecodeJSON(b []byte, enc encoder.Encoder) error

func (SuffrageDisjoinFact) IsValid

func (fact SuffrageDisjoinFact) IsValid([]byte) error

func (SuffrageDisjoinFact) MarshalBSON

func (fact SuffrageDisjoinFact) MarshalBSON() ([]byte, error)

func (SuffrageDisjoinFact) MarshalJSON

func (fact SuffrageDisjoinFact) MarshalJSON() ([]byte, error)

func (SuffrageDisjoinFact) Node

func (fact SuffrageDisjoinFact) Node() base.Address

func (SuffrageDisjoinFact) Start

func (fact SuffrageDisjoinFact) Start() base.Height

type SuffrageDisjoinFactBSONUnMarshaler

type SuffrageDisjoinFactBSONUnMarshaler struct {
	Hint  string      `bson:"_hint"`
	Node  string      `bson:"node"`
	Start base.Height `bson:"start"`
}

type SuffrageDisjoinProcessor

type SuffrageDisjoinProcessor struct {
	*base.BaseOperationProcessor
	// contains filtered or unexported fields
}

func NewSuffrageDisjoinProcessor

func NewSuffrageDisjoinProcessor(
	height base.Height,
	getStateFunc base.GetStateFunc,
	newPreProcessConstraintFunc base.NewOperationProcessorProcessFunc,
	newProcessConstraintFunc base.NewOperationProcessorProcessFunc,
) (*SuffrageDisjoinProcessor, error)

func (*SuffrageDisjoinProcessor) Close

func (p *SuffrageDisjoinProcessor) Close() error

func (*SuffrageDisjoinProcessor) PreProcess

func (*SuffrageDisjoinProcessor) Process

type SuffrageExpelProcessor

type SuffrageExpelProcessor struct {
	*base.BaseOperationProcessor
	// contains filtered or unexported fields
}

func NewSuffrageExpelProcessor

func NewSuffrageExpelProcessor(
	height base.Height,
	getStateFunc base.GetStateFunc,
	newPreProcessConstraintFunc base.NewOperationProcessorProcessFunc,
	newProcessConstraintFunc base.NewOperationProcessorProcessFunc,
) (*SuffrageExpelProcessor, error)

func (*SuffrageExpelProcessor) Close

func (p *SuffrageExpelProcessor) Close() error

func (*SuffrageExpelProcessor) PreProcess

func (*SuffrageExpelProcessor) Process

type SuffrageGenesisJoin

type SuffrageGenesisJoin struct {
	common.BaseOperation
}

SuffrageGenesisJoin is only for used for genesis block

func NewSuffrageGenesisJoin

func NewSuffrageGenesisJoin(fact SuffrageGenesisJoinFact) SuffrageGenesisJoin

func (*SuffrageGenesisJoin) DecodeBSON

func (op *SuffrageGenesisJoin) DecodeBSON(b []byte, enc *bsonenc.Encoder) error

func (SuffrageGenesisJoin) IsValid

func (op SuffrageGenesisJoin) IsValid(networkID []byte) error

func (SuffrageGenesisJoin) PreProcess

type SuffrageGenesisJoinFact

type SuffrageGenesisJoinFact struct {
	base.BaseFact
	// contains filtered or unexported fields
}

func NewSuffrageGenesisJoinFact

func NewSuffrageGenesisJoinFact(
	nodes []base.Node,
	networkID base.NetworkID,
) SuffrageGenesisJoinFact

func (*SuffrageGenesisJoinFact) DecodeBSON

func (fact *SuffrageGenesisJoinFact) DecodeBSON(b []byte, enc *bsonenc.Encoder) error

func (*SuffrageGenesisJoinFact) DecodeJSON

func (fact *SuffrageGenesisJoinFact) DecodeJSON(b []byte, enc encoder.Encoder) error

func (SuffrageGenesisJoinFact) IsValid

func (fact SuffrageGenesisJoinFact) IsValid(networkID []byte) error

func (SuffrageGenesisJoinFact) MarshalBSON

func (fact SuffrageGenesisJoinFact) MarshalBSON() ([]byte, error)

func (SuffrageGenesisJoinFact) MarshalJSON

func (fact SuffrageGenesisJoinFact) MarshalJSON() ([]byte, error)

func (SuffrageGenesisJoinFact) Nodes

func (fact SuffrageGenesisJoinFact) Nodes() []base.Node

type SuffrageGenesisJoinFactBSONUnMarshaler

type SuffrageGenesisJoinFactBSONUnMarshaler struct {
	Hint  string   `bson:"_hint"`
	Nodes bson.Raw `bson:"nodes"`
}

type SuffrageJoin

type SuffrageJoin struct {
	common.BaseNodeOperation
}

func NewSuffrageJoin

func NewSuffrageJoin(fact SuffrageJoinFact) SuffrageJoin

func (*SuffrageJoin) DecodeBSON

func (op *SuffrageJoin) DecodeBSON(b []byte, enc *bsonenc.Encoder) error

func (SuffrageJoin) IsValid

func (op SuffrageJoin) IsValid(networkID []byte) error

func (*SuffrageJoin) SetToken

func (op *SuffrageJoin) SetToken(t base.Token) error

type SuffrageJoinFact

type SuffrageJoinFact struct {
	base.BaseFact
	// contains filtered or unexported fields
}

func NewSuffrageJoinFact

func NewSuffrageJoinFact(
	token base.Token,
	candidate base.Address,
	start base.Height,
) SuffrageJoinFact

func (SuffrageJoinFact) Candidate

func (fact SuffrageJoinFact) Candidate() base.Address

func (*SuffrageJoinFact) DecodeBSON

func (fact *SuffrageJoinFact) DecodeBSON(b []byte, enc *bsonenc.Encoder) error

func (*SuffrageJoinFact) DecodeJSON

func (fact *SuffrageJoinFact) DecodeJSON(b []byte, enc encoder.Encoder) error

func (SuffrageJoinFact) IsValid

func (fact SuffrageJoinFact) IsValid([]byte) error

func (SuffrageJoinFact) MarshalBSON

func (fact SuffrageJoinFact) MarshalBSON() ([]byte, error)

func (SuffrageJoinFact) MarshalJSON

func (fact SuffrageJoinFact) MarshalJSON() ([]byte, error)

func (SuffrageJoinFact) Start

func (fact SuffrageJoinFact) Start() base.Height

type SuffrageJoinFactBSONUnMarshaler

type SuffrageJoinFactBSONUnMarshaler struct {
	Hint      string      `bson:"_hint"`
	Candidate string      `bson:"candidate"`
	Start     base.Height `bson:"start"`
}

type SuffrageJoinProcessor

type SuffrageJoinProcessor struct {
	*base.BaseOperationProcessor
	// contains filtered or unexported fields
}

func NewSuffrageJoinProcessor

func NewSuffrageJoinProcessor(
	height base.Height,
	threshold base.Threshold,
	getStateFunc base.GetStateFunc,
	newPreProcessConstraintFunc base.NewOperationProcessorProcessFunc,
	newProcessConstraintFunc base.NewOperationProcessorProcessFunc,
) (*SuffrageJoinProcessor, error)

func (*SuffrageJoinProcessor) Close

func (p *SuffrageJoinProcessor) Close() error

func (*SuffrageJoinProcessor) PreProcess

func (*SuffrageJoinProcessor) Process

type SuffrageJoinStateValueMerger

type SuffrageJoinStateValueMerger struct {
	*common.BaseStateValueMerger

	sync.Mutex
	// contains filtered or unexported fields
}

func NewSuffrageJoinStateValueMerger

func NewSuffrageJoinStateValueMerger(height base.Height, st base.State) *SuffrageJoinStateValueMerger

func (*SuffrageJoinStateValueMerger) CloseValue

func (s *SuffrageJoinStateValueMerger) CloseValue() (base.State, error)

func (*SuffrageJoinStateValueMerger) Merge

Jump to

Keyboard shortcuts

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