Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introducing new api package #383

Merged
merged 26 commits into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fe0e6cd
reorganize folder structure of mesg, api, cli packages. resolves #377
ilgooz Aug 20, 2018
705338d
move task execution logic from interface/grpc/core to api package
ilgooz Aug 20, 2018
2b5d860
move service delete logic from interface/grpc/core to api package
ilgooz Aug 22, 2018
1181f35
move service get logic from interface/grpc/core to api package
ilgooz Aug 22, 2018
10a69ae
move service list logic from interface/grpc/core to api package & min…
ilgooz Aug 22, 2018
5e262da
move event listen logic from interface/grpc/core to api package
ilgooz Aug 22, 2018
1ecb5c6
move result listen logic from interface/grpc/core to api package & ma…
ilgooz Aug 22, 2018
0442316
move service start logic from interface/grpc/core to api package & im…
ilgooz Aug 23, 2018
e839bd9
move service stop logic from interface/grpc/core to api package
ilgooz Aug 23, 2018
cba99ba
move event emit logic from interface/grpc/service to api package & ma…
ilgooz Aug 23, 2018
844b060
move task listen logic from interface/grpc/service to api package
ilgooz Aug 23, 2018
09cd6f2
move result submit logic from interface/grpc/service to api package
ilgooz Aug 23, 2018
acb71ce
[folder-structure-refactor-fix] update import paths and mesg name as …
ilgooz Aug 23, 2018
6c5adb2
update proto paths in scripts/build-proto.sh
ilgooz Aug 23, 2018
9eef3b9
cosmetic & comment updates on api package
ilgooz Aug 23, 2018
ccece83
api: block ListenX functions until listenings started
ilgooz Aug 24, 2018
b95dcb2
interface/grpc: refactor tests to use features from api package
ilgooz Aug 24, 2018
2546bd5
add comments to dev-core script
ilgooz Aug 24, 2018
df406f2
api: improve comments
ilgooz Aug 24, 2018
7522248
re-organize service-test-x testing services
ilgooz Aug 24, 2018
337f162
merge dev
ilgooz Aug 27, 2018
b1faf66
merge dev
ilgooz Aug 27, 2018
bdecfaf
fix logrus import path
ilgooz Aug 27, 2018
9961a3b
ignore test folder from static code analytic tools
antho1404 Aug 27, 2018
8a776f0
Generate proto
NicolasMahe Aug 28, 2018
7d7111b
Fix path to cli in script build-cli
NicolasMahe Aug 28, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ exclude_paths:
- "service/importer/assets/*.go"
- "cmd/service/assets/*.go"
- "cmd/service/tests/**/*"
- "service-test/**"
- "docs/**"
- "vendor/**/*"
1 change: 1 addition & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ exclude_patterns:
- "service/importer/assets/*.go"
- "cmd/service/assets/*.go"
- "cmd/service/tests/**/*"
- "service-test/**"
- "docs/**/*"
- "**/vendor/"
plugins:
Expand Down
26 changes: 13 additions & 13 deletions mesg/mesg.go → api/api.go
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
package mesg
package api

import "github.com/mesg-foundation/core/container"

// MESG gives all functionalies of MESG core.
type MESG struct {
// API exposes all functionalies of MESG core.
type API struct {
container *container.Container
}

// Option is a configuration func for MESG.
type Option func(*MESG)
type Option func(*API)

// New creates a new MESG with given options.
func New(options ...Option) (*MESG, error) {
m := &MESG{}
// New creates a new API with given options.
func New(options ...Option) (*API, error) {
a := &API{}
for _, option := range options {
option(m)
option(a)
}
var err error
if m.container == nil {
m.container, err = container.New()
if a.container == nil {
a.container, err = container.New()
if err != nil {
return nil, err
}
}
return m, nil
return a, nil
}

// ContainerOption configures underlying container access API.
func ContainerOption(container *container.Container) Option {
return func(m *MESG) {
m.container = container
return func(a *API) {
a.container = container
}
}
8 changes: 4 additions & 4 deletions mesg/mesg_test.go → api/api_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mesg
package api

import (
"testing"
Expand All @@ -8,14 +8,14 @@ import (
"github.com/stretchr/testify/require"
)

func newMESGAndDockerTest(t *testing.T) (*MESG, *dockertest.Testing) {
func newAPIAndDockerTest(t *testing.T) (*API, *dockertest.Testing) {
dt := dockertest.New()

container, err := container.New(container.ClientOption(dt.Client()))
require.Nil(t, err)

m, err := New(ContainerOption(container))
a, err := New(ContainerOption(container))
require.Nil(t, err)

return m, dt
return a, dt
}
38 changes: 0 additions & 38 deletions api/core/core_test.go

This file was deleted.

22 changes: 0 additions & 22 deletions api/core/delete.go

This file was deleted.

30 changes: 0 additions & 30 deletions api/core/delete_test.go

This file was deleted.

10 changes: 0 additions & 10 deletions api/core/error.go

This file was deleted.

12 changes: 0 additions & 12 deletions api/core/error_test.go

This file was deleted.

54 changes: 0 additions & 54 deletions api/core/execute.go

This file was deleted.

Loading