Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Allow users to select storage engine #491

Merged
merged 4 commits into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ jobs:
dotnet tool install --tool-path ./ dotnet-format
./dotnet-format --check --dry-run -v diagnostic
- name: Build
run: dotnet publish -o ./out -c Release
run: |
dotnet publish -o ./out -c Release
find ./out -name 'config.json' | xargs perl -pi -e 's|LevelDBStore|MemoryStore|g'
- name: Install dependencies
run: sudo apt-get install libleveldb-dev expect
- name: Run tests with expect
Expand Down
12 changes: 12 additions & 0 deletions neo-cli/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Neo
{
internal class Settings
{
public StorageSettings Storage { get; }
public P2PSettings P2P { get; }
public RPCSettings RPC { get; }
public UnlockWalletSettings UnlockWallet { get; }
Expand Down Expand Up @@ -41,13 +42,24 @@ public static Settings Default

public Settings(IConfigurationSection section)
{
this.Storage = new StorageSettings(section.GetSection("Storage"));
this.P2P = new P2PSettings(section.GetSection("P2P"));
this.RPC = new RPCSettings(section.GetSection("RPC"));
this.UnlockWallet = new UnlockWalletSettings(section.GetSection("UnlockWallet"));
this.PluginURL = section.GetSection("PluginURL").Value;
}
}

internal class StorageSettings
{
public string Engine { get; }

public StorageSettings(IConfigurationSection section)
{
this.Engine = section.GetSection("Engine").Value;
}
}

internal class P2PSettings
{
public ushort Port { get; }
Expand Down
2 changes: 1 addition & 1 deletion neo-cli/Shell/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ protected internal override void OnStart(string[] args)
Settings.Initialize(new ConfigurationBuilder().AddJsonFile("config.mainnet.json").Build());
break;
}
system = new NeoSystem();
system = new NeoSystem(Settings.Default.Storage.Engine);
system.StartNode(new ChannelsConfig
{
Tcp = new IPEndPoint(IPAddress.Any, Settings.Default.P2P.Port),
Expand Down
3 changes: 3 additions & 0 deletions neo-cli/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"ApplicationConfiguration": {
"Storage": {
"Engine": "LevelDBStore"
},
"P2P": {
"Port": 10333,
"WsPort": 10334
Expand Down
3 changes: 3 additions & 0 deletions neo-cli/config.mainnet.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"ApplicationConfiguration": {
"Storage": {
"Engine": "LevelDBStore"
},
"P2P": {
"Port": 10333,
"WsPort": 10334
Expand Down
3 changes: 3 additions & 0 deletions neo-cli/config.testnet.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"ApplicationConfiguration": {
"Storage": {
"Engine": "LevelDBStore"
},
"P2P": {
"Port": 20333,
"WsPort": 20334
Expand Down
2 changes: 1 addition & 1 deletion neo-cli/neo-cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="3.0.0-CI00809" />
<PackageReference Include="Neo" Version="3.0.0-CI00815" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.6.0" />
</ItemGroup>

Expand Down