Versions in this module Expand all Collapse all v0 v0.1.0 Jul 29, 2020 Changes in this version + func GeneratePrivateKey() (pk *ecdsa.PrivateKey, err error) + func GenerateTLSCert(hosts []string, privateKey *ecdsa.PrivateKey) (cert []byte, err error) + func ReadCertFile(certFile string) (cert []byte, err error) + func ReadPrivateKeyFile(keyFile string) (key *ecdsa.PrivateKey, err error) + func ReadPublicKeyFile(keyFile string) (key *ecdsa.PublicKey, err error) + func VerifyPartialCert(conf *config.ReplicaConfig, cert *PartialCert) bool + func VerifyQuorumCert(conf *config.ReplicaConfig, qc *QuorumCert) bool + func WriteCertFile(cert []byte, file string) (err error) + func WritePrivateKeyFile(key *ecdsa.PrivateKey, filePath string) (err error) + func WritePublicKeyFile(key *ecdsa.PublicKey, filePath string) (err error) + type Block struct + Commands []Command + Committed bool + Height int + Justify *QuorumCert + ParentHash BlockHash + Proposer config.ReplicaID + func (n Block) Hash() BlockHash + func (n Block) String() string + type BlockHash [32]byte + func (h BlockHash) String() string + type BlockStorage interface + BlockOf func(*QuorumCert) (*Block, bool) + GarbageCollectBlocks func(int) + Get func(BlockHash) (*Block, bool) + ParentOf func(*Block) (*Block, bool) + Put func(*Block) + type Command string + type CommandSet struct + func NewCommandSet() *CommandSet + func (s *CommandSet) Add(cmds ...Command) + func (s *CommandSet) Contains(cmd Command) bool + func (s *CommandSet) GetFirst(n int) []Command + func (s *CommandSet) IsProposed(cmd Command) bool + func (s *CommandSet) Len() int + func (s *CommandSet) MarkProposed(cmds ...Command) + func (s *CommandSet) Remove(cmds ...Command) + func (s *CommandSet) TrimToLen(length int) + type MapStorage struct + func NewMapStorage() *MapStorage + func (s *MapStorage) BlockOf(qc *QuorumCert) (block *Block, ok bool) + func (s *MapStorage) GarbageCollectBlocks(currentVeiwHeigth int) + func (s *MapStorage) Get(hash BlockHash) (block *Block, ok bool) + func (s *MapStorage) ParentOf(child *Block) (parent *Block, ok bool) + func (s *MapStorage) Put(block *Block) + type PartialCert struct + BlockHash BlockHash + Sig PartialSig + func CreatePartialCert(id config.ReplicaID, privKey *ecdsa.PrivateKey, block *Block) (*PartialCert, error) + type PartialSig struct + ID config.ReplicaID + R *big.Int + S *big.Int + func (psig PartialSig) ToBytes() []byte + type QuorumCert struct + BlockHash BlockHash + Sigs map[config.ReplicaID]PartialSig + func CreateQuorumCert(block *Block) *QuorumCert + func (qc *QuorumCert) AddPartial(cert *PartialCert) error + func (qc *QuorumCert) String() string + func (qc *QuorumCert) ToBytes() []byte + type SignatureCache struct + func NewSignatureCache(conf *config.ReplicaConfig) *SignatureCache + func (s *SignatureCache) CreatePartialCert(id config.ReplicaID, privKey *ecdsa.PrivateKey, block *Block) (*PartialCert, error) + func (s *SignatureCache) EvictOld(size int) + func (s *SignatureCache) VerifyQuorumCert(qc *QuorumCert) bool + func (s *SignatureCache) VerifySignature(sig PartialSig, hash BlockHash) bool