Documentation ¶
Index ¶
- Variables
- func DisableGopool() error
- func Run(mainOptions config.Options) (err error)
- func RunAsDaemon(mainOptions config.Options) error
- func SetBifrost(bifrost *Bifrost)
- func StopDaemon(mainOptions config.Options) error
- func Upgrade(mainOptions config.Options) error
- type Bifrost
- func (b *Bifrost) IsActive() bool
- func (b *Bifrost) Run()
- func (b *Bifrost) Service(serviceID string) (*Service, bool)
- func (b *Bifrost) SetActive(value bool)
- func (b *Bifrost) Shutdown(ctx context.Context) error
- func (b *Bifrost) ShutdownNow(ctx context.Context) error
- func (b *Bifrost) ZeroDownTime() *zero.ZeroDownTime
- type DynamicService
- type Engine
- type HTTPServer
- type PromMetricMiddleware
- type Router
- type Routes
- type Service
- type Upstream
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func DisableGopool ¶
func DisableGopool() error
func Run ¶
Run starts the bifrost server with the given options.
mainOptions is the configuration for the bifrost server. err is the error that occurred during the startup process.
func RunAsDaemon ¶
RunAsDaemon runs the current process as a daemon.
It takes mainOptions of type config.Options which contains the user and group information to run the daemon process. Returns an error if the daemon process fails to start.
func SetBifrost ¶
func SetBifrost(bifrost *Bifrost)
SetBifrost sets the current instance of Bifrost. It stores the given Bifrost instance in the defaultBifrost atomic value. This function is used to set the Bifrost instance after it has been created. It is typically called by the top-level application code to initialize the Bifrost instance.
func StopDaemon ¶
StopDaemon stops the daemon process.
It takes mainOptions of type config.Options which contains the upgrade socket and PID file information. Returns an error if the daemon process fails to stop.
Types ¶
type Bifrost ¶
type Bifrost struct {
// contains filtered or unexported fields
}
func GetBifrost ¶
func GetBifrost() *Bifrost
GetBifrost retrieves the current instance of Bifrost. It returns a pointer to the Bifrost instance stored in the defaultBifrost atomic value.
func NewBifrost ¶
NewBifrost creates a new instance of Bifrost.
It takes in two parameters: mainOptions of type config.Options and isReload of type bool. The mainOptions parameter contains the main configuration options for the Bifrost instance. The isReload parameter indicates whether the function is being called during a reload operation. The function returns a pointer to Bifrost and an error.
func (*Bifrost) IsActive ¶
IsActive returns whether the Bifrost is active or not. It returns true if the Bifrost is active, false otherwise.
func (*Bifrost) Run ¶
func (b *Bifrost) Run()
Run starts all HTTP servers in the Bifrost instance. The last server is started in the current goroutine, and the function will block until the last server stops. The other servers are started in separate goroutines.
func (*Bifrost) Service ¶
Service retrieves a service by its ID from the Bifrost instance. It returns a pointer to the Service and a boolean indicating whether the service was found. If the serviceID does not exist, the returned Service pointer will be nil and the boolean will be false.
func (*Bifrost) SetActive ¶
SetActive sets whether the Bifrost is active or not. If the value is true, Bifrost will be set to active, otherwise it will be set to inactive.
func (*Bifrost) Shutdown ¶
Shutdown shuts down all HTTP servers in the Bifrost instance gracefully. It blocks until all servers finish their shutdown process. The function returns an error if any server fails to shut down.
func (*Bifrost) ZeroDownTime ¶
func (b *Bifrost) ZeroDownTime() *zero.ZeroDownTime
type DynamicService ¶
type DynamicService struct {
// contains filtered or unexported fields
}
func (*DynamicService) ServeHTTP ¶
func (svc *DynamicService) ServeHTTP(c context.Context, ctx *app.RequestContext)
type Engine ¶
type Engine struct { ID string // contains filtered or unexported fields }
func (*Engine) OnShutdown ¶
func (e *Engine) OnShutdown()
func (*Engine) Use ¶
func (e *Engine) Use(middleware ...app.HandlerFunc)
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
func (*HTTPServer) Bind ¶
func (s *HTTPServer) Bind() string
func (*HTTPServer) Engine ¶
func (s *HTTPServer) Engine() *Engine
func (*HTTPServer) Run ¶
func (s *HTTPServer) Run()
func (*HTTPServer) SetEngine ¶
func (s *HTTPServer) SetEngine(engine *Engine)
type PromMetricMiddleware ¶
type PromMetricMiddleware struct {
// contains filtered or unexported fields
}
func (*PromMetricMiddleware) ServeHTTP ¶
func (m *PromMetricMiddleware) ServeHTTP(ctx context.Context, c *app.RequestContext)
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router struct contains the Trie and handler chain
type Routes ¶
type Routes struct {
// contains filtered or unexported fields
}
func (*Routes) Add ¶
func (r *Routes) Add(routeOpts config.RouteOptions, middlewares ...app.HandlerFunc) error
Add adds a new route
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Middlewares ¶
func (svc *Service) Middlewares() []app.HandlerFunc