Skip to content

Commit

Permalink
Testing DB with large number of tables
Browse files Browse the repository at this point in the history
  • Loading branch information
fireduck64 committed Aug 17, 2019
1 parent c525d27 commit 4fde3e2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
18 changes: 18 additions & 0 deletions NOTES.md
@@ -0,0 +1,18 @@
# First Version Stuff

* full channel syncing
* dht discovery
* static file serving
* web simple rpc/auth
* xss protection

# Later Stuff

* header only channels
* dht throttling
* channel throttling
* channel storage limits
* some sort of channel pruning



10 changes: 9 additions & 1 deletion src/ChannelNode.java
Expand Up @@ -2,6 +2,8 @@

import duckutil.Config;
import duckutil.ConfigFile;
import duckutil.ConfigCat;
import duckutil.ConfigMem;
import snowblossom.lib.*;
import snowblossom.proto.WalletDatabase;
import snowblossom.proto.AddressSpec;
Expand All @@ -21,6 +23,7 @@

import java.security.cert.X509Certificate;
import java.util.Random;
import java.util.TreeMap;

import snowblossom.channels.proto.StargateServiceGrpc.StargateServiceBlockingStub;
import snowblossom.channels.proto.*;
Expand Down Expand Up @@ -60,7 +63,11 @@ public static void main(String args[])
System.exit(-1);
}

ConfigFile config = new ConfigFile(args[0]);
ConfigFile f_config = new ConfigFile(args[0]);

TreeMap<String,String> mem_config = new TreeMap<>();
mem_config.put("db_separate","true");
Config config = new ConfigCat(new ConfigMem(mem_config), f_config);

LogSetup.setup(config);
new ChannelNode(config);
Expand All @@ -87,6 +94,7 @@ public ChannelNode(Config config)
WalletUtil.saveWallet(wallet_db, wallet_path);
}


db = new ChannelsDB(config, new JRocksDB(config) );
net_ex = new NetworkExaminer(this);
peer_manager = new PeerManager(this);
Expand Down
14 changes: 14 additions & 0 deletions src/ChannelsDB.java
Expand Up @@ -18,6 +18,9 @@
import snowblossom.lib.db.DBProvider;
import snowblossom.lib.db.DBMapMutationSet;

import java.util.TreeMap;
import java.util.Random;


public class ChannelsDB
{
Expand All @@ -36,6 +39,7 @@ public ChannelsDB(Config config, DBProvider prov)
throws Exception
{
Runtime.getRuntime().addShutdownHook(new DBShutdownThread());

this.config = config;
this.prov = prov;

Expand All @@ -54,6 +58,16 @@ public void open()
peer_map = new ProtoDBMap(LocalPeerInfo.newBuilder().build().getParserForType(), prov.openMap("peer"));
dht_data_map = new ProtoDBMap(SignedMessage.newBuilder().build().getParserForType(), prov.openMap("dht_data"));

/*Random rnd = new Random();
byte[] b=new byte[64];
for(int i=0; i<1000; i++)
{
rnd.nextBytes(b);
DBMap d = prov.openMap("load_test_" + i);
d.put("s" + rnd.nextInt(), ByteString.copyFrom(b));
}*/

}

public ProtoDBMap<LocalPeerInfo> getPeerMap(){return peer_map; }
Expand Down

0 comments on commit 4fde3e2

Please sign in to comment.