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 meta api #78

Merged
merged 1 commit into from
Jan 18, 2022
Merged

add meta api #78

merged 1 commit into from
Jan 18, 2022

Conversation

kqzh
Copy link
Contributor

@kqzh kqzh commented Jan 13, 2022

  • ADD HOSTS
  • DROP HOSTS
  • LIST SPACES
  • BALANCE

@kqzh kqzh requested review from veezhang and freekatz January 13, 2022 11:51
return nil, err
}

return newListSpacesResponseWrapper(resp.Spaces), codeErrorIfHappened(resp.Code, []byte(nthrift.ErrorCodeToName[resp.Code]))
Copy link
Contributor

Choose a reason for hiding this comment

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

Adjust it like this?

if err := codeErrorIfHappened(resp.Code, nil) {
    return nil, err
}
return newListSpacesResponseWrapper(resp.Spaces), nil


type (
MetaClient interface {
Open() error
AddHosts(endpoints []string) error
DropHosts(endpoints []string) error
ListSpaces() (types.ListSpacesResponse, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

ListSpaces() ([]types.Space, error) or ListSpaces() ([]types.SpaceList, error)?

AddHosts(endpoints []string) error
DropHosts(endpoints []string) error
ListSpaces() (types.ListSpacesResponse, error)
SubmitJobBalance(space string, endpoints ...string) error
Copy link
Contributor

@veezhang veezhang Jan 14, 2022

Choose a reason for hiding this comment

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

Use BalanceData instead? client
How about the client api takes the function as the consideration point, and the driver match the nebula?

@@ -1,7 +1,13 @@
package v3_0

import (
nerrors "github.com/vesoft-inc/nebula-http-gateway/ccore/nebula/errors"
Copy link
Contributor

Choose a reason for hiding this comment

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

sort it?

Comment on lines 72 to 74
Spaces interface {
GetSpaceNames() []string
}
Copy link
Contributor

@veezhang veezhang Jan 17, 2022

Choose a reason for hiding this comment

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

How about define it as:

Space interface {
    GetSpaceName() string
}
Spaces []Space

func (s Spaces) GetSpaceNames() []string {
    ...
}

}

func (c *defaultMetaClient) Balance(req types.BalanceReq) (types.Balancer, error) {
return nil, nerrors.ErrUnsupported
Copy link
Contributor

Choose a reason for hiding this comment

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

Add TODO here.


func (c *defaultMetaClient) AddHosts(endpoints []string) error {
hostsToAdd := make([]*nthrift.HostAddr, 0, len(endpoints))
for _, ep := range endpoints {
Copy link
Contributor

Choose a reason for hiding this comment

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

Check it at nebula pkg? And add an func for it?

type BalanceCmd string

const (
BalanceData = BalanceCmd("Balance Data")
Copy link
Contributor

Choose a reason for hiding this comment

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

rename it to balanceData ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

driver used this, so can't private

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 ce0f101 into master Jan 18, 2022
@hetao92 hetao92 deleted the meta_api branch January 19, 2022 02:44
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.

2 participants