mirror of https://github.com/hyperledger/besu
Add Tuweni to Plugin-APIs (#295)
Generally, byte[] -> Bytes of some form. Most of the changes are the side effect of the type changes or chaning to the names of Tuweni equivilant calls (getHexString->toHexString, etc). UnformattedData -> Bytes Log Topics went from Hash to Bytes32 Difficulty went to UInt256 to match core impl. Quantity lost BinaryData and is just getValue() and toHexString() Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>pull/299/head
parent
8675a6632a
commit
66a4cd8bf9
@ -1,40 +0,0 @@ |
||||
/* |
||||
* |
||||
* Copyright ConsenSys AG. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
* |
||||
* SPDX-License-Identifier: Apache-2.0 |
||||
* |
||||
*/ |
||||
package org.hyperledger.besu.ethereum.core; |
||||
|
||||
import org.hyperledger.besu.plugin.data.UnformattedData; |
||||
|
||||
import org.apache.tuweni.bytes.Bytes; |
||||
import org.apache.tuweni.bytes.DelegatingBytes; |
||||
|
||||
/** Wrapper for a Bytes value to be exposed as UnformattedData. */ |
||||
public class UnformattedDataImpl extends DelegatingBytes implements UnformattedData { |
||||
|
||||
public UnformattedDataImpl(final Bytes value) { |
||||
super(value); |
||||
} |
||||
|
||||
@Override |
||||
public byte[] getByteArray() { |
||||
return toArray(); |
||||
} |
||||
|
||||
@Override |
||||
public String getHexString() { |
||||
return toHexString(); |
||||
} |
||||
} |
@ -1,48 +0,0 @@ |
||||
/* |
||||
* Copyright ConsenSys AG. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
* |
||||
* SPDX-License-Identifier: Apache-2.0 |
||||
*/ |
||||
package org.hyperledger.besu.plugin.data; |
||||
|
||||
import org.hyperledger.besu.plugin.Unstable; |
||||
|
||||
/** Super class for all types that are ultimately represented by binary data. */ |
||||
@Unstable |
||||
public interface BinaryData { |
||||
|
||||
/** |
||||
* The byte level representation of the binary data. This array should be treated as read only |
||||
* constant data as any changes will not be reflected in the source. |
||||
* |
||||
* @return a read-only array of the bytes of the binary data. |
||||
*/ |
||||
byte[] getByteArray(); |
||||
|
||||
/** |
||||
* A hex string representation of the data. This hex string will represent the hex of the entire |
||||
* binary data and will be "<code>0x</code>" prefixed. APIs that depend on shortend forms will |
||||
* need to process the string. |
||||
* |
||||
* @return A string repsenting the hex encodeing of the data. |
||||
*/ |
||||
String getHexString(); |
||||
|
||||
/** |
||||
* The size, in bytes, of the contained binary data. Because {@link #getByteArray()} may cause the |
||||
* underlying data to be copied using this size method is preferred when such a check would avoid |
||||
* a call to {@link #getByteArray()} or {@link #getHexString()}. |
||||
* |
||||
* @return The length of the binary data in bytes. |
||||
*/ |
||||
int size(); |
||||
} |
@ -1,21 +0,0 @@ |
||||
/* |
||||
* Copyright ConsenSys AG. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
* |
||||
* SPDX-License-Identifier: Apache-2.0 |
||||
*/ |
||||
package org.hyperledger.besu.plugin.data; |
||||
|
||||
import org.hyperledger.besu.plugin.Unstable; |
||||
|
||||
/** An interface to mark BinaryData that is not a scalar {@link Quantity}. */ |
||||
@Unstable |
||||
public interface UnformattedData extends BinaryData {} |
Loading…
Reference in new issue