Skip to content

Commit

Permalink
Merge branch 'serathius/public'
Browse files Browse the repository at this point in the history
  • Loading branch information
anishathalye committed Apr 27, 2024
2 parents 629b8ef + a9ef2e3 commit 0f7a190
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type entry struct {
clientId int
}

type linearizationInfo struct {
type LinearizationInfo struct {
history [][]entry // for each partition, a list of entries
partialLinearizations [][][]int // for each partition, a set of histories (list of ids)
}
Expand Down Expand Up @@ -271,7 +271,7 @@ func fillDefault(model Model) Model {
return model
}

func checkParallel(model Model, history [][]entry, computeInfo bool, timeout time.Duration) (CheckResult, linearizationInfo) {
func checkParallel(model Model, history [][]entry, computeInfo bool, timeout time.Duration) (CheckResult, LinearizationInfo) {
ok := true
timedOut := false
results := make(chan bool, len(history))
Expand Down Expand Up @@ -308,7 +308,7 @@ loop:
break loop // if we time out, we might get a false positive
}
}
var info linearizationInfo
var info LinearizationInfo
if computeInfo {
// make sure we've waited for all goroutines to finish,
// otherwise we might race on access to longest[]
Expand Down Expand Up @@ -350,7 +350,7 @@ loop:
return result, info
}

func checkEvents(model Model, history []Event, verbose bool, timeout time.Duration) (CheckResult, linearizationInfo) {
func checkEvents(model Model, history []Event, verbose bool, timeout time.Duration) (CheckResult, LinearizationInfo) {
model = fillDefault(model)
partitions := model.PartitionEvent(history)
l := make([][]entry, len(partitions))
Expand All @@ -360,7 +360,7 @@ func checkEvents(model Model, history []Event, verbose bool, timeout time.Durati
return checkParallel(model, l, verbose, timeout)
}

func checkOperations(model Model, history []Operation, verbose bool, timeout time.Duration) (CheckResult, linearizationInfo) {
func checkOperations(model Model, history []Operation, verbose bool, timeout time.Duration) (CheckResult, LinearizationInfo) {
model = fillDefault(model)
partitions := model.Partition(history)
l := make([][]entry, len(partitions))
Expand Down
8 changes: 4 additions & 4 deletions porcupine.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func CheckOperationsTimeout(model Model, history []Operation, timeout time.Durat
// CheckOperationsVerbose checks whether a history is linearizable while
// computing data that can be used to visualize the history and linearization.
//
// The returned linearizationInfo can be used with [Visualize].
func CheckOperationsVerbose(model Model, history []Operation, timeout time.Duration) (CheckResult, linearizationInfo) {
// The returned LinearizationInfo can be used with [Visualize].
func CheckOperationsVerbose(model Model, history []Operation, timeout time.Duration) (CheckResult, LinearizationInfo) {
return checkOperations(model, history, true, timeout)
}

Expand All @@ -42,7 +42,7 @@ func CheckEventsTimeout(model Model, history []Event, timeout time.Duration) Che
// CheckEventsVerbose checks whether a history is linearizable while computing
// data that can be used to visualize the history and linearization.
//
// The returned linearizationInfo can be used with [Visualize].
func CheckEventsVerbose(model Model, history []Event, timeout time.Duration) (CheckResult, linearizationInfo) {
// The returned LinearizationInfo can be used with [Visualize].
func CheckEventsVerbose(model Model, history []Event, timeout time.Duration) (CheckResult, LinearizationInfo) {
return checkEvents(model, history, true, timeout)
}
8 changes: 4 additions & 4 deletions visualization.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type partitionVisualizationData struct {

type visualizationData = []partitionVisualizationData

func computeVisualizationData(model Model, info linearizationInfo) visualizationData {
func computeVisualizationData(model Model, info LinearizationInfo) visualizationData {
model = fillDefault(model)
data := make(visualizationData, len(info.history))
for partition := 0; partition < len(info.history); partition++ {
Expand Down Expand Up @@ -94,12 +94,12 @@ func computeVisualizationData(model Model, info linearizationInfo) visualization
// the history. If the history is not linearizable, the visualization shows
// partial linearizations and illegal linearization points.
//
// To get the linearizationInfo that this function requires, you can use
// To get the LinearizationInfo that this function requires, you can use
// [CheckOperationsVerbose] / [CheckEventsVerbose].
//
// This function writes the visualization, an HTML file with embedded
// JavaScript and data, to the given output.
func Visualize(model Model, info linearizationInfo, output io.Writer) error {
func Visualize(model Model, info LinearizationInfo, output io.Writer) error {
data := computeVisualizationData(model, info)
jsonData, err := json.Marshal(data)
if err != nil {
Expand All @@ -118,7 +118,7 @@ func Visualize(model Model, info linearizationInfo, output io.Writer) error {

// VisualizePath is a wrapper around [Visualize] to write the visualization to
// a file path.
func VisualizePath(model Model, info linearizationInfo, path string) error {
func VisualizePath(model Model, info LinearizationInfo, path string) error {
f, err := os.Create(path)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion visualization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
)

func visualizeTempFile(t *testing.T, model Model, info linearizationInfo) {
func visualizeTempFile(t *testing.T, model Model, info LinearizationInfo) {
file, err := os.CreateTemp("", "*.html")
if err != nil {
t.Fatalf("failed to create temp file")
Expand Down

0 comments on commit 0f7a190

Please sign in to comment.