forked from somewheel/erigon-bsc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
496 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package gopool | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/panjf2000/ants/v2" | ||
) | ||
|
||
var ( | ||
// Init a instance pool when importing ants. | ||
defaultPool, _ = ants.NewPool(ants.DefaultAntsPoolSize, ants.WithExpiryDuration(10*time.Second)) | ||
) | ||
|
||
// Logger is used for logging formatted messages. | ||
type Logger interface { | ||
// Printf must have the same semantics as log.Printf. | ||
Printf(format string, args ...interface{}) | ||
} | ||
|
||
// Submit submits a task to pool. | ||
func Submit(task func()) error { | ||
return defaultPool.Submit(task) | ||
} | ||
|
||
// Running returns the number of the currently running goroutines. | ||
func Running() int { | ||
return defaultPool.Running() | ||
} | ||
|
||
// Cap returns the capacity of this default pool. | ||
func Cap() int { | ||
return defaultPool.Cap() | ||
} | ||
|
||
// Free returns the available goroutines to work. | ||
func Free() int { | ||
return defaultPool.Free() | ||
} | ||
|
||
// Release Closes the default pool. | ||
func Release() { | ||
defaultPool.Release() | ||
} | ||
|
||
// Reboot reboots the default pool. | ||
func Reboot() { | ||
defaultPool.Reboot() | ||
} |
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,15 @@ | ||
package systemcontracts | ||
|
||
const ( | ||
// genesis contracts | ||
ValidatorContract = "0x0000000000000000000000000000000000001000" | ||
SlashContract = "0x0000000000000000000000000000000000001001" | ||
SystemRewardContract = "0x0000000000000000000000000000000000001002" | ||
LightClientContract = "0x0000000000000000000000000000000000001003" | ||
TokenHubContract = "0x0000000000000000000000000000000000001004" | ||
RelayerIncentivizeContract = "0x0000000000000000000000000000000000001005" | ||
RelayerHubContract = "0x0000000000000000000000000000000000001006" | ||
GovHubContract = "0x0000000000000000000000000000000000001007" | ||
TokenManagerContract = "0x0000000000000000000000000000000000001008" | ||
CrossChainContract = "0x0000000000000000000000000000000000002000" | ||
) |
Large diffs are not rendered by default.
Oops, something went wrong.
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