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
Show 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
...
@@ -2,6 +2,7 @@ package git
import
(
import
(
"fmt"
"fmt"
"io"
"net/http"
"net/http"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
...
@@ -71,12 +72,12 @@ func handleGetInfoRefsWithGitaly(w http.ResponseWriter, a *api.Response, rpc str
...
@@ -71,12 +72,12 @@ func handleGetInfoRefsWithGitaly(w http.ResponseWriter, a *api.Response, rpc str
ctx
,
cancelFunc
:=
context
.
WithCancel
(
context
.
Background
())
ctx
,
cancelFunc
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancelFunc
()
defer
cancelFunc
()
infoRefsResponse
Writer
,
err
:=
smarthttp
.
InfoRefsResponseWriterTo
(
ctx
,
&
a
.
Repository
,
rpc
)
infoRefsResponse
Reader
,
err
:=
smarthttp
.
InfoRefsResponseReader
(
ctx
,
&
a
.
Repository
,
rpc
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"GetInfoRefsHandler: %v"
,
err
)
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
)
return
fmt
.
Errorf
(
"GetInfoRefsHandler: copy Gitaly response: %v"
,
err
)
}
}
...
...
internal/gitaly/commit.go
View file @
fadf660e
...
@@ -7,7 +7,7 @@ import (
...
@@ -7,7 +7,7 @@ import (
"strconv"
"strconv"
pb
"gitlab.com/gitlab-org/gitaly-proto/go"
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"
"golang.org/x/net/context"
)
)
...
@@ -26,7 +26,7 @@ func (client *CommitClient) SendBlob(w http.ResponseWriter, request *pb.TreeEntr
...
@@ -26,7 +26,7 @@ func (client *CommitClient) SendBlob(w http.ResponseWriter, request *pb.TreeEntr
}
}
firstResponseReceived
:=
false
firstResponseReceived
:=
false
rr
:=
pbhelper
.
NewReceive
Reader
(
func
()
([]
byte
,
error
)
{
rr
:=
streamio
.
New
Reader
(
func
()
([]
byte
,
error
)
{
resp
,
err
:=
c
.
Recv
()
resp
,
err
:=
c
.
Recv
()
if
!
firstResponseReceived
&&
err
==
nil
{
if
!
firstResponseReceived
&&
err
==
nil
{
...
...
internal/gitaly/smarthttp.go
View file @
fadf660e
...
@@ -5,7 +5,7 @@ import (
...
@@ -5,7 +5,7 @@ import (
"io"
"io"
pb
"gitlab.com/gitlab-org/gitaly-proto/go"
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"
"golang.org/x/net/context"
)
)
...
@@ -14,25 +14,30 @@ type SmartHTTPClient struct {
...
@@ -14,25 +14,30 @@ type SmartHTTPClient struct {
pb
.
SmartHTTPClient
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
}
rpcRequest
:=
&
pb
.
InfoRefsRequest
{
Repository
:
repo
}
var
c
pbhelper
.
InfoRefsClient
var
err
error
switch
rpc
{
switch
rpc
{
case
"git-upload-pack"
:
case
"git-upload-pack"
:
c
,
err
=
client
.
InfoRefsUploadPack
(
ctx
,
rpcRequest
)
stream
,
err
:=
client
.
InfoRefsUploadPack
(
ctx
,
rpcRequest
)
return
infoRefsReader
(
stream
),
err
case
"git-receive-pack"
:
case
"git-receive-pack"
:
c
,
err
=
client
.
InfoRefsReceivePack
(
ctx
,
rpcRequest
)
stream
,
err
:=
client
.
InfoRefsReceivePack
(
ctx
,
rpcRequest
)
return
infoRefsReader
(
stream
),
err
default
:
default
:
return
nil
,
fmt
.
Errorf
(
"InfoRefsResponseWriterTo: Unsupported RPC: %q"
,
rpc
)
return
nil
,
fmt
.
Errorf
(
"InfoRefsResponseWriterTo: Unsupported RPC: %q"
,
rpc
)
}
}
}
if
err
!=
nil
{
type
infoRefsClient
interface
{
return
nil
,
fmt
.
Errorf
(
"InfoRefsResponseWriterTo: RPC call failed: %v"
,
er
r
)
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
{
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
...
@@ -58,7 +63,7 @@ func (client *SmartHTTPClient) ReceivePack(repo *pb.Repository, glId string, glR
errC
:=
make
(
chan
error
,
numStreams
)
errC
:=
make
(
chan
error
,
numStreams
)
go
func
()
{
go
func
()
{
rr
:=
pbhelper
.
NewReceive
Reader
(
func
()
([]
byte
,
error
)
{
rr
:=
streamio
.
New
Reader
(
func
()
([]
byte
,
error
)
{
response
,
err
:=
stream
.
Recv
()
response
,
err
:=
stream
.
Recv
()
return
response
.
GetData
(),
err
return
response
.
GetData
(),
err
})
})
...
@@ -67,7 +72,7 @@ func (client *SmartHTTPClient) ReceivePack(repo *pb.Repository, glId string, glR
...
@@ -67,7 +72,7 @@ func (client *SmartHTTPClient) ReceivePack(repo *pb.Repository, glId string, glR
}()
}()
go
func
()
{
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
})
return
stream
.
Send
(
&
pb
.
PostReceivePackRequest
{
Data
:
data
})
})
})
_
,
err
:=
io
.
Copy
(
sw
,
clientRequest
)
_
,
err
:=
io
.
Copy
(
sw
,
clientRequest
)
...
@@ -105,7 +110,7 @@ func (client *SmartHTTPClient) UploadPack(repo *pb.Repository, clientRequest io.
...
@@ -105,7 +110,7 @@ func (client *SmartHTTPClient) UploadPack(repo *pb.Repository, clientRequest io.
errC
:=
make
(
chan
error
,
numStreams
)
errC
:=
make
(
chan
error
,
numStreams
)
go
func
()
{
go
func
()
{
rr
:=
pbhelper
.
NewReceive
Reader
(
func
()
([]
byte
,
error
)
{
rr
:=
streamio
.
New
Reader
(
func
()
([]
byte
,
error
)
{
response
,
err
:=
stream
.
Recv
()
response
,
err
:=
stream
.
Recv
()
return
response
.
GetData
(),
err
return
response
.
GetData
(),
err
})
})
...
@@ -114,7 +119,7 @@ func (client *SmartHTTPClient) UploadPack(repo *pb.Repository, clientRequest io.
...
@@ -114,7 +119,7 @@ func (client *SmartHTTPClient) UploadPack(repo *pb.Repository, clientRequest io.
}()
}()
go
func
()
{
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
})
return
stream
.
Send
(
&
pb
.
PostUploadPackRequest
{
Data
:
data
})
})
})
_
,
err
:=
io
.
Copy
(
sw
,
clientRequest
)
_
,
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,
...
@@ -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
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
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
Copyright (c) 2016 Masahiro Sano
MIT License
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
(
import
(
"io"
"io"
)
)
// NewRe
ceiveReader turns receiver into an io.Reader. Errors from the
// NewRe
ader turns receiver into an io.Reader. Errors from the receiver
//
receiver function are passed on unmodified. This means receiver should
//
function are passed on unmodified. This means receiver should emit
//
emit
io.EOF when done.
// io.EOF when done.
func
NewRe
ceiveRe
ader
(
receiver
func
()
([]
byte
,
error
))
io
.
Reader
{
func
NewReader
(
receiver
func
()
([]
byte
,
error
))
io
.
Reader
{
return
&
receiveReader
{
receiver
:
receiver
}
return
&
receiveReader
{
receiver
:
receiver
}
}
}
...
@@ -29,9 +29,9 @@ func (rr *receiveReader) Read(p []byte) (int, error) {
...
@@ -29,9 +29,9 @@ func (rr *receiveReader) Read(p []byte) (int, error) {
return
n
,
nil
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).
// 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
}
return
&
sendWriter
{
sender
:
sender
}
}
}
...
...
vendor/vendor.json
View file @
fadf660e
...
@@ -135,21 +135,21 @@
...
@@ -135,21 +135,21 @@
"version"
:
"v0.9.0"
,
"version"
:
"v0.9.0"
,
"versionExact"
:
"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="
,
"checksumSHA1"
:
"dUHJbKas746n5fLzlwxHb6FOCxs="
,
"path"
:
"gitlab.com/gitlab-org/gitaly/auth"
,
"path"
:
"gitlab.com/gitlab-org/gitaly/auth"
,
"revision"
:
"b933e5ce4843ec6c332a0184afb8e69820cc9050"
,
"revision"
:
"e4f8d3d14cc3fe673cb511fb4d0189b68a158ccd"
,
"revisionTime"
:
"2017-06-22T09:36:09Z"
,
"revisionTime"
:
"2017-06-30T12:58:40Z"
,
"version"
:
"v0.13.0"
,
"version"
:
"v0.14.0"
,
"versionExact"
:
"v0.13.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="
,
"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