good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pggat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gfx
pggat
Commits
26c54bd9
Commit
26c54bd9
authored
2 years ago
by
Garet Halliday
Browse files
Options
Downloads
Patches
Plain Diff
clean up
parent
367af814
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/gat/gatling/client/client.go
+0
-127
0 additions, 127 deletions
lib/gat/gatling/client/client.go
lib/gat/gatling/conn_pool/conn_pool.go
+3
-0
3 additions, 0 deletions
lib/gat/gatling/conn_pool/conn_pool.go
with
3 additions
and
127 deletions
lib/gat/gatling/client/client.go
+
0
−
127
View file @
26c54bd9
...
...
@@ -348,133 +348,6 @@ func (c *Client) handle_function(ctx context.Context, f *protocol.FunctionCall)
return
err
}
/*
func (c *Client) handle_query(ctx context.Context, q *protocol.Query) error {
// TODO extract query and do stuff based on it
_, err := q.Write(c.server.wr)
if err != nil {
return err
}
for {
var rsp protocol.Packet
rsp, err = protocol.ReadBackend(c.server.r)
if err != nil {
return err
}
switch r := rsp.(type) {
case *protocol.ReadyForQuery:
if r.Fields.Status == 'I' {
_, err = r.Write(c.wr)
if err != nil {
return err
}
return nil
}
case *protocol.CopyInResponse, *protocol.CopyOutResponse, *protocol.CopyBothResponse:
err = c.handle_copy(ctx, rsp)
if err != nil {
return err
}
continue
}
_, err = rsp.Write(c.wr)
if err != nil {
return err
}
}
}
func (c *Client) handle_function(ctx context.Context, f *protocol.FunctionCall) error {
_, err := f.Write(c.wr)
if err != nil {
return err
}
for {
var rsp protocol.Packet
rsp, err = protocol.ReadBackend(c.server.r)
if err != nil {
return err
}
_, err = rsp.Write(c.wr)
if err != nil {
return err
}
if r, ok := rsp.(*protocol.ReadyForQuery); ok {
if r.Fields.Status == 'I' {
break
}
}
}
return nil
}
func (c *Client) handle_copy(ctx context.Context, p protocol.Packet) error {
_, err := p.Write(c.wr)
if err != nil {
return err
}
switch p.(type) {
case *protocol.CopyInResponse:
outer:
for {
var rsp protocol.Packet
rsp, err = protocol.ReadFrontend(c.r)
if err != nil {
return err
}
// forward packet
_, err = rsp.Write(c.server.wr)
if err != nil {
return err
}
switch rsp.(type) {
case *protocol.CopyDone, *protocol.CopyFail:
break outer
}
}
return nil
case *protocol.CopyOutResponse:
for {
var rsp protocol.Packet
rsp, err = protocol.ReadBackend(c.server.r)
if err != nil {
return err
}
// forward packet
_, err = rsp.Write(c.wr)
if err != nil {
return err
}
switch r := rsp.(type) {
case *protocol.CopyDone:
return nil
case *protocol.ErrorResponse:
e := new(error2.Error)
e.Read(r)
return e
}
}
case *protocol.CopyBothResponse:
// TODO fix this filthy hack, instead of going in parallel (like normal), read fields serially
err = c.handle_copy(ctx, new(protocol.CopyInResponse))
if err != nil {
return err
}
err = c.handle_copy(ctx, new(protocol.CopyOutResponse))
if err != nil {
return err
}
return nil
default:
panic("unreachable")
}
}
*/
func
(
c
*
Client
)
Send
(
pkt
protocol
.
Packet
)
error
{
_
,
err
:=
pkt
.
Write
(
c
.
wr
)
return
err
...
...
This diff is collapsed.
Click to expand it.
lib/gat/gatling/conn_pool/conn_pool.go
+
3
−
0
View file @
26c54bd9
...
...
@@ -226,6 +226,9 @@ func (c *ConnectionPool) GetServerInfo() []*protocol.ParameterStatus {
}
func
(
c
*
ConnectionPool
)
Query
(
client
gat
.
Client
,
ctx
context
.
Context
,
q
string
)
(
context
.
Context
,
error
)
{
// note: these deadlines aren't the time to complete the query, that should be controlled by postgres
// instead, this is the amount of time we allow the client to send extra data for a command
// (mainly so the server doesn't hang indefinitely waiting for client data)
cmdCtx
,
done
:=
context
.
WithDeadline
(
ctx
,
time
.
Now
()
.
Add
(
1
*
time
.
Second
))
c
.
queries
<-
request
[
string
]{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment