Skip to content

Commit 8311477

Browse files
ADD: nodes, get-put visitors, abstracting BitSequence
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
1 parent a7a6224 commit 8311477

16 files changed

Lines changed: 2177 additions & 437 deletions

File tree

src/main/java/org/hyperledger/besu/ethereum/stateless/bintrie/BitSequence.java

Lines changed: 54 additions & 276 deletions
Large diffs are not rendered by default.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright Hyperledger Besu Contributors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*
13+
* SPDX-License-Identifier: Apache-2.0
14+
*
15+
*/
16+
package org.hyperledger.besu.ethereum.stateless.bintrie;
17+
18+
public interface BitSequenceFactory<K extends BitSequence<K>> {
19+
/**
20+
* Default empty Sequence.
21+
*
22+
* @return Empty BitSequence.
23+
*/
24+
public K empty();
25+
26+
/**
27+
* Get a BitSequence from a binary string representation.
28+
*
29+
* @param bits Binary string representation.
30+
* @return A string representation of the node.
31+
*/
32+
public K fromBinaryString(String bits);
33+
34+
/**
35+
* Get a BitSequence from an Integer.
36+
*
37+
* @param value Integer value.
38+
* @return BitSequence representing value in big-endian format.
39+
*/
40+
public K fromInteger(int value);
41+
42+
/**
43+
* Decode a BitSequence from the encoded form.
44+
*
45+
* @param encoded The encoded representation of a BytesPackedBitSequence
46+
* @return Decoded BitSequence.
47+
*/
48+
public K decode(byte[] encoded);
49+
}

0 commit comments

Comments
 (0)