Bläddra i källkod

[refactor, feat] 모스카토 구조체 변경, 매칭 큐 추가

master
extra1563 4 år sedan
förälder
incheckning
2c6e33f05c
1 ändrade filer med 13 tillägg och 19 borttagningar
  1. 13
    19
      src/broker/modules/init.go

+ 13
- 19
src/broker/modules/init.go Visa fil

4
 	"encoding/json"
4
 	"encoding/json"
5
 	"errors"
5
 	"errors"
6
 	"fmt"
6
 	"fmt"
7
-	"github.com/fatih/color"
7
+	_ "github.com/fatih/color"
8
 	"log"
8
 	"log"
9
 	"net"
9
 	"net"
10
 	"net/rpc"
10
 	"net/rpc"
11
 )
11
 )
12
 
12
 
13
 // TODO: RM 처리와 init.go 전반적으로 DI 이용하여 구현 RM 키등록 부분 구현 예정
13
 // TODO: RM 처리와 init.go 전반적으로 DI 이용하여 구현 RM 키등록 부분 구현 예정
14
-//temporary type for matching manager
15
-//type match_manager struct{}
16
-
17
-func (match_mng *match_manager) matching(queue *MsgQueue) {
18
-	//msg := queue.pop(true)
19
-	//Implement here ~~
20
-}
21
-
22
-func (match_mng *match_manager) add_subscription(msg MsgUnit) {
23
-
24
-}
25
-
26
-//temporary type for secure(key) manager
27
-type secure_manager struct{}
28
 
14
 
29
 type Moscato struct {
15
 type Moscato struct {
30
 	queue               MsgQueue
16
 	queue               MsgQueue
17
+	SendQueue			chan myType
31
 	MicroServiceManager NodeManager `inject:""`
18
 	MicroServiceManager NodeManager `inject:""`
32
 	MatchingManager     match_manager
19
 	MatchingManager     match_manager
20
+	Subscriptionmanager	sub_manager
33
 	SecureManager       SecurityManager `inject:""`
21
 	SecureManager       SecurityManager `inject:""`
34
 }
22
 }
35
 
23
 
24
+type myType struct{
25
+	subList	[]string
26
+	pubMsg	MsgUnit
27
+	err		error
28
+}
29
+
36
 type Reply struct {
30
 type Reply struct {
37
 	CompleteLog string
31
 	CompleteLog string
38
 }
32
 }
144
 		moscato.queue.push(msg.(PublishMsg))
138
 		moscato.queue.push(msg.(PublishMsg))
145
 
139
 
146
 	case SM: //Subscription msg
140
 	case SM: //Subscription msg
147
-		moscato.MatchingManager.add_subscription(msg.(*SubscriptionMsg))
141
+		moscato.Subscriptionmanager.addSubscription(msg.(*SubscriptionMsg))
148
 
142
 
149
 	case RM: //Register msg
143
 	case RM: //Register msg
150
 		log.Println("RM received")
144
 		log.Println("RM received")
217
 	}
211
 	}
218
 
212
 
219
 	//go routine -> matching 동작
213
 	//go routine -> matching 동작
220
-	go moscato.MatchingManager.matching(&moscato.queue)
214
+	go moscato.Matching()
221
 	go moscato.CheckQueue()
215
 	go moscato.CheckQueue()
222
 
216
 
223
 	//rpc 등록 -> Receive 함수
217
 	//rpc 등록 -> Receive 함수
228
 	}
222
 	}
229
 
223
 
230
 	go Listen()
224
 	go Listen()
231
-	color.Blue("initializing complete.")
225
+	//color.Blue("initializing complete.")
232
 	fmt.Scanln()
226
 	fmt.Scanln()
233
 }
227
 }
234
 
228
 
254
 		conn, _ := l2.Accept()
248
 		conn, _ := l2.Accept()
255
 		go rpc.ServeConn(conn)
249
 		go rpc.ServeConn(conn)
256
 	}*/
250
 	}*/
257
-}
251
+}

Laddar…
Avbryt
Spara