|
|
@@ -27,8 +27,6 @@ type MsgUnit interface {
|
|
27
|
27
|
ConvertToJson() ([]byte, error)
|
|
28
|
28
|
// CheckType - Message의 타입을 알려줌
|
|
29
|
29
|
CheckType() int
|
|
30
|
|
- // SetType - Message 객체가 생성 되었을때 종류 정하기
|
|
31
|
|
- //SetType(int)
|
|
32
|
30
|
}
|
|
33
|
31
|
|
|
34
|
32
|
//*****각 메세지 형식 및 정의**********
|
|
|
@@ -48,14 +46,16 @@ type KeyShareMsg struct {
|
|
48
|
46
|
//전달할 내용을 담은 메세지
|
|
49
|
47
|
type PublishMsg struct {
|
|
50
|
48
|
Message
|
|
51
|
|
- subscription []int64 //선호도
|
|
|
49
|
+ subscription []int64 //대주제
|
|
52
|
50
|
content []int64 // 내용
|
|
53
|
51
|
}
|
|
54
|
52
|
|
|
55
|
53
|
//구독 정보를 담은 메세지
|
|
56
|
54
|
type SubscriptionMsg struct {
|
|
57
|
55
|
Message
|
|
58
|
|
- subscription []int64 //선호도
|
|
|
56
|
+ subscription []int64 //대주제
|
|
|
57
|
+ content []int64 //내용
|
|
|
58
|
+ value string //범위
|
|
59
|
59
|
}
|
|
60
|
60
|
|
|
61
|
61
|
//Microservice 등록 메세지
|
|
|
@@ -110,27 +110,11 @@ func (msg Message) CheckType() int {
|
|
110
|
110
|
return msg.kind
|
|
111
|
111
|
}
|
|
112
|
112
|
|
|
113
|
|
-/*
|
|
114
|
|
-func (msg Message)SetType(t int){
|
|
115
|
|
- msg.kind=t
|
|
116
|
|
-}
|
|
117
|
|
-
|
|
118
|
|
-func NewMessage() *Message{
|
|
119
|
|
- //m:=&Message{
|
|
120
|
|
- //from: ip
|
|
121
|
|
- //version: version
|
|
122
|
|
- //time : time
|
|
123
|
|
- //kind : kind(종류)
|
|
124
|
|
- //}
|
|
125
|
|
-}
|
|
126
|
|
-*/
|
|
127
|
|
-
|
|
128
|
|
-//*********************************
|
|
129
|
|
-
|
|
130
|
|
-// Send - rpc를 이용하여 msg전송
|
|
131
|
|
-//func (msg *MsgUnit) Send(ipaddr string, message MsgUnit) (error){}
|
|
132
|
|
-
|
|
133
|
|
-// Recieve - rpc를 이용하여 msg전달 받음(rpc call)
|
|
134
|
|
-//func Recieve(msg *MsgUnit) (MsgUnit, error){ }
|
|
135
|
|
-
|
|
136
|
|
-//*********************************
|
|
|
113
|
+//KeyGenMsg 생성자
|
|
|
114
|
+func NewKeyGenMsg(table *MStable) *KeyGenMsg{
|
|
|
115
|
+ m:= &KeyGenMsg{}
|
|
|
116
|
+ for _,value:= range table.NodeTable{
|
|
|
117
|
+ m.iptable=append(m.iptable,value.Getipaddr())
|
|
|
118
|
+ }
|
|
|
119
|
+ return m
|
|
|
120
|
+}
|