Skip to content

Commit

Permalink
Fix constructor of rows
Browse files Browse the repository at this point in the history
  • Loading branch information
ben221199 committed Sep 20, 2024
1 parent 90ed8b2 commit 26f7b36
Show file tree
Hide file tree
Showing 45 changed files with 371 additions and 136 deletions.
78 changes: 39 additions & 39 deletions src/main/java/com/lbry/database/PrefixDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,45 +118,45 @@ public PrefixDB(String path,int maxOpenFiles,String secondaryPath,int maxUndoDep

this.maxUndoDepth = maxUndoDepth;

this.claim_to_support = new ClaimToSupportPrefixRow(this);
this.support_to_claim = new SupportToClaimPrefixRow(this);
this.claim_to_txo = new ClaimToTXOPrefixRow(this);
this.txo_to_claim = new TXOToClaimPrefixRow(this);
this.claim_to_channel = new ClaimToChannelPrefixRow(this);
this.channel_to_claim = new ChannelToClaimPrefixRow(this);
this.claim_short_id = new ClaimShortIDPrefixRow(this);
this.claim_expiration = new ClaimExpirationPrefixRow(this);
this.claim_takeover = new ClaimTakeoverPrefixRow(this);
this.pending_activation = new PendingActivationPrefixRow(this);
this.activated = new ActivatedPrefixRow(this);
this.active_amount = new ActiveAmountPrefixRow(this);
this.bid_order = new BidOrderPrefixRow(this);
this.repost = new RepostPrefixRow(this);
this.reposted_claim = new RepostedPrefixRow(this);
this.reposted_count = new RepostedCountPrefixRow(this);
this.undo = new UndoPrefixRow(this);
this.utxo = new UTXOPrefixRow(this);
this.hashX_utxo = new HashXUTXOPrefixRow(this);
this.hashX_history = new HashXHistoryPrefixRow(this);
this.block_hash = new BlockHashPrefixRow(this);
this.tx_count = new TxCountPrefixRow(this);
this.tx_hash = new TXHashPrefixRow(this);
this.tx_num = new TXNumPrefixRow(this);
this.tx = new TXPrefixRow(this);
this.header = new BlockHeaderPrefixRow(this);
this.touched_or_deleted = new TouchedOrDeletedPrefixRow(this);
this.channel_count = new ChannelCountPrefixRow(this);
this.db_state = new DBStatePrefixRow(this);
this.support_amount = new SupportAmountPrefixRow(this);
this.block_txs = new BlockTxsPrefixRow(this);
this.mempool_tx = new MempoolTXPrefixRow(this);
this.trending_notification = new TrendingNotificationPrefixRow(this);
this.touched_hashX = new TouchedHashXPrefixRow(this);
this.hashX_status = new HashXStatusPrefixRow(this);
this.hashX_mempool_status = new HashXMempoolStatusPrefixRow(this);
this.effective_amount = new EffectiveAmountPrefixRow(this);
this.future_effective_amount = new FutureEffectiveAmountPrefixRow(this);
this.hashX_history_hasher = new HashXHistoryHasherPrefixRow(this);
this.claim_to_support = new ClaimToSupportPrefixRow(this,this.operationStack);
this.support_to_claim = new SupportToClaimPrefixRow(this,this.operationStack);
this.claim_to_txo = new ClaimToTXOPrefixRow(this,this.operationStack);
this.txo_to_claim = new TXOToClaimPrefixRow(this,this.operationStack);
this.claim_to_channel = new ClaimToChannelPrefixRow(this,this.operationStack);
this.channel_to_claim = new ChannelToClaimPrefixRow(this,this.operationStack);
this.claim_short_id = new ClaimShortIDPrefixRow(this,this.operationStack);
this.claim_expiration = new ClaimExpirationPrefixRow(this,this.operationStack);
this.claim_takeover = new ClaimTakeoverPrefixRow(this,this.operationStack);
this.pending_activation = new PendingActivationPrefixRow(this,this.operationStack);
this.activated = new ActivatedPrefixRow(this,this.operationStack);
this.active_amount = new ActiveAmountPrefixRow(this,this.operationStack);
this.bid_order = new BidOrderPrefixRow(this,this.operationStack);
this.repost = new RepostPrefixRow(this,this.operationStack);
this.reposted_claim = new RepostedPrefixRow(this,this.operationStack);
this.reposted_count = new RepostedCountPrefixRow(this,this.operationStack);
this.undo = new UndoPrefixRow(this,this.operationStack);
this.utxo = new UTXOPrefixRow(this,this.operationStack);
this.hashX_utxo = new HashXUTXOPrefixRow(this,this.operationStack);
this.hashX_history = new HashXHistoryPrefixRow(this,this.operationStack);
this.block_hash = new BlockHashPrefixRow(this,this.operationStack);
this.tx_count = new TxCountPrefixRow(this,this.operationStack);
this.tx_hash = new TXHashPrefixRow(this,this.operationStack);
this.tx_num = new TXNumPrefixRow(this,this.operationStack);
this.tx = new TXPrefixRow(this,this.operationStack);
this.header = new BlockHeaderPrefixRow(this,this.operationStack);
this.touched_or_deleted = new TouchedOrDeletedPrefixRow(this,this.operationStack);
this.channel_count = new ChannelCountPrefixRow(this,this.operationStack);
this.db_state = new DBStatePrefixRow(this,this.operationStack);
this.support_amount = new SupportAmountPrefixRow(this,this.operationStack);
this.block_txs = new BlockTxsPrefixRow(this,this.operationStack);
this.mempool_tx = new MempoolTXPrefixRow(this,this.operationStack);
this.trending_notification = new TrendingNotificationPrefixRow(this,this.operationStack);
this.touched_hashX = new TouchedHashXPrefixRow(this,this.operationStack);
this.hashX_status = new HashXStatusPrefixRow(this,this.operationStack);
this.hashX_mempool_status = new HashXMempoolStatusPrefixRow(this,this.operationStack);
this.effective_amount = new EffectiveAmountPrefixRow(this,this.operationStack);
this.future_effective_amount = new FutureEffectiveAmountPrefixRow(this,this.operationStack);
this.hashX_history_hasher = new HashXHistoryHasherPrefixRow(this,this.operationStack);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void validateAndApplyStashedOperations(){
if(this.enforceIntegrity && !uniqueKeys.isEmpty()){
List<byte[]> uniqueKeysList = new ArrayList<>(uniqueKeys);
for(int idx=0;idx<uniqueKeys.size();idx+=10000){
List<byte[]> batch = uniqueKeysList.subList(idx,idx+10000);
List<byte[]> batch = uniqueKeysList.subList(idx,Math.min(uniqueKeysList.size(),idx+10000));
Iterator<Optional<byte[]>> iterator = this.multiGet.apply(batch).iterator();
for(byte[] k : batch){
byte[] v = iterator.next().get();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/lbry/database/rows/ActivatedPrefixRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.ActivationKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.ActivationValue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class ActivatedPrefixRow extends PrefixRow<ActivationKey,ActivationValue>{

public ActivatedPrefixRow(PrefixDB database){
super(database);
public ActivatedPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.ActiveAmountKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.ActiveAmountValue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class ActiveAmountPrefixRow extends PrefixRow<ActiveAmountKey,ActiveAmountValue>{

public ActiveAmountPrefixRow(PrefixDB database){
super(database);
public ActiveAmountPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/lbry/database/rows/BidOrderPrefixRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.BidOrderKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.BidOrderValue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class BidOrderPrefixRow extends PrefixRow<BidOrderKey,BidOrderValue>{

public BidOrderPrefixRow(PrefixDB database){
super(database);
public BidOrderPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/lbry/database/rows/BlockHashPrefixRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.BlockHashKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.BlockHashValue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class BlockHashPrefixRow extends PrefixRow<BlockHashKey,BlockHashValue>{

public BlockHashPrefixRow(PrefixDB database){
super(database);
public BlockHashPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.BlockHeaderKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.BlockHeaderValue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class BlockHeaderPrefixRow extends PrefixRow<BlockHeaderKey,BlockHeaderValue>{

public BlockHeaderPrefixRow(PrefixDB database){
super(database);
public BlockHeaderPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/lbry/database/rows/BlockTxsPrefixRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.BlockTxsKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.BlockTxsValue;

import java.nio.ByteBuffer;
Expand All @@ -11,8 +12,8 @@

public class BlockTxsPrefixRow extends PrefixRow<BlockTxsKey,BlockTxsValue>{

public BlockTxsPrefixRow(PrefixDB database){
super(database);
public BlockTxsPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.ChannelCountKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.ChannelCountValue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class ChannelCountPrefixRow extends PrefixRow<ChannelCountKey,ChannelCountValue>{

public ChannelCountPrefixRow(PrefixDB database){
super(database);
public ChannelCountPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.ChannelToClaimKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.ChannelToClaimValue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class ChannelToClaimPrefixRow extends PrefixRow<ChannelToClaimKey,ChannelToClaimValue>{

public ChannelToClaimPrefixRow(PrefixDB database){
super(database);
public ChannelToClaimPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.ClaimExpirationKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.ClaimExpirationValue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class ClaimExpirationPrefixRow extends PrefixRow<ClaimExpirationKey,ClaimExpirationValue>{

public ClaimExpirationPrefixRow(PrefixDB database){
super(database);
public ClaimExpirationPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.ClaimShortIDKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.ClaimShortIDValue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class ClaimShortIDPrefixRow extends PrefixRow<ClaimShortIDKey,ClaimShortIDValue>{

public ClaimShortIDPrefixRow(PrefixDB database){
super(database);
public ClaimShortIDPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.ClaimTakeoverKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.ClaimTakeoverValue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class ClaimTakeoverPrefixRow extends PrefixRow<ClaimTakeoverKey,ClaimTakeoverValue>{

public ClaimTakeoverPrefixRow(PrefixDB database){
super(database);
public ClaimTakeoverPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.ClaimToChannelKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.ClaimToChannelValue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class ClaimToChannelPrefixRow extends PrefixRow<ClaimToChannelKey,ClaimToChannelValue>{

public ClaimToChannelPrefixRow(PrefixDB database){
super(database);
public ClaimToChannelPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.ClaimToSupportKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.ClaimToSupportValue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class ClaimToSupportPrefixRow extends PrefixRow<ClaimToSupportKey,ClaimToSupportValue>{

public ClaimToSupportPrefixRow(PrefixDB database){
super(database);
public ClaimToSupportPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/lbry/database/rows/ClaimToTXOPrefixRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.ClaimToTXOKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.ClaimToTXOValue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class ClaimToTXOPrefixRow extends PrefixRow<ClaimToTXOKey,ClaimToTXOValue>{

public ClaimToTXOPrefixRow(PrefixDB database){
super(database);
public ClaimToTXOPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/lbry/database/rows/DBStatePrefixRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.KeyInterface;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.DBState;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class DBStatePrefixRow extends PrefixRow<KeyInterface,DBState>{

public DBStatePrefixRow(PrefixDB database){
super(database);
public DBStatePrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import com.lbry.database.Prefix;
import com.lbry.database.PrefixDB;
import com.lbry.database.keys.EffectiveAmountKey;
import com.lbry.database.revert.RevertibleOperationStack;
import com.lbry.database.values.EffectiveAmountValue;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class EffectiveAmountPrefixRow extends PrefixRow<EffectiveAmountKey,EffectiveAmountValue>{

public EffectiveAmountPrefixRow(PrefixDB database){
super(database);
public EffectiveAmountPrefixRow(PrefixDB database,RevertibleOperationStack operationStack){
super(database,operationStack);
}

@Override
Expand Down
Loading

0 comments on commit 26f7b36

Please sign in to comment.