-
Notifications
You must be signed in to change notification settings - Fork 15
Features register #19
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
Open
githublaohu
wants to merge
13
commits into
bfenetworks:develop
Choose a base branch
from
githublaohu:features-register
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e4a388e
fix(*):1. 基本完成register模块开发,2.完成register-nacos开发
95055e8
pool split
liuqing6767 b8f946a
Merge pull request #1 from liuximu/features-register
githublaohu 97a7ac4
fix(*):按照讨论结果重写设计与开发整个regsiter
404c8df
fix(model,starage,stateful,conf): 完成nacos作为注册中心
e02c95c
回滚配置
09031eb
fix(.gitignore):添加过滤
e4cd5ec
fix(*):1. 异常加强
fca98ea
fix(*):1. 修正命名,2. 配置文件中连接错误
3190310
fix(*):修正命名
28ab6e2
fix(*):修改命名
9577254
fix(*):修改命名
840c7ce
fix(model):添加pool_manager.go
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,16 +48,18 @@ type OneData struct { | |
| Instances []*Instance `json:"instances" uri:"instances"` | ||
| } | ||
|
|
||
| func NewOneData(pool *icluster_conf.Pool) *OneData { | ||
| func NewOneData(pool *icluster_conf.Pool, pis *icluster_conf.InstancePool) *OneData { | ||
| is := []*Instance{} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is => instances |
||
| for _, one := range pool.Instances { | ||
| is = append(is, &Instance{ | ||
| Hostname: one.HostName, | ||
| IP: one.IP, | ||
| Weight: one.Weight, | ||
| Ports: one.Ports, | ||
| Tags: one.Tags, | ||
| }) | ||
| if pis != nil { | ||
| for _, one := range pis.Instances { | ||
| is = append(is, &Instance{ | ||
| Hostname: one.HostName, | ||
| IP: one.IP, | ||
| Weight: one.Weight, | ||
| Ports: one.Ports, | ||
| Tags: one.Tags, | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| return &OneData{ | ||
|
|
@@ -105,5 +107,9 @@ func OneAction(req *http.Request) (interface{}, error) { | |
| return nil, xerror.WrapRecordNotExist("Instance Pool") | ||
| } | ||
|
|
||
| return NewOneData(one), nil | ||
| manager, err := container.InstancePoolManager.BatchFetchInstances(req.Context(), []*icluster_conf.Pool{one}) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return NewOneData(one, manager[one.Name]), nil | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,24 @@ import ( | |
| "github.com/bfenetworks/api-server/stateful/container" | ||
| ) | ||
|
|
||
| // UpdateParam Request Param | ||
| // AUTO GEN BY ctrl, MODIFY AS U NEED | ||
| type UpdateParam struct { | ||
| Name *string `uri:"instance_pool_name" validate:"required,min=2"` | ||
| Instances []*Instance `json:"instances" validate:"min=1,dive"` | ||
| } | ||
|
|
||
| // AUTO GEN BY ctrl, MODIFY AS U NEED | ||
| func NewUpdateParam(req *http.Request) (*UpdateParam, error) { | ||
| param := &UpdateParam{} | ||
| err := xreq.Bind(req, param) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| return param, err | ||
| } | ||
|
|
||
| // UpdateRoute route | ||
| // AUTO GEN BY ctrl, MODIFY AS U NEED | ||
| var UpdateEndpoint = &xreq.Endpoint{ | ||
|
|
@@ -39,7 +57,7 @@ var _ xreq.Handler = UpdateAction | |
| // UpdateAction action | ||
| // AUTO GEN BY ctrl, MODIFY AS U NEED | ||
| func UpdateAction(req *http.Request) (interface{}, error) { | ||
| param, err := NewUpsertParam(req) | ||
| param, err := NewCreateParam(req) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
@@ -56,11 +74,14 @@ func UpdateAction(req *http.Request) (interface{}, error) { | |
| return nil, xerror.WrapRecordNotExist("Instance Pool") | ||
| } | ||
|
|
||
| err = container.PoolManager.UpdateProductPool(req.Context(), product, one, &icluster_conf.PoolParam{ | ||
| pi := &icluster_conf.InstancePool{ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pi => pool |
||
| Name: one.Name, | ||
| Instances: Instancesc2i(param.Instances), | ||
| }) | ||
|
|
||
| one.Instances = Instancesc2i(param.Instances) | ||
| } | ||
| err = container.InstancePoolManager.UpdateInstances(req.Context(), one, pi) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| return NewOneData(one), err | ||
| return NewOneData(one, pi), nil | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
pis => iPool