Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
service-registry
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
service-registry
Commits
89640375
Commit
89640375
authored
Feb 27, 2024
by
luxq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update query
parent
5d6df477
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
+29
-2
query.go
query/query.go
+2
-0
query_test.go
query/query_test.go
+21
-0
worker.go
query/worker.go
+6
-2
No files found.
query/query.go
View file @
89640375
...
...
@@ -42,6 +42,8 @@ func (s *ServiceQuerier) Select(service common.ServiceType) ServiceQuery {
return
s
.
backendInfoQuery
case
common
.
SERVICE_API_GATEWAY
:
return
s
.
gatewayQuery
case
common
.
SERVICE_WORKER
:
return
s
.
workerQuery
default
:
return
nil
}
...
...
query/query_test.go
0 → 100644
View file @
89640375
package
query
import
(
"github.com/odysseus/service-registry/common"
"github.com/odysseus/service-registry/registry"
"github.com/stretchr/testify/assert"
"testing"
)
func
TestQuery
(
t
*
testing
.
T
)
{
q
:=
NewQuery
(
registry
.
RedisConnParam
{
Addr
:
"localhost:6379"
,
Password
:
""
,
DbIndex
:
0
,
})
nmlistInfo
,
err
:=
q
.
Select
(
common
.
SERVICE_NODE_MANAGER
)
.
List
()
assert
.
Equal
(
t
,
err
,
nil
)
gatewayInfo
,
err
:=
q
.
Select
(
common
.
SERVICE_API_GATEWAY
)
.
ServiceInfo
(
"gateway1"
)
assert
.
Equal
(
t
,
err
,
nil
)
t
.
Logf
(
"nmlistInfo: %v, gatewayInfo: %v"
,
nmlistInfo
,
gatewayInfo
)
}
query/worker.go
View file @
89640375
...
...
@@ -6,8 +6,12 @@ import (
)
type
WorkerInfo
struct
{
Timestamp
int64
`redis:"timestamp" json:"timestamp"`
Endpoint
string
`redis:"endpoint" json:"endpoint"`
Timestamp
int64
`json:"timestamp"`
ActiveNM
[]
string
`json:"active_nm"`
MinerAddress
string
`json:"miner_address"`
BenefitAddress
string
`json:"benefit_address"`
IPs
[]
string
`json:"ip_list"`
Status
string
`json:"status"`
}
func
(
g
WorkerInfo
)
TimeStamp
()
int64
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment