forked from distribworks/dkron
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Victor Castell
committed
Oct 19, 2016
1 parent
744dff5
commit 963eb63
Showing
16 changed files
with
98 additions
and
100 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,11 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/victorcoder/dkron/dkron" | ||
) | ||
|
||
type LogOutput struct{} | ||
|
||
func (l *LogOutput) Process(execution *dkron.Execution) *dkron.Execution { | ||
return execution | ||
} |
File renamed without changes.
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,5 @@ | ||
package dkron | ||
|
||
type ExecutionProcessor interface { | ||
Process(execution *Execution) *Execution | ||
} |
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 was deleted.
Oops, something went wrong.
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,51 @@ | ||
package plugin | ||
|
||
import ( | ||
"net/rpc" | ||
|
||
"github.com/hashicorp/go-plugin" | ||
"github.com/victorcoder/dkron/dkron" | ||
) | ||
|
||
type ExecutionProcessorPlugin struct { | ||
Processor dkron.ExecutionProcessor | ||
} | ||
|
||
func (p *ExecutionProcessorPlugin) Server(b *plugin.MuxBroker) (interface{}, error) { | ||
return &ExecutionProcessorServer{Broker: b, Impl: p.Processor}, nil | ||
} | ||
|
||
func (p *ExecutionProcessorPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error) { | ||
return &Outputter{Broker: b, Client: c}, nil | ||
} | ||
|
||
// Here is an implementation that talks over RPC | ||
type ExecutionProcessor struct { | ||
Broker *plugin.MuxBroker | ||
Client *rpc.Client | ||
} | ||
|
||
func (e *ExecutionProcessor) Process(execution *dkron.Execution) *dkron.Execution { | ||
var resp dkron.Execution | ||
err := e.Client.Call("Plugin.Process", execution, &resp) | ||
if err != nil { | ||
// You usually want your interfaces to return errors. If they don't, | ||
// there isn't much other choice here. | ||
panic(err) | ||
} | ||
|
||
return resp | ||
} | ||
|
||
// Here is the RPC server that Outputter talks to, conforming to | ||
// the requirements of net/rpc | ||
type ExecutionProcessorServer struct { | ||
// This is the real implementation | ||
Broker *plugin.MuxBroker | ||
Processor dkron.ExecutionProcessor | ||
} | ||
|
||
func (e *ExecutionProcessorServer) Process(execution *dkron.Execution, resp *dkron.ExecutionProcessor) error { | ||
*resp = s.Processor.Process(execution) | ||
return nil | ||
} |
This file was deleted.
Oops, something went wrong.
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