Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Proto Kms
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
Proto Kms
Commits
810bf77f
Commit
810bf77f
authored
1 year ago
by
Martin Stiemerling
Browse files
Options
Downloads
Patches
Plain Diff
Added Functions needed for KMS peer handling
parent
c538ecf3
No related branches found
No related tags found
2 merge requests
!9
First working draft version
,
!6
Added Functions needed for KMS peer handling
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kms/kmspeers.go
+19
-3
19 additions, 3 deletions
kms/kmspeers.go
with
19 additions
and
3 deletions
kms/kmspeers.go
+
19
−
3
View file @
810bf77f
...
@@ -12,20 +12,23 @@ import (
...
@@ -12,20 +12,23 @@ import (
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/credentials/insecure"
)
)
type
k
msPeerStatus
int16
type
K
msPeerStatus
int16
const
(
const
(
kmsPeerUp
k
msPeerStatus
=
iota
// peer was seen up lately
kmsPeerUp
K
msPeerStatus
=
iota
// peer was seen up lately
kmsPeerDown
// peer not reachable anymore
kmsPeerDown
// peer not reachable anymore
kmsPeerPending
// peer was added and has to be succesfully contacted once
kmsPeerPending
// peer was added and has to be succesfully contacted once
kmsPeerUnknown
// not known, not initialized
kmsPeerUnknown
// not known, not initialized
)
)
type
kmsPeerInfo
interface
{
type
kmsPeerInfo
interface
{
GetKmsPeerStatus
()
KmsPeerStatus
GetKmsPeerId
()
uuid
.
UUID
GetKmsPeerQkdiId
()
uint32
}
}
type
kmsPeer
struct
{
type
kmsPeer
struct
{
peerStatus
k
msPeerStatus
peerStatus
K
msPeerStatus
servingQLE
*
QuantumElement
servingQLE
*
QuantumElement
tcpSocket
net
.
TCPAddr
// the IP address and TCP port (aka socket) of the kms peer
tcpSocket
net
.
TCPAddr
// the IP address and TCP port (aka socket) of the kms peer
tcpSocketStr
string
// string rep. of tcpSocket
tcpSocketStr
string
// string rep. of tcpSocket
...
@@ -37,6 +40,7 @@ func NewKmsPeer(servQLE *QuantumElement) (peer kmsPeer) {
...
@@ -37,6 +40,7 @@ func NewKmsPeer(servQLE *QuantumElement) (peer kmsPeer) {
return
kmsPeer
{
return
kmsPeer
{
peerStatus
:
kmsPeerUnknown
,
peerStatus
:
kmsPeerUnknown
,
servingQLE
:
servQLE
,
servingQLE
:
servQLE
,
id
:
uuid
.
New
(),
}
}
}
}
...
@@ -71,3 +75,15 @@ func (ph *kmsPeer) PeerHandler(kmsName string) {
...
@@ -71,3 +75,15 @@ func (ph *kmsPeer) PeerHandler(kmsName string) {
log
.
Printf
(
"Greeting: %s which is now in peerStatus %d"
,
r
.
GetPeerKmsName
(),
ph
.
peerStatus
)
log
.
Printf
(
"Greeting: %s which is now in peerStatus %d"
,
r
.
GetPeerKmsName
(),
ph
.
peerStatus
)
}
}
func
(
ph
*
kmsPeer
)
GetKmsPeerStatus
()
KmsPeerStatus
{
return
ph
.
peerStatus
}
func
(
ph
*
kmsPeer
)
GetKmsPeerId
()
uuid
.
UUID
{
return
ph
.
id
}
func
(
ph
*
kmsPeer
)
GetKmsPeerQkdiId
()
uint32
{
return
uint32
(
ph
.
servingQLE
.
qlID
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment