server

package
v0.9.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: Apache-2.0 Imports: 58 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 return a http.FileSystem instance that data backend by asset.

Types

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
	UIUser               string // name of the user allowed to access the UI
}

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) APIHandlers

func (s *Server) APIHandlers(legacyAPI bool) http.Handler

APIHandlers handles API requests.

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) Refresh added in v0.8.0

func (s *Server) Refresh(ctx context.Context) error

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) RequireUIUserAuth added in v0.8.0

func (s *Server) RequireUIUserAuth(hf http.Handler) http.Handler

RequireUIUserAuth wraps the provided http.Handler to only allow UI user and return 403 otherwise.

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) StopAllSourceManagers added in v0.5.2

func (s *Server) StopAllSourceManagers(ctx context.Context)

StopAllSourceManagers causes all source managers to stop.

func (*Server) SyncSources added in v0.5.2

func (s *Server) SyncSources(ctx context.Context) error

SyncSources synchronizes the repository and source managers.

Jump to

Keyboard shortcuts

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