Skip to content

Commit 2cb8060

Browse files
committed
[core] Pass to FairMQ tasks abstract namespace endpoint paths
O2-5457 OCTRL-946
1 parent ddb067b commit 2cb8060

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

core/task/channel/endpoint.go

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ import (
3232
"github.com/rs/xid"
3333
)
3434

35-
const ipcPathFormat = "/tmp/o2ipc-%s"
35+
const IPC_PATH_FORMAT = "@o2ipc-%s"
3636

3737
type BindMap map[string]Endpoint
3838

39-
4039
type Endpoint interface {
4140
GetAddressFormat() AddressFormat
4241
GetAddress() string
@@ -68,38 +67,37 @@ func EndpointEquals(e Endpoint, f Endpoint) bool {
6867

6968
func NewTcpEndpoint(host string, port uint64, transport TransportType) Endpoint {
7069
return TcpEndpoint{
71-
Host: host,
72-
Port: port,
70+
Host: host,
71+
Port: port,
7372
Transport: transport,
7473
}
7574
}
7675

7776
func NewBoundTcpEndpoint(port uint64, transport TransportType) Endpoint {
7877
return TcpEndpoint{
79-
Host: "*",
80-
Port: port,
78+
Host: "*",
79+
Port: port,
8180
Transport: transport,
8281
}
8382
}
8483

8584
func NewIpcEndpoint(path string, transport TransportType) Endpoint {
8685
return IpcEndpoint{
87-
Path: strings.TrimPrefix(path, "ipc://"),
86+
Path: strings.TrimPrefix(path, "ipc://"),
8887
Transport: transport,
8988
}
9089
}
9190

9291
func NewBoundIpcEndpoint(transport TransportType) Endpoint {
9392
return IpcEndpoint{
94-
Path: fmt.Sprintf(ipcPathFormat, xid.New().String()),
93+
Path: fmt.Sprintf(IPC_PATH_FORMAT, xid.New().String()),
9594
Transport: transport,
9695
}
9796
}
9897

99-
10098
type TcpEndpoint struct {
101-
Host string
102-
Port uint64
99+
Host string
100+
Port uint64
103101
Transport TransportType
104102
}
105103

@@ -134,9 +132,8 @@ func (t TcpEndpoint) ToBoundEndpoint() Endpoint {
134132
}
135133
}
136134

137-
138135
type IpcEndpoint struct {
139-
Path string
136+
Path string
140137
Transport TransportType
141138
}
142139

@@ -154,14 +151,14 @@ func (t IpcEndpoint) GetTransport() TransportType {
154151

155152
func (t IpcEndpoint) ToTargetEndpoint(_ string) Endpoint {
156153
return IpcEndpoint{
157-
Path: t.Path,
154+
Path: t.Path,
158155
Transport: t.Transport,
159156
}
160157
}
161158

162159
func (t IpcEndpoint) ToBoundEndpoint() Endpoint {
163160
return IpcEndpoint{
164-
Path: t.Path,
161+
Path: t.Path,
165162
Transport: t.Transport,
166163
}
167164
}

0 commit comments

Comments
 (0)