Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
00ce8756
Commit
00ce8756
authored
Nov 02, 2017
by
Kim "BKC" Carlbäcker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate GitLab::Git::Wiki.update_page to Gitaly
parent
a845cf24
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
6 deletions
+46
-6
GITALY_SERVER_VERSION
GITALY_SERVER_VERSION
+1
-1
lib/gitlab/git/wiki.rb
lib/gitlab/git/wiki.rb
+20
-5
lib/gitlab/gitaly_client/wiki_service.rb
lib/gitlab/gitaly_client/wiki_service.rb
+25
-0
No files found.
GITALY_SERVER_VERSION
View file @
00ce8756
0.5
1
.0
0.5
2
.0
lib/gitlab/git/wiki.rb
View file @
00ce8756
...
@@ -48,11 +48,14 @@ module Gitlab
...
@@ -48,11 +48,14 @@ module Gitlab
end
end
def
update_page
(
page_path
,
title
,
format
,
content
,
commit_details
)
def
update_page
(
page_path
,
title
,
format
,
content
,
commit_details
)
assert_type!
(
format
,
Symbol
)
@repository
.
gitaly_migrate
(
:wiki_update_page
)
do
|
is_enabled
|
assert_type!
(
commit_details
,
CommitDetails
)
if
is_enabled
gitaly_update_page
(
page_path
,
title
,
format
,
content
,
commit_details
)
gollum_wiki
.
update_page
(
gollum_page_by_path
(
page_path
),
title
,
format
,
content
,
commit_details
.
to_h
)
gollum_wiki
.
clear_cache
nil
else
gollum_update_page
(
page_path
,
title
,
format
,
content
,
commit_details
)
end
end
end
end
def
pages
def
pages
...
@@ -149,6 +152,14 @@ module Gitlab
...
@@ -149,6 +152,14 @@ module Gitlab
nil
nil
end
end
def
gollum_update_page
(
page_path
,
title
,
format
,
content
,
commit_details
)
assert_type!
(
format
,
Symbol
)
assert_type!
(
commit_details
,
CommitDetails
)
gollum_wiki
.
update_page
(
gollum_page_by_path
(
page_path
),
title
,
format
,
content
,
commit_details
.
to_h
)
nil
end
def
gollum_find_page
(
title
:,
version:
nil
,
dir:
nil
)
def
gollum_find_page
(
title
:,
version:
nil
,
dir:
nil
)
if
version
if
version
version
=
Gitlab
::
Git
::
Commit
.
find
(
@repository
,
version
).
id
version
=
Gitlab
::
Git
::
Commit
.
find
(
@repository
,
version
).
id
...
@@ -172,6 +183,10 @@ module Gitlab
...
@@ -172,6 +183,10 @@ module Gitlab
gitaly_wiki_client
.
write_page
(
name
,
format
,
content
,
commit_details
)
gitaly_wiki_client
.
write_page
(
name
,
format
,
content
,
commit_details
)
end
end
def
gitaly_update_page
(
page_path
,
title
,
format
,
content
,
commit_details
)
gitaly_wiki_client
.
update_page
(
page_path
,
title
,
format
,
content
,
commit_details
)
end
def
gitaly_delete_page
(
page_path
,
commit_details
)
def
gitaly_delete_page
(
page_path
,
commit_details
)
gitaly_wiki_client
.
delete_page
(
page_path
,
commit_details
)
gitaly_wiki_client
.
delete_page
(
page_path
,
commit_details
)
end
end
...
...
lib/gitlab/gitaly_client/wiki_service.rb
View file @
00ce8756
...
@@ -37,6 +37,31 @@ module Gitlab
...
@@ -37,6 +37,31 @@ module Gitlab
end
end
end
end
def
update_page
(
page_path
,
title
,
format
,
content
,
commit_details
)
request
=
Gitaly
::
WikiUpdatePageRequest
.
new
(
repository:
@gitaly_repo
,
page_path:
GitalyClient
.
encode
(
page_path
),
title:
GitalyClient
.
encode
(
title
),
format:
format
.
to_s
,
commit_details:
gitaly_commit_details
(
commit_details
)
)
strio
=
StringIO
.
new
(
content
)
enum
=
Enumerator
.
new
do
|
y
|
until
strio
.
eof?
chunk
=
strio
.
read
(
MAX_MSG_SIZE
)
request
.
content
=
GitalyClient
.
encode
(
chunk
)
y
.
yield
request
request
=
Gitaly
::
WikiUpdatePageRequest
.
new
end
end
GitalyClient
.
call
(
@repository
.
storage
,
:wiki_service
,
:wiki_update_page
,
enum
)
end
def
delete_page
(
page_path
,
commit_details
)
def
delete_page
(
page_path
,
commit_details
)
request
=
Gitaly
::
WikiDeletePageRequest
.
new
(
request
=
Gitaly
::
WikiDeletePageRequest
.
new
(
repository:
@gitaly_repo
,
repository:
@gitaly_repo
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment