Skip to content

Commit

Permalink
Added parallel finality listener manager (hyperledger-labs#713)
Browse files Browse the repository at this point in the history
Added parallel finality listener manager

Signed-off-by: Alexandros Filios <alexandros.filios@ibm.com>
  • Loading branch information
alexandrosfilios authored Jul 24, 2024
1 parent 32e8ba0 commit 6ec3e99
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/IBM/mathlib v0.0.3-0.20231011094432-44ee0eb539da
github.com/dgraph-io/badger/v3 v3.2103.2
github.com/hashicorp/go-uuid v1.0.2
github.com/hyperledger-labs/fabric-smart-client v0.3.1-0.20240722061028-99a78434fc4f
github.com/hyperledger-labs/fabric-smart-client v0.3.1-0.20240723153140-ad4a4163401f
github.com/hyperledger-labs/fabric-token-sdk/txgen v0.0.0-00010101000000-000000000000
github.com/hyperledger-labs/orion-sdk-go v0.2.10
github.com/hyperledger-labs/orion-server v0.2.10
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY=
github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8=
github.com/hyperledger-labs/fabric-smart-client v0.3.1-0.20240722061028-99a78434fc4f h1:nkZsw6hIozyElfAcdURbEpLcnKpWAl3/WAr+EBoglPI=
github.com/hyperledger-labs/fabric-smart-client v0.3.1-0.20240722061028-99a78434fc4f/go.mod h1:o/L/+Apv/hCHFVIQNIiYJcHh1Sl0LGSc2kAWJAeFLB0=
github.com/hyperledger-labs/fabric-smart-client v0.3.1-0.20240723153140-ad4a4163401f h1:D2Gj4+EmsvDpWIiGcFY+L8Tbkq1T+7im4dlqW1Y6RwU=
github.com/hyperledger-labs/fabric-smart-client v0.3.1-0.20240723153140-ad4a4163401f/go.mod h1:o/L/+Apv/hCHFVIQNIiYJcHh1Sl0LGSc2kAWJAeFLB0=
github.com/hyperledger-labs/orion-sdk-go v0.2.10 h1:lFgWgxyvngIhWnIqymYGBmtmq9D6uC5d0uLG9cbyh5s=
github.com/hyperledger-labs/orion-sdk-go v0.2.10/go.mod h1:iN2xZB964AqwVJwL+EnwPOs8z1EkMEbbIg/qYeC7gDY=
github.com/hyperledger-labs/orion-server v0.2.10 h1:G4zbQEL5Egk0Oj+TwHCZWdTOLDBHOjaAEvYOT4G7ozw=
Expand Down
11 changes: 11 additions & 0 deletions integration/token/common/sdk/odlog/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import (
"errors"

"github.com/hyperledger-labs/fabric-smart-client/pkg/node"
"github.com/hyperledger-labs/fabric-smart-client/platform/orion/driver"
orionsdk "github.com/hyperledger-labs/fabric-smart-client/platform/orion/sdk/dig"
dlog "github.com/hyperledger-labs/fabric-token-sdk/token/core/zkatdlog/nogh/driver"
tokensdk "github.com/hyperledger-labs/fabric-token-sdk/token/sdk/dig"
auditdb "github.com/hyperledger-labs/fabric-token-sdk/token/services/auditdb/db/sql"
identitydb "github.com/hyperledger-labs/fabric-token-sdk/token/services/identitydb/db/sql"
"github.com/hyperledger-labs/fabric-token-sdk/token/services/network/common"
"github.com/hyperledger-labs/fabric-token-sdk/token/services/network/orion"
tokendb "github.com/hyperledger-labs/fabric-token-sdk/token/services/tokendb/db/sql"
tokenlockdb "github.com/hyperledger-labs/fabric-token-sdk/token/services/tokenlockdb/db/sql"
Expand Down Expand Up @@ -45,5 +47,14 @@ func (p *SDK) Install() error {
return err
}

err = errors.Join(
p.Container().Decorate(func(p driver.ListenerManagerProvider) driver.ListenerManagerProvider {
return common.NewParallelListenerManagerProvider(p)
}),
)
if err != nil {
return err
}

return p.SDK.Install()
}
31 changes: 31 additions & 0 deletions token/services/network/common/finalitymanager.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/

package common

import (
"github.com/hyperledger-labs/fabric-smart-client/platform/common/driver"
)

type parallelListenerManagerProvider[V comparable] struct {
provider driver.ListenerManagerProvider[V]
}

func NewParallelListenerManagerProvider[V comparable](provider driver.ListenerManagerProvider[V]) *parallelListenerManagerProvider[V] {
return &parallelListenerManagerProvider[V]{provider: provider}
}

func (p *parallelListenerManagerProvider[V]) NewManager() driver.ListenerManager[V] {
return &parallelListenerManager[V]{ListenerManager: p.provider.NewManager()}
}

type parallelListenerManager[V comparable] struct {
driver.ListenerManager[V]
}

func (m *parallelListenerManager[V]) InvokeListeners(event driver.FinalityEvent[V]) {
m.ListenerManager.InvokeListeners(event)
}

0 comments on commit 6ec3e99

Please sign in to comment.