fabric 2.0, leveldb usage in details

DB in Peer

DB ProviderDir
transientstore.NewStoreProvider/var/hyperledger/production/transientstore
idStore/var/hyperledger/production/ledgersData/ledgerProvider
initLedgerStorageProvider fsblkstorage.NewProvider/var/hyperledger/production/ledgersData/chains/index
initLedgerStorageProvider pvtdatastorage.NewProvider/var/hyperledger/production/ledgersData/pvtdataStore
initHistoryDBProvider/var/hyperledger/production/ledgersData/historyLeveldb
initConfigHistoryManager/var/hyperledger/production/ledgersData/configHistory
initStateDBProvider BookkeeperDBPath/var/hyperledger/production/ledgersData/bookkeeper
initStateDBProvider NewCommonStorageDBProvider/var/hyperledger/production/ledgersData/stateLeveldb

index prefix definitions

####### blockMgrInfo

blkMgrInfoKey = []byte("blkMgrInfo")
blockIndex
// prefix for block index:
const (
	blockNumIdxKeyPrefix        = 'n'
	blockHashIdxKeyPrefix       = 'h'
	txIDIdxKeyPrefix            = 't'
	blockNumTranNumIdxKeyPrefix = 'a'
	indexCheckpointKeyStr       = "indexCheckpointKey"
)
idStore
	// ledgerKeyPrefix is the prefix for each ledger key in idStore db
	ledgerKeyPrefix = []byte{'l'}
	// ledgerKeyStop is the end key when querying idStore db by ledger key
	ledgerKeyStop = []byte{'l' + 1}
	// metadataKeyPrefix is the prefix for each metadata key in idStore db
	metadataKeyPrefix = []byte{'s'}
	// metadataKeyStop is the end key when querying idStore db by metadata key
	metadataKeyStop = []byte{'s' + 1}

	// formatKey
	formatKey = []byte("f")
stateDB
var (
	dataKeyPrefix    = []byte{'d'}
	nsKeySep         = []byte{0x00}
	lastKeyIndicator = byte(0x01)
	savePointKey     = []byte{'s'}
)
historyDB
var (
	compositeKeySep = []byte{0x00} // used as a separator between different components of dataKey
	dataKeyPrefix   = []byte{'d'}  // prefix added to dataKeys
	savePointKey    = []byte{'s'}  // a single key in db for persisting savepoint
	emptyValue      = []byte{}     // used to store as value for keys where only key needs to be stored (e.g., dataKeys)
)

Sample DBs in Peer

---------------------------LedgerDS :  /var/hyperledger/production/ledgersData/chains/index
_ f [50 46 48] 
test1 a   [0 39 162 130 1] 
test1 a  [0 150 131 1 140 23] 
test1 a  [0 202 162 1 140 23] 
test1 a  [0 253 193 1 139 23] 
test1 a  [0 175 225 1 141 23] 
test1 a  [0 227 128 2 139 23] 
test1 blkMgrInfo [0 207 159 2 5 0] 
test1 hI�C~4R��N駽�z�fL֡�����4�6l" [0 132 162 1 0] 
test1 h28��Z@3���ꃂ�k,�N٩ܸП�`m�e�0 [0 233 224 1 0] 
test1 hVz�5��pVz��ls�@���2�����f���� [0 0 0] 
test1 hW�ݕO�u"k���­a�?8�=Jx�U�*��� [0 183 193 1 0] 
test1 h��5��tj��d���Po���U����1m��1s [0 208 130 1 0] 
�7 [0 157 128 2 0] 
test1 indexCheckpointKey [5] 
test1 n  [0 0 0] 
test1 n [0 208 130 1 0] 
test1 n [0 132 162 1 0] 
test1 n [0 183 193 1 0] 
test1 n [0 233 224 1 0] 
test1 n [0 157 128 2 0] 
test1 t@4588f24920c8d5e74362c459d1cd0f1680fa404a2dddf12beaf2ff1bc046e1fb  [10 5 0 183 193 1 0 18 6 0] ...
test1 t@6be3ae396b198a79abee167a9ebada4f887b8fc733b892258d406550001efdc0  [10 5 0 132 162 1 0 18 6 0] ...
test1 t@7b65cda6481b275863f71fb12334d2926fc5fe172014cadefb1e688b79563386   [10 3 0 0 0 18 5 0 39 162] ...
test1 t@a3eb002cff8de734f167bc2572d23472f86b100478351b7d763d961109d4a24b  [10 5 0 208 130 1 0 18 6 0] ...
test1 t@b3ae1b68b48090a37e06fca16d2045e2d723f1466a5c3913c3b0b9a68fa2f208  [10 5 0 157 128 2 0 18 6 0] ...
test1 t@cdda449de586e79bacdc8b0ee55a7a0c8ef19d9a0bde3d653a35d30826c81338  [10 5 0 233 224 1 0 18 6 0] ...
test2 a   [0 39 162 130 1] 
test2 blkMgrInfo [0 208 130 1 0 0] 
test2 h"�ۘ�!G��lޕ������"<��g��t�- [0 0 0] 
test2 indexCheckpointKey [0] 
test2 n  [0 0 0] 
test2 t@1817ae9cbf0235e4563785be2f92f4d8d2faea26c7076dbfda6b2c90db7c89d3   [10 3 0 0 0 18 5 0 39 162] ...
test3 a   [0 39 161 130 1] 
test3 blkMgrInfo [0 207 130 1 0 0] 
test3 h:H?�"���@[���a�����U�Y6e�lG [0 0 0] 
test3 indexCheckpointKey [0] 
test3 n  [0 0 0] 
test3 t@666ccd78d2fd480f6056943bbaa2e8769ad920fd9ffac7ffe3f6e2960b76655f   [10 3 0 0 0 18 5 0 39 161] ...
test5 a   [0 39 162 130 1] 
test5 blkMgrInfo [0 208 130 1 0 0] 
test5 h��o-�{o���LVxɟ!�e�~�lw��T�B [0 0 0] 
test5 indexCheckpointKey [0] 
test5 n  [0 0 0] 
test5 t@f5b2fafd304634749c5952b4f1a8c943d85595f53e6b56b36a5a039488e978be   [10 3 0 0 0 18 5 0 39 162] ...
test9 a   [0 39 162 130 1] 
test9 blkMgrInfo [0 208 130 1 0 0] 
���qk [0 0 0] 
test9 indexCheckpointKey [0] 
test9 n  [0 0 0] 
test9 t@f6c4314c8df25c8ce07dbfa2434c9b4d946ccd1540f373188d38a7ba8817b1f6   [10 3 0 0 0 18 5 0 39 162] ...
--------------------PrivateDS : /var/hyperledger/production/ledgersData/pvtdataStore
test1  [5] 
test2  [0] 
test3  [0] 
test5  [0] 
test9  [0] 
---------------------HistoryDB : /var/hyperledger/production/ledgersData/historyLeveldb
_ f [50 46 48] 
test1 s [1 5 1 1] 
test2 s [0 1 1] 
test3 s [0 1 1] 
test5 s [0 1 1] 
test9 s [0 1 1] 
---------------------StateDB : /var/hyperledger/production/ledgersData/stateLeveldb
_ f [50 46 48] 
test1 d CHANNEL_CONFIG_ENV_BYTES [10 2 0 0 18 209 122 10 219 87] ...
test1 s [1 5 0] 
test2 d CHANNEL_CONFIG_ENV_BYTES [10 2 0 0 18 209 122 10 219 87] ...
test2 s [0 0] 
test3 d CHANNEL_CONFIG_ENV_BYTES [10 2 0 0 18 208 122 10 219 87] ...
test3 s [0 0] 
test5 d CHANNEL_CONFIG_ENV_BYTES [10 2 0 0 18 209 122 10 219 87] ...
test5 s [0 0] 
test9 d CHANNEL_CONFIG_ENV_BYTES [10 2 0 0 18 209 122 10 219 87] ...
test9 s [0 0] 
-------------------IdStore : /var/hyperledger/production/ledgersData/ledgerProvider
f [50 46 48] 
ltest1 [10 34 26 32 153 79 159 11 162 224] ...
ltest2 [10 34 26 32 20 21 195 86 255 206] ...
ltest3 [10 34 26 32 62 17 175 27 126 79] ...
ltest5 [10 34 26 32 209 238 104 97 118 44] ...
ltest9 [10 34 26 32 230 153 85 57 81 35] ...
stest1 [] 
stest2 [] 
stest3 [] 
stest5 [] 
stest9 [] 

DB in Orderer

DB ProviderDir
createLedgerFactory/var/hyperledger/production/orderer/index

This is the ledger DB holding indices for block data. Data are like these:

‘system blkMgrInfo’ is the key. Prefix ‘system’ represents the DB instance for system channel. Only BlockNum will be indexed in Order ledger DB.

system blkMgrInfo [0 138 240 10 9 0]
system indexCheckpointKey [9]
system n  [0 0 0]
system n [0 226 78 0]
system n [0 217 224 1 0]
system n [0 208 242 2 0]
system n [0 197 132 4 0]
system n [0 186 150 5 0]
system n [0 178 168 6 0]
system n [0 167 186 7 0]
system n [0 158 204 8 0]
system n	 [0 147 222 9 0]
test1 blkMgrInfo [0 159 158 2 5 0]
test1 indexCheckpointKey [5]
test1 n  [0 0 0]
test1 n [0 207 130 1 0]
test1 n [0 224 161 1 0]
test1 n [0 240 192 1 0]
test1 n [0 255 223 1 0]
test1 n [0 144 255 1 0]
test2 blkMgrInfo [0 207 130 1 0 0]
test2 indexCheckpointKey [0]
test2 n  [0 0 0]
test3 blkMgrInfo [0 206 130 1 0 0]
test3 indexCheckpointKey [0]
test3 n  [0 0 0]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值