hiero-ledger / hiero-ledger/hiero-consensus-node
Proposal: Reorganize Consensus Node File System
Open
@cody-littley is already working on this.
Since Apr 29, 2024.
Platform
- Dominant language
- Java
- Stars
- 407
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
Our current file system layout is extremely adhoc and the product of a long sequence of seemingly random decisions. I think we can do a much better job at organizing our file system.
Current Structure
Here, "root" is the current working directory of the JVM. (I'm 80% sure on this point... needs confirmation). I am not sure if there are other files elsewhere on the file system that the node utilizes.
root
├── VERSION
├── config.txt
├── data
│ ├── config
│ │ ├── api-permission.properties
│ │ ├── application.properties
│ │ ├── bootstrap.properties
│ │ ├── genesis.properties
│ │ └── node.properties
│ ├── diskFs
│ ├── keys
│ │ ├── private-node1.pfx
│ │ └── public.pfx
│ ├── onboard
│ ├── saved
│ │ ├── address_book
│ │ │ └── addressBookDebugFiles.txt
│ │ ├── com.hedera.services.ServicesMain
│ │ │ └── 0
│ │ │ └── 123
│ │ │ └── roundNumber
│ │ │ ├── SignedState.swh
│ │ │ └── variousStateFiles
│ │ ├── preconsensus-events
│ │ │ └── treeWithPcesFiles
│ │ ├── swirlds-recycle-bin
│ │ │ └── 0
│ │ │ └── recycledFiles
│ │ └── swirlds-tmp
│ │ └── temporaryFiles
│ ├── stats
│ │ └── legacyMetricsFiles.csv
│ └── upgrade
│ └── filesForUpgrade
├── eventStreams
│ └── events_0
│ └── eventStreamFiles
├── hedera.crt
├── hedera.key
├── log4j2.xml
├── output
│ ├── hgcaa.log
│ ├── queries.log
│ ├── swirlds-hashstream
│ │ └── hashStreamFiles.log
│ ├── swirlds-vmap.log
│ └── transaction-state
│ └── state-changes.log
├── settings.txt
├── settingsUsed.txt
└── stdout.log
Proposed Structure
Conventions:
- always prefer to use
-in between words (as opposed to underscores or camel case) - never include the node ID in any directory path beneath the root
- all files should be created with the file system manager, which will only permit files to be created within the
datadirectory - we should assume that for the time being that
rootwill be a single mount point (i.e. it's safe to hard link between any two locations beneathroot) - the
rootdirectory should be configurable. All other directories below root should not be specified in configuration (old pattern is to make each directory configurable). We never change from the defaults, and having things configurable increases code complexity a lot. Better to use static constants for directory names beneathroot. - never use characters that are not compatible with all major operating systems
- even if they are technically compatible, never use white space in file names
- never use non-ASCII characters
root
├── bin
│ └── recycledFiles
├── data
│ ├── blocks
│ │ └── blockStreamFiles
│ ├── ces
│ │ └── consensusEventStreamFiles
│ ├── config
│ │ ├── VERSION
│ │ ├── api-permission.properties
│ │ ├── application.properties
│ │ ├── bootstrap.properties
│ │ ├── config.txt
│ │ ├── genesis.properties
│ │ ├── log4j2.xml
│ │ ├── node.properties
│ │ └── settings.txt
│ ├── keys
│ │ ├── hedera.crt
│ │ ├── hedera.key
│ │ ├── private-node0.pfx // currently there is an off by 1 error, can we remove the number entirely?
│ │ └── public.pfx
│ ├── logs
│ │ ├── address-book
│ │ │ └── addressBookDebugFiles.txt
│ │ ├── hgcaa.log
│ │ ├── queries.log
│ │ ├── settingsUsed.txt
│ │ ├── stdout.log
│ │ ├── swirlds-hashstream
│ │ │ └── hashStreamFiles.log
│ │ ├── swirlds-vmap.log
│ │ └── transaction-state
│ │ └── state-changes.log
│ ├── pces
│ │ └── treeWithPcesFiles
│ ├── snapshots
│ │ └── roundNumber
│ │ ├── SignedState.swh
│ │ └── variousStateFiles
│ ├── stats
│ │ └── legacyMetricsFiles.csv
│ └── upgrade
│ └── filesForUpgrade
└── tmp
└── temporaryFiles
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.