Skip to content

Commit

Permalink
fabric batch operations
Browse files Browse the repository at this point in the history
Signed-off-by: Fedor Partanskiy <[email protected]>
  • Loading branch information
pfi79 committed Oct 6, 2024
1 parent 02e04e2 commit 81d6455
Show file tree
Hide file tree
Showing 67 changed files with 2,990 additions and 342 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/verify-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
strategy:
fail-fast: false
matrix:
INTEGRATION_TEST_SUITE: ["raft","pvtdata","pvtdatapurge","ledger","lifecycle","e2e smartbft","discovery gossip devmode pluggable","gateway idemix pkcs11 configtx configtxlator","sbe nwo msp"]
INTEGRATION_TEST_SUITE: ["raft","pvtdata","pvtdatapurge smartbft","ledger","lifecycle","e2e","discovery gossip devmode pluggable","gateway idemix pkcs11 configtx configtxlator","sbe nwo msp"]
runs-on: ${{ github.repository == 'hyperledger/fabric' && 'fabric-ubuntu-22.04' || 'ubuntu-22.04' }}
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 4 additions & 0 deletions core/chaincode/chaincode_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ type ChaincodeSupport struct {
Runtime Runtime
TotalQueryLimit int
UserRunsCC bool
UsePutStateBatch bool
MaxSizePutStateBatch uint32
}

// Launch starts executing chaincode if it is not already running. This method
Expand Down Expand Up @@ -126,6 +128,8 @@ func (cs *ChaincodeSupport) HandleChaincodeStream(stream ccintf.ChaincodeStream)
AppConfig: cs.AppConfig,
Metrics: cs.HandlerMetrics,
TotalQueryLimit: cs.TotalQueryLimit,
UsePutStateBatch: cs.UsePutStateBatch,
MaxSizePutStateBatch: cs.MaxSizePutStateBatch,
}

return handler.ProcessStream(stream)
Expand Down
34 changes: 22 additions & 12 deletions core/chaincode/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@ import (
)

const (
defaultExecutionTimeout = 30 * time.Second
minimumStartupTimeout = 5 * time.Second
defaultExecutionTimeout = 30 * time.Second
minimumStartupTimeout = 5 * time.Second
defaultMaxSizePutStateBatch = 1000
)

type Config struct {
TotalQueryLimit int
TLSEnabled bool
Keepalive time.Duration
ExecuteTimeout time.Duration
InstallTimeout time.Duration
StartupTimeout time.Duration
LogFormat string
LogLevel string
ShimLogLevel string
SCCAllowlist map[string]bool
TotalQueryLimit int
TLSEnabled bool
Keepalive time.Duration
ExecuteTimeout time.Duration
InstallTimeout time.Duration
StartupTimeout time.Duration
LogFormat string
LogLevel string
ShimLogLevel string
SCCAllowlist map[string]bool
UsePutStateBatch bool
MaxSizePutStateBatch uint32
}

func GlobalConfig() *Config {
Expand Down Expand Up @@ -71,6 +74,13 @@ func (c *Config) load() {
if viper.IsSet("ledger.state.totalQueryLimit") {
c.TotalQueryLimit = viper.GetInt("ledger.state.totalQueryLimit")
}
if viper.IsSet("chaincode.additionalParams.usePutStateBatch") {
c.UsePutStateBatch = viper.GetBool("chaincode.additionalParams.usePutStateBatch")
}
c.MaxSizePutStateBatch = viper.GetUint32("ledger.state.maxSizePutStateBatch")
if c.MaxSizePutStateBatch <= 0 {
c.MaxSizePutStateBatch = defaultMaxSizePutStateBatch
}
}

func parseBool(s string) bool {
Expand Down
Loading

0 comments on commit 81d6455

Please sign in to comment.