Reorganize request handling code so that we don't touch storage until we have the stateLock. (#11835)

This commit is contained in:
Nick Cabatoff
2021-06-11 19:18:16 +02:00
committed by GitHub
parent 2168d91efb
commit 7679223da6
14 changed files with 239 additions and 252 deletions

View File

@@ -205,6 +205,11 @@ type Request struct {
// request that generated this logical.Request object.
ResponseWriter *HTTPResponseWriter `json:"-" sentinel:""`
// requiredState is used internally to propagate the X-Vault-Index request
// header to later levels of request processing that operate only on
// logical.Request.
requiredState []string
// responseState is used internally to propagate the state that should appear
// in response headers; it's attached to the request rather than the response
// because not all requests yields non-nil responses.
@@ -273,6 +278,14 @@ func (r *Request) SetLastRemoteWAL(last uint64) {
r.lastRemoteWAL = last
}
func (r *Request) RequiredState() []string {
return r.requiredState
}
func (r *Request) SetRequiredState(state []string) {
r.requiredState = state
}
func (r *Request) ResponseState() *WALState {
return r.responseState
}