-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
127 additions
and
286 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
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 was deleted.
Oops, something went wrong.
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,27 @@ | ||
package prover | ||
|
||
import ( | ||
"fmt" | ||
"path/filepath" | ||
|
||
"github.com/spacemeshos/merkle-tree/cache" | ||
"github.com/spacemeshos/merkle-tree/cache/readwriters" | ||
) | ||
|
||
// GetLayerFactory creates a merkle LayerFactory. | ||
// The minMemoryLayer determines the threshold below which layers are saved on-disk, while layers equal and above - | ||
// in-memory. | ||
func GetLayerFactory(minMemoryLayer uint, datadir string, fileWriterBufSize uint) cache.LayerFactory { | ||
return func(layerHeight uint) (cache.LayerReadWriter, error) { | ||
if layerHeight < minMemoryLayer { | ||
fileName := filepath.Join(datadir, fmt.Sprintf("layercache_%d.bin", layerHeight)) | ||
readWriter, err := readwriters.NewFileReadWriter(fileName, int(fileWriterBufSize)) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return readWriter, nil | ||
} | ||
return &readwriters.SliceReadWriter{}, nil | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.