forked from NethermindEth/nethermind
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathINodeStorage.cs
More file actions
50 lines (41 loc) · 1.54 KB
/
Copy pathINodeStorage.cs
File metadata and controls
50 lines (41 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only
using System;
using Nethermind.Core;
using Nethermind.Core.Crypto;
using Nethermind.Trie;
public interface INodeStorage
{
/// <summary>
/// What is the current key scheme
/// </summary>
public KeyScheme Scheme { get; set; }
/// <summary>
/// When running completely from hash based db, some code path that calculate path can be ignored.
/// </summary>
public bool RequirePath { get; }
byte[]? Get(Hash256? address, in TreePath path, in ValueHash256 keccak, ReadFlags readFlags = ReadFlags.None);
void Set(Hash256? address, in TreePath path, in ValueHash256 hash, ReadOnlySpan<byte> data, WriteFlags writeFlags = WriteFlags.None);
IWriteBatch StartWriteBatch();
/// <summary>
/// Used by StateSync
/// </summary>
bool KeyExists(in ValueHash256? address, in TreePath path, in ValueHash256 hash);
/// <summary>
/// Used by StateSync to make sure values are flushed.
/// </summary>
/// <param name="onlyWal">True if only WAL file should be flushed, not memtable.</param>
void Flush(bool onlyWal);
void Compact();
public enum KeyScheme
{
Hash,
HalfPath,
// The default setting in config, which for some reason, can't be a null enum.
Current,
}
public interface IWriteBatch : IDisposable
{
void Set(Hash256? address, in TreePath path, in ValueHash256 currentNodeKeccak, ReadOnlySpan<byte> data, WriteFlags writeFlags);
}
}