Documentation ¶
Overview ¶
Package gsutil is collection of helper functions for storage tools.
Index ¶
- func EnsureGracefulExit(gs ...graphstore.Service)
- func Flag(gs *graphstore.Service, name, usage string)
- func LogClose(ctx context.Context, gs graphstore.Service)
- func ParseGraphStore(str string) (graphstore.Service, error)
- func Register(kind string, h Handler)
- func RegisterDefault(kind string)
- type Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureGracefulExit ¶
func EnsureGracefulExit(gs ...graphstore.Service)
EnsureGracefulExit will try to close each gs when notified of an Interrupt, SIGTERM, or Kill signal and immediately exit the program unsuccessfully. Any errors will be logged. This function should only be called once and closing the GraphStores manually is still needed when the program does not receive a signal to quit.
func Flag ¶
func Flag(gs *graphstore.Service, name, usage string)
Flag defines a GraphStore flag with the specified name and usage string.
func LogClose ¶
func LogClose(ctx context.Context, gs graphstore.Service)
LogClose closes gs and logs any resulting error.
func ParseGraphStore ¶
func ParseGraphStore(str string) (graphstore.Service, error)
ParseGraphStore returns a GraphStore for the given specification.
func Register ¶
Register exposes the given Handler to ParseGraphStore. Each string starting with kind+":" will be passed to the given Handler. A kind can only be registered once.
func RegisterDefault ¶
func RegisterDefault(kind string)
RegisterDefault gives ParseGraphStore a fallback kind if not given any "____:" prefix. A default can only be set once.