github.com/SmartMeshFoundation/Spectrum@v0.0.0-20220621030607-452a266fee1e/dashboard/message.go (about)

     1  // Copyright 2017 The Spectrum Authors
     2  // This file is part of the Spectrum library.
     3  //
     4  // The Spectrum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The Spectrum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the Spectrum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package dashboard
    18  
    19  import "time"
    20  
    21  type Message struct {
    22  	Home    *HomeMessage    `json:"home,omitempty"`
    23  	Chain   *ChainMessage   `json:"chain,omitempty"`
    24  	TxPool  *TxPoolMessage  `json:"txpool,omitempty"`
    25  	Network *NetworkMessage `json:"network,omitempty"`
    26  	System  *SystemMessage  `json:"system,omitempty"`
    27  	Logs    *LogsMessage    `json:"logs,omitempty"`
    28  }
    29  
    30  type HomeMessage struct {
    31  	Memory  *Chart `json:"memory,omitempty"`
    32  	Traffic *Chart `json:"traffic,omitempty"`
    33  }
    34  
    35  type Chart struct {
    36  	History []*ChartEntry `json:"history,omitempty"`
    37  	New     *ChartEntry   `json:"new,omitempty"`
    38  }
    39  
    40  type ChartEntry struct {
    41  	Time  time.Time `json:"time,omitempty"`
    42  	Value float64   `json:"value,omitempty"`
    43  }
    44  
    45  type ChainMessage struct {
    46  	/* TODO (kurkomisi) */
    47  }
    48  
    49  type TxPoolMessage struct {
    50  	/* TODO (kurkomisi) */
    51  }
    52  
    53  type NetworkMessage struct {
    54  	/* TODO (kurkomisi) */
    55  }
    56  
    57  type SystemMessage struct {
    58  	/* TODO (kurkomisi) */
    59  }
    60  
    61  type LogsMessage struct {
    62  	Log string `json:"log,omitempty"`
    63  }