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()
- 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)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type InitRepositoryFunc ¶
type InitRepositoryFunc func(ctx context.Context) (repo.Repository, error)
InitRepositoryFunc is a function that attempts to connect to/open repository.
func RetryInitRepository ¶
func RetryInitRepository(initialize InitRepositoryFunc) InitRepositoryFunc
RetryInitRepository wraps provided initialization function with retries until the context gets canceled.
type Options ¶
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
PersistentLogs bool
UITitlePrefix string
DebugScheduler bool
MinMaintenanceInterval time.Duration
EnableErrorNotifications bool
NotifyTemplateOptions notifytemplate.Options
}
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 ¶
GRPCRouterHandler returns HTTP handler that supports GRPC services and routes non-GRPC calls to the provided handler.
func (*Server) InitRepositoryAsync ¶
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 ¶
func (s *Server) Refresh()
Refresh refreshes the state of the server in response to external signal (e.g. SIGHUP).
func (*Server) RegisterGRPCHandlers ¶
func (s *Server) RegisterGRPCHandlers(r grpc.ServiceRegistrar)
RegisterGRPCHandlers registers server gRPC handler.
func (*Server) ServeStaticFiles ¶
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 ¶
func (s *Server) Session(srv grpcapi.KopiaRepository_SessionServer) error
Session handles GRPC session from a repository client.
func (*Server) SetRepository ¶
SetRepository sets the repository (nil is allowed and indicates server that is not connected to the repository).
func (*Server) SetupControlAPIHandlers ¶
SetupControlAPIHandlers registers control API handlers.
func (*Server) SetupHTMLUIAPIHandlers ¶
SetupHTMLUIAPIHandlers registers API requests required by the HTMLUI.
Source Files
¶
- api_cli.go
- api_error.go
- api_estimate.go
- api_mount.go
- api_notification_profile.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_maintenance.go
- server_mount_manager.go
- source_manager.go