Documentation ¶
Overview ¶
Package server implements Kopia API server handlers.
Index ¶
- func AssetFile() http.FileSystem
- type InitRepositoryFunc
- type Options
- type Server
- func (s *Server) GRPCRouterHandler(handler http.Handler) http.Handler
- func (s *Server) InitRepositoryAsync(ctx context.Context, mode string, initializer InitRepositoryFunc, wait bool) (string, error)
- func (s *Server) Refresh(ctx context.Context) error
- func (s *Server) RegisterGRPCHandlers(r grpc.ServiceRegistrar)
- func (s *Server) ServeStaticFiles(m *mux.Router, fs http.FileSystem)
- func (s *Server) Session(srv grpcapi.KopiaRepository_SessionServer) error
- func (s *Server) SetRepository(ctx context.Context, rep repo.Repository) error
- func (s *Server) SetupControlAPIHandlers(m *mux.Router)
- func (s *Server) SetupHTMLUIAPIHandlers(m *mux.Router)
- func (s *Server) SetupRepositoryAPIHandlers(m *mux.Router)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type InitRepositoryFunc ¶ added in v0.10.2
type InitRepositoryFunc func(ctx context.Context) (repo.Repository, error)
InitRepositoryFunc is a function that attempts to connect to/open repository.
func RetryInitRepository ¶ added in v0.10.2
func RetryInitRepository(initialize InitRepositoryFunc) InitRepositoryFunc
RetryInitRepository wraps provided initialization function with retries until the context gets canceled.
type Options ¶ added in v0.5.2
type Options struct { ConfigFile string ConnectOptions *repo.ConnectOptions RefreshInterval time.Duration MaxConcurrency int Authenticator auth.Authenticator Authorizer auth.Authorizer PasswordPersist passwordpersist.Strategy AuthCookieSigningKey string LogRequests bool UIUser string // name of the user allowed to access the UI API UIPreferencesFile string // name of the JSON file storing UI preferences ServerControlUser string // name of the user allowed to access the server control API DisableCSRFTokenChecks bool UITitlePrefix string }
Options encompasses all API server options.
type Server ¶
type Server struct { OnShutdown func(ctx context.Context) error // contains filtered or unexported fields }
Server exposes simple HTTP API for programmatically accessing Kopia features.
func (*Server) GRPCRouterHandler ¶ added in v0.8.0
GRPCRouterHandler returns HTTP handler that supports GRPC services and routes non-GRPC calls to the provided handler.
func (*Server) InitRepositoryAsync ¶ added in v0.10.2
func (s *Server) InitRepositoryAsync(ctx context.Context, mode string, initializer InitRepositoryFunc, wait bool) (string, error)
InitRepositoryAsync starts a task that initializes the repository by invoking the provided callback and initializes the repository when done. The initializer may return nil to indicate there is no repository configured.
func (*Server) Refresh ¶ added in v0.8.0
Refresh refreshes the state of the server in response to external signal (e.g. SIGHUP).
func (*Server) RegisterGRPCHandlers ¶ added in v0.8.0
func (s *Server) RegisterGRPCHandlers(r grpc.ServiceRegistrar)
RegisterGRPCHandlers registers server gRPC handler.
func (*Server) ServeStaticFiles ¶ added in v0.10.0
func (s *Server) ServeStaticFiles(m *mux.Router, fs http.FileSystem)
ServeStaticFiles configures HTTP handler that serves static files and dynamically patches index.html to embed CSRF token, etc.
func (*Server) Session ¶ added in v0.8.0
func (s *Server) Session(srv grpcapi.KopiaRepository_SessionServer) error
Session handles GRPC session from a repository client.
func (*Server) SetRepository ¶ added in v0.5.2
SetRepository sets the repository (nil is allowed and indicates server that is not connected to the repository).
func (*Server) SetupControlAPIHandlers ¶ added in v0.10.0
SetupControlAPIHandlers registers control API handlers.
func (*Server) SetupHTMLUIAPIHandlers ¶ added in v0.10.0
SetupHTMLUIAPIHandlers registers API requests required by the HTMLUI.
func (*Server) SetupRepositoryAPIHandlers ¶ added in v0.10.0
SetupRepositoryAPIHandlers registers HTTP repository API handlers.
Source Files ¶
- api_cli.go
- api_content.go
- api_error.go
- api_estimate.go
- api_manifest.go
- api_mount.go
- api_object_get.go
- api_paths.go
- api_policies.go
- api_repo.go
- api_restore.go
- api_snapshots.go
- api_sources.go
- api_tasks.go
- api_ui_pref.go
- api_user.go
- grpc_session.go
- htmlui_embed.go
- request_context.go
- server.go
- server_authz_checks.go
- server_mount_manager.go
- source_manager.go