github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/core/ledger/kvledger/ledger_filepath.go (about) 1 /* 2 Copyright hechain. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package kvledger 8 9 import ( 10 "path/filepath" 11 "strconv" 12 ) 13 14 func fileLockPath(rootFSPath string) string { 15 return filepath.Join(rootFSPath, "fileLock") 16 } 17 18 // LedgerProviderPath returns the absolute path of ledgerprovider 19 func LedgerProviderPath(rootFSPath string) string { 20 return filepath.Join(rootFSPath, "ledgerProvider") 21 } 22 23 // BlockStorePath returns the absolute path of block storage 24 func BlockStorePath(rootFSPath string) string { 25 return filepath.Join(rootFSPath, "chains") 26 } 27 28 // PvtDataStorePath returns the absolute path of pvtdata storage 29 func PvtDataStorePath(rootFSPath string) string { 30 return filepath.Join(rootFSPath, "pvtdataStore") 31 } 32 33 // StateDBPath returns the absolute path of state level DB 34 func StateDBPath(rootFSPath string) string { 35 return filepath.Join(rootFSPath, "stateLeveldb") 36 } 37 38 // HistoryDBPath returns the absolute path of history DB 39 func HistoryDBPath(rootFSPath string) string { 40 return filepath.Join(rootFSPath, "historyLeveldb") 41 } 42 43 // ConfigHistoryDBPath returns the absolute path of configHistory DB 44 func ConfigHistoryDBPath(rootFSPath string) string { 45 return filepath.Join(rootFSPath, "configHistory") 46 } 47 48 // BookkeeperDBPath return the absolute path of bookkeeper DB 49 func BookkeeperDBPath(rootFSPath string) string { 50 return filepath.Join(rootFSPath, "bookkeeper") 51 } 52 53 // SnapshotsTempDirPath returns the dir path that is used temporarily during the genration or import of the snapshots for a ledger 54 func SnapshotsTempDirPath(snapshotRootDir string) string { 55 return filepath.Join(snapshotRootDir, "temp") 56 } 57 58 // CompletedSnapshotsPath returns the absolute path that is used for persisting the snapshots 59 func CompletedSnapshotsPath(snapshotRootDir string) string { 60 return filepath.Join(snapshotRootDir, "completed") 61 } 62 63 // SnapshotsDirForLedger returns the absolute path of the dir for the snapshots for a specified ledger 64 func SnapshotsDirForLedger(snapshotRootDir, ledgerID string) string { 65 return filepath.Join(CompletedSnapshotsPath(snapshotRootDir), ledgerID) 66 } 67 68 // SnapshotDirForLedgerBlockNum returns the absolute path for a particular snapshot for a ledger 69 func SnapshotDirForLedgerBlockNum(snapshotRootDir, ledgerID string, blockNumber uint64) string { 70 return filepath.Join(SnapshotsDirForLedger(snapshotRootDir, ledgerID), strconv.FormatUint(blockNumber, 10)) 71 }