Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
Cloud
MAS
clonemap
Commits
c3af3514
Commit
c3af3514
authored
Feb 05, 2021
by
Stefan Dähling
Browse files
move ams cli back to separate pkg
parent
f825ae60
Pipeline
#404899
passed with stages
in 5 minutes and 15 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
build/docker/agency/Dockerfile
View file @
c3af3514
...
...
@@ -48,7 +48,7 @@ COPY go.sum .
RUN
go mod download
COPY
cmd/agency cmd/agency
COPY
pkg/agency pkg/agency
COPY
pkg/ams pkg/ams
COPY
pkg/ams
/client
pkg/ams
/client
COPY
pkg/logger/client pkg/logger/client
COPY
pkg/df/client pkg/df/client
COPY
pkg/schemas pkg/schemas
...
...
build/docker/benchmark/Dockerfile
View file @
c3af3514
...
...
@@ -47,7 +47,7 @@ COPY go.mod .
COPY
go.sum .
RUN
go mod download
COPY
pkg/agency pkg/agency
COPY
pkg/ams pkg/ams
COPY
pkg/ams
/client
pkg/ams
/client
COPY
pkg/logger/client pkg/logger/client
COPY
pkg/df/client pkg/df/client
COPY
pkg/schemas pkg/schemas
...
...
build/docker/frontend/Dockerfile
View file @
c3af3514
...
...
@@ -50,7 +50,7 @@ COPY cmd/frontend cmd/frontend
COPY
pkg/frontend pkg/frontend
COPY
pkg/common pkg/common
COPY
pkg/schemas pkg/schemas
COPY
pkg/ams pkg/ams
COPY
pkg/ams
/client
pkg/ams
/client
COPY
pkg/df/client pkg/df/client
COPY
pkg/logger/client pkg/logger/client
COPY
web web
...
...
build/docker/plugnplay/Dockerfile
View file @
c3af3514
...
...
@@ -48,7 +48,7 @@ COPY go.sum .
RUN
go mod download
COPY
cmd/plugnplay cmd/plugnplay
COPY
pkg/plugnplay pkg/plugnplay
COPY
pkg/ams pkg/ams
COPY
pkg/ams
/client
pkg/ams
/client
COPY
pkg/schemas pkg/schemas
COPY
pkg/common pkg/common
ENV
PATH="/clonemap:${PATH}"
...
...
pkg/agency/agency.go
View file @
c3af3514
...
...
@@ -58,7 +58,7 @@ import (
"syscall"
"time"
"git.rwth-aachen.de/acs/public/cloud/mas/clonemap/pkg/ams"
amscli
"git.rwth-aachen.de/acs/public/cloud/mas/clonemap/pkg/ams
/client
"
"git.rwth-aachen.de/acs/public/cloud/mas/clonemap/pkg/schemas"
"git.rwth-aachen.de/acs/public/cloud/mas/clonemap/pkg/status"
)
...
...
@@ -75,7 +75,7 @@ type Agency struct {
msgIn
chan
[]
schemas
.
ACLMessage
logger
*
loggerClient
mqtt
*
mqttClient
amsClient
*
ams
.
Client
amsClient
*
ams
cli
.
Client
logInfo
*
log
.
Logger
// logger for info logging
logError
*
log
.
Logger
// logger for error logging
}
...
...
@@ -89,7 +89,7 @@ func StartAgency(task func(*Agent) error) (err error) {
remoteAgents
:
make
(
map
[
int
]
*
Agent
),
remoteAgencies
:
make
(
map
[
string
]
*
remoteAgency
),
msgIn
:
make
(
chan
[]
schemas
.
ACLMessage
,
1000
),
amsClient
:
ams
.
New
Client
(
time
.
Second
*
60
,
time
.
Second
*
1
,
4
),
amsClient
:
ams
cli
.
New
(
time
.
Second
*
60
,
time
.
Second
*
1
,
4
),
logError
:
log
.
New
(
os
.
Stderr
,
"[ERROR] "
,
log
.
LstdFlags
),
}
err
=
agency
.
init
()
...
...
pkg/ams/ams_test.go
View file @
c3af3514
...
...
@@ -51,6 +51,7 @@ import (
"testing"
"time"
amscli
"git.rwth-aachen.de/acs/public/cloud/mas/clonemap/pkg/ams/client"
"git.rwth-aachen.de/acs/public/cloud/mas/clonemap/pkg/common/httpreply"
"git.rwth-aachen.de/acs/public/cloud/mas/clonemap/pkg/schemas"
)
...
...
@@ -113,7 +114,7 @@ func stubHandler(w http.ResponseWriter, r *http.Request) {
// dummyClient makes requests to ams and terminates ams server at end
func
dummyClient
(
s
*
http
.
Server
,
t
*
testing
.
T
)
{
time
.
Sleep
(
time
.
Second
*
1
)
amsClient
:=
NewClient
(
time
.
Second
*
60
,
time
.
Second
*
1
,
4
)
amsClient
:=
amscli
.
New
(
time
.
Second
*
60
,
time
.
Second
*
1
,
4
)
amsClient
.
Host
=
"localhost"
amsClient
.
Port
=
10000
...
...
pkg/ams/client.go
→
pkg/ams/client
/client
.go
View file @
c3af3514
...
...
@@ -42,9 +42,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// contains code for interaction with ams
package
ams
// Package client contains code for interaction with ams
package
client
import
(
"encoding/json"
...
...
@@ -254,8 +253,8 @@ func (cli *Client) prefix() (ret string) {
return
}
// New
Client
creates a new AMS client
func
New
Client
(
timeout
time
.
Duration
,
del
time
.
Duration
,
numRet
int
)
(
cli
*
Client
)
{
// New creates a new AMS client
func
New
(
timeout
time
.
Duration
,
del
time
.
Duration
,
numRet
int
)
(
cli
*
Client
)
{
cli
=
&
Client
{
httpClient
:
&
http
.
Client
{
Timeout
:
timeout
},
Host
:
"ams"
,
...
...
pkg/frontend/frontend.go
View file @
c3af3514
...
...
@@ -47,18 +47,18 @@ package frontend
import
(
"time"
"git.rwth-aachen.de/acs/public/cloud/mas/clonemap/pkg/ams"
amscli
"git.rwth-aachen.de/acs/public/cloud/mas/clonemap/pkg/ams
/client
"
)
// Frontend frontend
type
Frontend
struct
{
amsClient
*
ams
.
Client
amsClient
*
ams
cli
.
Client
}
// StartFrontend start
func
StartFrontend
()
(
err
error
)
{
fe
:=
&
Frontend
{
amsClient
:
ams
.
New
Client
(
time
.
Second
*
60
,
time
.
Second
*
1
,
4
),
amsClient
:
ams
cli
.
New
(
time
.
Second
*
60
,
time
.
Second
*
1
,
4
),
}
fe
.
listen
()
return
...
...
pkg/plugnplay/mqtt.go
View file @
c3af3514
...
...
@@ -51,7 +51,7 @@ import (
"strconv"
"sync"
"git.rwth-aachen.de/acs/public/cloud/mas/clonemap/pkg/ams"
amscli
"git.rwth-aachen.de/acs/public/cloud/mas/clonemap/pkg/ams
/client
"
"git.rwth-aachen.de/acs/public/cloud/mas/clonemap/pkg/schemas"
mqtt
"github.com/eclipse/paho.mqtt.golang"
)
...
...
@@ -65,12 +65,12 @@ type mqttClient struct {
mutex
*
sync
.
Mutex
// mutex for message inbox map
logError
*
log
.
Logger
logInfo
*
log
.
Logger
amsClient
*
ams
.
Client
amsClient
*
ams
cli
.
Client
}
// newMQTTClient creates a new mqtt agency client
func
newMQTTClient
(
svc
string
,
port
int
,
name
string
,
logErr
*
log
.
Logger
,
logInf
*
log
.
Logger
,
amsClient
*
ams
.
Client
)
(
cli
*
mqttClient
)
{
logInf
*
log
.
Logger
,
amsClient
*
ams
cli
.
Client
)
(
cli
*
mqttClient
)
{
cli
=
&
mqttClient
{
brokerSvc
:
svc
,
brokerPort
:
port
,
...
...
pkg/plugnplay/plugnplay.go
View file @
c3af3514
...
...
@@ -54,7 +54,7 @@ import (
"os"
"time"
"git.rwth-aachen.de/acs/public/cloud/mas/clonemap/pkg/ams"
amscli
"git.rwth-aachen.de/acs/public/cloud/mas/clonemap/pkg/ams
/client
"
)
// PnP implements the plug and play mechanism
...
...
@@ -62,14 +62,14 @@ type PnP struct {
logInfo
*
log
.
Logger
// logger for info logging
logError
*
log
.
Logger
// logger for error logging
mqttCli
*
mqttClient
amsClient
*
ams
.
Client
amsClient
*
ams
cli
.
Client
}
// StartPnP starts an PnP instance. It initializes the storage object and starts the API server.
func
StartPnP
()
(
err
error
)
{
pnp
:=
&
PnP
{
logError
:
log
.
New
(
os
.
Stderr
,
"[ERROR] "
,
log
.
LstdFlags
),
amsClient
:
ams
.
New
Client
(
time
.
Second
*
60
,
time
.
Second
*
1
,
4
),
amsClient
:
ams
cli
.
New
(
time
.
Second
*
60
,
time
.
Second
*
1
,
4
),
}
// create storage and deployment object according to specified deployment type
err
=
pnp
.
init
()
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment