Documentation ¶
Overview ¶
Package services provides the background operations that the application runs independent of any HTTP interfaces, e.g. data cleanups on timers
Index ¶
- Constants
- Variables
- func BindGatewayHandlers(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func HttpServer(c *gin.Context) *http.Server
- func InitializeGrpcServers(server *grpc.Server, client *ent.Client, readies []ReadyCheck) error
- func Module() fx.Option
- func WrapService(ctx context.Context, eg *errgroup.Group, service Service, l fx.Lifecycle, ...) (serviceResults, error)
- type DeadLetterSettings
- type HTTPService
- type PruneCommonSettings
- type ReadyCheck
- type Service
Constants ¶
View Source
const ReadyTag = `group:"ready"`
Variables ¶
View Source
var ErrNotReady = errors.New("service not ready")
Functions ¶
func BindGatewayHandlers ¶
func InitializeGrpcServers ¶
Types ¶
type DeadLetterSettings ¶
type DeadLetterSettings struct { actions.DeadLetterDeliveriesParams Interval time.Duration Fuzz time.Duration Backoff time.Duration }
func (*DeadLetterSettings) ApplyDefaults ¶
func (s *DeadLetterSettings) ApplyDefaults()
type HTTPService ¶ added in v0.13.0
type HTTPService struct {
// contains filtered or unexported fields
}
func NewHTTPService ¶ added in v0.13.0
func NewHTTPService(r *gin.Engine, defaultPort, offset int) *HTTPService
NewHTTPService configures an HTTP server service using the given routing engine.
It will listen on `defaultPort` normally, unless overridden by the PORT environment variable.
func (*HTTPService) Cleanup ¶ added in v0.13.0
func (s *HTTPService) Cleanup(ctx context.Context) error
func (*HTTPService) Name ¶ added in v0.13.0
func (s *HTTPService) Name() string
type PruneCommonSettings ¶
type PruneCommonSettings struct { actions.PruneCommonParams Interval time.Duration Fuzz time.Duration Backoff time.Duration }
func (*PruneCommonSettings) ApplyDefaults ¶
func (s *PruneCommonSettings) ApplyDefaults()
type ReadyCheck ¶ added in v0.13.0
type ReadyCheck interface {
Ready() error
}
type Service ¶ added in v0.13.0
type Service interface { // Name describes the specific service for use in logging and status reports Name() string // Initialize should do any prep work for the service, but not actually start // it yet. The context should only be used for the duration of the initialization. Initialize(context.Context, *ent.Client) error // Start runs the service. It will be invoked on a goroutine, so it should // block and not return until the context is canceled, which is how the // service is requested to stop. The service must close the ready channel once // it is operational, so that any dependent services can know when they are OK // to proceed. Start(context.Context, chan<- struct{}) error // Cleanup should release any resources acquired during Initialize. If another // service fails during Initialize, Cleanup may be called without Start ever // being called. If Start is called, Cleanup will not be called until after it // returns. Cleanup(context.Context) error }
Click to show internal directories.
Click to hide internal directories.