func (s *Server) Install(handle func(string, http.Handler)) {
	// rmw wires in error reporting to the handler. It is configured here, in
	// Install, because not every handler should have error reporting. For
	// example, we don't want to get an error report each time a /fetch fails.
	rmw := middleware.Identity()
	if s.reportingClient != nil {
		rmw = middleware.ErrorReporting(s.reportingClient.Report)
	}

	// scheduled: poll polls the Module Index for new versions
	// that have been published and inserts that metadata into
	// module_version_states.
	// This endpoint is intended to be invoked periodically by a scheduler.
	// See the note about duplicate tasks for "/enqueue" below.
	handle("/poll", rmw(s.errorHandler(s.handlePollIndex)))

	// TODO: remove after /poll is in production and the scheduler jobs have been changed.
	// scheduled: poll-and-queue polls the Module Index for new versions
	// that have been published and inserts that metadata into
	// module_version_states. It also inserts the version into the task-queue
	// to to be fetched and processed.
	// This endpoint is intended to be invoked periodically by a scheduler.
	// See the note about duplicate tasks for "/requeue" below.
	handle("/poll-and-queue", rmw(s.errorHandler(s.handleIndexAndQueue)))

	// scheduled: update-imported-by-count update the imported_by_count for
	// packages in search_documents where imported_by_count_updated_at is null
	// or imported_by_count_updated_at < version_updated_at.
	// This endpoint is intended to be invoked periodically by a scheduler.
	handle("/update-imported-by-count", rmw(s.errorHandler(s.handleUpdateImportedByCount)))

	// scheduled: download search document data and update the redis sorted
	// set(s) used in auto-completion.
	handle("/update-redis-indexes", rmw(s.errorHandler(s.handleUpdateRedisIndexes)))

	// task-queue: fetch fetches a module version from the Module Mirror, and
	// processes the contents, and inserts it into the database. If a fetch
	// request fails for any reason other than an http.StatusInternalServerError,
	// it will return an http.StatusOK so that the task queue does not retry
	// fetching module versions that have a terminal error.
	// This endpoint is intended to be invoked by a task queue with semantics like
	// Google Cloud Task Queues.
	handle("/fetch/", http.StripPrefix("/fetch", http.HandlerFunc(s.handleFetch)))

	// scheduled: enqueue queries the module_version_states table for the next
	// batch of module versions to process, and enqueues them for processing.
	// Normally this will not cause duplicate processing, because Cloud Tasks
	// are de-duplicated. That does not apply after a task has been finished or
	// deleted for Server.taskIDChangeInterval (see
	// https://cloud.google.com/tasks/docs/reference/rpc/google.cloud.tasks.v2#createtaskrequest,
	// under "Task De-duplication"). If you cannot wait, you can force
	// duplicate tasks by providing any string as the "suffix" query parameter.
	handle("/enqueue", rmw(s.errorHandler(s.handleEnqueue)))

	// TODO: remove after /queue is in production and the scheduler jobs have been changed.
	// scheduled: requeue queries the module_version_states table for the next
	// batch of module versions to process, and enqueues them for processing.
	// Normally this will not cause duplicate processing, because Cloud Tasks
	// are de-duplicated. That does not apply after a task has been finished or
	// deleted for Server.taskIDChangeInterval (see
	// https://cloud.google.com/tasks/docs/reference/rpc/google.cloud.tasks.v2#createtaskrequest,
	// under "Task De-duplication"). If you cannot wait, you can force
	// duplicate tasks by providing any string as the "suffix" query parameter.
	handle("/requeue", rmw(s.errorHandler(s.handleEnqueue)))

	// manual: reprocess sets a reprocess status for all records in the
	// module_version_states table that were processed by an app_version that
	// occurred after the provided app_version param, so that they will be
	// scheduled for reprocessing the next time a request to /requeue is made.
	handle("/reprocess", rmw(s.errorHandler(s.handleReprocess)))

	// manual: populate-stdlib inserts all versions of the Go standard
	// library into the tasks queue to be processed and inserted into the
	// database. handlePopulateStdLib should be updated whenever a new
	// version of Go is released.
	// see the comments on duplicate tasks for "/requeue", above.
	handle("/populate-stdlib", rmw(s.errorHandler(s.handlePopulateStdLib)))

	// manual: populate-search-documents repopulates every row in the
	// search_documents table that was last updated before the time in the
	// "before" query parameter.
	handle("/repopulate-search-documents", rmw(s.errorHandler(s.handleRepopulateSearchDocuments)))

	// manual: clear-cache clears the redis cache.
	handle("/clear-cache", rmw(s.errorHandler(s.clearCache)))

	// manual: delete the specified module version.
	handle("/delete/", http.StripPrefix("/delete", rmw(s.errorHandler(s.handleDelete))))

	// returns the Worker homepage.
	handle("/", http.HandlerFunc(s.handleStatusPage))
}
// Install registers server routes using the given handler registration func.
Install registers server routes using the given handler registration func.
// Install registers server routes using the given handler registration func .
func (s *Server) Install(handle func(string, http.Handler)) {
	rmw := middleware.Identity()
	if s.reportingClient != nil {
		rmw = middleware.ErrorReporting(s.reportingClient.Report)
	}
	handle("/poll", rmw(s.errorHandler(s.handlePollIndex)))
	 It also inserts the version into the task-queue
	handle("/poll-and-queue", rmw(s.errorHandler(s.handleIndexAndQueue)))
	handle("/update-imported-by-count", rmw(s.errorHandler(s.handleUpdateImportedByCount)))
	handle("/update-redis-indexes", rmw(s.errorHandler(s.handleUpdateRedisIndexes)))
	handle("/fetch/", http.StripPrefix("/fetch", http.HandlerFunc(s.handleFetch)))
	handle("/enqueue", rmw(s.errorHandler(s.handleEnqueue)))
	handle("/requeue", rmw(s.errorHandler(s.handleEnqueue)))
	handle("/reprocess", rmw(s.errorHandler(s.handleReprocess)))
	handle("/populate-stdlib", rmw(s.errorHandler(s.handlePopulateStdLib)))
	handle("/repopulate-search-documents", rmw(s.errorHandler(s.handleRepopulateSearchDocuments)))
	handle("/clear-cache", rmw(s.errorHandler(s.clearCache)))
	handle("/delete/", http.StripPrefix("/delete", rmw(s.errorHandler(s.handleDelete))))
	handle("/", http.HandlerFunc(s.handleStatusPage))
}
func ( s * Server ) Install ( handle func ( string , http . Handler ) ) { rmw := middleware . Identity ( ) if s . reportingClient != nil { rmw = middleware . ErrorReporting ( s . reportingClient . Report ) } handle ( " " , rmw ( s . errorHandler ( s . handlePollIndex ) ) ) handle ( " " , rmw ( s . errorHandler ( s . handleIndexAndQueue ) ) ) handle ( " " , rmw ( s . errorHandler ( s . handleUpdateImportedByCount ) ) ) handle ( " " , rmw ( s . errorHandler ( s . handleUpdateRedisIndexes ) ) ) handle ( " " , http . StripPrefix ( " " , http . HandlerFunc ( s . handleFetch ) ) ) handle ( " " , rmw ( s . errorHandler ( s . handleEnqueue ) ) ) handle ( " " , rmw ( s . errorHandler ( s . handleEnqueue ) ) ) handle ( " " , rmw ( s . errorHandler ( s . handleReprocess ) ) ) handle ( " " , rmw ( s . errorHandler ( s . handlePopulateStdLib ) ) ) handle ( " " , rmw ( s . errorHandler ( s . handleRepopulateSearchDocuments ) ) ) handle ( " " , rmw ( s . errorHandler ( s . clearCache ) ) ) handle ( " " , http . StripPrefix ( " " , rmw ( s . errorHandler ( s . handleDelete ) ) ) ) handle ( " " , http . HandlerFunc ( s . handleStatusPage ) ) }
Install registers server routes using the given handler registration func.
Install registers server routes using the given handler registration func .
// rmw wires in error reporting to the handler. It is configured here, in // Install, because not every handler should have error reporting. For // example, we don't want to get an error report each time a /fetch fails. // scheduled: poll polls the Module Index for new versions // that have been published and inserts that metadata into // module_version_states. // This endpoint is intended to be invoked periodically by a scheduler. // See the note about duplicate tasks for "/enqueue" below. // TODO: remove after /poll is in production and the scheduler jobs have been changed. // scheduled: poll-and-queue polls the Module Index for new versions // that have been published and inserts that metadata into // module_version_states. It also inserts the version into the task-queue // to to be fetched and processed. // This endpoint is intended to be invoked periodically by a scheduler. // See the note about duplicate tasks for "/requeue" below. // scheduled: update-imported-by-count update the imported_by_count for // packages in search_documents where imported_by_count_updated_at is null // or imported_by_count_updated_at < version_updated_at. // This endpoint is intended to be invoked periodically by a scheduler. // scheduled: download search document data and update the redis sorted // set(s) used in auto-completion. // task-queue: fetch fetches a module version from the Module Mirror, and // processes the contents, and inserts it into the database. If a fetch // request fails for any reason other than an http.StatusInternalServerError, // it will return an http.StatusOK so that the task queue does not retry // fetching module versions that have a terminal error. // This endpoint is intended to be invoked by a task queue with semantics like // Google Cloud Task Queues. // scheduled: enqueue queries the module_version_states table for the next // batch of module versions to process, and enqueues them for processing. // Normally this will not cause duplicate processing, because Cloud Tasks // are de-duplicated. That does not apply after a task has been finished or // deleted for Server.taskIDChangeInterval (see // https://cloud.google.com/tasks/docs/reference/rpc/google.cloud.tasks.v2#createtaskrequest, // under "Task De-duplication"). If you cannot wait, you can force // duplicate tasks by providing any string as the "suffix" query parameter. // TODO: remove after /queue is in production and the scheduler jobs have been changed. // scheduled: requeue queries the module_version_states table for the next // batch of module versions to process, and enqueues them for processing. // Normally this will not cause duplicate processing, because Cloud Tasks // are de-duplicated. That does not apply after a task has been finished or // deleted for Server.taskIDChangeInterval (see // https://cloud.google.com/tasks/docs/reference/rpc/google.cloud.tasks.v2#createtaskrequest, // under "Task De-duplication"). If you cannot wait, you can force // duplicate tasks by providing any string as the "suffix" query parameter. // manual: reprocess sets a reprocess status for all records in the // module_version_states table that were processed by an app_version that // occurred after the provided app_version param, so that they will be // scheduled for reprocessing the next time a request to /requeue is made. // manual: populate-stdlib inserts all versions of the Go standard // library into the tasks queue to be processed and inserted into the // database. handlePopulateStdLib should be updated whenever a new // version of Go is released. // see the comments on duplicate tasks for "/requeue", above. // manual: populate-search-documents repopulates every row in the // search_documents table that was last updated before the time in the // "before" query parameter. // manual: clear-cache clears the redis cache. // manual: delete the specified module version. // returns the Worker homepage.