Server exposes simple HTTP API for programmatically accessing Kopia features.
| 64 | |
| 65 | // Server exposes simple HTTP API for programmatically accessing Kopia features. |
| 66 | type Server struct { |
| 67 | //nolint:containedctx |
| 68 | rootctx context.Context // +checklocksignore |
| 69 | |
| 70 | OnShutdown func(ctx context.Context) error |
| 71 | options Options |
| 72 | authenticator auth.Authenticator |
| 73 | authorizer auth.Authorizer |
| 74 | |
| 75 | initTaskMutex sync.Mutex |
| 76 | // +checklocks:initTaskMutex |
| 77 | initRepositoryTaskID string // non-empty - repository is currently being opened. |
| 78 | |
| 79 | serverMutex sync.RWMutex |
| 80 | |
| 81 | parallelSnapshotsMutex sync.Mutex |
| 82 | |
| 83 | // +checklocks:parallelSnapshotsMutex |
| 84 | parallelSnapshotsChanged *sync.Cond // condition triggered on change to currentParallelSnapshots or maxParallelSnapshots |
| 85 | |
| 86 | // +checklocks:parallelSnapshotsMutex |
| 87 | currentParallelSnapshots int |
| 88 | // +checklocks:parallelSnapshotsMutex |
| 89 | maxParallelSnapshots int |
| 90 | |
| 91 | // +checklocks:parallelSnapshotsMutex |
| 92 | pendingMultiSnapshotStatus notifydata.MultiSnapshotStatus |
| 93 | |
| 94 | // +checklocks:serverMutex |
| 95 | rep repo.Repository |
| 96 | // +checklocks:serverMutex |
| 97 | maint *srvMaintenance |
| 98 | // +checklocks:serverMutex |
| 99 | sourceManagers map[snapshot.SourceInfo]*sourceManager |
| 100 | // +checklocks:serverMutex |
| 101 | mounts map[object.ID]mount.Controller |
| 102 | |
| 103 | taskmgr *uitask.Manager |
| 104 | authCookieSigningKey []byte |
| 105 | |
| 106 | // channel to which we can post to trigger scheduler re-evaluation. |
| 107 | schedulerRefresh chan string |
| 108 | |
| 109 | // +checklocks:serverMutex |
| 110 | sched *scheduler.Scheduler |
| 111 | |
| 112 | nextRefreshTimeLock sync.Mutex |
| 113 | |
| 114 | // +checklocks:nextRefreshTimeLock |
| 115 | nextRefreshTime time.Time |
| 116 | |
| 117 | grpcServerState |
| 118 | } |
| 119 | |
| 120 | // SetupHTMLUIAPIHandlers registers API requests required by the HTMLUI. |
| 121 | func (s *Server) SetupHTMLUIAPIHandlers(m *mux.Router) { |
nothing calls this directly
no outgoing calls
no test coverage detected