Skip to content

Commit

Permalink
Delete disabled unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
redgoat650 committed Mar 15, 2024
1 parent 10fc706 commit ac9a914
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 340 deletions.
102 changes: 0 additions & 102 deletions internal/server/api_content.go

This file was deleted.

156 changes: 0 additions & 156 deletions internal/server/api_manifest.go

This file was deleted.

18 changes: 0 additions & 18 deletions internal/server/api_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,6 @@ import (

const syncConnectWaitTime = 5 * time.Second

// func handleRepoParameters(ctx context.Context, rc requestContext) (interface{}, *apiError) {
// dr, ok := rc.rep.(repo.DirectRepository)
// if !ok {
// return &serverapi.StatusResponse{
// Connected: false,
// }, nil
// }

// rp := &remoterepoapi.Parameters{
// HashFunction: dr.ContentReader().ContentFormat().GetHashFunction(),
// HMACSecret: dr.ContentReader().ContentFormat().GetHmacSecret(),
// ObjectFormat: dr.ObjectFormat(),
// SupportsContentCompression: dr.ContentReader().SupportsContentCompression(),
// }

// return rp, nil
// }

func handleRepoStatus(ctx context.Context, rc requestContext) (interface{}, *apiError) {
if rc.rep == nil {
return &serverapi.StatusResponse{
Expand Down
17 changes: 0 additions & 17 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,23 +161,6 @@ func (s *Server) SetupHTMLUIAPIHandlers(m *mux.Router) {
m.HandleFunc("/api/v1/tasks/{taskID}/cancel", s.handleUIPossiblyNotConnected(handleTaskCancel)).Methods(http.MethodPost)
}

// // SetupRepositoryAPIHandlers registers HTTP repository API handlers.
// func (s *Server) SetupRepositoryAPIHandlers(m *mux.Router) {
// m.HandleFunc("/api/v1/flush", s.handleRepositoryAPI(anyAuthenticatedUser, handleFlush)).Methods(http.MethodPost)
// m.HandleFunc("/api/v1/repo/parameters", s.handleRepositoryAPI(anyAuthenticatedUser, handleRepoParameters)).Methods(http.MethodGet)

// m.HandleFunc("/api/v1/contents/{contentID}", s.handleRepositoryAPI(requireContentAccess(auth.AccessLevelRead), handleContentInfo)).Methods(http.MethodGet).Queries("info", "1")
// m.HandleFunc("/api/v1/contents/{contentID}", s.handleRepositoryAPI(requireContentAccess(auth.AccessLevelRead), handleContentGet)).Methods(http.MethodGet)
// m.HandleFunc("/api/v1/contents/{contentID}", s.handleRepositoryAPI(requireContentAccess(auth.AccessLevelAppend), handleContentPut)).Methods(http.MethodPut)
// m.HandleFunc("/api/v1/contents/prefetch", s.handleRepositoryAPI(requireContentAccess(auth.AccessLevelRead), handleContentPrefetch)).Methods(http.MethodPost)

// m.HandleFunc("/api/v1/manifests/{manifestID}", s.handleRepositoryAPI(handlerWillCheckAuthorization, handleManifestGet)).Methods(http.MethodGet)
// m.HandleFunc("/api/v1/manifests/{manifestID}", s.handleRepositoryAPI(handlerWillCheckAuthorization, handleManifestDelete)).Methods(http.MethodDelete)
// m.HandleFunc("/api/v1/manifests", s.handleRepositoryAPI(handlerWillCheckAuthorization, handleManifestCreate)).Methods(http.MethodPost)
// m.HandleFunc("/api/v1/manifests", s.handleRepositoryAPI(handlerWillCheckAuthorization, handleManifestList)).Methods(http.MethodGet)
// m.HandleFunc("/api/v1/policies/apply-retention", s.handleRepositoryAPI(handlerWillCheckAuthorization, handleApplyRetentionPolicy)).Methods(http.MethodPost)
// }

// SetupControlAPIHandlers registers control API handlers.
func (s *Server) SetupControlAPIHandlers(m *mux.Router) {
// server control API, requires authentication as `server-control` and no CSRF token.
Expand Down
47 changes: 0 additions & 47 deletions repo/api_server_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,53 +301,6 @@ func (r *apiServerRepository) OnSuccessfulFlush(callback RepositoryWriterCallbac

var _ Repository = (*apiServerRepository)(nil)

// // openRestAPIRepository connects remote repository over Kopia API.
// func openRestAPIRepository(ctx context.Context, si *APIServerInfo, password string, par *immutableServerRepositoryParameters) (Repository, error) {
// cli, err := apiclient.NewKopiaAPIClient(apiclient.Options{
// BaseURL: si.BaseURL,
// TrustedServerCertificateFingerprint: si.TrustedServerCertificateFingerprint,
// Username: par.cliOpts.UsernameAtHost(),
// Password: password,
// LogRequests: true,
// })
// if err != nil {
// return nil, errors.Wrap(err, "unable to create API client")
// }

// rr := &apiServerRepository{
// immutableServerRepositoryParameters: par,
// cli: cli,
// wso: WriteSessionOptions{
// OnUpload: func(_ int64) {},
// },
// }

// var p remoterepoapi.Parameters

// if err = cli.Get(ctx, "repo/parameters", nil, &p); err != nil {
// return nil, errors.Wrap(err, "unable to get repository parameters")
// }

// hf, err := hashing.CreateHashFunc(&p)
// if err != nil {
// return nil, errors.Wrap(err, "unable to create hash function")
// }

// rr.h = hf
// rr.objectFormat = p.ObjectFormat
// rr.serverSupportsContentCompression = p.SupportsContentCompression

// // create object manager using rr as contentManager implementation.
// omgr, err := object.NewObjectManager(ctx, rr, rr.objectFormat, par.metricsRegistry)
// if err != nil {
// return nil, errors.Wrap(err, "error initializing object manager")
// }

// rr.omgr = omgr

// return rr, nil
// }

// ConnectAPIServer sets up repository connection to a particular API server.
func ConnectAPIServer(ctx context.Context, configFile string, si *APIServerInfo, password string, opt *ConnectOptions) error {
lc := LocalConfig{
Expand Down

0 comments on commit ac9a914

Please sign in to comment.