Skip to content

Commit 14041cb

Browse files
Merge pull request #5 from tianxiaoliang/main
add model
2 parents 433406c + 979a175 commit 14041cb

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

discovery/instance.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ type GetInstancesResponse struct {
6767
Instances []*MicroServiceInstance `protobuf:"bytes,2,rep,name=instances" json:"instances,omitempty"`
6868
}
6969

70+
type GetProviderInstancesRequest struct {
71+
ProviderServiceId string `protobuf:"bytes,1,opt,name=providerServiceId" json:"providerServiceId,omitempty"`
72+
}
73+
7074
type UpdateInstanceStatusRequest struct {
7175
ServiceId string `protobuf:"bytes,1,opt,name=serviceId" json:"serviceId,omitempty"`
7276
InstanceId string `protobuf:"bytes,2,opt,name=instanceId" json:"instanceId,omitempty"`
@@ -109,3 +113,11 @@ type UpdateInstancePropsRequest struct {
109113
type UpdateInstancePropsResponse struct {
110114
Response *Response `protobuf:"bytes,1,opt,name=response" json:"response,omitempty"`
111115
}
116+
117+
type GetAllInstancesRequest struct {
118+
}
119+
120+
type GetAllInstancesResponse struct {
121+
Response *Response `protobuf:"bytes,1,opt,name=response" json:"response,omitempty"`
122+
Instances []*MicroServiceInstance `protobuf:"bytes,2,rep,name=instances" json:"instances,omitempty"`
123+
}

discovery/types.go

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package discovery
1919

20+
import "fmt"
21+
2022
const (
2123
MS_UP string = "UP"
2224
MS_DOWN string = "DOWN"
@@ -105,14 +107,16 @@ type GetServicesInfoResponse struct {
105107

106108
type MicroServiceKey struct {
107109
// Tenant: The format is "{domain}/{project}"
108-
Tenant string `protobuf:"bytes,1,opt,name=tenant" json:"tenant,omitempty"`
109-
// Deprecated: Use Tenant instead
110-
Project string `protobuf:"bytes,2,opt,name=project" json:"project,omitempty"`
110+
Tenant string `protobuf:"bytes,1,opt,name=tenant" json:"tenant,omitempty"`
111+
Environment string `protobuf:"bytes,2,opt,name=environment" json:"environment,omitempty"`
111112
AppId string `protobuf:"bytes,3,opt,name=appId" json:"appId,omitempty"`
112113
ServiceName string `protobuf:"bytes,4,opt,name=serviceName" json:"serviceName,omitempty"`
113-
Version string `protobuf:"bytes,5,opt,name=version" json:"version,omitempty"`
114-
Environment string `protobuf:"bytes,6,opt,name=environment" json:"environment,omitempty"`
115-
Alias string `protobuf:"bytes,7,opt,name=alias" json:"alias,omitempty"`
114+
Alias string `protobuf:"bytes,5,opt,name=alias" json:"alias,omitempty"`
115+
Version string `protobuf:"bytes,6,opt,name=version" json:"version,omitempty"`
116+
}
117+
118+
func (mk *MicroServiceKey) String() string {
119+
return fmt.Sprintf("&{%v %v %v %v %v %v}", mk.Tenant, mk.Environment, mk.AppId, mk.ServiceName, mk.Alias, mk.Version)
116120
}
117121

118122
type FrameWorkProperty struct {
@@ -363,6 +367,10 @@ type ConsumerDependency struct {
363367
Override bool `protobuf:"varint,3,opt,name=override" json:"override,omitempty"`
364368
}
365369

370+
func (cd *ConsumerDependency) String() string {
371+
return fmt.Sprintf("&{%v %v %v}", cd.Consumer, cd.Providers, cd.Override)
372+
}
373+
366374
type CreateDependenciesResponse struct {
367375
Response *Response `protobuf:"bytes,1,opt,name=response" json:"response,omitempty"`
368376
}
@@ -430,3 +438,12 @@ type MicroServiceDependency struct {
430438
type BatchGetInstancesRequest struct {
431439
ServiceIds []string `json:"serviceIds,omitempty"`
432440
}
441+
442+
type GetServiceCountRequest struct {
443+
Domain string `protobuf:"bytes,1,opt,name=domain" json:"domain,omitempty"`
444+
Project string `protobuf:"bytes,2,opt,name=project" json:"project,omitempty"`
445+
}
446+
type GetServiceCountResponse struct {
447+
Response *Response `protobuf:"bytes,1,opt,name=response" json:"response,omitempty"`
448+
Count int64 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"`
449+
}

0 commit comments

Comments
 (0)