two level routing (based on how network switches work) (#241)

This commit is contained in:
Mike Sawka
2024-08-16 16:49:49 -07:00
committed by GitHub
parent 03587184a0
commit ae7d85630b
5 changed files with 132 additions and 62 deletions
+6
View File
@@ -11,6 +11,12 @@ import (
"github.com/wavetermdev/thenextwave/pkg/waveobj"
)
// command "announce", wshserver.AnnounceCommand
func AnnounceCommand(w *wshutil.WshRpc, data string, opts *wshrpc.RpcOpts) error {
_, err := sendRpcRequestCallHelper[any](w, "announce", data, opts)
return err
}
// command "authenticate", wshserver.AuthenticateCommand
func AuthenticateCommand(w *wshutil.WshRpc, data string, opts *wshrpc.RpcOpts) error {
_, err := sendRpcRequestCallHelper[any](w, "authenticate", data, opts)
+2
View File
@@ -25,6 +25,7 @@ const (
const (
Command_Authenticate = "authenticate"
Command_Announce = "announce" // special (for routing)
Command_Message = "message"
Command_GetMeta = "getmeta"
Command_SetMeta = "setmeta"
@@ -60,6 +61,7 @@ type RespOrErrorUnion[T any] struct {
type WshRpcInterface interface {
AuthenticateCommand(ctx context.Context, data string) error
AnnounceCommand(ctx context.Context, data string) error // (special) announces a new route to the main router
MessageCommand(ctx context.Context, data CommandMessageData) error
GetMetaCommand(ctx context.Context, data CommandGetMetaData) (wstore.MetaMapType, error)