generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from layer5io/kumarabd/feature/resync
changes for resync
- Loading branch information
Showing
14 changed files
with
181 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package channels | ||
|
||
import "github.com/layer5io/meshkit/broker" | ||
|
||
var ( | ||
BrokerPublish = "broker-publish" | ||
BrokerSubscribe = "broker-subscribe" | ||
) | ||
|
||
type BrokerPublishPayload struct { | ||
Subject string | ||
Data *broker.Message | ||
} | ||
|
||
func NewBrokerSubscribeChannel() BrokerSubscribeChannel { | ||
return make(chan *broker.Message) | ||
} | ||
|
||
type BrokerSubscribeChannel chan *broker.Message | ||
|
||
func (ch BrokerSubscribeChannel) Stop() { | ||
<-ch | ||
} | ||
|
||
func NewBrokerPublishChannel() BrokerPublishChannel { | ||
return make(chan *BrokerPublishPayload) | ||
} | ||
|
||
type BrokerPublishChannel chan *BrokerPublishPayload | ||
|
||
func (ch BrokerPublishChannel) Stop() { | ||
<-ch | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package channels | ||
|
||
type GenericChannel interface { | ||
Stop() | ||
} | ||
|
||
func NewChannelPool() map[string]GenericChannel { | ||
return map[string]GenericChannel{ | ||
Stop: NewStopChannel(), | ||
OS: NewOSChannel(), | ||
ReSync: NewReSyncChannel(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package channels | ||
|
||
const ( | ||
Struct = "struct" | ||
) | ||
|
||
func NewStructChannel() StructChannel { | ||
return make(chan struct{}) | ||
} | ||
|
||
type StructChannel chan struct{} | ||
|
||
func (ch StructChannel) Stop() { | ||
<-ch | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package channels | ||
|
||
import "os" | ||
|
||
var ( | ||
OS = "os" | ||
Stop = "stop" | ||
ReSync = "resync" | ||
) | ||
|
||
func NewStopChannel() StopChannel { | ||
return make(chan struct{}) | ||
} | ||
|
||
type StopChannel chan struct{} | ||
|
||
func (ch StopChannel) Stop() { | ||
<-ch | ||
} | ||
|
||
func NewOSChannel() OSChannel { | ||
return make(chan os.Signal, 1) | ||
} | ||
|
||
type OSChannel chan os.Signal | ||
|
||
func (ch OSChannel) Stop() { | ||
<-ch | ||
} | ||
|
||
func NewReSyncChannel() ReSyncChannel { | ||
return make(chan struct{}) | ||
} | ||
|
||
type ReSyncChannel chan struct{} | ||
|
||
func (ch ReSyncChannel) Stop() { | ||
<-ch | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package meshsync | ||
|
||
import ( | ||
"github.com/layer5io/meshsync/internal/config" | ||
"github.com/layer5io/meshsync/internal/pipeline" | ||
) | ||
|
||
func (h *Handler) startDiscovery(pipelineCh chan struct{}) { | ||
pipelineConfigs := make(map[string]config.PipelineConfigs, 10) | ||
err := h.Config.GetObject(config.ResourcesKey, &pipelineConfigs) | ||
if err != nil { | ||
h.Log.Error(ErrGetObject(err)) | ||
} | ||
|
||
h.Log.Info("Pipeline started") | ||
pl := pipeline.New(h.Log, h.informer, h.Broker, pipelineConfigs, pipelineCh) | ||
result := pl.Run() | ||
if result.Error != nil { | ||
h.Log.Error(ErrNewPipeline(result.Error)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package model | ||
|
||
type ExecRequest struct { | ||
ID string `json:"id,omitempty"` | ||
Name string `json:"name,omitempty"` | ||
Namespace string `json:"namespace,omitempty"` | ||
Container string `json:"container,omitempty"` | ||
Stop bool `json:"stop,omitempty"` | ||
} | ||
|
||
type ExecObject struct { | ||
ID string `json:"id,omitempty"` | ||
Data string `json:"data,omitempty"` | ||
} | ||
|
||
type ExecRequests map[string]ExecRequest |