This is an automated email from the ASF dual-hosted git repository.

cmorris pushed a commit to branch splitroles-blockchain
in repository https://gitbox.apache.org/repos/asf/incubator-milagro-dta.git


The following commit(s) were added to refs/heads/splitroles-blockchain by this 
push:
     new eb7e448  Remove masterFiduciaryServer references
eb7e448 is described below

commit eb7e4480584422389b27be540d665afe2288d718
Author: Christopher Morris <[email protected]>
AuthorDate: Wed Oct 2 09:49:06 2019 +0100

    Remove masterFiduciaryServer references
---
 cmd/service/main.go           | 10 +----
 pkg/api/client.go             | 93 -------------------------------------------
 pkg/defaultservice/service.go |  5 +--
 plugins/plugin.go             |  3 +-
 4 files changed, 4 insertions(+), 107 deletions(-)

diff --git a/cmd/service/main.go b/cmd/service/main.go
index 5eb56de..286460c 100644
--- a/cmd/service/main.go
+++ b/cmd/service/main.go
@@ -34,7 +34,6 @@ import (
        "github.com/apache/incubator-milagro-dta/libs/ipfs"
        "github.com/apache/incubator-milagro-dta/libs/logger"
        "github.com/apache/incubator-milagro-dta/libs/transport"
-       "github.com/apache/incubator-milagro-dta/pkg/api"
        "github.com/apache/incubator-milagro-dta/pkg/config"
        "github.com/apache/incubator-milagro-dta/pkg/endpoints"
        "github.com/apache/incubator-milagro-dta/pkg/tendermint"
@@ -100,7 +99,7 @@ func initConfig(args []string) error {
                return errors.Errorf("Invalid service plugin: %v", 
initOptions.ServicePlugin)
        }
 
-       if err := svcPlugin.Init(svcPlugin, logger, rand.Reader, store, 
ipfsConnector, nil, cfg); err != nil {
+       if err := svcPlugin.Init(svcPlugin, logger, rand.Reader, store, 
ipfsConnector, cfg); err != nil {
                return errors.Errorf("init service plugin %s", 
cfg.Plugins.Service)
        }
 
@@ -186,18 +185,13 @@ func startDaemon(args []string) error {
                }
        }
 
-       masterFiduciaryServer, err := 
api.NewHTTPClient(cfg.Node.MasterFiduciaryServer, logger)
-       if err != nil {
-               return errors.Wrap(err, "init custody client")
-       }
-
        //The Server must have a valid ID before starting up
        svcPlugin := plugins.FindServicePlugin(cfg.Plugins.Service)
        if svcPlugin == nil {
                return errors.Errorf("invalid plugin: %v", cfg.Plugins.Service)
        }
 
-       if err := svcPlugin.Init(svcPlugin, logger, rand.Reader, store, 
ipfsConnector, masterFiduciaryServer, cfg); err != nil {
+       if err := svcPlugin.Init(svcPlugin, logger, rand.Reader, store, 
ipfsConnector, cfg); err != nil {
                return errors.Errorf("init service plugin %s", 
cfg.Plugins.Service)
        }
        logger.Info("Service plugin loaded: %s", svcPlugin.Name())
diff --git a/pkg/api/client.go b/pkg/api/client.go
deleted file mode 100644
index 86f97a7..0000000
--- a/pkg/api/client.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-/*
-Package api - service integration and contract types
-*/
-package api
-
-import (
-       "context"
-       "net/http"
-
-       "github.com/apache/incubator-milagro-dta/libs/logger"
-       "github.com/apache/incubator-milagro-dta/libs/transport"
-)
-
-var (
-       apiVersion = "v1"
-)
-
-//ClientService - enables service to be mocked
-type ClientService interface {
-       FulfillOrder(tx *BlockChainTX) (string, error)
-       FulfillOrderSecret(req *FulfillOrderSecretRequest) (string, error)
-       Status(token string) (*StatusResponse, error)
-       Dump(tx *BlockChainTX) error
-}
-
-// MilagroClientService - implements Service Interface
-type MilagroClientService struct {
-       endpoints transport.ClientEndpoints
-}
-
-// ClientEndpoints return only the exported endpoints
-func ClientEndpoints() transport.HTTPEndpoints {
-       return transport.HTTPEndpoints{
-               "Status": {
-                       Path:        "/" + apiVersion + "/status",
-                       Method:      http.MethodGet,
-                       NewResponse: func() interface{} { return 
&StatusResponse{} },
-               },
-       }
-}
-
-// NewHTTPClient returns Service backed by an HTTP server living at the remote 
instance
-func NewHTTPClient(instance string, logger *logger.Logger) (ClientService, 
error) {
-       clientEndpoints, err := transport.NewHTTPClient(instance, 
ClientEndpoints(), logger)
-       return MilagroClientService{clientEndpoints}, err
-
-}
-
-//Status - Allows a client to see the status of the server that it is 
connecting too
-func (c MilagroClientService) Status(token string) (*StatusResponse, error) {
-       endpoint := c.endpoints["Status"]
-       ctx := context.Background()
-       ctx = transport.SetJWTAuthHeader(ctx, token)
-
-       s, err := endpoint(ctx, nil)
-       if err != nil {
-               return nil, err
-       }
-       r := s.(*StatusResponse)
-       return r, nil
-}
-
-//FulfillOrderSecret -
-func (c MilagroClientService) FulfillOrderSecret(req 
*FulfillOrderSecretRequest) (string, error) {
-       return "", nil
-}
-
-//FulfillOrder -
-func (c MilagroClientService) FulfillOrder(tx *BlockChainTX) (string, error) {
-       return "", nil
-}
-
-//Dump - send a message to self via chain for display - For 
Debugging/Testing/Dev only
-func (c MilagroClientService) Dump(tx *BlockChainTX) error {
-       return nil
-}
diff --git a/pkg/defaultservice/service.go b/pkg/defaultservice/service.go
index 76101e9..1260a89 100644
--- a/pkg/defaultservice/service.go
+++ b/pkg/defaultservice/service.go
@@ -49,7 +49,6 @@ type Service struct {
        Rng                   io.Reader
        Store                 *datastore.Store
        Ipfs                  ipfs.Connector
-       MasterFiduciaryServer api.ClientService
        nodeID                string
        masterFiduciaryNodeID string
 }
@@ -61,14 +60,12 @@ func NewService() *Service {
 }
 
 // Init sets-up the service options. It's called when the plugin gets 
registered
-func (s *Service) Init(plugin Plugable, logger *logger.Logger, rng io.Reader, 
store *datastore.Store, ipfsConnector ipfs.Connector, masterFiduciaryServer 
api.ClientService, cfg *config.Config) error {
+func (s *Service) Init(plugin Plugable, logger *logger.Logger, rng io.Reader, 
store *datastore.Store, ipfsConnector ipfs.Connector, cfg *config.Config) error 
{
        s.Plugin = plugin
        s.Logger = logger
        s.Rng = rng
        s.Store = store
        s.Ipfs = ipfsConnector
-       s.MasterFiduciaryServer = masterFiduciaryServer
-
        s.SetNodeID(cfg.Node.NodeID)
        s.SetMasterFiduciaryNodeID(cfg.Node.MasterFiduciaryNodeID)
 
diff --git a/plugins/plugin.go b/plugins/plugin.go
index 57f5cd7..c88969a 100644
--- a/plugins/plugin.go
+++ b/plugins/plugin.go
@@ -26,7 +26,6 @@ import (
        "github.com/apache/incubator-milagro-dta/libs/datastore"
        "github.com/apache/incubator-milagro-dta/libs/ipfs"
        "github.com/apache/incubator-milagro-dta/libs/logger"
-       "github.com/apache/incubator-milagro-dta/pkg/api"
        "github.com/apache/incubator-milagro-dta/pkg/config"
        "github.com/apache/incubator-milagro-dta/pkg/defaultservice"
        "github.com/apache/incubator-milagro-dta/pkg/service"
@@ -45,7 +44,7 @@ type ServicePlugin interface {
        defaultservice.Plugable
        service.Service
 
-       Init(plugin defaultservice.Plugable, logger *logger.Logger, rng 
io.Reader, store *datastore.Store, ipfsConnector ipfs.Connector, 
masterFiduciaryServer api.ClientService, cfg *config.Config) error
+       Init(plugin defaultservice.Plugable, logger *logger.Logger, rng 
io.Reader, store *datastore.Store, ipfsConnector ipfs.Connector, cfg 
*config.Config) error
 }
 
 func registerPlugin(p Plugin) {

Reply via email to