Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: column setters in trace template #290

Merged
merged 1 commit into from
Nov 4, 2024
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
2 changes: 2 additions & 0 deletions src/exporters/besu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const TRACE_COLUMNS_TEMPLATE: &str = include_str!("besu_trace_columns.java");

#[derive(Serialize)]
struct BesuColumn {
class: String,
corset_name: String,
java_name: String,
appender: String,
Expand Down Expand Up @@ -240,6 +241,7 @@ pub fn render(
let r = c.register.unwrap();
let register = reg_to_string(&cs.columns.registers[r], r).to_case(Case::Camel);
Some(BesuColumn {
class: class.to_owned(),
corset_name: c.handle.to_string(),
java_name: c.handle.name.to_case(Case::Camel),
appender: handle_to_appender(&c.handle),
Expand Down
10 changes: 5 additions & 5 deletions src/exporters/besu_trace_columns.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* <p>Any modifications to this code may be overwritten and could lead to unexpected behavior.
* Please DO NOT ATTEMPT TO MODIFY this code directly.
*/
public class {{ class }} {
public class {{ this.class }} {
{{#each constants}}
public static final {{ this.tupe }} {{ this.name }} = {{ this.value }};
{{/each}}
Expand All @@ -51,7 +51,7 @@ static List<ColumnHeader> headers(int length) {
return headers;
}

public {{ class }} (List<MappedByteBuffer> buffers) {
public {{ this.class }} (List<MappedByteBuffer> buffers) {
{{ #each registers }}
this.{{ java_name }} = buffers.get({{ @index }});
{{ /each }}
Expand All @@ -66,7 +66,7 @@ public int size() {
}

{{#each columns}}
public {{ class }} {{ this.appender }}(final {{ this.tupe }} b) {
public {{ this.class }} {{ this.appender }}(final {{ this.tupe }} b) {
if (filled.get({{ this.reg_id }})) {
throw new IllegalStateException("{{ this.corset_name }} already set");
} else {
Expand All @@ -79,7 +79,7 @@ public int size() {
}

{{/each}}
public {{ class }} validateRow() {
public {{ this.class }} validateRow() {
{{#each registers}}
if (!filled.get({{ this.id }})) {
throw new IllegalStateException("{{ this.corset_name }} has not been filled");
Expand All @@ -92,7 +92,7 @@ public int size() {
return this;
}

public {{ class }} fillAndValidateRow() {
public {{ this.class }} fillAndValidateRow() {
{{#each registers}}
if (!filled.get({{ this.id }})) {
{{ this.java_name }}.position({{ this.java_name }}.position() + {{ this.bytes_width }});
Expand Down
Loading