cleanup, ensure haproxy is running and disallow writes to followers
This commit is contained in:
parent
0965f95ab0
commit
fef86deac8
9 changed files with 49 additions and 183 deletions
|
|
@ -14,9 +14,10 @@ import (
|
|||
)
|
||||
|
||||
type ContextData struct {
|
||||
Net netalloc.Allocator
|
||||
DB *db.DB
|
||||
Auth *Auth
|
||||
Net netalloc.Allocator
|
||||
DB *db.DB
|
||||
Auth *Auth
|
||||
Leader bool
|
||||
}
|
||||
|
||||
func NewContext(w http.ResponseWriter, r *http.Request, data *ContextData, log logr.Logger) *Context {
|
||||
|
|
@ -42,6 +43,10 @@ type Context struct {
|
|||
Log logr.Logger
|
||||
}
|
||||
|
||||
func (c *Context) Leader() bool {
|
||||
return c.Data.Leader
|
||||
}
|
||||
|
||||
// Method returns the request method
|
||||
func (c *Context) Method() string {
|
||||
return c.Request.Method
|
||||
|
|
|
|||
|
|
@ -43,4 +43,5 @@ var (
|
|||
ErrMNA = newError("method not allowed", http.StatusMethodNotAllowed)
|
||||
ErrExists = newError("resource already exists", http.StatusConflict)
|
||||
ErrISE = newError("internal server error", http.StatusInternalServerError)
|
||||
ErrFollower = newError("follower write forbidden", http.StatusForbidden)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue