-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FABG-824] Allow for provider-specific options
Added a 'WithProviderOptions' option in the SDK to allow for provider-specific options. Change-Id: Ib75b948e3a0bd82ce971adf388fca33889647db9 Signed-off-by: Bob Stasyszyn <[email protected]>
- Loading branch information
1 parent
bda01c9
commit 5fd3e98
Showing
17 changed files
with
152 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
Copyright SecureKey Technologies Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package chconfig | ||
|
||
import ( | ||
"time" | ||
|
||
coptions "github.com/hyperledger/fabric-sdk-go/pkg/common/options" | ||
) | ||
|
||
const ( | ||
defaultRefreshInterval = time.Second * 90 | ||
) | ||
|
||
type params struct { | ||
refreshInterval time.Duration | ||
} | ||
|
||
func newDefaultParams() *params { | ||
return ¶ms{ | ||
refreshInterval: defaultRefreshInterval, | ||
} | ||
} | ||
|
||
// WithRefreshInterval sets the interval in which the | ||
// channel config cache is refreshed | ||
func WithRefreshInterval(value time.Duration) coptions.Opt { | ||
return func(p coptions.Params) { | ||
if setter, ok := p.(refreshIntervalSetter); ok { | ||
setter.SetChConfigRefreshInterval(value) | ||
} | ||
} | ||
} | ||
|
||
type refreshIntervalSetter interface { | ||
SetChConfigRefreshInterval(value time.Duration) | ||
} | ||
|
||
func (o *params) SetChConfigRefreshInterval(value time.Duration) { | ||
logger.Debugf("RefreshInterval: %s", value) | ||
o.refreshInterval = value | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.