Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement persistence? #24

Open
lichengqian opened this issue May 5, 2016 · 1 comment
Open

implement persistence? #24

lichengqian opened this issue May 5, 2016 · 1 comment

Comments

@lichengqian
Copy link

lichengqian commented May 5, 2016

hello everyone :
i have spent a lot of time to read juno code and run the test in my computer
i am trying to implement persistence feature myself, and this is my idea and plan:

       1.   change Seq LogEntry  to   Seq (LogIndex, LogEntry),  all unapplyed command stay in memory, and all applied command save to database.

       2.  declare PLogEntry , means persisntent LogEntry:
-- 只保存已经确认并已apply的LogEntry
share [mkPersist sqlSettings, mkMigrate "migrateBlockchain"] [persistLowerCase|
PLogEntry
    index Int
    term Int
    clientId ByteString
    requestId ByteString
    commandEntry ByteString
    commandSig   ByteString
    quorum_votes  ByteString
    sig           ByteString
    hash    ByteString
    commandResult ByteString
    deriving Show
|]
  3.  when server start , i need to load latest logentry to memory(LastAppliedIndex, LastCommitIndex...)

  4.  when a command is confirmed and applied, i need to write it to the database

  of course it need modify a lot of code ,  

  is this idea works? or any better idea?

 by the way , can i join the dev team and do some develop work? and how?
@axman6
Copy link

axman6 commented May 9, 2016

You need to fill in the functions that are used in the RaftSpec datatype, see https://github.com/buckie/juno/blob/96bac6174ccfa29be329810cc2f73b5eedb799ea/src/Juno/Types/Spec.hs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants