mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2025-06-20 19:57:49 +02:00
Added JMESpath to query the state of specific
meshes.
This commit is contained in:
parent
e56780fdd4
commit
aa3d40f82c
@ -2,15 +2,15 @@ package crdt
|
|||||||
|
|
||||||
// MeshNodeCrdt: Represents a CRDT for a mesh nodes
|
// MeshNodeCrdt: Represents a CRDT for a mesh nodes
|
||||||
type MeshNodeCrdt struct {
|
type MeshNodeCrdt struct {
|
||||||
HostEndpoint string `automerge:"hostEndpoint" json:"hostEndpoint"`
|
HostEndpoint string `automerge:"hostEndpoint"`
|
||||||
WgEndpoint string `automerge:"wgEndpoint" json:"wgEndpoint"`
|
WgEndpoint string `automerge:"wgEndpoint"`
|
||||||
PublicKey string `automerge:"publicKey" json:"publicKey"`
|
PublicKey string `automerge:"publicKey"`
|
||||||
WgHost string `automerge:"wgHost" json:"wgHost"`
|
WgHost string `automerge:"wgHost"`
|
||||||
Timestamp int64 `automerge:"timestamp" json:"timestamp"`
|
Timestamp int64 `automerge:"timestamp"`
|
||||||
Routes map[string]interface{} `automerge:"routes" json:"routes"`
|
Routes map[string]interface{} `automerge:"routes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MeshCrdt: Represents the mesh network as a whole
|
// MeshCrdt: Represents the mesh network as a whole
|
||||||
type MeshCrdt struct {
|
type MeshCrdt struct {
|
||||||
Nodes map[string]MeshNodeCrdt `automerge:"nodes" json:"nodes"`
|
Nodes map[string]MeshNodeCrdt `automerge:"nodes"`
|
||||||
}
|
}
|
||||||
|
@ -43,3 +43,15 @@ func MapKeys[K comparable, V any](m map[K]V) []K {
|
|||||||
|
|
||||||
return values
|
return values
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type convert[V1 any, V2 any] func(V1) V2
|
||||||
|
|
||||||
|
func Map[V1 any, V2 any](list []V1, f convert[V1, V2]) []V2 {
|
||||||
|
newList := make([]V2, len(list))
|
||||||
|
|
||||||
|
for i, elem := range list {
|
||||||
|
newList[i] = f(elem)
|
||||||
|
}
|
||||||
|
|
||||||
|
return newList
|
||||||
|
}
|
||||||
|
@ -87,10 +87,12 @@ func (s *SyncServiceImpl) SyncMesh(stream rpc.SyncService_SyncMeshServer) error
|
|||||||
if syncer != nil {
|
if syncer != nil {
|
||||||
syncer.Complete()
|
syncer.Complete()
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSyncService(server *ctrlserver.MeshCtrlServer) *SyncServiceImpl {
|
func NewSyncService(server *ctrlserver.MeshCtrlServer) *SyncServiceImpl {
|
||||||
return &SyncServiceImpl{Server: server}
|
return &SyncServiceImpl{Server: server}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user