mirror of
https://github.com/singchia/frontier.git
synced 2025-10-05 08:16:55 +08:00
servicebound: finish basic forward logic
This commit is contained in:
@@ -35,7 +35,9 @@ type EdgeInformer interface {
|
||||
type Servicebound interface {
|
||||
ListService() []geminio.End
|
||||
// for management
|
||||
GetService(service string) geminio.End
|
||||
GetServiceByName(service string) geminio.End
|
||||
GetServiceByRPC(rpc string) (geminio.End, error)
|
||||
GetServiceByTopic(topic string) (geminio.End, error)
|
||||
DelSerivces(service string) error
|
||||
}
|
||||
|
||||
@@ -44,3 +46,27 @@ type ServiceInformer interface {
|
||||
ServiceOffline(serviceID uint64, service string, addr net.Addr)
|
||||
ServiceHeartbeat(serviceID uint64, service string, addr net.Addr)
|
||||
}
|
||||
|
||||
// mq related
|
||||
type MQ interface {
|
||||
Produce(topic string, data []byte, opts ...OptionProduce) error
|
||||
}
|
||||
|
||||
type ProduceOption struct {
|
||||
Origin interface{}
|
||||
EdgeID uint64
|
||||
}
|
||||
|
||||
type OptionProduce func(*ProduceOption)
|
||||
|
||||
func WithEdgeID(edgeID uint64) OptionProduce {
|
||||
return func(po *ProduceOption) {
|
||||
po.EdgeID = edgeID
|
||||
}
|
||||
}
|
||||
|
||||
func WithOrigin(origin interface{}) OptionProduce {
|
||||
return func(po *ProduceOption) {
|
||||
po.Origin = origin
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user