-
Notifications
You must be signed in to change notification settings - Fork 8
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
Refactor the field of network entity. #32
Conversation
src/server/handler_network_test.go
Outdated
@@ -7,6 +7,7 @@ import ( | |||
"strings" | |||
"testing" | |||
|
|||
"github.com/docker/docker/pkg/namesgenerator" |
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.
github.com/moby/moby/pkg/namesgenerator
and don't forget add to vendor.json
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.
it already add.
src/server/handler_network.go
Outdated
@@ -28,6 +28,10 @@ func CreateNetworkHandler(ctx *web.Context) { | |||
} | |||
|
|||
session := as.Mongo.NewSession() | |||
session.C(entity.NetworkCollectionName).EnsureIndex(mgo.Index{ |
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.
according to document
Deprecated since version 3.0.0: db.collection.ensureIndex() is now an alias for db.collection.createIndex().
does mgo support createIndex()
?
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.
on, only ensureIndex.
src/entity/network.go
Outdated
@@ -18,8 +18,7 @@ type PhysicalPort struct { | |||
|
|||
type Network struct { | |||
ID bson.ObjectId `bson:"_id,omitempty" json:"id"` | |||
DisplayName string `bson:"displayName" json:"displayName"` | |||
BridgeName string `bson:"bridgeName" json:"bridgeName"` | |||
Name string `bson:"name" json:"name"` | |||
BridgeType string `bson:"bridgeType" json:"bridgeType"` | |||
Node string `bson:"node" json:"node"` |
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.
we could use NodeName
here
src/entity/network.go
Outdated
@@ -18,8 +18,7 @@ type PhysicalPort struct { | |||
|
|||
type Network struct { | |||
ID bson.ObjectId `bson:"_id,omitempty" json:"id"` | |||
DisplayName string `bson:"displayName" json:"displayName"` | |||
BridgeName string `bson:"bridgeName" json:"bridgeName"` | |||
Name string `bson:"name" json:"name"` |
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.
Is this BridgeName
?
src/entity/network.go
Outdated
BridgeName string `bson:"bridgeName" json:"bridgeName"` | ||
BridgeType string `bson:"bridgeType" json:"bridgeType"` | ||
Node string `bson:"node" json:"node"` | ||
NodeName string `bson:"node" json:"node"` |
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.
bson:"nodeName" json:"nodeName"
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.
話說目前除了 Bridge/OVS 外,還有其他的網路可能性嗎?
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.
目前只支援這兩個虛擬交換機吧. 但這個留言是想說你的bson沒改到
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.
恩恩,我有看到lol,那我們就先暫時只支援交換機類型的,之後要別的類型要在改
Codecov Report
@@ Coverage Diff @@
## develop #32 +/- ##
============================================
+ Coverage 62.32% 76.38% +14.06%
============================================
Files 14 13 -1
Lines 361 288 -73
============================================
- Hits 225 220 -5
+ Misses 124 60 -64
+ Partials 12 8 -4
Continue to review full report at Codecov.
|
.... 我晚點修一下這個,重開 |
這是推錯嗎? 看起來怪怪的 |
@John-Lin fix to |
Refactor the field of network entity. Former-commit-id: 943f4232d65b8024df1353b9b339a3c657711a3f [formerly 253e7e4] Former-commit-id: 491c1a812f15fd4d30d7e446231888dffdc3aad9
Refactor the field of network entity.
We replace the "BridgeName" and "DisplayName" by "Name" now.
Use can create duplicated name on different node but can't in the same node.