code.vegaprotocol.io/vega@v0.79.0/paths/doc.go (about) 1 // Copyright (C) 2023 Gobalsky Labs Limited 2 // 3 // This program is free software: you can redistribute it and/or modify 4 // it under the terms of the GNU Affero General Public License as 5 // published by the Free Software Foundation, either version 3 of the 6 // License, or (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU Affero General Public License for more details. 12 // 13 // You should have received a copy of the GNU Affero General Public License 14 // along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16 package paths 17 18 import "fmt" 19 20 const ( 21 // LongestPathNameLen is the length of the longest path name. It is used 22 // for text formatting. 23 LongestPathNameLen = 35 24 ) 25 26 type ListPathsResponse struct { 27 CachePaths map[string]string `json:"cachePaths"` 28 ConfigPaths map[string]string `json:"configPaths"` 29 DataPaths map[string]string `json:"dataPaths"` 30 StatePaths map[string]string `json:"statePaths"` 31 } 32 33 func List(vegaPaths Paths) *ListPathsResponse { 34 // Some files don't support custom vega home. So we need the default anyway. 35 defaultPath := New("") 36 37 return &ListPathsResponse{ 38 CachePaths: map[string]string{ 39 "DataNodeCacheHome": vegaPaths.CachePathFor(DataNodeCacheHome), 40 }, 41 ConfigPaths: map[string]string{ 42 "DataNodeConfigHome": vegaPaths.ConfigPathFor(DataNodeConfigHome), 43 "DataNodeDefaultConfigFile": vegaPaths.ConfigPathFor(DataNodeDefaultConfigFile), 44 "FaucetConfigHome": vegaPaths.ConfigPathFor(FaucetConfigHome), 45 "FaucetDefaultConfigFile": vegaPaths.ConfigPathFor(FaucetDefaultConfigFile), 46 "NodeConfigHome": vegaPaths.ConfigPathFor(NodeConfigHome), 47 "NodeDefaultConfigFile": vegaPaths.ConfigPathFor(NodeDefaultConfigFile), 48 "NodeWalletsConfigFile": vegaPaths.ConfigPathFor(NodeWalletsConfigFile), 49 "WalletCLIConfigHome": vegaPaths.ConfigPathFor(WalletCLIConfigHome), 50 "WalletCLIDefaultConfigFile": vegaPaths.ConfigPathFor(WalletCLIDefaultConfigFile), 51 "WalletAppConfigHome": defaultPath.ConfigPathFor(WalletAppConfigHome), 52 "WalletAppFairgroundConfigFile": defaultPath.ConfigPathFor(WalletAppFairgroundConfigFile), 53 "WalletAppDefaultConfigFile": defaultPath.ConfigPathFor(WalletAppDefaultConfigFile), 54 "WalletServiceConfigHome": vegaPaths.ConfigPathFor(WalletServiceConfigHome), 55 "WalletServiceDefaultConfigFile": vegaPaths.ConfigPathFor(WalletServiceDefaultConfigFile), 56 "WalletServiceNetworksConfigHome": vegaPaths.ConfigPathFor(WalletServiceNetworksConfigHome), 57 }, 58 DataPaths: map[string]string{ 59 "NodeDataHome": vegaPaths.DataPathFor(NodeDataHome), 60 "NodeWalletsDataHome": vegaPaths.DataPathFor(NodeWalletsDataHome), 61 "VegaNodeWalletsDataHome": vegaPaths.DataPathFor(VegaNodeWalletsDataHome), 62 "EthereumNodeWalletsDataHome": vegaPaths.DataPathFor(EthereumNodeWalletsDataHome), 63 "FaucetDataHome": vegaPaths.DataPathFor(FaucetDataHome), 64 "FaucetWalletsDataHome": vegaPaths.DataPathFor(FaucetWalletsDataHome), 65 "WalletsDataHome": vegaPaths.DataPathFor(WalletsDataHome), 66 "WalletServiceDataHome": vegaPaths.DataPathFor(WalletServiceDataHome), 67 "WalletServiceAPITokensDataFile": vegaPaths.DataPathFor(WalletServiceAPITokensDataFile), 68 "WalletServiceSessionTokensDataFile": vegaPaths.DataPathFor(WalletServiceSessionTokensDataFile), 69 "WalletServiceRSAKeysDataHome": vegaPaths.DataPathFor(WalletServiceRSAKeysDataHome), 70 "WalletServicePublicRSAKeyDataFile": vegaPaths.DataPathFor(WalletServicePublicRSAKeyDataFile), 71 "WalletServicePrivateRSAKeyDataFile": vegaPaths.DataPathFor(WalletServicePrivateRSAKeyDataFile), 72 }, 73 StatePaths: map[string]string{ 74 "DataNodeStateHome": vegaPaths.StatePathFor(DataNodeStateHome), 75 "DataNodeAutoCertHome": vegaPaths.StatePathFor(DataNodeAutoCertHome), 76 "DataNodeLogsHome": vegaPaths.StatePathFor(DataNodeLogsHome), 77 "DataNodeStorageHome": vegaPaths.StatePathFor(DataNodeStorageHome), 78 "DataNodeStorageSQLStoreHome": vegaPaths.StatePathFor(DataNodeStorageSQLStoreHome), 79 "DataNodeStorageSQLStoreNodeDataHome": vegaPaths.StatePathFor(DataNodeStorageSQLStoreNodeDataHome), 80 "DataNodeEmbeddedPostgresRuntimeDir": vegaPaths.StatePathFor(DataNodeEmbeddedPostgresRuntimeDir), 81 "DataNodeNetworkHistoryHome": vegaPaths.StatePathFor(DataNodeNetworkHistoryHome), 82 "DataNodeNetworkHistorySnapshotCopyTo": vegaPaths.StatePathFor(DataNodeNetworkHistorySnapshotCopyTo), 83 "DataNodeNetworkHistorySnapshotCopyFrom": vegaPaths.StatePathFor(DataNodeNetworkHistorySnapshotCopyFrom), 84 "DataNodeEventBufferHome": vegaPaths.StatePathFor(DataNodeEventBufferHome), 85 "DataNodeArchivedEventBufferHome": vegaPaths.StatePathFor(DataNodeArchivedEventBufferHome), 86 "NodeStateHome": vegaPaths.StatePathFor(NodeStateHome), 87 "NodeLogsHome": vegaPaths.StatePathFor(NodeLogsHome), 88 "CheckpointStateHome": vegaPaths.StatePathFor(CheckpointStateHome), 89 "SnapshotStateHome": vegaPaths.StatePathFor(SnapshotStateHome), 90 "SnapshotDBStateFile": vegaPaths.StatePathFor(SnapshotDBStateFile), 91 "SnapshotMetadataDBStateFile": vegaPaths.StatePathFor(SnapshotMetadataDBStateFile), 92 "WalletCLIStateHome": vegaPaths.StatePathFor(WalletCLIStateHome), 93 "WalletCLILogsHome": vegaPaths.StatePathFor(WalletCLILogsHome), 94 "WalletAppStateHome": vegaPaths.StatePathFor(WalletAppStateHome), 95 "WalletAppLogsHome": vegaPaths.StatePathFor(WalletAppLogsHome), 96 "WalletServiceStateHome": vegaPaths.StatePathFor(WalletServiceStateHome), 97 "WalletServiceLogsHome": vegaPaths.StatePathFor(WalletServiceLogsHome), 98 }, 99 } 100 } 101 102 func Explain(name string) (string, error) { 103 paths := map[string]string{ 104 "DataNodeCacheHome": `This folder contains the cache used by the data-node.`, 105 "DataNodeConfigHome": `This folder contains the configuration files used by the data-node.`, 106 "DataNodeDefaultConfigFile": `This file contains the configuration used by the data-node.`, 107 "FaucetConfigHome": `This folder contains the configuration files used by the faucet.`, 108 "FaucetDefaultConfigFile": `This file contains the configuration used by the faucet.`, 109 "NodeConfigHome": `This folder contains the configuration files used by the node.`, 110 "NodeDefaultConfigFile": `This file contains the configuration used by the node.`, 111 "NodeWalletsConfigFile": `This file contains information related to the registered node's wallets used by the node.`, 112 "WalletCLIConfigHome": `This folder contains the configuration files used by the wallet-cli.`, 113 "WalletCLIDefaultConfigFile": `This file contains the configuration used by the wallet-cli.`, 114 "WalletAppConfigHome": `This folder contains the configuration files used by the wallet-app.`, 115 "WalletAppFairgroundConfigFile": `This file contains the Fairground configuration used by the wallet-app.`, 116 "WalletAppDefaultConfigFile": `This file contains the default configuration used by the wallet-app.`, 117 "WalletServiceConfigHome": `This folder contains the configuration files used by the wallet's service.`, 118 "WalletServiceDefaultConfigFile": `This file contains the configuration used by the wallet service.`, 119 "WalletServiceNetworksConfigHome": `This folder contains the network configuration files used by the wallet's service.`, 120 "NodeDataHome": `This folder contains the data managed by the node.`, 121 "NodeWalletsDataHome": `This folder contains the data managed by the node's wallets.`, 122 "VegaNodeWalletsDataHome": `This folder contains the Vega wallet registered as node's wallet, used by the node to sign Vega commands.`, 123 "EthereumNodeWalletsDataHome": `This folder contains the Ethereum wallet registered as node's wallet, used by the node to interact with the Ethereum blockchain.`, 124 "FaucetDataHome": `This folder contains the data used by the faucet.`, 125 "FaucetWalletsDataHome": `This folder contains the Vega wallet used by the faucet to sign its deposit commands.`, 126 "WalletsDataHome": `This folder contains the "user's" wallets. These wallets are used by the user to issue commands to a Vega network.`, 127 "WalletServiceDataHome": `This folder contains the data used by the wallet's service.`, 128 "WalletServiceRSAKeysDataHome": `This folder contains the RSA keys used by the wallet's service for authentication.`, 129 "WalletServicePublicRSAKeyDataFile": `This file contains the public RSA key used by the wallet's service for authentication.`, 130 "WalletServicePrivateRSAKeyDataFile": `This file contains the private RSA key used by the wallet's service for authentication.`, 131 "DataNodeStateHome": `This folder contains the state files used by the data-node.`, 132 "DataNodeAutoCertHome": `This folder contains the autogenerated SSL certificates.`, 133 "DataNodeLogsHome": `This folder contains the log files generated by the data-node.`, 134 "DataNodeStorageHome": `This folder contains the consolidated state, built out of the Vega network events, and served by the data-node's API.`, 135 "DataNodeStorageSQLStoreHome": `This folder contains the files generated by the embedded Postgres database.`, 136 "DataNodeStorageSQLStoreNodeDataHome": `This folder contains the data files generated by the embedded Postgres database.`, 137 "DataNodeEmbeddedPostgresRuntimeDir": `This folder contains the files used at runtime by the embedded Postgres database.`, 138 "DataNodeNetworkHistoryHome": `This folder contains the network history data.`, 139 "DataNodeNetworkHistorySnapshotCopyTo": `This folder contains the snapshots created by the datanode.`, 140 "DataNodeNetworkHistorySnapshotCopyFrom": `This folder contains the snapshots read by the datanode.`, 141 "DataNodeEventBufferHome": `This folder contains the event buffer files.`, 142 "DataNodeArchivedEventBufferHome": `This folder contains the archived event buffer files.`, 143 "NodeStateHome": `This folder contains the state files used by the node.`, 144 "NodeLogsHome": `This folder contains the log files generated by the node.`, 145 "CheckpointStateHome": `This folder contains the network checkpoints generated by the node.`, 146 "SnapshotStateHome": `This folder contains the Tendermint snapshots of the application state generated by the node.`, 147 "SnapshotDBStateFile": `This file is a database containing the snapshots' data of the of the application state generated by the node`, 148 "SnapshotMetadataDBStateFile": `This file is a database containing the metadata about the application snapshots`, 149 "WalletCLIStateHome": `This folder contains the state files used by the wallet-cli.`, 150 "WalletCLILogsHome": `This folder contains the log files generated by the wallet-cli.`, 151 "WalletAppStateHome": `This folder contains the state files used by the wallet-app.`, 152 "WalletAppLogsHome": `This folder contains the log files generated by the wallet-app.`, 153 "WalletServiceStateHome": `This folder contains the state files used by the wallet's service.`, 154 "WalletServiceLogsHome": `This folder contains the log files generated by the wallet's service'.`, 155 } 156 157 description, ok := paths[name] 158 if !ok { 159 return "", fmt.Errorf("path \"%s\" has no documentation", name) 160 } 161 162 return description, nil 163 }