Skip to content

Commit

Permalink
add more BDLS boilerplate
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed Al Salih <[email protected]>
  • Loading branch information
ahmed82 committed Jul 27, 2023
1 parent 65ed77a commit cd24c4d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
20 changes: 20 additions & 0 deletions orderer/consensus/bdls/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/BDLS-bft/bdls"
cb "github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-protos-go/orderer/etcdraft"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/orderer/consensus"
"github.com/pkg/errors"
Expand All @@ -24,6 +25,15 @@ type Chain struct {
Config *bdls.Config
logger *flogging.FabricLogger
support consensus.ConsenterSupport

opts Options
}

type Options struct {
// BlockMetadata and Consenters should only be modified while under lock
// of raftMetadataLock
BlockMetadata *etcdraft.BlockMetadata
Consenters map[uint64]*etcdraft.Consenter
}

// Order accepts a message which has been processed at a given configSeq.
Expand Down Expand Up @@ -76,6 +86,16 @@ func (c *Chain) Start() {
config.StateValidate = func(bdls.State) bool { return true }
//config.PrivateKey =
//config.Participants =

//c.opts.Consenters
}

// NewChain constructs a chain object.
func NewChain() (*Chain, error) {

c := &Chain{}
return c, nil

}

// Halt frees the resources which were allocated for this Chain.
Expand Down
26 changes: 26 additions & 0 deletions orderer/consensus/bdls/consenter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copyright @Ahmed Al Salih. @BDLS @UNCC All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/

package bdls

import (
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric/orderer/consensus"
)

// Config contains bdls configurations
type Config struct {
}

// Consenter implements bdls consenter
type Consenter struct {
}


// HandleChain returns a new Chain instance or an error upon failure
func (c *Consenter) HandleChain(support consensus.ConsenterSupport, metadata *common.Metadata) (consensus.Chain, error) {
return NewChain()
}

0 comments on commit cd24c4d

Please sign in to comment.