Skip to content

Commit 0e44c05

Browse files
committed
fabric batch operations
Signed-off-by: Fedor Partanskiy <fedor.partanskiy@atme.com>
1 parent 8439199 commit 0e44c05

File tree

105 files changed

+5238
-1459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+5238
-1459
lines changed

core/chaincode/chaincode_support.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ type ChaincodeSupport struct {
7373
Runtime Runtime
7474
TotalQueryLimit int
7575
UserRunsCC bool
76+
UseWriteBatch bool
77+
MaxSizeWriteBatch uint32
7678
}
7779

7880
// Launch starts executing chaincode if it is not already running. This method
@@ -126,6 +128,8 @@ func (cs *ChaincodeSupport) HandleChaincodeStream(stream ccintf.ChaincodeStream)
126128
AppConfig: cs.AppConfig,
127129
Metrics: cs.HandlerMetrics,
128130
TotalQueryLimit: cs.TotalQueryLimit,
131+
UseWriteBatch: cs.UseWriteBatch,
132+
MaxSizeWriteBatch: cs.MaxSizeWriteBatch,
129133
}
130134

131135
return handler.ProcessStream(stream)

core/chaincode/config.go

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,24 @@ import (
1616
)
1717

1818
const (
19-
defaultExecutionTimeout = 30 * time.Second
20-
minimumStartupTimeout = 5 * time.Second
19+
defaultExecutionTimeout = 30 * time.Second
20+
minimumStartupTimeout = 5 * time.Second
21+
defaultMaxSizeWriteBatch = 1000
2122
)
2223

2324
type Config struct {
24-
TotalQueryLimit int
25-
TLSEnabled bool
26-
Keepalive time.Duration
27-
ExecuteTimeout time.Duration
28-
InstallTimeout time.Duration
29-
StartupTimeout time.Duration
30-
LogFormat string
31-
LogLevel string
32-
ShimLogLevel string
33-
SCCAllowlist map[string]bool
25+
TotalQueryLimit int
26+
TLSEnabled bool
27+
Keepalive time.Duration
28+
ExecuteTimeout time.Duration
29+
InstallTimeout time.Duration
30+
StartupTimeout time.Duration
31+
LogFormat string
32+
LogLevel string
33+
ShimLogLevel string
34+
SCCAllowlist map[string]bool
35+
UseWriteBatch bool
36+
MaxSizeWriteBatch uint32
3437
}
3538

3639
func GlobalConfig() *Config {
@@ -71,6 +74,13 @@ func (c *Config) load() {
7174
if viper.IsSet("ledger.state.totalQueryLimit") {
7275
c.TotalQueryLimit = viper.GetInt("ledger.state.totalQueryLimit")
7376
}
77+
if viper.IsSet("chaincode.additionalParams.useWriteBatch") {
78+
c.UseWriteBatch = viper.GetBool("chaincode.additionalParams.useWriteBatch")
79+
}
80+
c.MaxSizeWriteBatch = viper.GetUint32("ledger.state.maxSizeWriteBatch")
81+
if c.MaxSizeWriteBatch <= 0 {
82+
c.MaxSizeWriteBatch = defaultMaxSizeWriteBatch
83+
}
7484
}
7585

7686
func parseBool(s string) bool {

0 commit comments

Comments
 (0)