-
Notifications
You must be signed in to change notification settings - Fork 23
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
Showing
15 changed files
with
270 additions
and
55 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
Binary file not shown.
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,32 @@ | ||
package act | ||
|
||
import ( | ||
"log/slog" | ||
|
||
"github.com/anthdm/ffaas/pkg/storage" | ||
"github.com/anthdm/ffaas/pkg/types" | ||
"github.com/anthdm/hollywood/actor" | ||
) | ||
|
||
type Metric struct { | ||
store storage.MetricStore | ||
} | ||
|
||
func NewMetric(store storage.MetricStore) actor.Producer { | ||
return func() actor.Receiver { | ||
return &Metric{ | ||
store: store, | ||
} | ||
} | ||
} | ||
|
||
func (m *Metric) Receive(c *actor.Context) { | ||
switch msg := c.Message().(type) { | ||
case actor.Started: | ||
case actor.Stopped: | ||
case *types.RuntimeMetric: | ||
if err := m.store.CreateRuntimeMetric(msg); err != nil { | ||
slog.Warn("failed to store RuntimeMetric", "err", err) | ||
} | ||
} | ||
} |
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,39 @@ | ||
package act | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/anthdm/hollywood/actor" | ||
) | ||
|
||
const ( | ||
KindRuntimeManager = "runtime_manager" | ||
RuntimeManagerID = "rtm" | ||
) | ||
|
||
type RuntimeStart struct { | ||
pid *actor.PID | ||
} | ||
|
||
type RuntimeManager struct { | ||
runtimes map[string]*actor.PID | ||
} | ||
|
||
func NewRuntimeManager() actor.Producer { | ||
return func() actor.Receiver { | ||
return &RuntimeManager{ | ||
runtimes: make(map[string]*actor.PID), | ||
} | ||
} | ||
} | ||
|
||
func (rm *RuntimeManager) Receive(c *actor.Context) { | ||
switch msg := c.Message().(type) { | ||
case RuntimeStart: | ||
fmt.Println("need to start", msg) | ||
// pid := s.engine.Spawn(act.NewRuntime(w, args, endpointID, deploy.ID, s.metricStore, requestURL), act.KindRuntime) | ||
case actor.Started: | ||
case actor.Stopped: | ||
|
||
} | ||
} |
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
Oops, something went wrong.