server

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 72 Imported by: 0

Documentation

Overview

Package server implements Kopia API server handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetFile added in v0.4.0

func AssetFile() http.FileSystem

AssetFile exposes HTML UI files.

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
	PersistentLogs         bool
	UITitlePrefix          string
	DebugScheduler         bool
	MinMaintenanceInterval time.Duration
}

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 New

func New(ctx context.Context, options *Options) (*Server, error)

New creates a Server. The server will manage sources for a given username@hostname.

func (*Server) GRPCRouterHandler added in v0.8.0

func (s *Server) GRPCRouterHandler(handler http.Handler) http.Handler

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

func (s *Server) Refresh()

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

Session handles GRPC session from a repository client.

func (*Server) SetRepository added in v0.5.2

func (s *Server) SetRepository(ctx context.Context, rep repo.Repository) error

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

func (s *Server) SetupControlAPIHandlers(m *mux.Router)

SetupControlAPIHandlers registers control API handlers.

func (*Server) SetupHTMLUIAPIHandlers added in v0.10.0

func (s *Server) SetupHTMLUIAPIHandlers(m *mux.Router)

SetupHTMLUIAPIHandlers registers API requests required by the HTMLUI.

func (*Server) SetupRepositoryAPIHandlers added in v0.10.0

func (s *Server) SetupRepositoryAPIHandlers(m *mux.Router)

SetupRepositoryAPIHandlers registers HTTP repository API handlers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL