Skip to content

Commit

Permalink
(OraklNode) Basic Raft Implementation (#1115)
Browse files Browse the repository at this point in the history
* feat: initialization

wip

feat: election implementation (without term & log)

fix: safely resign leader

* feat: add term for leader decision on two leaders

* feat: term implementation updates

* fix: implement mutex

* fix: submit immediately after becoming leader
  • Loading branch information
nick-bisonai authored Feb 8, 2024
1 parent ce676ce commit dd448f9
Show file tree
Hide file tree
Showing 2 changed files with 532 additions and 2 deletions.
11 changes: 9 additions & 2 deletions fetcher-v2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/libp2p/go-libp2p/core/peer"

"bisonai.com/orakl/node/admin"
"bisonai.com/orakl/node/node"
"bisonai.com/orakl/node/utils"
)

Expand Down Expand Up @@ -41,11 +42,17 @@ func main() {

go utils.DiscoverPeers(context.Background(), h, discoverString, *bootstrap, discoveredPeers)

electorNode, err := utils.NewElectorNode(h, ps, "orakl-nodes-elector-2024")
// electorNode, err := utils.NewElectorNode(h, ps, "orakl-nodes-elector-2024")
// if err != nil {
// log.Fatal(err)
// }
// electorNode.Start()

raftNode, err := node.NewRaftNode(h, ps, "orakl-node-raft-2024-gazua!")
if err != nil {
log.Fatal(err)
}
electorNode.Start()
raftNode.Run()

nodes := make(map[string]*utils.FetcherNode)

Expand Down
Loading

0 comments on commit dd448f9

Please sign in to comment.