-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go/storage: Refactor checkpointing interface
Previously the way storage checkpoints were implemented had several drawbacks, namely: - Since the checkpoint only streamed key/value pairs this prevented correct tree reconstruction as tree nodes also include a Round field which specifies the round at which a given tree node was created. - While old checkpoints were streamed in chunks and thus could be resumed or streamed in parallel from multiple nodes, there was no support for verifying the integrity of a single chunk. This change introduces an explicit checkpointing mechanism with a simple file-based backend reference implementation. The same mechanism could also be used in the future with Tendermint's app state sync proposal.
- Loading branch information
Showing
46 changed files
with
1,591 additions
and
361 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
go/storage: Refactor checkpointing interface | ||
|
||
Previously the way storage checkpoints were implemented had several | ||
drawbacks, namely: | ||
|
||
- Since the checkpoint only streamed key/value pairs this prevented | ||
correct tree reconstruction as tree nodes also include a Round field | ||
which specifies the round at which a given tree node was created. | ||
|
||
- While old checkpoints were streamed in chunks and thus could be | ||
resumed or streamed in parallel from multiple nodes, there was no | ||
support for verifying the integrity of a single chunk. | ||
|
||
This change introduces an explicit checkpointing mechanism with a simple | ||
file-based backend reference implementation. The same mechanism could | ||
also be used in the future with Tendermint's app state sync proposal. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package grpc | ||
|
||
import ( | ||
"io" | ||
|
||
"google.golang.org/grpc" | ||
) | ||
|
||
type streamWriter struct { | ||
grpc.ServerStream | ||
} | ||
|
||
// Implements io.Writer. | ||
func (c *streamWriter) Write(p []byte) (int, error) { | ||
err := c.SendMsg(p) | ||
if err != nil { | ||
return 0, err | ||
} | ||
return len(p), nil | ||
} | ||
|
||
// NewStreamWriter wraps a server-side gRPC stream into an io.Writer interface so that a stream can | ||
// be used as a writer. Each Write into such a strema will cause a message to be sent, encoded as a | ||
// raw byte slice. | ||
func NewStreamWriter(stream grpc.ServerStream) io.Writer { | ||
return &streamWriter{stream} | ||
} |
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 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 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.