-
Notifications
You must be signed in to change notification settings - Fork 21
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
add meta api #78
Conversation
kqzh
commented
Jan 13, 2022
•
edited
Loading
edited
- ADD HOSTS
- DROP HOSTS
- LIST SPACES
- BALANCE
return nil, err | ||
} | ||
|
||
return newListSpacesResponseWrapper(resp.Spaces), codeErrorIfHappened(resp.Code, []byte(nthrift.ErrorCodeToName[resp.Code])) |
There was a problem hiding this comment.
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
ccore/nebula/client_meta.go
Outdated
|
||
type ( | ||
MetaClient interface { | ||
Open() error | ||
AddHosts(endpoints []string) error | ||
DropHosts(endpoints []string) error | ||
ListSpaces() (types.ListSpacesResponse, error) |
There was a problem hiding this comment.
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)
?
ccore/nebula/client_meta.go
Outdated
AddHosts(endpoints []string) error | ||
DropHosts(endpoints []string) error | ||
ListSpaces() (types.ListSpacesResponse, error) | ||
SubmitJobBalance(space string, endpoints ...string) error |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort it?
ccore/nebula/types/driver.go
Outdated
Spaces interface { | ||
GetSpaceNames() []string | ||
} |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename it to balanceData
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM