Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
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
1
Merge Requests
1
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
nexedi
gitlab-workhorse
Commits
fadf660e
Commit
fadf660e
authored
Jun 30, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gitaly-0.14.0' into 'master'
Use reader/writer from gitaly streamio See merge request !178
parents
45ce9636
2a84720d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
70 deletions
+44
-70
internal/git/info-refs.go
internal/git/info-refs.go
+3
-2
internal/gitaly/commit.go
internal/gitaly/commit.go
+2
-2
internal/gitaly/smarthttp.go
internal/gitaly/smarthttp.go
+19
-14
vendor/gitlab.com/gitlab-org/gitaly-proto/go/helper/inforefs.go
.../gitlab.com/gitlab-org/gitaly-proto/go/helper/inforefs.go
+0
-32
vendor/gitlab.com/gitlab-org/gitaly/NOTICE
vendor/gitlab.com/gitlab-org/gitaly/NOTICE
+1
-1
vendor/gitlab.com/gitlab-org/gitaly/streamio/stream.go
vendor/gitlab.com/gitlab-org/gitaly/streamio/stream.go
+7
-7
vendor/vendor.json
vendor/vendor.json
+12
-12
No files found.
internal/git/info-refs.go
View file @
fadf660e
...
...
@@ -2,6 +2,7 @@ package git
import
(
"fmt"
"io"
"net/http"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
...
...
@@ -71,12 +72,12 @@ func handleGetInfoRefsWithGitaly(w http.ResponseWriter, a *api.Response, rpc str
ctx
,
cancelFunc
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancelFunc
()
infoRefsResponse
Writer
,
err
:=
smarthttp
.
InfoRefsResponseWriterTo
(
ctx
,
&
a
.
Repository
,
rpc
)
infoRefsResponse
Reader
,
err
:=
smarthttp
.
InfoRefsResponseReader
(
ctx
,
&
a
.
Repository
,
rpc
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"GetInfoRefsHandler: %v"
,
err
)
}
if
_
,
err
=
i
nfoRefsResponseWriter
.
WriteTo
(
w
);
err
!=
nil
{
if
_
,
err
=
i
o
.
Copy
(
w
,
infoRefsResponseReader
);
err
!=
nil
{
return
fmt
.
Errorf
(
"GetInfoRefsHandler: copy Gitaly response: %v"
,
err
)
}
...
...
internal/gitaly/commit.go
View file @
fadf660e
...
...
@@ -7,7 +7,7 @@ import (
"strconv"
pb
"gitlab.com/gitlab-org/gitaly-proto/go"
pbhelper
"gitlab.com/gitlab-org/gitaly-proto/go/helper
"
"gitlab.com/gitlab-org/gitaly/streamio
"
"golang.org/x/net/context"
)
...
...
@@ -26,7 +26,7 @@ func (client *CommitClient) SendBlob(w http.ResponseWriter, request *pb.TreeEntr
}
firstResponseReceived
:=
false
rr
:=
pbhelper
.
NewReceive
Reader
(
func
()
([]
byte
,
error
)
{
rr
:=
streamio
.
New
Reader
(
func
()
([]
byte
,
error
)
{
resp
,
err
:=
c
.
Recv
()
if
!
firstResponseReceived
&&
err
==
nil
{
...
...
internal/gitaly/smarthttp.go
View file @
fadf660e
...
...
@@ -5,7 +5,7 @@ import (
"io"
pb
"gitlab.com/gitlab-org/gitaly-proto/go"
pbhelper
"gitlab.com/gitlab-org/gitaly-proto/go/helper
"
"gitlab.com/gitlab-org/gitaly/streamio
"
"golang.org/x/net/context"
)
...
...
@@ -14,25 +14,30 @@ type SmartHTTPClient struct {
pb
.
SmartHTTPClient
}
func
(
client
*
SmartHTTPClient
)
InfoRefsResponse
WriterTo
(
ctx
context
.
Context
,
repo
*
pb
.
Repository
,
rpc
string
)
(
io
.
WriterTo
,
error
)
{
func
(
client
*
SmartHTTPClient
)
InfoRefsResponse
Reader
(
ctx
context
.
Context
,
repo
*
pb
.
Repository
,
rpc
string
)
(
io
.
Reader
,
error
)
{
rpcRequest
:=
&
pb
.
InfoRefsRequest
{
Repository
:
repo
}
var
c
pbhelper
.
InfoRefsClient
var
err
error
switch
rpc
{
case
"git-upload-pack"
:
c
,
err
=
client
.
InfoRefsUploadPack
(
ctx
,
rpcRequest
)
stream
,
err
:=
client
.
InfoRefsUploadPack
(
ctx
,
rpcRequest
)
return
infoRefsReader
(
stream
),
err
case
"git-receive-pack"
:
c
,
err
=
client
.
InfoRefsReceivePack
(
ctx
,
rpcRequest
)
stream
,
err
:=
client
.
InfoRefsReceivePack
(
ctx
,
rpcRequest
)
return
infoRefsReader
(
stream
),
err
default
:
return
nil
,
fmt
.
Errorf
(
"InfoRefsResponseWriterTo: Unsupported RPC: %q"
,
rpc
)
}
}
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"InfoRefsResponseWriterTo: RPC call failed: %v"
,
er
r
)
}
type
infoRefsClient
interface
{
Recv
()
(
*
pb
.
InfoRefsResponse
,
erro
r
)
}
return
&
pbhelper
.
InfoRefsClientWriterTo
{
c
},
nil
func
infoRefsReader
(
stream
infoRefsClient
)
io
.
Reader
{
return
streamio
.
NewReader
(
func
()
([]
byte
,
error
)
{
resp
,
err
:=
stream
.
Recv
()
return
resp
.
GetData
(),
err
})
}
func
(
client
*
SmartHTTPClient
)
ReceivePack
(
repo
*
pb
.
Repository
,
glId
string
,
glRepository
string
,
clientRequest
io
.
Reader
,
clientResponse
io
.
Writer
)
error
{
...
...
@@ -58,7 +63,7 @@ func (client *SmartHTTPClient) ReceivePack(repo *pb.Repository, glId string, glR
errC
:=
make
(
chan
error
,
numStreams
)
go
func
()
{
rr
:=
pbhelper
.
NewReceive
Reader
(
func
()
([]
byte
,
error
)
{
rr
:=
streamio
.
New
Reader
(
func
()
([]
byte
,
error
)
{
response
,
err
:=
stream
.
Recv
()
return
response
.
GetData
(),
err
})
...
...
@@ -67,7 +72,7 @@ func (client *SmartHTTPClient) ReceivePack(repo *pb.Repository, glId string, glR
}()
go
func
()
{
sw
:=
pbhelper
.
NewSend
Writer
(
func
(
data
[]
byte
)
error
{
sw
:=
streamio
.
New
Writer
(
func
(
data
[]
byte
)
error
{
return
stream
.
Send
(
&
pb
.
PostReceivePackRequest
{
Data
:
data
})
})
_
,
err
:=
io
.
Copy
(
sw
,
clientRequest
)
...
...
@@ -105,7 +110,7 @@ func (client *SmartHTTPClient) UploadPack(repo *pb.Repository, clientRequest io.
errC
:=
make
(
chan
error
,
numStreams
)
go
func
()
{
rr
:=
pbhelper
.
NewReceive
Reader
(
func
()
([]
byte
,
error
)
{
rr
:=
streamio
.
New
Reader
(
func
()
([]
byte
,
error
)
{
response
,
err
:=
stream
.
Recv
()
return
response
.
GetData
(),
err
})
...
...
@@ -114,7 +119,7 @@ func (client *SmartHTTPClient) UploadPack(repo *pb.Repository, clientRequest io.
}()
go
func
()
{
sw
:=
pbhelper
.
NewSend
Writer
(
func
(
data
[]
byte
)
error
{
sw
:=
streamio
.
New
Writer
(
func
(
data
[]
byte
)
error
{
return
stream
.
Send
(
&
pb
.
PostUploadPackRequest
{
Data
:
data
})
})
_
,
err
:=
io
.
Copy
(
sw
,
clientRequest
)
...
...
vendor/gitlab.com/gitlab-org/gitaly-proto/go/helper/inforefs.go
deleted
100644 → 0
View file @
45ce9636
package
helper
import
(
"io"
pb
"gitlab.com/gitlab-org/gitaly-proto/go"
)
type
InfoRefsClient
interface
{
Recv
()
(
*
pb
.
InfoRefsResponse
,
error
)
}
type
InfoRefsClientWriterTo
struct
{
InfoRefsClient
}
func
(
clientReader
*
InfoRefsClientWriterTo
)
WriteTo
(
w
io
.
Writer
)
(
total
int64
,
err
error
)
{
for
{
response
,
err
:=
clientReader
.
Recv
()
if
err
==
io
.
EOF
{
return
total
,
nil
}
else
if
err
!=
nil
{
return
total
,
err
}
n
,
err
:=
w
.
Write
(
response
.
GetData
())
total
+=
int64
(
n
)
if
err
!=
nil
{
return
total
,
err
}
}
}
vendor/gitlab.com/gitlab-org/gitaly/NOTICE
View file @
fadf660e
...
...
@@ -77,7 +77,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LICENSE - gitlab.com/gitlab-org/gitaly/internal/
service/
middleware/panichandler
LICENSE - gitlab.com/gitlab-org/gitaly/internal/middleware/panichandler
Copyright (c) 2016 Masahiro Sano
MIT License
...
...
vendor/gitlab.com/gitlab-org/gitaly
-proto/go/helper
/stream.go
→
vendor/gitlab.com/gitlab-org/gitaly
/streamio
/stream.go
View file @
fadf660e
package
helper
package
streamio
import
(
"io"
)
// NewRe
ceiveReader turns receiver into an io.Reader. Errors from the
//
receiver function are passed on unmodified. This means receiver should
//
emit
io.EOF when done.
func
NewRe
ceiveRe
ader
(
receiver
func
()
([]
byte
,
error
))
io
.
Reader
{
// NewRe
ader turns receiver into an io.Reader. Errors from the receiver
//
function are passed on unmodified. This means receiver should emit
// io.EOF when done.
func
NewReader
(
receiver
func
()
([]
byte
,
error
))
io
.
Reader
{
return
&
receiveReader
{
receiver
:
receiver
}
}
...
...
@@ -29,9 +29,9 @@ func (rr *receiveReader) Read(p []byte) (int, error) {
return
n
,
nil
}
// New
Send
Writer turns sender into an io.Writer. The number of 'bytes
// NewWriter turns sender into an io.Writer. The number of 'bytes
// written' reported back is always len(p).
func
New
Send
Writer
(
sender
func
(
p
[]
byte
)
error
)
io
.
Writer
{
func
NewWriter
(
sender
func
(
p
[]
byte
)
error
)
io
.
Writer
{
return
&
sendWriter
{
sender
:
sender
}
}
...
...
vendor/vendor.json
View file @
fadf660e
...
...
@@ -135,21 +135,21 @@
"version"
:
"v0.9.0"
,
"versionExact"
:
"v0.9.0"
},
{
"checksumSHA1"
:
"GkeSZfXVbtAkBZOrswot19GJZqQ="
,
"path"
:
"gitlab.com/gitlab-org/gitaly-proto/go/helper"
,
"revision"
:
"e302a46f7ccd889bfaa683d2ba06ffe06ca5875b"
,
"revisionTime"
:
"2017-06-12T18:49:50Z"
,
"version"
:
"v0.9.0"
,
"versionExact"
:
"v0.9.0"
},
{
"checksumSHA1"
:
"dUHJbKas746n5fLzlwxHb6FOCxs="
,
"path"
:
"gitlab.com/gitlab-org/gitaly/auth"
,
"revision"
:
"b933e5ce4843ec6c332a0184afb8e69820cc9050"
,
"revisionTime"
:
"2017-06-22T09:36:09Z"
,
"version"
:
"v0.13.0"
,
"versionExact"
:
"v0.13.0"
"revision"
:
"e4f8d3d14cc3fe673cb511fb4d0189b68a158ccd"
,
"revisionTime"
:
"2017-06-30T12:58:40Z"
,
"version"
:
"v0.14.0"
,
"versionExact"
:
"v0.14.0"
},
{
"checksumSHA1"
:
"sdUF3j5MaQ9Tjc2dGHqc/toQxyk="
,
"path"
:
"gitlab.com/gitlab-org/gitaly/streamio"
,
"revision"
:
"e4f8d3d14cc3fe673cb511fb4d0189b68a158ccd"
,
"revisionTime"
:
"2017-06-30T12:58:40Z"
,
"version"
:
"v0.14.0"
,
"versionExact"
:
"v0.14.0"
},
{
"checksumSHA1"
:
"9jjO5GjLa0XF/nfWihF02RoH4qc="
,
...
...
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