mirror of
https://github.com/kopia/kopia.git
synced 2026-01-23 13:58:08 -05:00
This removes big shared lock held for for the duration of each request and replaces it with trivially short lock to capture the current state of the server/repository before passing it to handlers. Handlers are now limited to only accessing a small subset of Server functionality to be able to better reason about them.
16 lines
339 B
Go
16 lines
339 B
Go
package server
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/kopia/kopia/internal/serverapi"
|
|
"github.com/kopia/kopia/repo"
|
|
)
|
|
|
|
func handleCurrentUser(ctx context.Context, rc requestContext) (interface{}, *apiError) {
|
|
return serverapi.CurrentUserResponse{
|
|
Username: repo.GetDefaultUserName(ctx),
|
|
Hostname: repo.GetDefaultHostName(ctx),
|
|
}, nil
|
|
}
|