Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
SeeingStrategy --> СausalityStrategy
Browse files Browse the repository at this point in the history
  • Loading branch information
sfxdxdev committed Sep 11, 2019
1 parent c27fabb commit 2cbebc8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/gossip/emitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (em *Emitter) createEvent() *inter.Event {

var strategy ancestor.SearchStrategy
if seeVec != nil {
strategy = ancestor.NewSeeingStrategy(seeVec)
strategy = ancestor.NewСausalityStrategy(seeVec)
} else {
strategy = ancestor.NewRandomStrategy(nil)
}
Expand Down
12 changes: 6 additions & 6 deletions src/inter/ancestor/parents.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ func FindBestParents(max int, options hash.Events, selfParent *hash.Event, strat
}

/*
* SeeingStrategy
* СausalityStrategy
*/

type SeeingStrategy struct {
type СausalityStrategy struct {
seeVec *vector.Index
template []vector.HighestBefore
}

func NewSeeingStrategy(seeVec *vector.Index) *SeeingStrategy {
return &SeeingStrategy{
func NewСausalityStrategy(seeVec *vector.Index) *СausalityStrategy {
return &СausalityStrategy{
seeVec: seeVec,
}
}
Expand All @@ -56,14 +56,14 @@ type eventScore struct {
vec []vector.HighestBefore
}

func (st *SeeingStrategy) Init(selfParent *hash.Event) {
func (st *СausalityStrategy) Init(selfParent *hash.Event) {
if selfParent != nil {
// we start searching by comparing with self-parent
st.template = st.seeVec.GetEvent(*selfParent).HighestBefore
}
}

func (st *SeeingStrategy) Find(options hash.Events) hash.Event {
func (st *СausalityStrategy) Find(options hash.Events) hash.Event {
scores := make([]eventScore, 0, 100)

// estimate score of each option as number of members it sees higher than provided template
Expand Down
4 changes: 2 additions & 2 deletions src/inter/ancestor/parents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/Fantom-foundation/go-lachesis/src/vector"
)

func TestSeeingStrategy(t *testing.T) {
func TestСausalityStrategy(t *testing.T) {
testSpecialNamedParents(t, `
a1.0 b1.0 c1.0 d1.0 e1.0
║ ║ ║ ║ ║
Expand Down Expand Up @@ -130,7 +130,7 @@ func testSpecialNamedParents(t *testing.T, asciiScheme string, exp map[int]map[s
for _, node := range nodes {
selfParent := tips[node]

strategy := NewSeeingStrategy(vecSee)
strategy := NewСausalityStrategy(vecSee)

selfParent_, parents := FindBestParents(5, heads.Slice(), selfParent, strategy)

Expand Down

0 comments on commit 2cbebc8

Please sign in to comment.