diff --git a/go.mod b/go.mod index 6b0674189..42ce2b176 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 3d1a4890d..863f8265c 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/integration/token/common/sdk/odlog/sdk.go b/integration/token/common/sdk/odlog/sdk.go index 684ed15f3..4f0b8f8fd 100644 --- a/integration/token/common/sdk/odlog/sdk.go +++ b/integration/token/common/sdk/odlog/sdk.go @@ -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" @@ -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() } diff --git a/token/services/network/common/finalitymanager.go b/token/services/network/common/finalitymanager.go new file mode 100644 index 000000000..5340dac3a --- /dev/null +++ b/token/services/network/common/finalitymanager.go @@ -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 ¶llelListenerManagerProvider[V]{provider: provider} +} + +func (p *parallelListenerManagerProvider[V]) NewManager() driver.ListenerManager[V] { + return ¶llelListenerManager[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) +}