Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add execute response wrappers and fit db http apis with ccore #69

Merged
merged 25 commits into from
Jan 10, 2022
Merged

Add execute response wrappers and fit db http apis with ccore #69

merged 25 commits into from
Jan 10, 2022

Conversation

freekatz
Copy link
Contributor

No description provided.

ErrUnsupportedVersion = errors.New("unsupported version")
ErrUnsupported = errors.New("unsupported")
ErrNoEndpoints = errors.New("no endpoints")
ErrVersionEstimateFailed = errors.New("version infer failed")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ErrUnsupportedVersion? And why use the different words Estimate and infer ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will use infer to replace the estimate

Comment on lines 12 to 14
V2_5,
V2_6,
V3_0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give priority to the higher version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, ok.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 4 to 12
"encoding/json"
"github.com/astaxie/beego/logs"
"github.com/vesoft-inc/nebula-http-gateway/ccore/nebula/types"
"github.com/vesoft-inc/nebula-http-gateway/ccore/service/pool"

"github.com/astaxie/beego"
"github.com/vesoft-inc/nebula-http-gateway/ccore/nebula"
"github.com/vesoft-inc/nebula-http-gateway/ccore/service/dao"
"github.com/vesoft-inc/nebula-http-gateway/common"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import group, std, vesoft then others.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

nsid, err := dao.Connect(params.Address, params.Port, params.Username, params.Password)

if params.Version == "" {
version, err := nebula.VersionHelper(params.Address, params.Port, params.Username, params.Password)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about auto infer version into nebula pkg?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, It's better.

}

func Execute(nsid string, gql string) (result ExecuteResult, err error) {
result = ExecuteResult{
func Execute(nsid string, gql string) (ExecuteResult, interface{}, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why return a new interface{} value? And the interface{} is unclear, the caller is confused about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the returned interface{} is the runtime panic error. I will add code commit later.

@@ -0,0 +1,149 @@
package pool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move service to ccore/nebula/gataway?

I think it's temporary, and will add Manager to manager client in ccore/nebula pkg.

ccore
    nebula
        gateway
            pool
            dao

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Comment on lines 39 to 45
resp, err := c.graph.VerifyClientVersion()
if err != nil {
return fmt.Errorf("failed to verify client version: %s", err.Error())
}
if resp != nil && resp.ErrorCode != nerrors.ErrorCode_SUCCEEDED {
return fmt.Errorf("incompatible version between client and server: %s", string(resp.ErrorMsg))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return ErrVersionConflict if version conflicts, nor return the raw err?

Copy link
Contributor

@veezhang veezhang Dec 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And auto check the next version only if err is ErrVersionConflict.

@freekatz freekatz requested a review from hetao92 January 4, 2022 13:53
@@ -6,4 +6,5 @@ var (
ErrUnsupportedVersion = errors.New("unsupported version")
ErrUnsupported = errors.New("unsupported")
ErrNoEndpoints = errors.New("no endpoints")
ErrMethodNotSupported = errors.New("method not supported")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ErrUnsupported?

//nebula.Version2_5,
//nebula.Version2_6,
//nebula.Version3_0,
nebula.VersionAuto,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Range multi connection info?

"github.com/vesoft-inc/nebula-http-gateway/ccore/nebula/types"
"github.com/vesoft-inc/nebula-http-gateway/ccore/nebula/wrapper"
"log"
"strings"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sort import group ? std, vesoft and then others.

Comment on lines 22 to 34
//NewNSetBuilder() types.NSetBuilder
//NewGeographyBuilder() types.GeographyBuilder
//NewTagBuilder() types.TagBuilder
//NewStepBuilder() types.StepBuilder
//NewPointBuilder() types.PointBuilder
//NewLineStringBuilder() types.LineStringBuilder
//NewPolygonBuilder() types.PolygonBuilder
//NewCoordinateBuilder() types.CoordinateBuilder
//NewPlanDescriptionBuilder() types.PlanDescriptionBuilder
//NewPlanNodeDescriptionBuilder() types.PlanNodeDescriptionBuilder
//NewPairBuilder() types.PairBuilder
//NewProfilingStatsBuilder() types.ProfilingStatsBuilder
//NewPlanNodeBranchInfoBuilder() types.PlanNodeBranchInfoBuilder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it if no more use.

veezhang
veezhang previously approved these changes Jan 10, 2022
Copy link
Contributor

@veezhang veezhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@veezhang veezhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@veezhang veezhang merged commit 26a3128 into vesoft-inc:master Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants