Documentation ¶
Index ¶
- type IBigQueryClient
- type IBigtableClient
- type ICentrifugeNode
- type IGRPCClientConn
- type IGRPCServer
- type IHTTPServer
- type IPubsubTopic
- type IRedisClient
- type ISpannerClient
- type ParallelShutdownOptions
- type ShutdownContextErrorFunc
- type ShutdownContextFunc
- type ShutdownErrorFunc
- func BigQuery(client IBigQueryClient) ShutdownErrorFunc
- func Bigtable(client IBigtableClient) ShutdownErrorFunc
- func Context(cancel context.CancelFunc) ShutdownErrorFunc
- func GRPCClient(client IGRPCClientConn) ShutdownErrorFunc
- func GRPCServer(server IGRPCServer) ShutdownErrorFunc
- func Logger(sugaredLogger *zap.SugaredLogger) ShutdownErrorFunc
- func PubSubTopic(topic IPubsubTopic) ShutdownErrorFunc
- func Redis(client IRedisClient) ShutdownErrorFunc
- func Sleep(duration time.Duration) ShutdownErrorFunc
- func Spanner(client ISpannerClient) ShutdownErrorFunc
- func WaitGroup(wg *sync.WaitGroup) ShutdownErrorFunc
- type ShutdownManager
- type ShutdownManagerOptions
- type Shutdowner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IBigQueryClient ¶
type IBigQueryClient interface {
Close() error
}
IBigQueryClient is an interface for shutting down *bigquery.Client.
type IBigtableClient ¶
type IBigtableClient interface {
Close() error
}
IBigtableClient is an interface for shutting down *bigtable.Client.
type ICentrifugeNode ¶
ICentrifugeNode is an interface for shutting down *centrifuge.Node.
type IGRPCClientConn ¶
type IGRPCClientConn interface {
Close() error
}
IGRPCClientConn is an interface for shutting down *grpc.ClientConn.
type IGRPCServer ¶
type IGRPCServer interface {
GracefulStop()
}
IGRPCServer is an interface for shutting down *grpc.Server.
type IHTTPServer ¶
IHTTPServer is an interface for shutting down *http.Server.
type IPubsubTopic ¶
type IPubsubTopic interface {
Stop()
}
IPubsubTopic is an interface for shutting down *pubsub.Topic.
type IRedisClient ¶
type IRedisClient interface {
Close() error
}
IRedisClient is an interface for shutting down *redis.Client.
type ISpannerClient ¶
type ISpannerClient interface {
Close()
}
ISpannerClient is an interface for shutting down *spanner.Client.
type ParallelShutdownOptions ¶
ParallelShutdownOptions is an options structure for parallel Shutdowner.
type ShutdownContextErrorFunc ¶
ShutdownContextErrorFunc is a function that implements Shutdowner interface.
func Centrifuge ¶
func Centrifuge(node ICentrifugeNode) ShutdownContextErrorFunc
Centrifuge returns a ShutdownContextErrorFunc that gracefully stops centrifuge node.
func HTTPServer ¶
func HTTPServer(server IHTTPServer) ShutdownContextErrorFunc
HTTPServer returns a ShutdownContextErrorFunc that gracefully stops HTTP server.
func Tracer ¶
func Tracer() ShutdownContextErrorFunc
Tracer returns a ShutdownContextErrorFunc that gracefully shutdowns tracer exporter.
func (ShutdownContextErrorFunc) Shutdown ¶
func (s ShutdownContextErrorFunc) Shutdown(ctx context.Context) error
Shutdown runs the function itself.
func (ShutdownContextErrorFunc) String ¶
func (s ShutdownContextErrorFunc) String() string
String returns just dummy value.
type ShutdownContextFunc ¶
ShutdownContextFunc is a function that implements Shutdowner interface.
func (ShutdownContextFunc) Shutdown ¶
func (s ShutdownContextFunc) Shutdown(ctx context.Context) error
Shutdown runs the function itself. It always returns nil as the original function doesn't return any error.
func (ShutdownContextFunc) String ¶
func (s ShutdownContextFunc) String() string
String returns just dummy value.
type ShutdownErrorFunc ¶
type ShutdownErrorFunc func() error
ShutdownErrorFunc is a function that implements Shutdowner interface.
func BigQuery ¶
func BigQuery(client IBigQueryClient) ShutdownErrorFunc
BigQuery returns a ShutdownErrorFunc that stops BigQuery client.
func Bigtable ¶
func Bigtable(client IBigtableClient) ShutdownErrorFunc
Bigtable returns a ShutdownErrorFunc that stops Bigtable client.
func Context ¶
func Context(cancel context.CancelFunc) ShutdownErrorFunc
Context returns a ShutdownErrorFunc that cancels the context.
func GRPCClient ¶
func GRPCClient(client IGRPCClientConn) ShutdownErrorFunc
GRPCClient returns a ShutdownErrorFunc that stops GRPC client.
func GRPCServer ¶
func GRPCServer(server IGRPCServer) ShutdownErrorFunc
GRPCServer returns a ShutdownErrorFunc that gracefully stops GRPC server.
func Logger ¶
func Logger(sugaredLogger *zap.SugaredLogger) ShutdownErrorFunc
Logger returns a ShutdownErrorFunc that flushes logger. nil uses default logger.
func PubSubTopic ¶
func PubSubTopic(topic IPubsubTopic) ShutdownErrorFunc
PubSubTopic returns a ShutdownErrorFunc that gracefully stops publishing into PubSub Topic.
func Redis ¶
func Redis(client IRedisClient) ShutdownErrorFunc
Redis returns a ShutdownErrorFunc that gracefully stops redis client.
func Sleep ¶
func Sleep(duration time.Duration) ShutdownErrorFunc
Sleep returns a ShutdownErrorFunc that just sleeps. Useful for delays and debug purposes.
func Spanner ¶
func Spanner(client ISpannerClient) ShutdownErrorFunc
Spanner returns a ShutdownErrorFunc that stops Spanner client.
func WaitGroup ¶
func WaitGroup(wg *sync.WaitGroup) ShutdownErrorFunc
WaitGroup returns a ShutdownErrorFunc that waits WaitGroup.
func (ShutdownErrorFunc) Shutdown ¶
func (s ShutdownErrorFunc) Shutdown(ctx context.Context) error
Shutdown runs the function itself. It returns early in case of context timeout but original function is not canceled and will run even after canceling context.
func (ShutdownErrorFunc) String ¶
func (s ShutdownErrorFunc) String() string
String returns just dummy value.
type ShutdownManager ¶
type ShutdownManager interface { Shutdowner RegisterSignals(...os.Signal) AddStep(Shutdowner) }
ShutdownManager is a manager that is a Shutdowner and can handle signals.
func New ¶
func New(opts *ShutdownManagerOptions, steps ...Shutdowner) ShutdownManager
New returns a new ShutdownManager.
type ShutdownManagerOptions ¶
ShutdownManagerOptions is an options structure for ShutdownManager.
type Shutdowner ¶
Shutdowner is an interface that gracefully shuts down something.
func Parallel ¶
func Parallel(opts *ParallelShutdownOptions, funcs ...Shutdowner) Shutdowner
Parallel returns a Shutdowner that executes underlying Shutdowner's in parallel.