diff options
author | John Olheiser <john.olheiser@gmail.com> | 2020-10-23 10:59:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-23 11:59:45 -0400 |
commit | 1d6b565de452d24e1db0ca21ba69289809fdc32a (patch) | |
tree | 90baf36836e97916c0469da6ecd5605c81e80b00 /docs/content/doc/advanced/migrations.en-us.md | |
parent | bfc553164aafaacf5a82427b85145aa2ef34aaa3 (diff) | |
download | gitea-1d6b565de452d24e1db0ca21ba69289809fdc32a.tar.gz gitea-1d6b565de452d24e1db0ca21ba69289809fdc32a.zip |
Refactor docs (#13275)
* First pass
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* More changes
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Redirects
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Diffstat (limited to 'docs/content/doc/advanced/migrations.en-us.md')
-rw-r--r-- | docs/content/doc/advanced/migrations.en-us.md | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/docs/content/doc/advanced/migrations.en-us.md b/docs/content/doc/advanced/migrations.en-us.md deleted file mode 100644 index 746c68f426..0000000000 --- a/docs/content/doc/advanced/migrations.en-us.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -date: "2019-04-15T17:29:00+08:00" -title: "Advanced: Migrations Interfaces" -slug: "migrations-interfaces" -weight: 30 -toc: true -draft: false -menu: - sidebar: - parent: "advanced" - name: "Migrations Interfaces" - weight: 55 - identifier: "migrations-interfaces" ---- - -# Migration Features - -The new migration features were introduced in Gitea 1.9.0. It defines two interfaces to support migrating -repositories data from other git host platforms to gitea or, in the future migrating gitea data to other -git host platforms. Currently, migrations from Github, Gitlab and Gitea to Gitea is implemented. - -First of all, Gitea defines some standard objects in packages `modules/migrations/base`. They are - `Repository`, `Milestone`, `Release`, `ReleaseAsset`, `Label`, `Issue`, `Comment`, `PullRequest`, `Reaction`, `Review`, `ReviewComment`. - -## Downloader Interfaces - -To migrate from a new git host platform, there are two steps to be updated. - -- You should implement a `Downloader` which will get all kinds of repository informations. -- You should implement a `DownloaderFactory` which is used to detect if the URL matches and -create a Downloader. -- You'll need to register the `DownloaderFactory` via `RegisterDownloaderFactory` on init. - -```Go -type Downloader interface { - GetAsset(relTag string, relID, id int64) (io.ReadCloser, error) - SetContext(context.Context) - GetRepoInfo() (*Repository, error) - GetTopics() ([]string, error) - GetMilestones() ([]*Milestone, error) - GetReleases() ([]*Release, error) - GetLabels() ([]*Label, error) - GetIssues(page, perPage int) ([]*Issue, bool, error) - GetComments(issueNumber int64) ([]*Comment, error) - GetPullRequests(page, perPage int) ([]*PullRequest, bool, error) - GetReviews(pullRequestNumber int64) ([]*Review, error) -} -``` - -```Go -type DownloaderFactory interface { - New(ctx context.Context, opts MigrateOptions) (Downloader, error) - GitServiceType() structs.GitServiceType -} -``` - -## Uploader Interface - -Currently, only a `GiteaLocalUploader` is implemented, so we only save downloaded -data via this `Uploader` on the local Gitea instance. Other uploaders are not supported -and will be implemented in future. - -```Go -// Uploader uploads all the informations -type Uploader interface { - MaxBatchInsertSize(tp string) int - CreateRepo(repo *Repository, opts MigrateOptions) error - CreateTopics(topic ...string) error - CreateMilestones(milestones ...*Milestone) error - CreateReleases(downloader Downloader, releases ...*Release) error - SyncTags() error - CreateLabels(labels ...*Label) error - CreateIssues(issues ...*Issue) error - CreateComments(comments ...*Comment) error - CreatePullRequests(prs ...*PullRequest) error - CreateReviews(reviews ...*Review) error - Rollback() error - Close() -} - -``` |