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
`import sys` | |
#![generate_frame_event] | |
fn main { | |
var hsm:# = #HierarchicalStateMachine() | |
hsm.start() | |
hsm.stop() | |
} |
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
func (m *trafficLightManagerStruct) initTrafficLight() { | |
sendMessage("sendResponseToUI", "begin", "", "true") | |
time.Sleep(1 * time.Second) | |
} | |
func (m *trafficLightManagerStruct) startFlashingTimer() { | |
sendMessage("timerEvent", "startFlashingTimer", "", "") | |
} |
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
func (m *trafficLightStruct) initTrafficLight() { | |
m._manager_.InitTrafficLight() | |
} | |
func (m *trafficLightStruct) startWorkingTimer() { | |
m._manager_.StartWorkingTimer() | |
} |
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
func init() { | |
// For testing | |
cloudFunctionID = strconv.FormatInt(time.Now().UTC().UnixNano(), 10) | |
log.Println("A new cloud function is being inilialized: ", cloudFunctionID) | |
// err is pre-declared to avoid shadowing client. | |
var err error | |
// client is initialized with context.Background() because it should | |
// persist between function invocations. |
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
func (m *trafficLightMomStruct) getFromRedis() []byte { | |
conn := redisPool.Get() | |
defer conn.Close() | |
data, err := redis.String(conn.Do("GET", userID)) | |
if err != nil { | |
log.Println(err) | |
} | |
log.Println("Data Received from Redis for User ", userID, "->", data) |
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
package trafficlight | |
import ( | |
"time" | |
"log" | |
"github.com/gomodule/redigo/redis" | |
) | |
func (m *trafficLightMomStruct) initTrafficLight() { |
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
$Working => $HandleExternalEvents | |
$HandleExternalEvents => $HandleControllerEvents | |
|tick| | |
trafficLight.Tick() -> "Tick" $Save ^ | |
|systemError| | |
trafficLight.SystemError() -> "System\nError" $Save ^ | |
|systemRestart| |
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
``` | |
package trafficlight | |
import ( | |
"github.com/frame-lang/cloudtraffic/cloudtraffic_v2/framelang" | |
) | |
``` | |
#TrafficLightManager >[createWorkflow:bool] |
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
// Package p contains a Pub/Sub Cloud Function. | |
package trafficlight | |
import ( | |
"context" | |
"log" | |
"os" | |
"strconv" | |
"time" |
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
``` | |
package trafficlight | |
import ( | |
"encoding/json" | |
"github.com/frame-lang/cloudtraffic/cloudtraffic_v2/framelang" | |
) | |
``` | |
#[derive(Marshal)] |
NewerOlder