From ff09166335a396ec5f90cc0cd92a7e373bee4a7b Mon Sep 17 00:00:00 2001 From: Bruno Bressi Date: Thu, 30 Mar 2023 20:40:36 +0200 Subject: [PATCH] chore: minor corrections (documentation and comments) --- mesh/client.go | 4 ++-- mesh/mesh.go | 6 +++--- mesh/server.go | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mesh/client.go b/mesh/client.go index 77c5472..0b6f4a2 100644 --- a/mesh/client.go +++ b/mesh/client.go @@ -309,11 +309,11 @@ func (m *Mesh) Rtt() { // RTT without handshake rtt := rttEnd.Sub(rttStart) - // safe metrics + // save metrics m.metrics.GetRtt().WithLabelValues(data.SampleName[data.RTT_TOTAL], node.Name).Observe(rttH.Seconds()) m.metrics.GetRtt().WithLabelValues(data.SampleName[data.RTT_REQUEST], node.Name).Observe(rtt.Seconds()) - // safe samples + // save samples m.database.SetSample( &data.Sample{ From: m.setupConfig.Name, diff --git a/mesh/mesh.go b/mesh/mesh.go index c0f1403..0c0c944 100644 --- a/mesh/mesh.go +++ b/mesh/mesh.go @@ -36,7 +36,7 @@ import ( "go.uber.org/zap" ) -// Main struct for the mesh +// Mesh is the internal mesh representation type Mesh struct { // Mesh in-memory datastore database data.Database @@ -70,13 +70,13 @@ type Mesh struct { joinRoutineDone bool } -// A newly discoverd node in the mesh +// NodeDiscovered represents a newly discovered node in the mesh type NodeDiscovered struct { NewNode *meshv1.Node From uint32 // TODO change to name } -// Create a canary bot & mesh with the desired configuration +// CreateCanaryMesh creates a canary bot & mesh with the desired configuration // Use a pre-defined routineConfig with e.g. StandardProductionRoutineConfig() // and define your mesh setup configuration // diff --git a/mesh/server.go b/mesh/server.go index 1300d37..dfbc6f2 100644 --- a/mesh/server.go +++ b/mesh/server.go @@ -40,7 +40,7 @@ import ( grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap" ) -// Mesh server for incomming requests +// MeshServer for incoming requests type MeshServer struct { meshv1.UnimplementedMeshServiceServer metrics metric.Metrics @@ -51,7 +51,7 @@ type MeshServer struct { newNodeDiscovered chan NodeDiscovered } -// RPC if node wants to join the mesh +// JoinMesh allows a node to join the mesh func (s *MeshServer) JoinMesh(ctx context.Context, req *meshv1.Node) (*meshv1.JoinMeshResponse, error) { s.log.Infow("New join mesh request", "node", req.Name) // Check if name of joining node is unique in mesh, let join if state is not ok, let join if target is same