-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add massif options to suppress nonleaf errors when getting massifs
- Loading branch information
jgough
committed
Jun 5, 2024
1 parent
027fecb
commit 927820e
Showing
2 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package logverification | ||
|
||
type MassifOptions struct { | ||
|
||
// nonLeafNode is an optional suppression | ||
// | ||
// of errors that occur due to attempting to get | ||
// a massif based on a non leaf node mmrIndex. | ||
nonLeafNode bool | ||
} | ||
|
||
type MassifOption func(*MassifOptions) | ||
|
||
// WithNonLeafNode is an optional suppression | ||
// | ||
// of errors that occur due to attempting to get | ||
// a massif based on a non leaf node mmrIndex. | ||
func WithNonLeafNode(nonLeafNode bool) MassifOption { | ||
return func(mo *MassifOptions) { mo.nonLeafNode = nonLeafNode } | ||
} | ||
|
||
// ParseMassifOptions parses the given options into a MassifOptions struct | ||
func ParseMassifOptions(options ...MassifOption) MassifOptions { | ||
massifOptions := MassifOptions{ | ||
nonLeafNode: false, // default to erroring on non leaf nodes | ||
} | ||
|
||
for _, option := range options { | ||
option(&massifOptions) | ||
} | ||
|
||
return massifOptions | ||
} |