github.com/neatlab/neatio@v1.7.3-0.20220425043230-d903e92fcc75/chain/core/rawdb/schema_data_prune.go (about)

     1  // Package rawdb contains a collection of low level database accessors.
     2  package rawdb
     3  
     4  // The fields below define the low level database schema prefixing for data prune.
     5  var (
     6  	// headDataScanKey tracks the latest know scan header's number.
     7  	headDataScanKey = []byte("LastDataScanHeight")
     8  
     9  	// headDataPruneKey tracks the latest know prune header's number.
    10  	headDataPruneKey = []byte("LastDataPruneHeight")
    11  
    12  	// Data item prefixes (use single byte to avoid mixing data types, avoid `i`, used for indexes).
    13  	dataPruneProcessPrefix = []byte("p") // dataPruneProcessPrefix + scan num (uint64 big endian) + prune num (uint64 big endian) + dataPruneProcessSuffix -> trie root hash
    14  	dataPruneProcessSuffix = []byte("n")
    15  )
    16  
    17  // dataPruneNumberKey = dataPruneProcessPrefix + scan (uint64 big endian) + prune (uint64 big endian) + dataPruneProcessSuffix
    18  func dataPruneNumberKey(scan, prune uint64) []byte {
    19  	return append(append(append(dataPruneProcessPrefix, encodeBlockNumber(scan)...), encodeBlockNumber(prune)...), dataPruneProcessSuffix...)
    20  }