Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GracefulShutdown ¶
func GracefulShutdown(wg *sync.WaitGroup, cancel context.CancelFunc)
GracefulShutdown supports to clean up goroutines after termination signal captured.
func StartAndGracefulShutdown ¶
StartAndGracefulShutdown starts to run the specified task in a goroutine and wait for termination signal to shutdown gracefully.
Note, this method is not suitable for any non-blocking task that release resources in defer way.
Types ¶
type GracefulShutdownContext ¶
GracefulShutdownContext wraps context and wait group which can be utilized to handle graceful shutdown on termination signal received.
type StoreContext ¶
type StoreContext struct { CfxDB *mysql.MysqlStore EthDB *mysql.MysqlStore CfxCache *redis.RedisStore }
StoreContext context to hold store instances
func MustInitStoreContext ¶
func MustInitStoreContext() StoreContext
func (*StoreContext) Close ¶
func (ctx *StoreContext) Close()
func (*StoreContext) GetMysqlStore ¶
func (ctx *StoreContext) GetMysqlStore(network string) (store *mysql.MysqlStore, err error)
GetMysqlStore returns mysql store by network space
type SyncContext ¶
type SyncContext struct { StoreContext SyncCfx *sdk.Client SubCfx *sdk.Client SyncEth *web3go.Client }
SyncContext context to hold sdk clients for blockchain interoperation.
func MustInitSyncContext ¶
func MustInitSyncContext(storeCtx StoreContext) SyncContext
func (*SyncContext) Close ¶
func (ctx *SyncContext) Close()
Click to show internal directories.
Click to hide internal directories.